Skip to content

Small follow-ups: undelivered audit reporting, review app.fetch, Worker header counts (#875, #889) - #897

Merged
jimhoyd merged 3 commits into
mainfrom
claude/small-followups
Sep 29, 2026
Merged

jimhoyd merged 3 commits into
mainfrom
claude/small-followups

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Three small fixes, one commit each.

1. Store audit delivery (#875 item 3, option B)

  • Schema: a forward schema step (2 → 3) adds a one-row store_audit_drain table.
  • Recording: the store's audit producer records the last drain time, at most every 10 s. It updates after an ack, or after a peek that finds the outbox empty.
  • Command output: operator commands that write audited events add undeliveredEvents per touched collection and lastAuditDrain to their report. They also add a warning when events are waiting and nothing has drained within 60 s, or ever. The commands are members add|remove, reassign and ownerless-*.
  • Nothing added: for dry runs and unaudited collections.

2. Review no longer reports an in-process app.fetch(request) as egress (#889 item 7)

  • Always outbound: global fetch, http(s).request/get, and any member .fetch given a URL literal or new URL(.
  • Not reported: a member .fetch on an imported app or router object, such as Hono's app.fetch or itty-router.
  • Reported with a hedge: any other member .fetch.
  • A method or function that is merely named fetch no longer matches, and comments are ignored.
  • The ecosystem proof no longer asserts the false positive.

3. Cloudflare header counts

  • Before: the Worker passed headerCounts: {}, so a repeated header read as 0.
  • Now: it counts joined values with the same conservative comma rule as the embedded handler. That covers policies, duplicate Content-Type, and duplicate scalar header parameters.
  • Where the helper lives: a new Node-free header-counts.ts, re-exported from host-request.ts.
  • Documented behavior change: a legitimate comma in one checked header line is refused on Workers.

Evidence (macOS, Node 26)

  • npm run verify passes: 1161 root tests, store 132, test:ecosystem 12/12.
  • npm run test:package passes.
  • npm run test:workerd: every response is identical, including 3 new header cases.

A store migration renumbering may be needed if the store JSON Schema rework lands first.

🤖 Generated with Claude Code

jimhoyd and others added 3 commits September 29, 2026 02:57
…lare Worker

The Worker passed empty header counts, so a repeated scalar header parameter
or a repeated Content-Type read as absent and the duplicate refusals never
fired. It now applies the same rule as a fetch-only embedded host: a joined
value containing a comma counts as two lines. The helper moves to a Node-free
header-counts.ts so the Worker closure stays free of node: imports.

Tests: test/cloudflare.test.ts, and three raw-socket cases in the workerd
parity script (all identical on workerd and Node).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…as egress (#889)

The outbound-network-call signal matched any `fetch(`, so Hono's
`app.fetch(request)` in a trusted function read as an outbound call. The
global fetch (bare or via globalThis/window/self/global), http(s).request/get
and a member .fetch with a URL argument still count; a member call on a
receiver imported or built from an imported name is in-process and skipped;
any other member .fetch is still reported with a note that it may be
in-process. Definitions named fetch and comments no longer match.

The ecosystem proof now asserts the absence of the false positive.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eeps up (#875)

Operator commands write audit events into the outbox, but only a serving
process's drain delivers them. The store's audit producer now records when the
drain last kept up (an ack, or a peek that found the outbox empty) in a new
one-row store_audit_drain table (schema version 3), at most every 10 s. Every
urlcode-store command that records events (members add|remove, reassign,
ownerless-assign, ownerless-delete on an audit: true collection; not a dry
run) adds undeliveredEvents for the collections it touched, lastAuditDrain,
and a warning when events wait and no drain has kept up in the last 60 s or
ever.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jimhoyd
jimhoyd enabled auto-merge (squash) September 29, 2026 08:10
@jimhoyd
jimhoyd merged commit f6ffe62 into main Sep 29, 2026
25 checks passed
@jimhoyd
jimhoyd deleted the claude/small-followups branch September 29, 2026 08:18
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.

1 participant