Skip to content

test: report Windows ACL fixture phase timings - #190

Merged
abogartz merged 3 commits into
abogartz:mainfrom
WhollyMindless:test/acl-phase-timing
Oct 31, 2026
Merged

abogartz merged 3 commits into
abogartz:mainfrom
WhollyMindless:test/acl-phase-timing

Conversation

@WhollyMindless

@WhollyMindless WhollyMindless commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

The Windows ACL fixture previously exhausted its outer timeout without showing whether identity lookup, ACL setup, the lock probe, or cleanup was slow. Emit start/end records and elapsed milliseconds for those phases, including command exit codes and explicit notices when the fixture cannot exercise ACL denial. No usernames or paths are logged.

The production lock behavior, 30-second outer budget, and all four assertions remain intact. The lock must still fail in under two seconds; its measured interval excludes diagnostic output.

Validation on Windows with Bun 1.4.4: ten focused repetitions passed (40 assertions), with phase records present. The full merge gate passed (typecheck, lint, 722 unit passes/12 skips, and 11 e2e passes). These local runs do not establish which phase caused the historical timeout; hosted-runner timing is the purpose of this instrumentation.

Refs #68, particularly the follow-up in #68 (comment). This does not close the broader issue.

Please feel free to decline or close this if the extra test logging is not useful for your project.

Hosted validation: all four checks passed at 7bf5dda. The Windows job exercised the ACL fixture and emitted all five phase pairs: identity 37 ms, ACL deny 16 ms, deny probe 0 ms, lock 90 ms, restoration 15 ms (fixture total 161.51 ms). This successful run establishes that the diagnostics work on the hosted runner; it does not explain the historical stall. Windows job.

@abogartz abogartz left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: APPROVED_WITH_NITS

Reviewed at 7bf5dda. Test-only, one file, and the instrumentation does exactly what it says without touching what the fixture is actually asserting.

Verified

  • The assertions are untouched. The ACL fixture contains 4 expect( calls before and after: ran === false, failed === true, the sub-2-second bound, and /EPERM|EACCES|permission/i. The { timeoutMs: 5000 } argument and the 30_000 outer budget are both still there (test/lock.test.ts:293, previously :261).
  • The timing change is a tightening, not a loosening. Date.now() - t0 is now captured in the finally (lockMs = Date.now() - t0; endLock();) and asserted afterwards, so the diagnostic write is excluded from the measured interval rather than included in it — the claim in your body is accurate in the direction that matters.
  • Nothing leaks. Every new line is JSON.stringify of {phase, event, elapsedMs, exitCode?} plus two fixed not-exercised reason strings. No username, no temp path, no icacls argv. Confirmed against the real hosted output rather than the code: the Windows job emitted exactly the five pairs — identity 37ms exitCode 0, acl-deny 16ms exitCode 0, deny-probe 0ms, lock 90ms, acl-restore 15ms.
  • measure() cannot swallow a failure: the value is returned from inside try and the finally only logs, so the writeFileSync throw that the fixture depends on for denied = true still propagates.
  • Gates: locally (macOS) test/lock.test.ts is 9 pass / 1 skip (the win32 block, as expected), typecheck clean, biome 409 warnings — flat versus base. CI: lint / test / test-windows / smoke all green at this head.

Nits

  • not-exercised still counts as a pass. Logging the two capability bail-outs is a real improvement over a bare return — but the run still reports green while the defence was never exercised, which is the exact accounting gap #71 complains about ("capability probes can return early and print as passed"). Cheap close: have the sweep/triage tooling treat a [acl-fixture] {"event":"not-exercised"} line as a declared skip so the ledger's denominator is not inflated on runners that cannot manage ACLs.
  • Setup is outside the instrumentation. tmp() and mkdirSync(store) run before the first measure("identity", …), so a stall there would show every phase fast and still blow the 30 s budget — the one failure mode this PR exists to diagnose. Worth wrapping in a phase: "setup" for symmetry.
  • Minor shape point: the deny-probe end line has no exitCode key at all (the wrapped call returns void). A uniform exitCode: null would make the emitted lines trivially parseable as one record type.

Neither nit has to land before this merges — the instrumentation is already earning its keep on the hosted runner, and the historical stall is still unexplained, which you say plainly.

@WhollyMindless

Copy link
Copy Markdown
Contributor Author

Addressed the local instrumentation nits in 1a4e1b5:

  • setup now starts before tmp() and covers mkdirSync(store), so a setup stall leaves a phase-start record too.
  • Every phase-end record includes exitCode, using null for non-command phases.
  • All four ACL assertions, the 5-second lock option, and the 30-second outer test budget remain unchanged. The lock measurement still excludes diagnostic output.

Windows / Bun 1.4.4: all 10 lock tests pass, including real ACL denial (no capability bailout); six phase pairs were emitted. Typecheck and lint pass, with the same 409 advisory warnings. I did not rerun the full gate for this test-diagnostics-only follow-up; CI will exercise the pushed head.

I recorded the not-exercised accounting request on #71. That remains open: #195 already changes the sweep parser/triage tooling, so this PR does not introduce a competing parser change or claim that a logged bailout is now counted as a skip. The historical stall remains unexplained.

Please feel free to defer the accounting follow-up or decline the extra diagnostics if they are not useful to the project.

@abogartz abogartz left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round 2: APPROVED

Re-verified at 1a4e1b5. One file touched, both test-side nits closed, and — the part I can only check on the hosted runner — the new telemetry actually fires where it is supposed to.

Hosted Windows log at this head (ci run 41161137856, test-windows success), the complete [acl-fixture] stream:

setup        end   1 ms  exitCode: null
identity     end  31 ms  exitCode: 0
acl-deny     end  11 ms  exitCode: 0
deny-probe   end   0 ms  exitCode: null
lock         end  91 ms  exitCode: null
acl-restore  end  11 ms  exitCode: 0

setup is now inside the instrumentation, so tmp() + mkdirSync can no longer stall and report every phase fast before blowing the 30 s budget — the specific blind spot this PR exists to diagnose, which was the one asymmetry left in round 1. And the record shape is uniform: deny-probe and lock now carry "exitCode": null rather than omitting the key, so every line parses as one record type instead of needing a conditional reader. No not-exercised line, which is the good case — the ACL defence really was exercised on that runner.

Nothing weakened: expect( count in test/lock.test.ts is 24 at both 7bf5dda and 1a4e1b5; the diff is the exitCode expression plus wrapping four lines in measure("setup", …). timeoutMs: 5000 and the outer 30_000 budget are untouched. Local gates: typecheck clean, biome exit 0 at 409 warnings — flat versus base, unit 722 pass / 12 skip / 0 fail (the Windows suite is skipIf on darwin; the hosted run is the only place it lives, and it is green).

Still open from my list, and it is a sweep-tooling item rather than one in this diff: a [acl-fixture] {"event":"not-exercised"} line still prints as a pass, so a runner that cannot manage ACLs inflates the ledger's denominator by one — the same accounting gap #71 is about. Nothing here regressed it; the two bail-outs are now at least logged rather than a silent return.

The historical stall this PR hunts is still unexplained, which the body says plainly. What this adds is that a stall in setup is no longer invisible when it recurs.

@abogartz
abogartz merged commit 5e3b80a into abogartz:main Oct 31, 2026
4 checks passed
@abogartz-opencode-self-improvement

Copy link
Copy Markdown

🎉 This PR is included in version 0.14.28 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants