@openwop/openwop-conformance 1.123.0 → 1.124.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openwop/openwop-conformance",
3
- "version": "1.123.0",
3
+ "version": "1.124.0",
4
4
  "description": "Production-ready black-box conformance suite for OpenWOP v1.0 compliant servers.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "_comment": "Provenance of this vendored schemas/ copy. See conformance/README.md \u00a7\"Resolving the contract\". Compare against the stamp in your installed @openwop/openwop-conformance to detect a stale hand-copied contract.",
3
- "suiteVersion": "1.123.0",
4
- "corpusCommit": "9eb52572cde5f5406ad6ed21a62bb6932cb6bae9"
3
+ "suiteVersion": "1.124.0",
4
+ "corpusCommit": "7dffa37f3864f170141130aa0360765ba89b2e7e"
5
5
  }
@@ -0,0 +1,77 @@
1
+ /**
2
+ * The canonical HTTP error envelope (`schemas/error-envelope.schema.json`,
3
+ * `rest-endpoints.md` §"Error envelope") is FLAT:
4
+ *
5
+ * { "error": "<code>", "message": "<text>", "details"?: { … } }
6
+ *
7
+ * `additionalProperties: false`; `retriable`, `retryAfter`, `correlationId`,
8
+ * `supported`, `requested`, … live under `details`. Every conforming host,
9
+ * the TypeScript SDK's `ErrorEnvelope`, and the v1 lock all agree on this.
10
+ *
11
+ * Between 2026-06 and 2026-08 a NESTED shape — `{ error: { code, retriable } }`
12
+ * — crept into a few code-list entries of `rest-endpoints.md`, four
13
+ * `host-sample-test-seams.md` seam contracts (§19/§20/§22/§23) and ~15
14
+ * scenarios that read `body.error.code` off an HTTP response (S22, decided
15
+ * 2026-08-16: flat wins — the schema is authoritative and re-shaping `error`
16
+ * from string to object would break every conforming host under
17
+ * COMPATIBILITY.md §2.2). Three OTHER error objects are legitimately nested and
18
+ * are NOT this envelope: `RunSnapshot.error { code, message, retriable? }`
19
+ * (run-level), bulk-result items `{ ok:false, error:{ code } }`, and JSON-RPC
20
+ * bodies (MCP / A2A `{ error: { code, message } }`).
21
+ *
22
+ * These helpers read the CODE and the retriable hint from a canonical (flat)
23
+ * envelope, and — for a deprecation window ending with the first suite minor
24
+ * after 2026-11-10 — tolerate the legacy nested shape a seam may still emit,
25
+ * so a host is not made red for a shape the catalog itself prescribed until
26
+ * today. `assertCanonicalErrorEnvelope` is the strict form for legs that check
27
+ * the envelope's shape rather than only its code.
28
+ */
29
+
30
+ export interface CanonicalErrorEnvelope {
31
+ readonly error: string;
32
+ readonly message: string;
33
+ readonly details?: Readonly<Record<string, unknown>>;
34
+ }
35
+
36
+ /** The error code from a canonical envelope; the legacy nested `error.code` is tolerated (deprecation window). */
37
+ export function readErrorCode(body: unknown): string | undefined {
38
+ if (body === null || typeof body !== 'object') return undefined;
39
+ const e = (body as { error?: unknown }).error;
40
+ if (typeof e === 'string') return e;
41
+ if (e !== null && typeof e === 'object') {
42
+ const code = (e as { code?: unknown }).code;
43
+ return typeof code === 'string' ? code : undefined;
44
+ }
45
+ return undefined;
46
+ }
47
+
48
+ /** `details.retriable` from a canonical envelope; legacy nested `error.retriable` tolerated. */
49
+ export function readRetriable(body: unknown): boolean | undefined {
50
+ if (body === null || typeof body !== 'object') return undefined;
51
+ const d = (body as { details?: unknown }).details;
52
+ if (d !== null && typeof d === 'object' && typeof (d as { retriable?: unknown }).retriable === 'boolean') {
53
+ return (d as { retriable: boolean }).retriable;
54
+ }
55
+ const e = (body as { error?: unknown }).error;
56
+ if (e !== null && typeof e === 'object' && typeof (e as { retriable?: unknown }).retriable === 'boolean') {
57
+ return (e as { retriable: boolean }).retriable;
58
+ }
59
+ return undefined;
60
+ }
61
+
62
+ /** True iff the body is the legacy nested `{ error: { code } }` shape (for reporting, never for asserting a pass). */
63
+ export function isLegacyNestedEnvelope(body: unknown): boolean {
64
+ if (body === null || typeof body !== 'object') return false;
65
+ const e = (body as { error?: unknown }).error;
66
+ return e !== null && typeof e === 'object' && typeof (e as { code?: unknown }).code === 'string';
67
+ }
68
+
69
+ /** Strict shape check: flat, `error` + `message` strings, only the three top-level keys. */
70
+ export function isCanonicalErrorEnvelope(body: unknown): body is CanonicalErrorEnvelope {
71
+ if (body === null || typeof body !== 'object' || Array.isArray(body)) return false;
72
+ const b = body as Record<string, unknown>;
73
+ if (typeof b['error'] !== 'string' || b['error'].length === 0) return false;
74
+ if (typeof b['message'] !== 'string' || b['message'].length === 0) return false;
75
+ for (const k of Object.keys(b)) if (k !== 'error' && k !== 'message' && k !== 'details') return false;
76
+ return b['details'] === undefined || (b['details'] !== null && typeof b['details'] === 'object');
77
+ }
@@ -17,6 +17,7 @@
17
17
  */
18
18
 
19
19
  import { describe, it, expect } from 'vitest';
20
+ import { readErrorCode } from '../lib/error-envelope.js';
20
21
  import { driver } from '../lib/driver.js';
21
22
  import { isFixtureAdvertised } from '../lib/fixtures.js';
22
23
  import { isConversationPrimitiveSupported } from '../lib/multi-agent-capabilities.js';
@@ -33,8 +34,8 @@ describe.skipIf(SKIP)('conversationCapabilityNegotiation: refusal contract', ()
33
34
  // or at run-create (400). What MUST NOT happen is a successful
34
35
  // 201 followed by silent fallback.
35
36
  expect([400, 404, 422]).toContain(create.status);
36
- const body = create.json as { error?: { code?: string }; code?: string };
37
- const code = body.error?.code ?? body.code ?? '';
37
+ const body = create.json as { code?: string };
38
+ const code = readErrorCode(create.json) ?? body.code ?? '';
38
39
  expect(typeof code).toBe('string');
39
40
  });
40
41
  });
@@ -36,6 +36,7 @@
36
36
  */
37
37
 
38
38
  import { describe, it, expect } from 'vitest';
39
+ import { readErrorCode } from '../lib/error-envelope.js';
39
40
  import { readFileSync } from 'node:fs';
40
41
  import { join } from 'node:path';
41
42
  import Ajv2020 from 'ajv/dist/2020.js';
@@ -96,12 +97,11 @@ describe.skipIf(HTTP_SKIP)('data-residency: admission control (capability-gated,
96
97
  // A host may legitimately reject the probe workflow for reasons unrelated to
97
98
  // residency (e.g. unknown workflowId) — but it MUST NOT reject an ADVERTISED
98
99
  // region with residency_unavailable. That specific pairing is the violation.
99
- const okBody = ok.json as { error?: { code?: string } } | undefined;
100
100
  expect(
101
- okBody?.error?.code !== 'residency_unavailable',
101
+ readErrorCode(ok.json) !== 'residency_unavailable',
102
102
  driver.describe(
103
103
  'capabilities.md §dataResidency / RFC 0129 §3',
104
- `an ADVERTISED region ("${advertised}") MUST NOT be rejected with residency_unavailable (accept iff advertised) — got ${ok.status} ${JSON.stringify(okBody?.error)}`,
104
+ `an ADVERTISED region ("${advertised}") MUST NOT be rejected with residency_unavailable (accept iff advertised) — got ${ok.status} ${JSON.stringify(ok.json).slice(0, 200)}`,
105
105
  ),
106
106
  ).toBe(true);
107
107
 
@@ -114,7 +114,7 @@ describe.skipIf(HTTP_SKIP)('data-residency: admission control (capability-gated,
114
114
  inputs: {},
115
115
  residency: { region: bogus },
116
116
  });
