Skip to content

fix(test): restore the two checks #8573 left red on main - #8592

Closed
XiaoBinGan wants to merge 2 commits into
morluto:mainfrom
XiaoBinGan:style/restore-oxfmt-after-8573
Closed

XiaoBinGan wants to merge 2 commits into
morluto:mainfrom
XiaoBinGan:style/restore-oxfmt-after-8573

Conversation

@XiaoBinGan

@XiaoBinGan XiaoBinGan commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

7bcefead6 ("test: strengthen and prune audited test coverage", #8573) left main red in Static checks and in the test shards. Every PR whose merge ref includes it inherits the failures even when its own diff is clean, so no PR can go green until this is fixed.

Two independent regressions from that commit, both restored here:

  1. Formatting. 16 files do not satisfy oxfmt --check, so npm run format:check fails on main itself.
  2. A blocked event loop retires the fixture's sockets. The commit added a get_evidence_bundle call to tests/boundary/mcp/javascriptRuntimeObservationMcp.test.ts before its direct-observation assertion. The first such call in a process spends ~8.4s compiling the tool output schema inside the MCP client, blocking the loop synchronously. The fake Inspector's in-process HTTP server keeps Node's 5s keep-alive default, retires the pooled discovery socket during that block, and the provider's next CDP upgrade reuses the retired socket and is reset — endpoint_unreachable / ECONNRESET, before the assertion can compare evidence IDs.

The third regression from the same commit — the Frida verifier fixture writing dist/contracts/fridaRemoteAddress.js while scripts/verify-frida.mjs imports dist/domain/fridaRemoteAddress.js — is #8595 and is fixed in #8596. This PR does not touch tests/boundary/process/providerVerifierCleanup.test.ts, so the two changes stay disjoint.

Problem and expected behavior

On a pristine main at d3ab0faf5:

$ npx oxfmt --check .
Format issues found in above 16 files. Run without `--check` to fix.

$ node node_modules/vitest/vitest.mjs run tests/boundary/mcp/javascriptRuntimeObservationMcp.test.ts
FAIL ... lists and observes one target as retained Evidence
AssertionError: expected false to be true  (direct.ok)
BrowserObservationError { reason: "endpoint_unreachable", cause: Error: read ECONNRESET }

Expected: All matched files use the correct format. and 3 passed. Both are now true on this branch.

Change and scope

Formatting. oxfmt . applied to exactly the 16 files the check reports. Line wrapping, blank lines, and quote placement only: no behaviour, assertion, fixture value, or test-name change.

  • docs/testing.md
  • scripts/verify-adb.mjs, scripts/verify-http3-network-captures.mjs
  • src/application/electron/ElectronFuseService.test.ts
  • src/domain/changedBehavior.test.ts
  • src/domain/managed/managedNativeVerificationSource.test.ts
  • src/electron/ElectronFuseProvider.test.ts
  • tests/boundary/filesystem/releaseNotes.test.ts
  • tests/boundary/process/adbVerifierCleanup.test.ts, claudeVerifierSetupTargets.test.ts, clientVerifierSetupTargets.test.ts, commandcodeVerifierSkillBody.test.ts, deepseekVerifierSkillBody.test.ts, geminiVerifierSkillBody.test.ts
  • tests/conformance/providers/ghidra/realGhidraWindowsWorkflow.test.ts
  • tests/conformance/providers/managed/managedNativeVerification.test.ts

Fixture keep-alive. One line plus a comment in tests/fixtures/inspector/fakeV8Inspector.ts:

http.keepAliveTimeout = 120_000;

The fixture is not modelling an idle-connection policy, so it has no reason to enforce Node's default there. No assertion, timeout, or stub value is touched, and the test itself is unmodified.

Contract and boundary impact

  • Semantic owner and earliest changed stage: none — formatter output and a loopback test fixture.
  • Contribution scope fit and linked maintainer decision: not applicable; restores gates that are currently failing on main.
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details: not applicable — no target interaction. The Frida/JEB cases remain simulated provider outcomes and the Inspector fixture remains a loopback fake; neither establishes real-provider behaviour.
  • Generated metadata, package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Documentation or usability only; no target interaction.

Evidence and regression coverage

  • Tests added or updated: none added. javascriptRuntimeObservationMcp.test.ts executes its existing 3 cases again; the formatting half changes no test semantics.
  • Base reproduction and mechanism evidence, all measured on this host with Node 24.22.1:
probe result
get_evidence_bundle first call 8490ms; second and third 1ms each
setInterval(100ms) ticks during that first call 0
node --cpu-prof top self-time @modelcontextprotocol/client Ajv addNames 2.3s, compileSchema 1.0s, codegen
replace the block with a synchronous 8s spin fails 2/2 (reproduces)
replace the block with async 6s / 10s / 15s delays passes 5/5 (does not reproduce)
reorder: bundle assertions after the direct observation passes
/json/version, /json/list, raw CDP WebSocket connect just before the direct observation all succeed — discovery state intact, only the pooled socket is dead
MCP test on unmodified main fails 4/4 runs
MCP test on this branch passes 3/3 consecutive runs
  • User-visible CLI/MCP output: not applicable.
  • Remaining proof gaps: the ~8.4s synchronous compile lives in the MCP client dependency, not this repository; this PR stops the fixture from treating a blocked loop as an idle connection but does not remove that cost. Static checks and the test shards on this PR will stay red until fix(test): load real Frida verifier address dependency #8596 lands, because the Frida fixture failure is independent of this diff.

Validation performed

  • npx oxfmt --check . — All matched files use the correct format. (exit 0; exit 1 with 16 files on base)
  • node node_modules/vitest/vitest.mjs run tests/boundary/mcp/javascriptRuntimeObservationMcp.test.ts — 3 passed, 3 consecutive runs (4 failed on base)
  • node scripts/run-typescript.mjs --noEmit — exit 0
  • node --check scripts/verify-adb.mjs — exit 0
  • node --check scripts/verify-http3-network-captures.mjs — exit 0
  • git diff --stat upstream/main — 17 files changed, 72 insertions(+), 58 deletions(-)
  • all six other suites that use the Inspector fixture — unchanged; the two that still fail (javascriptRuntimeObservation.test.ts, javascriptRuntimeUnresolvedTarget.test.ts) fail identically with the change reverted, so they are unrelated.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable — loopback fixture and formatter output only.
  • Package or release metadata impact: none (chore: title, no release-please bump).
  • Security, privacy, process, or containment review: none — no target interaction.

Author readiness

Human owner: @XiaoBinGan

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

7bcefea ("test: strengthen and prune audited test coverage", morluto#8573)
landed 16 files that do not satisfy `oxfmt --check`, so `npm run
format:check` fails on main itself and on every PR whose merge ref
includes it.

Apply `oxfmt .` to exactly those 16 files; no other file is touched.
The diff is line wrapping, blank-line, and quote placement only - no
behaviour, assertion, fixture value, or test name change.

Verified on this branch: `npx oxfmt --check .` exits 0, both changed
scripts pass `node --check`, and `node scripts/run-typescript.mjs
--noEmit` exits 0.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T19:45:06.048013Z 9909a1e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The reviewed changes appear safe to merge.

Summary

Restores formatting across 16 files and extends the fake Inspector server’s idle connection timeout.

  • Repository files now match the formatter's required layout.
  • Fake inspector discovery connections stay open longer during tests.

Reviews (4) · Last reviewed commit: "fix(test): keep the fake Inspector's dis..." · Reviewed by Greptile

@XiaoBinGan XiaoBinGan changed the title chore: restore repository formatting fix(test): restore the checks #8573 left red on main Nov 1, 2026
@XiaoBinGan
XiaoBinGan force-pushed the style/restore-oxfmt-after-8573 branch from 3420047 to 9909a1e Compare November 1, 2026 22:58
@XiaoBinGan XiaoBinGan changed the title fix(test): restore the checks #8573 left red on main chore: restore repository formatting after #8573 Nov 1, 2026
@XiaoBinGan

Copy link
Copy Markdown
Contributor Author

Left a note on #8596: its remaining Static checks red is the 16-file formatter breakage from 7bcefead6, which this PR fixes and which it does not touch. #8596 owns the Frida fixture half (#8595); this PR is formatting only, so the two are disjoint and can land in either order.

Once both are in, main should be green again — right now every code PR is inheriting both failures from the merge ref.

`tests/boundary/mcp/javascriptRuntimeObservationMcp.test.ts` fails on main at
the direct-observation assertion with `endpoint_unreachable` /
`ECONNRESET`, so the second CDP connection never opens and the case stops
before it can compare the two evidence IDs.

The cause is not the observation path. The first `get_evidence_bundle` call
in a process - which that test now performs before the direct observation -
spends ~8.4s compiling the tool output schema inside the MCP client. Measured:

    BUNDLE-CALL 1 ms= 8490
    BUNDLE-CALL 2 ms= 1
    setInterval(100ms) ticks during call 1: 0

`node --cpu-prof` attributes the time to `@modelcontextprotocol/client`'s Ajv
provider (`addNames` 2.3s, `compileSchema` 1.0s, plus codegen), so the event
loop is blocked synchronously, not waiting on I/O.

The fake Inspector's in-process HTTP server keeps Node's 5s keep-alive
default. While the loop is blocked that timeout expires, the server retires
the pooled discovery socket, and the provider's next CDP upgrade reuses the
retired socket and is reset.

Evidence that this is the mechanism rather than the assertions:

- replacing the block with a synchronous 8s spin reproduces the failure (2/2);
- replacing it with async 6s / 10s / 15s delays does not (5/5 pass);
- the fixture's CDP endpoint and WebSocket URL both answer correctly right
  before the direct observation, so discovery state is intact.

Raise the fixture server's keep-alive window so an in-process caller that
blocks the loop cannot retire a socket a later caller still holds. The fake
is not modelling an idle-connection policy, so it has no reason to enforce
Node's default there.

The MCP case now passes 3/3 for three consecutive runs. It fails 4/4 on
unmodified main. The other five files that use this fixture are unchanged: the
two that still fail (`javascriptRuntimeObservation.test.ts`,
`javascriptRuntimeUnresolvedTarget.test.ts`) fail identically with and without
this change, so they are unrelated.
@XiaoBinGan XiaoBinGan changed the title chore: restore repository formatting after #8573 fix(test): restore the two checks #8573 left red on main Nov 1, 2026
@XiaoBinGan

Copy link
Copy Markdown
Contributor Author

Updated: this branch now carries the two #8573 regressions I can fix here — the 16-file formatter breakage and the MCP fixture keep-alive. #8609 is closed as folded in; keeping them separate just deadlocked both, since each PR's merge ref inherits every main failure.

I left the third one (the Frida fixture path) out, because that's #8595 / #8596 and it's your call which one takes it.

Concretely, on this branch main's Static checks and the MCP case go green; the shards and Portable tests will stay red until #8596 lands. So #8592 + #8596 is the pair that makes main green, in either order — neither alone can be.

If you'd rather have a single PR that fixes all three, say so and I'll add the Frida fixture line here and you can close #8596 instead. I'm not going to guess which you prefer.

jaelliot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

I verified the combined effect of this PR's exact changed files (17e287c) and #8596 (a7dc107) on main d3ab0fa, without altering either source branch. Both separate PSP integration jobs in the fork-only run passed repository-wide formatting, the previously failing JS runtime and Frida cleanup regressions, build/type/lint/docs, and real PSP/Ghidra CLI/MCP verification. The two fixes and PSP changes have disjoint file paths.

Details and exact source hashes are in my #8596 integration note. This is not an upstream merge, full sharded CI, or a human-readiness attestation; it just supplies independent evidence for the maintainer's ordering/consolidation decision.

@SII-YDD

SII-YDD commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

2026-11-02 paired validation (independent, Codex-assisted). I applied the exact #8592 17e287ca and #8596 a7dc1070 patches to d3ab0faf5, without mixing my separate module-resolution work. The resulting 18-file tree is ab011ea29e505a4147d15bb81fa83116c4b53915.

  • Original npm run check:ci passed on macOS arm64 / Node24.22.1 / npm11.16.0. Both failing fixture files passed together: 11 tests. No assertion, test deadline or coverage configuration was changed beyond your exact patches.
  • Independent bounded control: block the event loop for6.2s between two fake-Inspector observations. Baseline's second observation returns endpoint_unreachable; your fixture correction succeeds twice with the same Evidence ID.
  • Original V8 coverage commands on Linux arm64: local shard1/6 passed (6,670 passed /181 conditional skips), including all8 Frida cleanup cases. Local shard3/6 executed all3 Inspector MCP cases successfully, but the whole shard still failed on the separate Cutter case below. I checked installed Vitest's actual partitioner and executed filenames; hosted1/4 numbers do not identify the same local buckets.

Additional pre-existing fixture ordering race found under coverage: tests/process-global/cutterDescriptorLifetime.test.ts, “does not assign a peer's later cancellation…”, expected one cancelled descriptor but observed two. The ordinary focused retry passes, which alone does not explain it. Holding the first opened handle's return until50ms after the peer enters close reproduces the failure: the test aborts before the first descriptor has actually reached close. Opening order plus one setImmediate is not an acknowledgement of that IO completion.

The following test-only barrier preserves the original count/cause/cleanup assertions. It passes the delayed control and all9 existing file cases; no production change or timeout increase. This is a proposal for review, not full qualification or a competing PR:

diff --git a/tests/process-global/cutterDescriptorLifetime.test.ts b/tests/process-global/cutterDescriptorLifetime.test.ts
--- a/tests/process-global/cutterDescriptorLifetime.test.ts
+++ b/tests/process-global/cutterDescriptorLifetime.test.ts
@@ -228,6 +228,10 @@
   fault.root = root;
   const controller = new AbortController();
   const reason = new Error("cancel after the first descriptor failure");
+  let firstClose!: () => void;
+  const firstClosing = new Promise<void>((resolve) => {
+    firstClose = resolve;
+  });
   let entered!: () => void;
   let release!: () => void;
   const waiting = new Promise<void>((resolve) => {
@@ -237,7 +241,10 @@
     release = resolve;
   });
   fault.onClose = async (handle) => {
-    if (handle === fault.handles[0]) return;
+    if (handle === fault.handles[0]) {
+      firstClose();
+      return;
+    }
     entered();
     await gate;
   };
@@ -247,7 +254,7 @@
     .catch((cause: unknown) => cause);
   try {
     await awaitAcknowledgement(
-      waiting,
+      Promise.all([waiting, firstClosing]).then(() => undefined),
       reading,
       "peer descriptor finalization",
     );

The remaining original shards/full combined qualification were not completed. My extra local shard4 also exposed an incomplete diagnostic Git snapshot (bad tree object HEAD); importing the37 exact missing base objects fixed that environment problem and the original ciFeedback file passed7/7. I have not relabeled either failed whole shard as green. Original failures and controls are retained locally.

@XiaoBinGan

Copy link
Copy Markdown
Contributor Author

@jaelliot @SII-YDD — I owe you both a real reply. This PR was closed while I was still working through your notes, and I never acknowledged them. That is my miss, not yours.

@jaelliot — your isolated fork-only tree from d3ab0fa taking the exact blobs from #8592 17e287c and #8596 a7dc107, with both PSP integration jobs green including the JS runtime and Frida cleanup regressions, is exactly the evidence this decision needed: the two fixes are disjoint and can land in either order. Your framing of what it is not — not an upstream merge, not full sharded CI, not a human-readiness attestation — is the right scope, and I should have said so at the time.

@SII-YDD — your paired validation on ab011ea29 is the most useful thing on this PR. Three points in particular:

  1. Your bounded control — blocking the event loop 6.2 s between two fake-Inspector observations — is the correct discriminator. Baseline returning endpoint_unreachable on the second observation while the fixture correction succeeds twice with the same Evidence ID isolates the fixture as the cause rather than a symptom.
  2. Re-deriving the shard partition from the installed Vitest and executed filenames instead of trusting the hosted 1/4 numbers is the step I had skipped, and it is why your local 3/6 disagrees with the hosted lane on the Cutter case.
  3. Your cutterDescriptorLifetime finding was right and it landed. The race you reproduced — the test aborting before the first descriptor reaches close, where opening order plus one setImmediate is not an acknowledgement of that IO completion — is now test(cutter): synchronize peer descriptor close before cancellation (#9082, merged 2026-11-06). main at 72d5e72e6 carries firstClosing / firstCloseStarted and awaits Promise.all([waiting, firstCloseStarted]), which is your proposal. You called it a proposal for review rather than a competing PR, and it was the right call.

You were also honest about the gaps — the remaining shards, the bad tree object HEAD from an incomplete diagnostic Git snapshot you repaired with the 37 missing base objects, and refusing to relabel a failed whole shard as green. That is the reporting standard this repository asks for, and it is the reason I trust the parts you did finish.

Both of you did verification work on a PR that was not yours to land. Thank you.

@morluto morluto added area: tests Test suite and verification bug Something isn't working labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tests Test suite and verification bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants