mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 17:17:38 +00:00
* test(terminal): check the runtime's workspace layout against structural rules A pure rules check over the runtime's session partitions: a terminal in two panes, a pane in two tabs, a tab outside exactly one group, tab rows and tab bar disagreeing, two tab orders, and ids changing for the same pane, tab or group across an update. Wired into the seeded layout model test after every step, plus late-spawn cases (one known on main, kept as an expected failure). * test(e2e): layout oracle scenarios with window, headless serve and SSH Drives layout journeys through window gestures, CLI and paired-client runtime commands, and after every step checks the runtime's layout against the structural rules, the window's DOM, the paired-client and CLI views, the expected end layout, restarts (relaunch, cold daemon, in-app daemon restart) and per-pane terminal markers. Findings main still has are listed with their cause; anything else fails. Includes headless orcad/Electron serve scenarios for the serve issues and a Docker SSH scenario. * test(terminal): check layout rules on every write and race client commands with the window The layout model now checks the structural rules on every in-memory workspace-session write, not only at each step's end, naming the writer of any breach. Three documented two-writer transients (main mints a tab row before the window writes its tab bar) are allow-listed by rule, op and writer; they must still heal by the step's end. New model ops race a stale window save against a paired client's tab close, a host-created split, and main's PTY-exit retirement. A new file runs main's updateMobileSessionPaneLayout (old phone pane trees) against the real Store; the case with no topology revision is an it.fails: main drops a live pane and its binding there. * test(e2e): oracle expected outcomes, transient sampling, remount counts, more scenarios, latency Every step checks the expected panes, which panes went away and that the rest kept their terminals; a 100 ms sampler runs the rules between steps; xterm creations are counted per pane and an unexpected recreation fails. Adds host navigation, window reload (graph republication), quit right after a change (quit-time save), an old client's stale pane tree, and a latency measurement (command to drawn update, idle and under an output flood; no pass/fail). * docs(e2e): describe the oracle's added checks and latency measurement * test(e2e): #12723 SSH folder scenario, CI lane for the SSH oracle spec, short socket dir Adds an SSH folder-workspace (no repo) scenario that checks the layout lives in one partition across relaunch; registers the SSH oracle spec in the Docker SSH lane's selection lists; headless hosts put long-TMPDIR profiles under ~/.orca-lo instead of /tmp. * ci(e2e): run the headless layout oracle in the job that builds orcad; Linux relaunch findings The headless oracle spec needs out/orcad, which only the orca serve mode-switch job builds, so it runs there (and fails rather than skips in CI if orcad is missing). Records what the first Linux CI run found on main: after a relaunch main can hold tab rows with no tab bar past the settle wait, and Electron serve on Linux also lists a renamed terminal's title as null after a restart. * test(e2e): join partition lists in the SSH folder scenario's log lines * test(e2e): retry the latency spec's reads through a brief terminal-ownership gap Linux CI saw terminal.list answer terminal_surface_ownership_unavailable while the window re-published its terminals; reads retry for up to 10 s, commands do not.
53 lines
2.0 KiB
JavaScript
53 lines
2.0 KiB
JavaScript
#!/usr/bin/env node
|
|
// Checks a profile's saved workspace layout against the structural layout rules
|
|
// (src/main/persistence/terminal-topology/workspace-layout-rules.ts). Works on a running dev app's
|
|
// profile too. Usage: node config/scripts/check-workspace-layout-rules.mjs <userDataDir>
|
|
// Exits 1 when any rule is broken, printing one line per breach.
|
|
|
|
import { build } from 'esbuild'
|
|
import { mkdir, mkdtemp, rm } from 'node:fs/promises'
|
|
import { createRequire } from 'node:module'
|
|
import { join, resolve } from 'node:path'
|
|
|
|
const userDataDir = process.argv[2]
|
|
if (!userDataDir) {
|
|
console.error('usage: check-workspace-layout-rules.mjs <userDataDir>')
|
|
process.exit(2)
|
|
}
|
|
|
|
const root = resolve(import.meta.dirname, '..', '..')
|
|
await mkdir(join(root, '.tmp'), { recursive: true })
|
|
const scratch = await mkdtemp(join(root, '.tmp', 'layout-rules-'))
|
|
try {
|
|
const outfile = join(scratch, 'check.cjs')
|
|
await build({
|
|
stdin: {
|
|
contents: `
|
|
export { readPersistedProfileState } from './tests/e2e/helpers/persisted-profile-state'
|
|
export { partitionsFromProfileRoot } from './tests/e2e/helpers/workspace-layout-oracle-views'
|
|
export { checkWorkspaceLayoutRules } from './src/main/persistence/terminal-topology/workspace-layout-rules'
|
|
`,
|
|
resolveDir: root,
|
|
loader: 'ts'
|
|
},
|
|
bundle: true,
|
|
platform: 'node',
|
|
format: 'cjs',
|
|
outfile,
|
|
external: ['electron', '@stablyai/playwright-test'],
|
|
logLevel: 'silent'
|
|
})
|
|
const { readPersistedProfileState, partitionsFromProfileRoot, checkWorkspaceLayoutRules } =
|
|
createRequire(import.meta.url)(outfile)
|
|
const violations = checkWorkspaceLayoutRules(
|
|
partitionsFromProfileRoot(readPersistedProfileState(resolve(userDataDir)))
|
|
)
|
|
for (const violation of violations) {
|
|
console.log(`${violation.rule}: ${violation.detail}`)
|
|
}
|
|
console.log(`${violations.length} layout rule breach(es) in ${userDataDir}`)
|
|
process.exitCode = violations.length > 0 ? 1 : 0
|
|
} finally {
|
|
await rm(scratch, { recursive: true, force: true })
|
|
}
|