117
- const rejBody = rej.json as { error?: { code?: string }; runId?: string } | undefined;
117
+ const rejBody = rej.json as { runId?: string } | undefined;
118
118
 
119
119
  expect(
120
120
  rej.status === 400 || rej.status === 404 || rej.status === 422,
@@ -124,10 +124,10 @@ describe.skipIf(HTTP_SKIP)('data-residency: admission control (capability-gated,
124
124
  ),
125
125
  ).toBe(true);
126
126
  expect(
127
- rejBody?.error?.code === 'residency_unavailable',
127
+ readErrorCode(rej.json) === 'residency_unavailable',
128
128
  driver.describe(
129
129
  'RFC 0129 §3',
130
- `an unadvertised region MUST be rejected with error code "residency_unavailable" (MUST NOT silently accept-and-ignore) — got ${JSON.stringify(rejBody?.error)}`,
130
+ `an unadvertised region MUST be rejected with error code "residency_unavailable" (MUST NOT silently accept-and-ignore) — got ${JSON.stringify(rej.json).slice(0, 200)}`,
131
131
  ),
132
132
  ).toBe(true);
133
133
  expect(
@@ -17,6 +17,7 @@
17
17
  */
18
18
 
19
19
  import { describe, it, expect } from 'vitest';
20
+ import { readErrorCode } from '../lib/error-envelope.js';
20
21
  import { driver } from '../lib/driver.js';
21
22
 
22
23
  const HTTP_SKIP = !process.env.OPENWOP_BASE_URL;
@@ -83,7 +84,7 @@ describe.skipIf(HTTP_SKIP)('envelope-recovery-applied: SECURITY invariant envelo
83
84
  'envelope.recovery.applied payload MUST NOT carry pre-recovery output substrings; only the canonical {nodeId, path, byteOffset?} keys per RFC 0032 §B.6 + §G — the recovered content rides on downstream RunEventDoc, not on the recovery event',
84
85
  ),
85
86
  ).toBe(400);
86
- expect(r.body.error?.code).toBe('envelope_recovery_content_leak');
87
+ expect(readErrorCode(r.body)).toBe('envelope_recovery_content_leak');
87
88
  });
88
89
 
89
90
  it('rejects payloads carrying any extra field outside {nodeId, path, byteOffset}', async () => {
@@ -104,7 +105,7 @@ describe.skipIf(HTTP_SKIP)('envelope-recovery-applied: SECURITY invariant envelo
104
105
  'envelope.recovery.applied has additionalProperties: false on the payload — any extra field MUST be rejected to prevent regression carriers for pre-recovery output (defense-in-depth on top of envelope-recovery-no-content-leak)',
105
106
  ),
106
107
  ).toBe(400);
107
- expect(r.body.error?.code).toBe('envelope_recovery_content_leak');
108
+ expect(readErrorCode(r.body)).toBe('envelope_recovery_content_leak');
108
109
  });
109
110
  });
110
111
 
@@ -27,6 +27,7 @@
27
27
  */
28
28
 
29
29
  import { describe, it, expect } from 'vitest';
30
+ import { readErrorCode } from '../lib/error-envelope.js';
30
31
  import { driver } from '../lib/driver.js';
31
32
 
