From dbd57b6991d3a965b4267b1abccefdcc552bd0f1 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 7 Nov 2026 16:07:22 +0000 Subject: [PATCH] test(runtime): compare /meta wire texts with clock-derived header values held fixed The ADR-0106 D1 action-entry describe compared whole wire texts, including the Last-Modified header the protocol stamps with the time of the read at one-second precision. Two sequential reads that straddled a second differed there only and ejected unrelated PRs from the merge queue. wireText now reads a date-valued Last-Modified or Date header as a fixed token; status, body, ETag, every other header, and the clock header's presence are still compared. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_017ihL2gH1g3Qk8UMKLnGKoq --- .../domains/mcp-object-schema-mask.test.ts | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/runtime/src/domains/mcp-object-schema-mask.test.ts b/packages/runtime/src/domains/mcp-object-schema-mask.test.ts index 2f4831e63d3..784ab7096c9 100644 --- a/packages/runtime/src/domains/mcp-object-schema-mask.test.ts +++ b/packages/runtime/src/domains/mcp-object-schema-mask.test.ts @@ -652,7 +652,27 @@ describe('[ADR-0106 D1] a standalone or object-less action entry is served as th /** One `/meta` answer, every byte a caller can compare: status, body and headers. */ interface Wire { status: number; body: any; headers: Record } - const wireText = (w: Wire) => JSON.stringify(w); + /** + * Headers whose value is the wall clock at the moment of the read, not + * anything the projection decided: the protocol stamps `lastModified` with + * the time of the read, which the door renders at one-second precision, so + * two sequential reads of one answer differ there whenever they straddle a + * second boundary. + */ + const CLOCK_HEADERS = new Set(['last-modified', 'date']); + /** + * The wire as compared: every byte, except that a clock header's VALUE + * reads as a fixed token when it is a date. Its presence, its position and + * a value that is not a date are still compared, so an answer that gains + * or drops the header still differs. + */ + const wireText = (w: Wire) => JSON.stringify({ + ...w, + headers: w.headers && Object.fromEntries(Object.entries(w.headers).map(([k, v]) => [ + k, + CLOCK_HEADERS.has(k.toLowerCase()) && !Number.isNaN(Date.parse(v)) ? 'CLOCK' : v, + ])), + }); /** A code/package store answering `/published` with each standalone fixture as declared, and nothing for any other name. */ const publishedStore = {