Skip to content

Record signals in test/audit and assert them with expectSignals; dev --signal-sink (#917) - #923

Merged
jimhoyd merged 2 commits into
mainfrom
claude/signal-recorder
Sep 29, 2026
Merged

jimhoyd merged 2 commits into
mainfrom
claude/signal-recorder

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Fixes #917 item 2 with options (a) and (b), which share one recorder.

The recorder (signal-recorder.ts):

  • It keeps the destination origin and the fixed payload {version, route, status, method}. It never keeps URL paths, queries or headers, where webhook tokens live.
  • Given a recorder, SignalBroker records synchronously as outcome captured and never calls egress.
  • Operator grants are still required.
  • Counters and Prometheus signals_total gain a captured outcome.

(a) urlcode test and urlcode audit always record, so nothing is delivered.

  • Fixtures assert with expectSignals: [{destination?, count?, match?}] on single cases and steps.
  • destination is an exact origin. count (0–100) means exactly that many; without it, at least one must match.
  • match takes up to 8 JSON Pointers into the payload, compared exactly.
  • At most 8 entries per request; [] means the request must emit no signal.
  • A failure shows what was captured (redacted).
  • verify-deployment notes that expectSignals was not checked.

(b) urlcode dev --signal-sink stdout|<file.jsonl> writes {"event":"signal","outcome":"captured",…} lines and delivers nothing.

  • It refuses a file inside the project (which would reload dev on every line), a name not ending in .jsonl, and a directory that doesn't exist.
  • serve and every other command refuse the flag.

Recipe: the contact-form valid POST asserts its signal, and its 422 and 415 cases assert expectSignals: [].

Agent-facts check: the old fact "fixtures do fire signals" (#793) is now false. It is inverted into signalsRecordedInTests, which caught a stale sentence in llms-full.

Evidence (macOS, Node 26)

  • New test/signal-recorder.test.ts:
    • token-bearing URLs never leak;
    • the matching rules;
    • the broker never calls its transport;
    • runFixtures against a real server with stubbed egress makes zero network calls, and metrics show 8 captured / 0 delivered;
    • runProjectTests passes, then fails when the count changes;
    • the schema bounds;
    • the dev sink, and the flag refusals.
  • A full npm run verify passes; npm run test:package passes.
  • Core budget raised to 977 / 3841 KiB (measured 996,230 / 3,929,960 bytes).

Limits

  • urlcode benchmark still delivers signals.
  • dev --signal-sink stdout interleaves with the readable log on a TTY.
  • match is exact equality only.

Docs: EGRESS "Checking signals locally", READINESS, LOCAL-DEVELOPMENT, OBSERVABILITY, TOOLING, llms, skills, the agents guide.

🤖 Generated with Claude Code

…ignals; dev --signal-sink (#917)

One in-process SignalRecorder (packages/core/src/signal-recorder.ts) stands in
for signal delivery. A runtime given one records each accepted signal as
outcome `captured` (destination origin plus the fixed payload, never the URL
path, query or headers) and never calls its egress transport.

- `urlcode test` and `urlcode audit` always use a recorder, so fixtures deliver
  nothing. Request fixtures and steps gain `expectSignals: [{destination?,
  count?, match?: {<json-pointer>: value}}]` (bounded in
  schemas/requests.schema.json): exact count when given, else at least one;
  `[]` asserts no signal. Failures print method, route pattern, status and
  destination origin, through the existing redaction. verify-deployment notes
  expectSignals as not checked.
- `urlcode dev --signal-sink stdout|<file.jsonl>` writes each would-be delivery
  as a JSON line and delivers none; a file inside the project is refused
  (reload loop), and serve and every other command refuse the flag.
- signals counters and signals_total gain the `captured` outcome.
- contact-form recipe fixtures assert its signal (and none on 422/415).
- Docs: EGRESS "Checking signals locally", READINESS, LOCAL-DEVELOPMENT,
  TOOLING, OBSERVABILITY, llms, agent skill/guide. The agent-facts check now
  rejects prose saying test/audit fixtures deliver signals.
- Core package budget re-measured: 996230 packed / 3929960 unpacked bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jimhoyd
jimhoyd enabled auto-merge (squash) September 29, 2026 15:03
@jimhoyd
jimhoyd merged commit 2b28881 into main Sep 29, 2026
24 checks passed
@jimhoyd
jimhoyd deleted the claude/signal-recorder branch September 29, 2026 15:17
jimhoyd added a commit that referenced this pull request Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Smaller dev-loop gaps: OpenAPI check command, local signal sink, find user by email, one error envelope

1 participant