32
33
  const HTTP_SKIP = !process.env.OPENWOP_BASE_URL;
@@ -115,7 +116,7 @@ describe.skipIf(HTTP_SKIP)('envelope-refusal-shape: seam emission (RFC 0032 §B.
115
116
  'envelope.refusal.refusalText MUST be passed through the host BYOK redaction harness; seam refuses payloads carrying secret-canary-* substrings (defense-in-depth CI gate per RFC 0032 §B.3 + §G)',
116
117
  ),
117
118
  ).toBe(400);
118
- expect(r.body.error?.code).toBe('envelope_reliability_credential_leak');
119
+ expect(readErrorCode(r.body)).toBe('envelope_reliability_credential_leak');
119
120
  });
120
121
 
121
122
  it('rejects payloads with a top-level `credentialRef` field', async () => {
@@ -131,7 +132,7 @@ describe.skipIf(HTTP_SKIP)('envelope-refusal-shape: seam emission (RFC 0032 §B.
131
132
  });
132
133
  if (r.status === 404) return;
133
134
  expect(r.status).toBe(400);
134
- expect(r.body.error?.code).toBe('envelope_reliability_credential_leak');
135
+ expect(readErrorCode(r.body)).toBe('envelope_reliability_credential_leak');
135
136
  });
136
137
 
137
138
  it('rejects payloads missing required `provider` field', async () => {
@@ -146,7 +147,7 @@ describe.skipIf(HTTP_SKIP)('envelope-refusal-shape: seam emission (RFC 0032 §B.
146
147
  });
147
148
  if (r.status === 404) return;
148
149
  expect(r.status).toBe(400);
149
- expect(r.body.error?.code).toBe('invalid_argument');
150
+ expect(readErrorCode(r.body)).toBe('invalid_argument');
150
151
  });
151
152
  });
152
153
 
