Repository navigation
test(unit-gate): name every known red and run what upstream's unit lane runs - #178
Merged
Merged
Conversation
Two gaps made a gate verdict narrower than it read. The suite ran `defaultExclude` rather than upstream's `UNIT_EXCLUDE`, so it collected 80 files the unit lane quarantines — electron, node-pty, live-shell and the whole cross-version-wire directory — and charged this fork for their reds. And `local/**/*.test.mjs` match nothing in `UNIT_INCLUDE`, so the sync-tooling tests were in no lane at all (fork issue #151 § 3 and § 5). The exclusion switch is `ORCA_BALANCE_UNIT_SHARDS=1`, the one `config/vitest.config.ts` already reads; a `--exclude` flag cannot reach the projects because each sets `extends: false`. Since parity is now a switch, the gate asserts the report collected none of the quarantined files and fails closed if one appears, and it treats an allowlist entry for a quarantined file as a problem rather than letting an entry that can never match sit there. Fork-local tests run first, so a broken sync tool cannot produce a verdict about anything else, and the summary line reports both facts.
…ned files The manifest was 15 entries, 14 of them file-level wildcards. A wildcard also covers a NEW failure in the same file, which is how one hid for two syncs. Every entry now names its test title, taken from a reconciliation run over the allowlisted files whose arithmetic closes: 32 allowlisted + 5 upstream-quarantined + 1 fixed = 38 records. Three files leave the manifest because the gate no longer runs them: upstream's own unit lane excludes repro-13767, relay-region-correction and the whole cross-version-wire directory, so their reds are upstream's to carry. Ownership is corrected where it was unattributed — both remaining `unattributed` files are upstream files this fork never touched.
`terminal-pane-screen-prompt.ts` returns `undefined` for a pane it cannot bind to a terminal, and says why in the method's own doc comment: a restored pane reconnects after the hook store starts, so "cannot see it" must not read as "no dialog". The case asserted `toBeNull()` for that path in the same commit that added both (`3526000b5c`), so it never passed — and a file-level allowlist entry kept it hidden inside a 1,476-case file. Found by tightening `local/unit-known-red.json` to test titles (fork issue #151 § 1). Renamed to match what it asserts.
…nd-test diagnosis LOCAL-PATCHES.md gains the section for this work, and the extend-test entry is corrected where fork issue #151 § 4 says it no longer matches the import graph: `ephemeral-vm-runtime-extend.ts:22` imports only `getSshConnectionManager`, so the mock was complete for the module under test and the missing export was only visible to what that module reaches. The 28 `TypeError: {} is not iterable` rejections were a second cause — the renderer's reclaim bridge iterating a non-list `listRuntimes` answer, fixed in `2368ed38da` — which the recorded sentence welded to the mock because both appeared in one run. BRANCHES.md gets the branch's entry and its place under nplez1/main.
The base moved while the branch was being written, so the branch no longer descended from it. Two files conflicted, both fork docs: - LOCAL-PATCHES.md — both sides appended a section at the same anchor. Kept nplez1/main's three (the `local(ratchets)` pair and `local(lint)`) ahead of this branch's `local(test)`, since theirs belong to older issues #161/#172. - BRANCHES.md — kept both: the base's branch-list change and this branch's `nplez1/issue-151` entry. The branch's own delta is unchanged by the merge (`git range-diff` reports all four commits identical); the resolution is docs only.
…them `tests/tools/**` is in `UNIT_INCLUDE` and is where `local/gate-lint.mjs` keeps its tests, so the gate's judging rules run in the suite rather than only in the gate's own fork-local lane. The lane stays, because `local/sync/lib/*.test.mjs` are still outside `UNIT_INCLUDE` and are what fork issue #151 § 5 is about. Written as vitest to match `tests/tools/lint-gate.test.mjs`; same assertions.
…try hiding Two gaps that naming the entries opened, both from the Opus review round. The isolation re-run asked whether the *file* passed alone. With named entries that question is unanswerable: the file's own allowlisted reds still fail when it runs alone, so a load flake in a file that also has recorded reds always looked like a real break — process-host-dev-rebuild and orca-runtime are both that shape. The re-run now writes its own JSON report and a failure counts as reproduced only when that same test failed there; a missing report still counts as reproduced, so it fails closed. `unseen` meant "the file did not fail", which cannot happen to a dead entry in a file that still reds elsewhere — so a renamed case left its entry matching nothing forever. It now means "nothing in the run matched this entry and it is not stale", which covers the renamed case and the vanished file alike. Also here: the fork-local lane gets its own five-minute deadline instead of the suite's hour, `closeSync` is imported (every `closeSyncSafe` had been throwing into its own catch, leaking the log descriptor), the duplicate JSDoc on `judgeUnhandled` is gone, and `repoPath` normalises the checkout prefix so the new quarantine check can fire on Windows too. The two new checks are extracted and tested rather than inlined in `evaluate()`.
…d repair case The case symlinked `/Applications/Old Orca.app/.../bin/orca` and expected the installer to adopt it. This fork ships `orca-np` (`cli-install-constants.ts:6`), and `isManagedSymlinkTarget` rejects a target whose basename differs from the launcher's own name (`cli-command-inspection.ts:117`), so the installer read its own launcher as a foreign command and refused it: `Refusing to replace non-Orca command at /var/folders/...`. The two sibling cases in this file already link `old/orca-np` — this one arrived later from upstream, after the fork's identity patch. One hunk, and the red is gone rather than recorded, so its allowlist entry goes with it. `local/unit-known-red.json` therefore drops to 31 named entries and its `observedRun` arithmetic closes at 38 records: 31 allowlisted, 5 upstream-quarantined, 2 repaired. The note also stops contradicting itself about keeping an entry that has stopped reproducing: prune wins, and LOCAL-PATCHES.md stays the history of why a class was red.
`vi.mock('./ipc/runtime-environments')` named a path the 2026-10-19 module
reorganisation deleted; the code imports
`./ipc/runtime-environments/runtime-environments` (`ephemeral-vm-runtime-extend.ts:16`)
and the directory has no `index.ts`, so the mock was inert and the real module
loaded with everything it reaches.
That is the mechanism behind the failure `LOCAL-PATCHES.md` recorded by guess:
a gap in the mocked SSH registry surfaced thirty frames away, because the graph
the dead mock failed to cut still read `getSshTargetRegistryStore`. Naming the
real module is the fix; the registry mock stays as it is.
…nd's corrections
The review round found the recorded cause wrong twice over, so LOCAL-PATCHES.md
now says what is checkable:
- the extend test's mock named `./ipc/runtime-environments`, a path the
2026-10-19 reorganisation deleted, so it was inert and the real module loaded
— which is why a registry-mock gap surfaced thirty frames away;
- the `TypeError: {} is not iterable` rejections had their own cause, the
renderer reclaim bridge iterating a non-list answer, fixed in `2368ed38da`;
- both files are fork-owned (`902955072a` is fork PR #81, absent from
`upstream/main`), so the issue's "send it upstream" premise does not hold.
The `local(test)` section also records the two reds the tightening repaired, the
per-test isolation rule, the new `unseen` meaning, and the resolved keep-vs-prune
contradiction. BRANCHES.md follows: 31 entries, and what § 4 actually turned out
to be.
…s the run A forwarded selector describes a different suite, so every entry outside it matches nothing. Reporting those as unseen made a one-file smoke run print all 31 entries as prune candidates, which is the false signal the new rule was supposed to avoid. Unseen is now only judged when the gate runs the whole suite, and a filtered run says so instead. The quarantine list also stops at twelve names without saying so; it now counts the rest.
The per-test rule asked whether the re-run *failed* the test, which is not the same as proof it passed. Three shapes slipped through as waivable flakes: a collect error in the re-run replaces every case with one `(suite)` entry, a failing `beforeAll` reports its cases as skipped, and a report with no files at all has an empty failure set. In each, the original test is absent — and absent is not evidence, which is the rule a missing report already followed. `reproducedFailures()` now waives only a test the re-run reported as passing; a `(suite)` failure is waived only when the file itself passed. A corrupt isolation report is parsed locally instead of through `readJsonFile`, which would exit mid-verdict. `prunableEntries()` replaces the bare `fullRun` filter for the same reason: an entry may be called unseen only on a complete, unfiltered run, and not when its file reported nothing but a collect failure. `repoPath` now checks the path separator, so a sibling checkout named `issue-151-x` no longer reads as inside this one. The judgement moved to `local/unit-gate-judgement.mjs`: it is pure over data the gate already holds, it is what the tests now import, and the gate had grown past this fork's 600-line budget carrying both roles.
`local(test)` § "five more environment-bound reds" filed that case under the `/private/var` symlink cause, which the re-diagnosis two sections down now contradicts — the recorded error path is `/var/…` and the cause is the fork's `orca-np` rename. The bullet says so and points at the entry, rather than leaving two causes for one red. Also names the reorganisation that deleted the extend test's mock path (`1938bd055a`, stablyai#30362) and records where the gate's judgement now lives.
…hecks
The changed-code gate's type-aware pass rejects `${label}` in the preparation
failure line: destructuring a heterogeneous tuple array widens `label` to
`string | string[]`. Objects give it one type, and the fork-local lane still
runs before both.
…file's report Round-3 delta findings, both one hunk. A waiver now needs the pass to be the whole story: a name the same report also failed (a `test.each` duplicate) or a `(suite)` entry beside it (a hook broken under) keeps the failure, which is also what puts `rerun.failures` back to work instead of leaving it built and unread. The re-run is also read per file — `reportForFile()` filters by path, because a positional selector is a substring match and `thing.test.ts` collects `thing.test.tsx` too. That function is tested directly, which the `filePassed` branch was not. Prune advice stays silent on a report with no tests at all, not merely on one that did not complete.
… takes `a8ca9685a3` (#170) made the branch-prefix login follow the repo's pinned gh account: `resolveLocalGitUsername(repoPath, ghAccount)`. This upstream case still asserted the one-argument call, so `nplez1/main` has been red on it since that merge — it surfaced as the only unallowlisted failure of the first full gate run on this branch, which is exactly what the tightened allowlist exists to show. The case's repo has no binding, so the second argument is `undefined`.
Verdict on the revision that ships, and the honest note that its first full run found a red the base had carried since #170 rather than a red this branch made — an upstream case still asserting the one-argument branch-prefix login. No entry was stale and none was unseen, which is the check that the tightening was faithful rather than merely equivalent to the wildcard it replaced. BRANCHES.md carries the same verdict plus the three review rounds.
The base moved while the gate work was being verified, and #177 touches the same two surfaces this branch rewrites, so the merge is a real reconciliation rather than a docs append: - `local/gate-unit.mjs` — #177 extracted the verdict cache and the summary line into `local/gate-verdict-cache.mjs` so `local/open-pr.mjs` can read a gate-1 PASS for the exact revision. Taken wholesale: this branch now uses `allowlistFingerprint`/`cachedVerdictPath`/`unitGateCacheDir` and prints `formatVerdict`, and the fork-local lane's status moves out of the summary line into the detail block, so a PR body quoting `formatVerdict` stays comparable with every other verdict in this fork's history. - `local/unit-known-red.json`, `local/unit-gate-judgement.mjs`, `tests/tools/unit-gate.test.mjs` — no conflict; #177 does not touch them. - `BRANCHES.md`, `LOCAL-PATCHES.md` — both appended; #177's sections kept ahead of this branch's, as with the previous merge.
NIT from the merge-resolution review: `closeSync` sorts before `openSync`. EOF2
PR #177 landed `local/gate-verdict-cache.mjs` and made `local/open-pr.mjs` read it, so a verdict now belongs to one exact revision and the shipped one is quoted in the PR body. This records the earlier full run as what it was — the first run after the tightening, before #177 — instead of calling it the shipped revision's verdict, and notes the merge-resolution review round. Raised as the only MINOR by the review of the merge resolution.
nplez1
added a commit
that referenced
this pull request
Oct 24, 2026
#150) LOCAL-PATCHES keeps the evidence for the release-tooling patch series and the known-red sets, so the gate repairs need an entry there: which of the issue's five items had already landed (#160's linked-worktree cache directory, #177's dirty-verdict refusal and shared cache module, #178's judgement module and its tests), what the new fail-closed and cache rules are, why the verdict records its gate inputs, and the coupling rule's limits. BRANCHES gets the branch entry: why it exists, its shape, its target, and its verification state.
nplez1
added a commit
that referenced
this pull request
Oct 24, 2026
#150) (#179) * fix(gate): fail the unit gate closed, and cache only what it can prove (#150) Vitest's exit status was returned by runSuite and never read, so a non-zero exit that the report did not explain was green. The rule is now the CI twin's (check-unit-shard-verdict): a non-zero exit fails the gate only when neither the report nor the log explains it. The declared-vs-read unhandled count drops '>' for '!==' for the same reason, and a step that could not be spawned names the step instead of reading as failed. A cached verdict now records the gate inputs it was computed against — GATE_INPUT_PATHS plus the installed node and bun — and both readers compare them, because the machine-bound sqlite-binding and host-toolchain classes move with a bun upgrade that HEAD never sees. What may be reused or recorded is a decision with a reason: --no-cache forces a re-run and still records it, --allow-dirty neither reuses nor records, forwarded selectors record nothing, and HEAD and the tree are re-read before writing so a mid-run commit cannot become the previous revision's verdict. A forwarded selector's summary line now says it is not a gate-1 verdict, because it printed the same shape as one. The flake waiver asked only whether the test file was in the diff, so a branch that changed src/x.ts and broke x.test.ts one run in ten waived it as 'not ours'. local/gate-flake-coupling.mjs couples a test to itself, its sibling module, its one level of imports and the harness sharedHarnessPaths derives from the config and the runner; a per-test row that passes in isolation but is still refused says why. * docs(fork): record the unit-gate repairs in LOCAL-PATCHES and BRANCHES (#150) LOCAL-PATCHES keeps the evidence for the release-tooling patch series and the known-red sets, so the gate repairs need an entry there: which of the issue's five items had already landed (#160's linked-worktree cache directory, #177's dirty-verdict refusal and shared cache module, #178's judgement module and its tests), what the new fail-closed and cache rules are, why the verdict records its gate inputs, and the coupling rule's limits. BRANCHES gets the branch entry: why it exists, its shape, its target, and its verification state.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes
local/unit-known-red.jsonthe file its own notes ask for, and makes gate 1 measure the same suite upstream's unit lane measures.Fixes #151.
What the issue asked for
§ 1 — file-level wildcards. All 15 entries were
"test": "*"(one had already been tightened). They are now 31 named entries, taken from a reconciliation run recorded in the file'sobservedRun, whose arithmetic closes at 38 records: 31 allowlisted + 5 upstream-quarantined + 2 repaired. A wildcard also masks a new failure in the same file, and tightening found two:pane-screen-prompt.spec.tsassertednullwhereterminal-pane-screen-prompt.ts:15-20documentsundefined("cannot see it" is not "no dialog"), in the same fork commit that added both — so it had never passed;cli-command-privileged-transaction.test.tslinked/Applications/Old Orca.app/…/bin/orcawhile this fork shipsorca-np, so the installer read its own launcher as a foreign command.Both are repaired, not recorded, so both entries are gone.
§ 2 — stale entries. None of the eight the issue names is still in the file; they were pruned at the 2026-10-21 reconciliation. The contradiction the issue flags (documented ⇒ keep vs passes ⇒ prune) is resolved in favour of pruning:
LOCAL-PATCHES.mdis the history of why a class was red, the JSON is the assertion.§ 3 — the gate ran files upstream excludes.
local/gate-unit.mjsnow setsORCA_BALANCE_UNIT_SHARDS=1for its suite — the switchconfig/vitest.config.ts:13already reads to applyUNIT_EXCLUDEinstead ofdefaultExclude— dropping 80 files here (electron, node-pty, live-shell, and the whole cross-version-wire directory). A--excludeflag cannot do it: every project in that config setsextends: false, so a root-level CLI exclude never reaches them (measured: the file still ran). Because parity is a switch rather than an argument, the gate asserts the report collected none of the 80 and fails closed if one appears, and it treats an allowlist entry for a quarantined file as a problem instead of leaving an entry that can never match.§ 4 — the two undiagnosed reds. Both pass. The recorded diagnosis was wrong in a way the issue only half caught:
ephemeral-vm-runtime-extend.test.ts:23mocked./ipc/runtime-environments, a path upstream's reorganisation deleted (1938bd055a, refactor(ipc): group SSH and runtime-environment IPC handlers into ipc/ssh/ and ipc/runtime-environments/ stablyai/orca#30362). The code imports./ipc/runtime-environments/runtime-environmentsand that directory has noindex.ts, so the mock was inert and the real module loaded with everything it reaches — which is how a gap in the mocked SSH registry surfaced thirty frames away. The mock now names the real module.TypeError: {} is not iterablerejections had their own cause: the renderer reclaim bridge iterated a non-listlistRuntimes()answer (2368ed38da). The old sentence welded the two because they shared a run.902955072ais fork PR feat(ephemeral-vm): give ephemeral hosts a lifetime contract and an extend hook #81, absent fromupstream/main), so there was nothing to send upstream.§ 5 — bookkeeping. The arithmetic closes and a test asserts it.
local/sync/lib/*.test.mjswere in no lane at all —node --testfiles outsideUNIT_INCLUDE— so the gate runs them first (35 tests, 0.7 s) beforebuild:packagesand the suite.Gate behaviour beyond the issue
beforeAll, or an empty report looks like.unseenmeant "the file did not fail", which cannot happen to a dead entry in a file that still reds elsewhere. It now means "nothing in the run matched this entry and it is not stale", judged only on a complete run with tests and no selector.local/unit-gate-judgement.mjs— pure functions over a report, imported by the gate and its tests, because one file carrying the run and the meaning of its report outgrew this fork's 600-line budget.Verification
Gate 1, on this revision, run from this worktree under the machine's heavy-run queue:
80 files upstream's unit lane quarantines were not run, and nothing was reported stale or unseen: the 31 names are exactly the 31 failures, with no wildcard left to absorb an unknown one. One declared unhandled headline recurred (
selector_not_found, the pre-existing unawaited removal promise this file already records); no unhandled headline was undeclared.One red the first full run found was the base's.
src/main/ipc/worktrees-windows.test.ts › resolves the Git username when the configured prefix consumes itfailed:a8ca9685a3(#170) made the branch-prefix login take the repo's pinned gh account, and that upstream case still asserted the one-argument call. Nothing here touches the file (git diff --stat b094309766..nplez1/maindoes not list it), so098d3ea4a3repairs it instead of recording it —nplez1/mainhas been red on it since #170. It is the only commit here that exists to make gate 1 pass on the base rather than to fix the issue; drop it if you would rather fix that onnplez1/maindirectly.Review
Reviewed by Opus 5.5, high (
claude/opus, the Claude Code CLI backend, tool-enabled over the actual commits): R1 (4 blocking fixed), delta R2 (1 blocking fixed), R3 (2 minor fixed), R4 on the merge resolution (1 minor fixed) — clean of BLOCKER and SHOULD-FIX on the shipped revision.nplez1/main: 4 SHOULD-FIX (isolation re-run judged per file; a named entry could go dead silently; the CLI entry blamed upstream when the fork'sorca-nprename caused it; the extend-test diagnosis still missed the real cause). All fixed, plus every one-hunk MINOR.nplez1/mainmerge resolution (PR fix(fork): make the process surface report what it reads #177 landedlocal/gate-verdict-cache.mjsand same-file changes tolocal/gate-unit.mjs): no BLOCKER/SHOULD-FIX, every branch behaviour accounted for; 1 MINOR (stale docs wording) and 3 NITs, all fixed.Found but not fixed here
src/main/agent-hooks/server/server-screen-prompt-wiring.ts:20—this.screenPromptReader?.(paneKey) ?? nullturns "cannot see this pane" back into "no dialog" one layer above the contract the pane test in this PR pins, so a reconnecting pane can be released to Working. Outside this diff; wants its own issue and test.macos-path-semanticsentries (os.tmpdir()vs/private/var) are host artifacts rather than repo defects — upstream's to fix, and cheap to fix there.