mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
Add a second axis to every RFC — its class (feature, bug-fix,
simplification, architecture, process, testing) — encoded in the path
as docs/rfc/{lifecycle}/{class}/file.md. The folder is the label, so
the closed set is enforced by structure rather than a parsed field.
Two new doc-sync gates back it:
- verify-rfc-classification: every RFC sits in a valid class folder and
the README index lists it under the matching lifecycle→class heading.
- verify-doc-refs: every docs/*.md path cited in a packages|examples TS
comment resolves — closes a drift class verify-md-links can't see, and
catches the four comment refs this reorg moved.
The README gains a Classification section explaining the taxonomy and
per-class index sub-sections. A self-referential process RFC records why
the scheme is path-encoded and gated.
1.8 KiB
1.8 KiB
RFC: Deterministic tests, the replay invariant fixture, and race stress
Status: proposed
Problem
Several loop tests synchronize with setTimeout(30) sleeps — flakiness debt that wastes agent cycles on retries and can mask ordering bugs. Separately, our core architectural promise (any session log replays to identical derived history) is asserted in two tests but is cheap to assert everywhere. And the inbox wakeup race was verified by hand exactly once; nothing re-verifies it continuously.
Proposal
Three measures:
- No wall-clock sleeps in tests. Replace
setTimeout(N)waits with event-driven waits (the existingwaitForIdlepattern, extended towaitForStatus,waitForEvent(n)) or vitest fake timers where time itself is under test. Enforce with a lint rule banningsetTimeoutinpackages/*/testsoutside an allowlisted helper module. - Universal replay fixture. A shared test helper wraps the loop harness so that after every test, the agent's session log is replayed into a fresh Session and
deriveMessages()equality is asserted automatically. The invariant then gets checked hundreds of times per CI run across every scenario the suite produces, not twice. - Nightly race stress. A CI job running the agent-loop and inbox suites with
vitest --repeat=200(and--shuffle) to flush scheduling-dependent failures; any flake found is a bug to fix, never a retry.
Plan
Land 1 and 2 together (they touch the same helpers); add the nightly job after the suite is sleep-free so repeats are fast.
Risks
Fake timers interact subtly with Promise scheduling in the loop — prefer event-driven waits; reserve fake timers for timer-service behavior itself.