@@ -0,0 +1,64 @@
1
+ /**
2
+ * S22 (2026-08-16) — the HTTP error envelope is FLAT, and the suite reads it
3
+ * through one helper.
4
+ *
5
+ * `rest-endpoints.md` §"Error response shape" and `schemas/error-envelope.schema.json`
6
+ * lock `{ error: <string code>, message, details? }` with `additionalProperties:
7
+ * false`. A nested `{ error: { code, retriable } }` shape had crept into three
8
+ * code-list entries, four seam contracts and ~15 scenarios; this scenario pins
9
+ * the decision at the three places it lives — the schema, the helper that every
10
+ * HTTP-envelope leg now reads through, and the prose — so it cannot re-open
11
+ * quietly. Server-free, always-on.
12
+ */
13
+
14
+ import { describe, it, expect } from 'vitest';
15
+ import { readFileSync } from 'node:fs';
16
+ import { join } from 'node:path';
17
+ import Ajv2020 from 'ajv/dist/2020.js';
18
+ import { SCHEMAS_DIR, V1_DIR } from '../lib/paths.js';
19
+ import { readErrorCode, readRetriable, isCanonicalErrorEnvelope, isLegacyNestedEnvelope } from '../lib/error-envelope.js';
20
+
21
+ export const HOST_CALLBACK_NOT_REQUIRED = 'server-free: pins the flat error-envelope decision against the schema, the helper and the prose';
22
+
23
+ describe('S22 — the canonical HTTP error envelope is flat', () => {
24
+ const schema = JSON.parse(readFileSync(join(SCHEMAS_DIR, 'error-envelope.schema.json'), 'utf8')) as Record<string, unknown>;
25
+ const validate = new Ajv2020({ allErrors: true, strict: false }).compile(schema);
26
+
27
+ it('the schema says `error` is a string, requires `message`, and forbids other top-level keys', () => {
28
+ expect(validate({ error: 'runner_unavailable', message: 'no runner', details: { retriable: true } })).toBe(true);
29
+ expect(validate({ error: { code: 'runner_unavailable', retriable: true } })).toBe(false);
30
+ expect(validate({ error: 'x', message: 'y', retriable: true })).toBe(false); // top-level retriable is illegal
31
+ expect(validate({ error: 'x' })).toBe(false); // message required
32
+ });
33
+
34
+ it('readErrorCode / readRetriable read the canonical shape, and tolerate the legacy nested shape only as legacy', () => {
35
+ const flat = { error: 'interop_version_unsupported', message: 'peer offers 0.3', details: { retriable: false, protocol: 'a2a' } };
36
+ expect(readErrorCode(flat)).toBe('interop_version_unsupported');
37
+ expect(readRetriable(flat)).toBe(false);
38
+ expect(isCanonicalErrorEnvelope(flat)).toBe(true);
39
+ expect(isLegacyNestedEnvelope(flat)).toBe(false);
40
+ const nested = { error: { code: 'runner_unavailable', retriable: true } };
41
+ expect(readErrorCode(nested)).toBe('runner_unavailable');
42
+ expect(readRetriable(nested)).toBe(true);
43
+ expect(isCanonicalErrorEnvelope(nested)).toBe(false);
44
+ expect(isLegacyNestedEnvelope(nested)).toBe(true);
45
+ expect(readErrorCode({ message: 'no code' })).toBeUndefined();
46
+ expect(readErrorCode(null)).toBeUndefined();
47
+ expect(readRetriable({ error: 'x', message: 'y' })).toBeUndefined();
48
+ });
49
+
50
+ it.skipIf(V1_DIR === null)('rest-endpoints.md states the precedence, the details.retriable convention, and carries no nested code-list entry', () => {
51
+ const prose = readFileSync(join(V1_DIR as string, 'rest-endpoints.md'), 'utf8');
52
+ expect(prose).toContain('flat** shape above');
53
+ expect(prose).toContain('### `details.retriable` convention');
54
+ // the three formerly-nested code-list entries are flat now
55
+ for (const code of ['runner_unavailable', 'residency_unavailable', 'interop_version_unsupported']) {
56
+ const line = prose.split('\n').find((l) => l.startsWith('- `' + code + '`')) ?? '';
57
+ expect(line, code + ' code-list entry MUST exist').not.toBe('');
58
+ expect(line, code + ' MUST NOT be described with the nested envelope').not.toMatch(/\{\s*"error"\s*:\s*\{/);
59
+ }
60
+ // the seam catalog too
61
+ const seams = readFileSync(join(V1_DIR as string, 'host-sample-test-seams.md'), 'utf8');
62
+ expect(seams).not.toMatch(/"error":\s*\{\s*"code"/);
63
+ });
64
+ });
@@ -26,6 +26,7 @@
26
26
  */
27
27
 
28
28
  import { describe, it, expect } from 'vitest';
29
+ import { readErrorCode } from '../lib/error-envelope.js';
29
30
  import { driver } from '../lib/driver.js';
30
31
  import { capabilityFamily } from '../lib/discovery-capabilities.js';
31
32
 
@@ -97,7 +98,7 @@ describe('fs-path-traversal: MUST-NOT escape sandboxRoot (RFC 0014 §C)', () =>
97
98
  'absolute paths outside sandboxRoot MUST be rejected with a 4xx envelope',
98
99
  ),
99
100
  ).toBeGreaterThanOrEqual(400);
100
- const code = (res.json as { error?: { code?: string } } | undefined)?.error?.code;
101
+ const code = readErrorCode(res.json);
101
102
  expect(
102
103
  code !== undefined && PATH_REJECTION_CODES.has(code),
103
104
  driver.describe(
@@ -113,7 +114,7 @@ describe('fs-path-traversal: MUST-NOT escape sandboxRoot (RFC 0014 §C)', () =>
113
114
  const res = await driver.post('/v1/host/sample/fs/read', { path: '../../etc/passwd' });
114
115
  if (res.status === 404) return;
115
116
  expect(res.status).toBeGreaterThanOrEqual(400);
116
- const code = (res.json as { error?: { code?: string } } | undefined)?.error?.code;
117
+ const code = readErrorCode(res.json);
117
118
  expect(
118
119
  code !== undefined && PATH_REJECTION_CODES.has(code),
119
120
  driver.describe(
@@ -20,6 +20,7 @@
20
20
  */
21
21
 
22
22
  import { describe, it, expect } from 'vitest';
23
+ import { readErrorCode } from '../lib/error-envelope.js';
23
24
  import Ajv2020 from 'ajv/dist/2020.js';
24
25
  import { readFileSync } from 'node:fs';
25
26
  import { join } from 'node:path';
@@ -179,8 +180,7 @@ describe('provider-usage: event presence via emit-seam + event-log query (RFC 00
179
180
  res.status,
180
181
  driver.describe('SECURITY/invariants.yaml provider-usage-no-credential-leak', 'payload with credentialRef-shaped content MUST be refused'),
181
182
  ).toBe(400);
182
- const body = res.json as { error?: { code?: string } };
183
- expect(body.error?.code).toBe('provider_usage_credential_leak');
183
+ expect(readErrorCode(res.json)).toBe('provider_usage_credential_leak');
184
184
  await resetTestSeam();
185
185
  });
186
186
  });
@@ -14,6 +14,7 @@
14
14
  */
15
15
 
16
16
  import { describe, it, expect } from 'vitest';
17
+ import { readErrorCode } from '../lib/error-envelope.js';
17
18
  import { driver } from '../lib/driver.js';
18
19
 
19
20
  interface DiscoveryDoc {
@@ -74,8 +75,7 @@ describe('table-schema-enforcement: behavioral (RFC 0016 §B point 2)', () => {
74
75
  bad.status >= 400 && bad.status < 500,
75
76
  driver.describe('RFC 0016 §B point 2', 'type-divergent insert MUST be rejected with 4xx'),
76
77
  ).toBe(true);
77
- const body = bad.json as { error?: { code?: string } | string };
78
- const code = typeof body.error === 'string' ? body.error : body.error?.code;
78
+ const code = readErrorCode(bad.json);
79
79
  expect(
80
80
  code,
81
81
  driver.describe('RFC 0016 §B point 2', 'rejection MUST carry the table_schema_violation error code'),
@@ -18,6 +18,7 @@
18
18
  */
19
19
 
20
20
  import { describe, it, expect } from 'vitest';
21
+ import { readErrorCode } from '../lib/error-envelope.js';
21
22
  import { driver } from '../lib/driver.js';
22
23
  import { behaviorGate } from '../lib/behavior-gate.js';
23
24
  import { readCapabilityFamily } from '../lib/discovery-capabilities.js';
@@ -29,7 +30,7 @@ function realtimeVoiceOf(ai: Record<string, unknown> | undefined): Record<string
29
30
  return rv && typeof rv === 'object' ? (rv as Record<string, unknown>) : undefined;
30
31
  }
31
32
  function errCode(json: unknown): string | undefined {
32
- return (json as { error?: { code?: string } })?.error?.code;
33
+ return readErrorCode(json);
33
34
  }
34
35
 
35
36
  describe('voice-streamref-tenant-bound (RFC 0106 §F INV-4)', () => {
@@ -19,6 +19,7 @@
19
19
  */
20
20
 
21
21
  import { describe, it, expect } from 'vitest';
22
+ import { readErrorCode } from '../lib/error-envelope.js';
22
23
  import { driver } from '../lib/driver.js';
23
24
  import { behaviorGate } from '../lib/behavior-gate.js';
24
25
  import { readCapabilityFamily } from '../lib/discovery-capabilities.js';
@@ -30,7 +31,7 @@ function realtimeVoiceOf(ai: Record<string, unknown> | undefined): Record<string
30
31
  return rv && typeof rv === 'object' ? (rv as Record<string, unknown>) : undefined;
31
32
  }
32
33
  function errCode(json: unknown): string | undefined {
33
- return (json as { error?: { code?: string } })?.error?.code;
34
+ return readErrorCode(json);
34
35
  }
35
36
  function eventsOf(json: unknown): Array<{ type?: string; payload?: Record<string, unknown> }> {
36
37
  const e = (json as { events?: unknown })?.events;
@@ -14,6 +14,7 @@
14
14
  */
15
15
 
16
16
  import { describe, it, expect } from 'vitest';
17
+ import { readErrorCode } from '../lib/error-envelope.js';
17
18
  import { driver } from '../lib/driver.js';
18
19
  import { behaviorGate } from '../lib/behavior-gate.js';
19
20
  import { readCapabilityFamily } from '../lib/discovery-capabilities.js';
@@ -25,7 +26,7 @@ function realtimeVoiceOf(ai: Record<string, unknown> | undefined): Record<string
25
26
  return rv && typeof rv === 'object' ? (rv as Record<string, unknown>) : undefined;
26
27
  }
27
28
  function errCode(json: unknown): string | undefined {
28
- return (json as { error?: { code?: string } })?.error?.code;
29
+ return readErrorCode(json);
29
30
  }
30
31
 
31
32
  describe('voice-transcription-unadvertised (RFC 0106 §B)', () => {
@@ -33,6 +33,7 @@
33
33
  */
34
34
 
35
35
  import { describe, it, expect } from 'vitest';
36
+ import { readErrorCode, readRetriable } from '../lib/error-envelope.js';
36
37
  import { driver } from '../lib/driver.js';
37
38
  import { behaviorGate } from '../lib/behavior-gate.js';
38
39
  import { capabilityFamily } from '../lib/discovery-capabilities.js';
@@ -76,7 +77,7 @@ async function resolve(body: Record<string, unknown>): Promise<{ status: number;
76
77
  }
77
78
 
78
79
  function reasonOf(json: unknown): string | undefined {
79
- return (json as { error?: { code?: string } })?.error?.code;
80
+ return readErrorCode(json);
80
81
  }
81
82
 
82
83
  const IDENTITY = { scheme: 'spiffe', subject: 'spiffe://example/dispatcher', issuer: 'spiffe://example' };
@@ -154,9 +155,11 @@ describe('RFC 0154 §A — workload identity resolution (capability-gated behavi
154
155
  if (!behaviorGate(PROFILE, (await caps())?.supported === true)) return;
155
156
  const r = await resolve({ identity: { scheme: 'spiffe', subject: 'spiffe://example/unknown' } });
156
157
  if (r === null || r.status < 400) return;
157
- const err = (r.json as { error?: { code?: string; retriable?: boolean } }).error;
158
+ // canonical flat envelope: code = `error`, retriable = `details.retriable`
159
+ // (the legacy nested `error.{code,retriable}` the §20 catalog prescribed until
160
+ // 2026-08-16 is tolerated by the helpers for the deprecation window)
158
161
  expect(
159
- err?.retriable,
162
+ readRetriable(r.json),
160
163
  driver.describe(
161
164
  'spec/v1/host-sample-test-seams.md §20',
162
165
  'an identity that does not resolve will not resolve on retry. Marking it retriable invites ' +
@@ -166,7 +169,7 @@ describe('RFC 0154 §A — workload identity resolution (capability-gated behavi
166
169
  expect(
167
170
  ['identity_unverified', 'identity_unresolvable', 'audience_mismatch', 'delegation_expired', 'sender_constraint_missing'],
168
171
  driver.describe('RFCS/0154 §A', 'failures use a closed reason vocabulary'),
169
- ).toContain(err?.code);
172
+ ).toContain(readErrorCode(r.json));
170
173
  });
171
174
 
172
175
  it('a resolution response carries no credential material', async () => {