Skip to content

F-harness: scriptable tunnel-fault proxy + test clock + deterministic kill hook (#1049) - #1051

Merged
aarontrowbridge merged 5 commits into
mainfrom
1049-f-harness
Sep 13, 2026
Merged

aarontrowbridge merged 5 commits into
mainfrom
1049-f-harness

Conversation

@aarontrowbridge

Copy link
Copy Markdown
Member

P2 of the approved fleet rearchitect (spec-20260913-114814 §8 — the F-harness deliverable). Pure test infrastructure: 7 files, all under packages/extension/test/**, 1109 insertions, zero runtime changes, zero new dependencies (node:net / node:timers / node:events only).

What lands:

  • FaultProxy — scripted tunnel-fault schedules with five OBSERVABLY DISTINCT modes, each mode's signature asserted mechanically (DROP → timeout w/ 0 handshake bytes; HALF-OPEN → timeout w/ accepted greeting; REFUSE → ECONNREFUSED via listen-level window; CLEAN-CLOSE; PASS), plus sustained no-response windows (N consecutive outcomes) and healthy-then-dead-then-healthy sequences (the F4 shape)
  • FakeClock + Lease — deterministic time source: deadline-order firing, same-deadline registration order, chained timers, callback-observes-deadline; lease expiry driven to expiry and back with zero wall-clock waiting (the F5 fixture's consumer)
  • KillHookRegistry + SimulatedCrash + JournalingCommitter — faults at NAMED state-machine points (pre-commit / mid-commit), restored-or-journaled never torn (the F2 fixture's registry; the real mode machine consumes the same registry in P4)
  • A dependency + scope guard test pinning the harness to node builtins + vitest, no src/** reach-ins

Gate evidence (director re-run, from commands):

TDD trail: 4 commits, RED→GREEN per criterion; the first cast's surviving RED clock test was adopted verbatim (never weakened). Teardown waits for process exit (the H4 lesson). Fault determinism: transitions only between awaited probes.

Blocks: the F1–F10 fixtures of P4–P9 (all consume this harness). Merge is human; the documented pre-existing reds are weighed per the #827 precedent.

AC2: deterministic advance with deadline-ordered firing (same-deadline in
registration order), chained timers due inside the same advance, negative
advance refused, pending() next-due probe. Lease expires exactly at issue+ttl
on the injected clock, renews from the renewal instant, onExpiry fires through
the clock — zero wall-clock waiting (spec-20260913-114814 §8).
… modes (#1049)

AC1+AC4: DROP black-holes (client timeout, zero handshake bytes), HALF-OPEN
delivers the accepted greeting then silence (distinguishable from DROP by
those bytes alone), REFUSE closes the listener (true ECONNREFUSED, same port
rebound on exit), CLEAN-CLOSE is an orderly zero-payload FIN, PASS proxies.
Schedules are {mode, probes} plans run with every transition awaited —
sustained no-response windows and healthy-then-dead sequences reproduce from
the plan; a signature-uniqueness test guards mode collisions (spec
§8). node:net/node:timers only; teardown waits for every socket (H4).
…ignal races (#1049)

AC3 + F2 shape: KillHookRegistry arms stop/throw/crash at NAMED state-machine
boundaries; JournalingCommitter (the representative consumer) invokes them at
pre-commit (after verify, pre-journal) and mid-commit (post-journal,
pre-done). Tests prove the target stops AT the named point via state, journal
and trace; mid-commit stop/crash leaves it journaled and resume() replays to
committed — restored-or-journaled, never torn; named-point specificity (an
armed pre-commit never fires mid-commit); the scenario reproduces from config.
)

AC5/AC6 guard: every fleet_fault_harness module may import node: builtins and
vitest only — no third-party dependency, no reach into src/** (the harness
stays plain test-tree fixture code, usable from the extension's vitest setup
without spawning outside the test process tree).
@aarontrowbridge aarontrowbridge added the hitl Needs human review before merge label Sep 13, 2026
@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 0c517a64-d259-4dca-8787-0ddc696940ef


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

hitl Needs human review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant