@openwop/openwop-conformance 2.0.0-rc.6 → 2.0.0-rc.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +8 -3
  2. package/dist/cli.js +24 -34
  3. package/dist/lib/requirement-registry.js +69 -0
  4. package/dist/lib/scenario-disposition.js +84 -11
  5. package/dist/lib/seams.js +42 -0
  6. package/dist/lib/soft-skip.js +39 -8
  7. package/dist/spec-artifacts.lock.json +2 -2
  8. package/package.json +2 -2
  9. package/requirement-aliases.json +4 -1
  10. package/requirements.json +1129 -51
  11. package/scenario-majors.json +60 -3
  12. package/schemas/CORPUS-STAMP.json +40 -37
  13. package/src/cli.ts +23 -30
  14. package/src/global-setup.ts +11 -0
  15. package/src/lib/corpus-stamp.ts +24 -2
  16. package/src/lib/fixtures.ts +31 -0
  17. package/src/lib/requirement-registry.ts +68 -0
  18. package/src/lib/scenario-disposition.ts +88 -9
  19. package/src/lib/soft-skip.ts +42 -7
  20. package/src/lib/sse.ts +8 -0
  21. package/src/scenarios/era-key-stamped-v1.test.ts +156 -0
  22. package/src/scenarios/pause-resume.test.ts +159 -75
  23. package/src/scenarios/v2-advertised-fixtures-exist.test.ts +25 -43
  24. package/src/scenarios/v2-advertised-path-space-served.test.ts +165 -0
  25. package/src/scenarios/v2-coherence-not-in-bundle.test.ts +11 -2
  26. package/src/scenarios/v2-created-run-readable.test.ts +98 -0
  27. package/src/scenarios/v2-dual-stack-negotiation.test.ts +29 -1
  28. package/src/scenarios/v2-effect-seam-manifest.test.ts +21 -55
  29. package/src/scenarios/v2-effect-seam-no-refire.test.ts +88 -0
  30. package/src/scenarios/v2-era-2-append-vocabulary.test.ts +16 -2
  31. package/src/scenarios/v2-era-stamp-universal.test.ts +1 -1
  32. package/src/scenarios/v2-interrupt-token-scheme.test.ts +1 -1
  33. package/src/scenarios/v2-malformed-body-envelope.test.ts +79 -0
  34. package/src/scenarios/v2-run-annotation-not-event.test.ts +71 -0
  35. package/src/scenarios/v2-run-bulk-cancel.test.ts +91 -0
  36. package/src/scenarios/v2-run-cancel.test.ts +97 -0
  37. package/src/scenarios/v2-run-completed-outputs.test.ts +93 -0
  38. package/src/scenarios/v2-run-diff-identical.test.ts +75 -0
  39. package/src/scenarios/v2-run-fork-prefix.test.ts +140 -0
  40. package/src/scenarios/v2-run-fork-refusals.test.ts +70 -0
  41. package/src/scenarios/v2-run-options-limits.test.ts +69 -0
  42. package/src/scenarios/v2-run-pause-resume.test.ts +117 -0
  43. package/src/scenarios/v2-run-snapshot-etag.test.ts +57 -0
  44. package/src/scenarios/v2-sse-last-event-id.test.ts +93 -0
  45. package/src/scenarios/v2-stream-mode-refusal.test.ts +118 -0
  46. package/src/scenarios/v2-stream-sse-projection.test.ts +79 -0
  47. package/src/scenarios/v2-version-header-honored.test.ts +124 -0
  48. package/src/scenarios/version-negotiation.test.ts +25 -3
  49. package/src/setup.ts +104 -50
@@ -0,0 +1,124 @@
1
+ /**
2
+ * RFC 0172 §A.3 — the `OpenWOP-Version` header is HONORED or REFUSED, never
3
+ * ignored (suite 2.0.0, target major 2; unaided).
4
+ *
5
+ * A host that does not implement v2 has two correct answers to
6
+ * `OpenWOP-Version: 2`: serve the v2 representation, or refuse with `406
7
+ * protocol_version_unsupported`. There is a third thing it can do, and it is
8
+ * the dangerous one — return `200` with the v1 document, ignoring the header
9
+ * entirely.
10
+ *
11
+ * That third case is invisible to every presence-gated scenario in the suite.
12
+ * A scenario that skips when a v2 shape is absent records `inapplicable`
13
+ * whether the host REFUSED major 2 or silently handed back v1; both are
14
+ * non-failures, so a bundle looks clean while witnessing nothing. This is not
15
+ * hypothetical: it is the shape that let RFC 0165 sit `Accepted` on a host
16
+ * that served none of it — the acceptance cited merged PRs, the gated
17
+ * scenarios recorded `inapplicable`, and nothing in the chain ever compared
18
+ * the two representations. Measured on a live tier-1 host 2026-09-04:
19
+ * `OpenWOP-Version: 2` returned `200` with a body byte-identical to the
20
+ * header-less fetch. Credit to the openwop-app session for the probe.
21
+ *
22
+ * The check is cheap and needs no v2 support: fetch the resource twice, once
23
+ * with the header and once without. A host advertising two majors MUST NOT
24
+ * return the same bytes for both, because the two representations differ by
25
+ * construction (`capabilities.md` §1). A host advertising one major MUST
26
+ * refuse rather than ignore.
27
+ *
28
+ * @see spec/v2/core/versioning.md §1.3
29
+ * @see RFCS/0172-v2-versioning-and-release.md §A.3
30
+ */
31
+
32
+ import { describe, it, expect } from 'vitest';
33
+ import { loadEnv } from '../lib/env.js';
34
+ import { softSkip } from '../lib/soft-skip.js';
35
+ import { req } from '../lib/requirement-ids.js';
36
+
37
+ const ID = 'openwop.requirement.0172.version-header-honored';
38
+ const DOC = 'spec/v2/core/versioning.md §1.3';
39
+ const PATH = '/.well-known/openwop';
40
+
41
+ interface Fetched {
42
+ readonly status: number;
43
+ readonly body: string;
44
+ readonly version: string | null;
45
+ }
46
+
47
+ async function fetchRepresentation(header: string | null): Promise<Fetched | null> {
48
+ const { baseUrl, apiKey } = loadEnv();
49
+ const headers: Record<string, string> = { Accept: 'application/json' };
50
+ if (header !== null) headers['OpenWOP-Version'] = header;
51
+ if (apiKey) headers['authorization'] = `Bearer ${apiKey}`;
52
+ try {
53
+ const res = await fetch(`${baseUrl.replace(/\/$/, '')}${PATH}`, { headers });
54
+ return { status: res.status, body: await res.text(), version: res.headers.get('openwop-version') };
55
+ } catch {
56
+ return null;
57
+ }
58
+ }
59
+
60
+ describe('v2-version-header-honored (RFC 0172 §A.3)', () => {
61
+ it('OpenWOP-Version is honored or refused — never ignored', async () => {
62
+ const bare = await fetchRepresentation(null);
63
+ const asked = await fetchRepresentation('2.0');
64
+ if (bare === null || asked === null) {
65
+ return softSkip('blocked', `${PATH} unreachable for one of the two probes — the comparison needs both`);
66
+ }
67
+ if (bare.status !== 200) {
68
+ return softSkip('blocked', `the header-less GET ${PATH} answered ${bare.status}; there is no baseline representation to compare against`);
69
+ }
70
+
71
+ // A refusal is a correct answer and ends the check: the host has told the
72
+ // truth about not serving major 2.
73
+ if (asked.status === 406) {
74
+ expect(
75
+ asked.status,
76
+ req(ID, DOC, 'a host that does not serve major 2 MUST refuse with 406 protocol_version_unsupported, which it did'),
77
+ ).toBe(406);
78
+ return softSkip('inapplicable', 'the host refused major 2 with the specified 406 — a correct answer, and there is no second representation to compare bytes against');
79
+ }
80
+ if (asked.status !== 200) {
81
+ return softSkip('blocked', `GET ${PATH} with OpenWOP-Version: 2.0 answered ${asked.status} — neither the v2 representation (200) nor the specified refusal (406), so this scenario cannot rule on it`);
82
+ }
83
+
84
+ // 200 means the host claims to have served major 2. The bytes decide
85
+ // whether it actually did.
86
+ expect(
87
+ asked.body === bare.body,
88
+ req(ID, DOC, `answering 200 to OpenWOP-Version: 2.0 with a body byte-identical to the header-less fetch means the header was IGNORED, not honored — the host served v1 and called it v2. Refusing with 406 is the correct answer for a host that does not implement major 2; silently returning v1 is the one answer that no presence-gated scenario can detect, because an absent v2 shape records \`inapplicable\` whether the host refused or ignored`),
89
+ ).toBe(false);
90
+ });
91
+
92
+ it('a host advertising two majors serves two different representations', async () => {
93
+ const bare = await fetchRepresentation(null);
94
+ if (bare === null || bare.status !== 200) {
95
+ return softSkip('blocked', `the header-less GET ${PATH} answered ${bare?.status ?? 'no response'}`);
96
+ }
97
+ let doc: Record<string, unknown>;
98
+ try {
99
+ doc = JSON.parse(bare.body) as Record<string, unknown>;
100
+ } catch {
101
+ return softSkip('blocked', `${PATH} did not return a JSON object`);
102
+ }
103
+ const versions = Array.isArray(doc['protocolVersions']) ? (doc['protocolVersions'] as unknown[]).map(String) : [];
104
+ const majors = new Set(versions.map((v) => v.split('.')[0]));
105
+ if (!(majors.has('1') && majors.has('2'))) {
106
+ return softSkip('inapplicable', `the host advertises [${versions.join(', ') || 'no protocolVersions'}] — one major or none, so there is no second representation to differ from`);
107
+ }
108
+
109
+ const asked = await fetchRepresentation('2.0');
110
+ if (asked === null) return softSkip('blocked', `${PATH} unreachable under OpenWOP-Version: 2.0`);
111
+ expect(
112
+ asked.status,
113
+ req(ID, DOC, `a host advertising both majors MUST serve major 2 when asked for it, not refuse (got ${asked.status})`),
114
+ ).toBe(200);
115
+ expect(
116
+ asked.body === bare.body,
117
+ req(ID, DOC, 'the v1 document and the closed v2 root differ by construction (capabilities.md §1), so a host advertising both majors returning identical bytes for both has advertised a major it does not actually serve'),
118
+ ).toBe(false);
119
+ expect(
120
+ asked.version?.trim().split('.')[0] ?? null,
121
+ req(ID, DOC, `the response to OpenWOP-Version: 2.0 MUST carry OpenWOP-Version naming the major it served (got ${String(asked.version)})`),
122
+ ).toBe('2');
123
+ });
124
+ });
@@ -7,9 +7,31 @@
7
7
  *
8
8
  * What we CAN test cheaply:
9
9
  * 1. Server advertises a `protocolVersion` in `Capabilities`.
10
- * 2. The four version axes (`engineVersion`,
11
- * `eventLogSchemaVersion`, per-event `schemaVersion`,
12
- * `pinnedVersions`) appear where the spec says they should.
10
+ * 2. `protocolVersion` is advertised, and every event carries the six
11
+ * required `RunEventDoc` fields.
12
+ *
13
+ * This file previously claimed to check "the four version axes
14
+ * (`engineVersion`, `eventLogSchemaVersion`, per-event `schemaVersion`,
15
+ * `pinnedVersions`)". IT DID NOT. `protocolVersion` was the only axis
16
+ * asserted, and across all 444 v1 scenario files the sole occurrence of the
17
+ * identifier `eventLogSchemaVersion` was that sentence — a docstring
18
+ * describing a check that did not exist. A comment claiming coverage is
19
+ * worse than no comment: it answers "is this tested?" for anyone who greps,
20
+ * and answers it wrongly.
21
+ *
22
+ * Current state of the four, stated so this comment can be checked rather
23
+ * than trusted: `eventLogSchemaVersion` and `engineVersion` are witnessed by
24
+ * `era-key-stamped-v1.test.ts` (both are run-document `MUST`s in
25
+ * `version-negotiation.md` §Stamping, and both were unasserted until
26
+ * 2026-09-04). Per-event `schemaVersion` and `pinnedVersions` are **not
27
+ * asserted here and carry no `MUST` in that document** — checked, rather
28
+ * than assumed to be a gap.
29
+ *
30
+ * This paragraph was itself wrong for one release candidate: it said
31
+ * `engineVersion` "remains UNASSERTED" after the leg asserting it had
32
+ * landed. A docstring that describes coverage goes stale the moment
33
+ * coverage changes, which is the argument for stating what can be
34
+ * re-derived rather than what was true once.
13
35
  * 3. Forward-compat read: events carrying an UNKNOWN
14
36
  * `schemaVersion` SHOULD still be readable via the events/poll
15
37
  * endpoint without 5xx (best-effort fold per
package/src/setup.ts CHANGED
@@ -25,7 +25,7 @@
25
25
  * `it` here; vitest treats setupFiles differently from scenario files.
26
26
  */
27
27
 
28
- import { setAdvertisedFixtures } from './lib/fixtures.js';
28
+ import { setAdvertisedFixtures, setDiscoveryUnreadable } from './lib/fixtures.js';
29
29
  import { setMultiAgentCapabilities } from './lib/multi-agent-capabilities.js';
30
30
  import { OtelCollector, setCollector } from './lib/otel-collector.js';
31
31
  import { McpFakeServer, setMcpFakeServer } from './lib/mcp-fake-server.js';
@@ -35,19 +35,23 @@ import { basename, join } from 'node:path';
35
35
  import { existsSync, readFileSync } from 'node:fs';
36
36
  import { PKG_ROOT_PATH } from './lib/paths.js';
37
37
  import { recordRequirement, hasRequirement, journalLength, journalSince } from './lib/requirement-ledger.js';
38
- import { requirementIdForFile, resolveFileRecord, type FileTestState } from './lib/scenario-disposition.js';
39
- import { softSkipDisposition } from './lib/soft-skip.js';
38
+ import { requirementIdForFile, resolveFileRecord, resolveItRecord, type FileTestState } from './lib/scenario-disposition.js';
39
+ import { softSkipDisposition, softSkipDispositionSince, softSkipMark } from './lib/soft-skip.js';
40
40
  import { ItIdAllocator, takeExplicitRequirementId } from './lib/requirement-ids.js';
41
41
  import { SPEC_COHERENCE_SCENARIOS, SPEC_COHERENCE_DETAIL } from './lib/spec-coherence.js';
42
42
  import type { DiscoveryPayload } from './lib/profiles.js';
43
+ import { targetMajor } from './lib/seams.js';
44
+ import { softSkip } from './lib/soft-skip.js';
43
45
 
44
- const SUITE_INIT_TIMEOUT_MS = 5_000;
46
+ // 20 s, not 5: a Cloud Run cold start routinely exceeds 5 s, and a discovery
47
+ // fetch that aborted at init used to turn every fixture-gated scenario into a
48
+ // vacuous `inapplicable`. Measured 2026-09-05 on a host answering in 200 ms.
49
+ const SUITE_INIT_TIMEOUT_MS = 20_000;
50
+ const SUITE_INIT_ATTEMPTS = 2;
45
51
 
46
52
  async function loadHostFixtures(): Promise<void> {
47
53
  const baseUrl = process.env.OPENWOP_BASE_URL?.trim();
48
54
  if (!baseUrl) {
49
- // Offline / fixture-stub-only run. No host to ask; treat as "host
50
- // advertises no fixtures" so all fixture-dependent scenarios skip.
51
55
  setAdvertisedFixtures(null);
52
56
  setMultiAgentCapabilities(null);
53
57
  return;
@@ -55,39 +59,36 @@ async function loadHostFixtures(): Promise<void> {
55
59
 
56
60
  const normalizedBase = baseUrl.replace(/\/$/, '');
57
61
  const url = `${normalizedBase}/.well-known/openwop`;
62
+ // The representation the header selects is the one whose fixtures[] this
63
+ // lane is held to (versioning.md §5): read it under the lane's major.
64
+ const headers: Record<string, string> = { Accept: 'application/json' };
65
+ if (targetMajor() === 2) headers['OpenWOP-Version'] = '2.0';
58
66
 
59
- const controller = new AbortController();
60
- const timer = setTimeout(() => controller.abort(), SUITE_INIT_TIMEOUT_MS);
61
- try {
62
- const res = await fetch(url, {
63
- method: 'GET',
64
- headers: { Accept: 'application/json' },
65
- signal: controller.signal,
66
- });
67
- if (!res.ok) {
68
- // eslint-disable-next-line no-console
69
- console.warn(
70
- `[openwop-conformance setup] discovery fetch returned ${res.status}; ` +
71
- `treating host as advertising no fixtures. Fixture-dependent scenarios will skip.`,
72
- );
73
- setAdvertisedFixtures(null);
74
- setMultiAgentCapabilities(null);
67
+ let lastFailure = 'unknown';
68
+ for (let attempt = 1; attempt <= SUITE_INIT_ATTEMPTS; attempt += 1) {
69
+ const controller = new AbortController();
70
+ const timer = setTimeout(() => controller.abort(), SUITE_INIT_TIMEOUT_MS);
71
+ try {
72
+ const res = await fetch(url, { method: 'GET', headers, signal: controller.signal });
73
+ if (!res.ok) {
74
+ lastFailure = `HTTP ${res.status} on attempt ${attempt}`;
75
+ continue;
76
+ }
77
+ const body = (await res.json()) as DiscoveryPayload;
78
+ setAdvertisedFixtures(body);
79
+ setMultiAgentCapabilities(body);
75
80
  return;
81
+ } catch (err) {
82
+ lastFailure = `${(err as Error).message ?? 'unknown'} on attempt ${attempt}`;
83
+ } finally {
84
+ clearTimeout(timer);
76
85
  }
77
- const body = (await res.json()) as DiscoveryPayload;
78
- setAdvertisedFixtures(body);
79
- setMultiAgentCapabilities(body);
80
- } catch (err) {
81
- // eslint-disable-next-line no-console
82
- console.warn(
83
- `[openwop-conformance setup] discovery fetch failed (${(err as Error).message ?? 'unknown'}); ` +
84
- `treating host as advertising no fixtures. Fixture-dependent scenarios will skip.`,
85
- );
86
- setAdvertisedFixtures(null);
87
- setMultiAgentCapabilities(null);
88
- } finally {
89
- clearTimeout(timer);
90
86
  }
87
+ // Not "the host advertises no fixtures". The document went UNREAD, and every
88
+ // fixture gate will say so as `blocked` rather than `inapplicable`.
89
+ console.warn(`[openwop-conformance setup] discovery unreadable after ${SUITE_INIT_ATTEMPTS} attempt(s) (${lastFailure}); fixture-gated scenarios will record blocked, not inapplicable.`);
90
+ setDiscoveryUnreadable(lastFailure);
91
+ setMultiAgentCapabilities(null);
91
92
  }
92
93
 
93
94
  /**
@@ -238,6 +239,7 @@ const _ledgerMarks = new Map<string, number>();
238
239
  const _itAllocators = new Map<string, ItIdAllocator>();
239
240
  const _itMarks = new Map<string, number>();
240
241
  const _itAssertionsBefore = new Map<string, number>();
242
+ const _itSoftSkipMarks = new Map<string, number>();
241
243
  function _assertionCalls(): number {
242
244
  try {
243
245
  return (expect.getState() as { assertionCalls?: number }).assertionCalls ?? 0;
@@ -277,6 +279,62 @@ function _fileOf(task: { file?: { filepath?: string; name?: string } } | undefin
277
279
  const f = task?.file?.filepath ?? task?.file?.name;
278
280
  return typeof f === 'string' && f.length > 0 ? basename(f) : null;
279
281
  }
282
+ // ---------------------------------------------------------------------------
283
+ // The applicability check and the assertion MUST run under the same contract.
284
+ //
285
+ // A scenario's registration in scenario-majors.json says which target majors it
286
+ // is written for. The driver reads OPENWOP_TARGET_MAJOR to decide which header
287
+ // and path space every probe uses. Nothing connected the two: a lane that ran
288
+ // vitest directly over all 501 files at the default (major 1) executed every
289
+ // major-2 scenario with major-1 requests. The scenarios' own gates call
290
+ // v2Discovery(), which sets the header EXPLICITLY, so the gate passed and the
291
+ // probe went out as v1 — a check that proved the host speaks v2 with one
292
+ // request, then tested a v2 requirement with a request that did not.
293
+ //
294
+ // Measured on a tier-1 host 2026-09-04: three "host defects" reported from that
295
+ // lane, all of which evaporated at major 2; the host was one edit from "fixing"
296
+ // correct behaviour. And in the other direction: 4 of 56 v2 files fail on every
297
+ // host forever under a major-1 driver, so a gate that runs them that way is red
298
+ // by construction and gets reasoned past. Both are the same defect: a scoped
299
+ // signal read as unscoped, with the scope nowhere in the output.
300
+ //
301
+ // So: a file whose registered majors do not include the driver's target major
302
+ // is INAPPLICABLE to this lane, recorded as such with the reason, and never
303
+ // probes. Files not in the registry (coherence checks, lib tests) are untouched.
304
+ // ---------------------------------------------------------------------------
305
+ const SCENARIO_MAJORS: Record<string, number[]> = (() => {
306
+ try {
307
+ const p = join(PKG_ROOT_PATH, 'scenario-majors.json');
308
+ if (!existsSync(p)) return {};
309
+ return (JSON.parse(readFileSync(p, 'utf8')) as { majors?: Record<string, number[]> }).majors ?? {};
310
+ } catch {
311
+ return {};
312
+ }
313
+ })();
314
+
315
+ beforeEach((ctx) => {
316
+ const p = (expect.getState() as { testPath?: string }).testPath;
317
+ if (!p) return;
318
+ const file = basename(p);
319
+ const majors = SCENARIO_MAJORS[file];
320
+ if (!majors) return;
321
+ const lane = targetMajor();
322
+ if (majors.includes(lane)) return;
323
+ const detail = `registered for target major ${majors.join('/')} and this lane runs at major ${lane} (OPENWOP_TARGET_MAJOR) — the probe would go out under a contract the scenario's gate does not use; select files with --target-major or set the variable`;
324
+ // Two records, one per resolver. The per-TEST disposition is read from the
325
+ // requirement journal (the same entry behaviorGate writes), so the row lands
326
+ // as `inapplicable` with this reason rather than `skipped`, which under RFC
327
+ // 0148 would claim the operator opted out. The per-FILE note covers the
328
+ // all-skipped fallback in resolveFileRecord.
329
+ try {
330
+ recordRequirement('openwop.family.lane-target-major', 'inapplicable', detail, { scenarioFile: file });
331
+ } catch {
332
+ /* never fail a test for bookkeeping */
333
+ }
334
+ softSkip('inapplicable', detail);
335
+ ctx.skip();
336
+ });
337
+
280
338
  beforeAll(({}, suite) => {
281
339
  // Mark the ledger journal BEFORE the file's tests run, so a behaviorGate
282
340
  // decision made by the very first test is inside the file's window.
@@ -290,6 +348,7 @@ beforeEach(({ task }) => {
290
348
  // Window for this test's own gate decisions and its own assertion count.
291
349
  _itMarks.set(file, journalLength());
292
350
  _itAssertionsBefore.set(file, _assertionCalls());
351
+ _itSoftSkipMarks.set(file, softSkipMark()); // rc.56: this test's own softSkip window
293
352
  takeExplicitRequirementId(); // clear any override left by a test that threw before afterEach
294
353
  });
295
354
  afterEach(({ task }) => {
@@ -338,7 +397,8 @@ afterEach(({ task }) => {
338
397
  _itAllocators.set(file, alloc);
339
398
  const itId = explicit ?? alloc.allocate(file, task.name);
340
399
  const since = journalSince(_itMarks.get(file) ?? 0);
341
- const gate = since.find((e) => e.disposition === 'inapplicable') ?? since.find((e) => e.disposition === 'skipped');
400
+ const gateEntry = since.find((e) => e.disposition === 'inapplicable') ?? since.find((e) => e.disposition === 'skipped');
401
+ const gate = gateEntry === undefined ? undefined : { disposition: gateEntry.disposition as 'inapplicable' | 'skipped', ...(gateEntry.detail === undefined ? {} : { detail: gateEntry.detail }) };
342
402
  let disposition: 'executed-pass' | 'executed-fail' | 'skipped' | 'inapplicable' | 'blocked';
343
403
  let detail: string | undefined;
344
404
  // Suite 2.0.0: under the corpus gate (scripts/check-spec-coherence.mjs sets OPENWOP_CORPUS_GATE) a coherence scenario IS the subject; its rows are real dispositions for evidence/corpus-ledger.json.
@@ -348,21 +408,15 @@ afterEach(({ task }) => {
348
408
  // rule `resolveFileRecord` applies to the file in the published layout.
349
409
  disposition = 'inapplicable';
350
410
  detail = SPEC_COHERENCE_DETAIL;
351
- } else if (state === 'fail') {
352
- disposition = 'executed-fail';
353
- const err = (task.result?.errors ?? [])[0] as { message?: string } | undefined;
354
- detail = `the test executed and failed: ${(err?.message ?? 'no message').slice(0, 300)}`;
355
- } else if (state === 'pass' && calls > 0) {
356
- disposition = 'executed-pass';
357
- } else if (gate !== undefined) {
358
- disposition = gate.disposition as 'skipped' | 'inapplicable';
359
- detail = gate.detail ?? `${gate.disposition} (gate recorded no reason)`;
360
- } else if (state === 'pass') {
361
- disposition = 'blocked';
362
- detail = 'unclassified return: the test passed with zero assertions and recorded no reason — RFC 0148 §A resolves it to blocked, never to a pass';
363
411
  } else {
364
- disposition = 'skipped';
365
- detail = 'vitest skipped the test (ctx.skip / it.skip) without a recorded gate reason';
412
+ // rc.56: the softSkip notes THIS test wrote are its reason (the file row
413
+ // already read them; the per-`it` row did not, and a leg that said
414
+ // `inapplicable` came out `blocked` — which denies certification bundle-wide).
415
+ const noted = softSkipDispositionSince(file, _itSoftSkipMarks.get(file) ?? 0);
416
+ const err = (task.result?.errors ?? [])[0] as { message?: string } | undefined;
417
+ const rec = resolveItRecord(state === 'pass' ? 'pass' : state === 'fail' ? 'fail' : 'skip', calls, gate, noted, err?.message);
418
+ disposition = rec.disposition;
419
+ detail = rec.detail;
366
420
  }
367
421
  try {
368
422
  recordRequirement(itId, disposition, detail, { assertionCount: calls, scenarioFile: file });