@riddledc/riddle-proof 0.8.14 → 0.8.16

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.
@@ -5220,6 +5220,40 @@ function checkpointResponseContinuation(state, value) {
5220
5220
  }
5221
5221
  };
5222
5222
  }
5223
+ function finalizedCheckpointResponseWithoutPacketResult(state, value) {
5224
+ if (!value || state.checkpoint_packet || !isProtectedFinalStatus(state.status)) return null;
5225
+ const response = normalizeCheckpointResponse(value);
5226
+ if (!response) return null;
5227
+ if (isDuplicateCheckpointResponse(state, response)) return null;
5228
+ const at = timestamp3();
5229
+ state.checkpoint_history = [
5230
+ ...state.checkpoint_history || [],
5231
+ { ts: at, response }
5232
+ ].slice(-25);
5233
+ appendRunEvent(state, {
5234
+ ts: at,
5235
+ kind: "checkpoint.response.ignored",
5236
+ checkpoint: response.checkpoint,
5237
+ stage: state.current_stage || "verify",
5238
+ summary: "Late checkpoint response ignored because the run is already finalized.",
5239
+ details: compactRecord({
5240
+ status: state.status,
5241
+ decision: response.decision,
5242
+ resume_token: response.resume_token,
5243
+ source: response.source
5244
+ })
5245
+ });
5246
+ persist(state);
5247
+ return createRunResult({
5248
+ state,
5249
+ status: state.status,
5250
+ last_summary: "Late checkpoint response ignored because the run is already finalized.",
5251
+ raw: {
5252
+ ignored_checkpoint_response: true,
5253
+ response
5254
+ }
5255
+ });
5256
+ }
5223
5257
  function disabledAdapterPayload(action, context) {
5224
5258
  return {
5225
5259
  ok: false,
@@ -5790,6 +5824,8 @@ async function runRiddleProofEngineHarness(input) {
5790
5824
  const state = loadRunState(input);
5791
5825
  state.request = normalizeRunParams({ ...state.request, ...input.request });
5792
5826
  state.request.engine_state_path = nonEmptyString(input.resume_params?.state_path) || nonEmptyString(state.request.engine_state_path) || createEngineStatePath(state, input.config);
5827
+ const finalizedCheckpointResponse = finalizedCheckpointResponseWithoutPacketResult(state, input.checkpoint_response);
5828
+ if (finalizedCheckpointResponse) return finalizedCheckpointResponse;
5793
5829
  const checkpointContinuation = checkpointResponseContinuation(state, input.checkpoint_response);
5794
5830
  if (checkpointContinuation.blocker) {
5795
5831
  return blockerResult(state, null, checkpointContinuation.blocker);
@@ -2,7 +2,7 @@ import {
2
2
  createDisabledRiddleProofAgentAdapter,
3
3
  readRiddleProofRunStatus,
4
4
  runRiddleProofEngineHarness
5
- } from "../chunk-YFRPFV4U.js";
5
+ } from "../chunk-ZOZLORGR.js";
6
6
  import "../chunk-YZUVEJ5B.js";
7
7
  import "../chunk-FMOYUYH2.js";
8
8
  import "../chunk-7GZY5PLT.js";
@@ -5757,6 +5757,40 @@ function checkpointResponseContinuation(state, value) {
5757
5757
  }
5758
5758
  };
5759
5759
  }
5760
+ function finalizedCheckpointResponseWithoutPacketResult(state, value) {
5761
+ if (!value || state.checkpoint_packet || !isProtectedFinalStatus(state.status)) return null;
5762
+ const response = normalizeCheckpointResponse(value);
5763
+ if (!response) return null;
5764
+ if (isDuplicateCheckpointResponse(state, response)) return null;
5765
+ const at = timestamp3();
5766
+ state.checkpoint_history = [
5767
+ ...state.checkpoint_history || [],
5768
+ { ts: at, response }
5769
+ ].slice(-25);
5770
+ appendRunEvent(state, {
5771
+ ts: at,
5772
+ kind: "checkpoint.response.ignored",
5773
+ checkpoint: response.checkpoint,
5774
+ stage: state.current_stage || "verify",
5775
+ summary: "Late checkpoint response ignored because the run is already finalized.",
5776
+ details: compactRecord({
5777
+ status: state.status,
5778
+ decision: response.decision,
5779
+ resume_token: response.resume_token,
5780
+ source: response.source
5781
+ })
5782
+ });
5783
+ persist(state);
5784
+ return createRunResult({
5785
+ state,
5786
+ status: state.status,
5787
+ last_summary: "Late checkpoint response ignored because the run is already finalized.",
5788
+ raw: {
5789
+ ignored_checkpoint_response: true,
5790
+ response
5791
+ }
5792
+ });
5793
+ }
5760
5794
  function disabledAdapterPayload(action, context) {
5761
5795
  return {
5762
5796
  ok: false,
@@ -6327,6 +6361,8 @@ async function runRiddleProofEngineHarness(input) {
6327
6361
  const state = loadRunState(input);
6328
6362
  state.request = normalizeRunParams({ ...state.request, ...input.request });
6329
6363
  state.request.engine_state_path = nonEmptyString(input.resume_params?.state_path) || nonEmptyString(state.request.engine_state_path) || createEngineStatePath(state, input.config);
6364
+ const finalizedCheckpointResponse = finalizedCheckpointResponseWithoutPacketResult(state, input.checkpoint_response);
6365
+ if (finalizedCheckpointResponse) return finalizedCheckpointResponse;
6330
6366
  const checkpointContinuation = checkpointResponseContinuation(state, input.checkpoint_response);
6331
6367
  if (checkpointContinuation.blocker) {
6332
6368
  return blockerResult(state, null, checkpointContinuation.blocker);
@@ -6,7 +6,7 @@ import {
6
6
  } from "../chunk-NGX4SUQN.js";
7
7
  import {
8
8
  engine_harness_exports
9
- } from "../chunk-YFRPFV4U.js";
9
+ } from "../chunk-ZOZLORGR.js";
10
10
  import "../chunk-YZUVEJ5B.js";
11
11
  import "../chunk-FMOYUYH2.js";
12
12
  import {
@@ -22,7 +22,7 @@ import {
22
22
  createDisabledRiddleProofAgentAdapter,
23
23
  readRiddleProofRunStatus,
24
24
  runRiddleProofEngineHarness
25
- } from "./chunk-YFRPFV4U.js";
25
+ } from "./chunk-ZOZLORGR.js";
26
26
  import {
27
27
  createCheckpointResponseTemplate
28
28
  } from "./chunk-4FOHZ7JG.js";
@@ -861,6 +861,40 @@ function checkpointResponseContinuation(state, value) {
861
861
  }
862
862
  };
863
863
  }
864
+ function finalizedCheckpointResponseWithoutPacketResult(state, value) {
865
+ if (!value || state.checkpoint_packet || !isProtectedFinalStatus(state.status)) return null;
866
+ const response = normalizeCheckpointResponse(value);
867
+ if (!response) return null;
868
+ if (isDuplicateCheckpointResponse(state, response)) return null;
869
+ const at = timestamp();
870
+ state.checkpoint_history = [
871
+ ...state.checkpoint_history || [],
872
+ { ts: at, response }
873
+ ].slice(-25);
874
+ appendRunEvent(state, {
875
+ ts: at,
876
+ kind: "checkpoint.response.ignored",
877
+ checkpoint: response.checkpoint,
878
+ stage: state.current_stage || "verify",
879
+ summary: "Late checkpoint response ignored because the run is already finalized.",
880
+ details: compactRecord({
881
+ status: state.status,
882
+ decision: response.decision,
883
+ resume_token: response.resume_token,
884
+ source: response.source
885
+ })
886
+ });
887
+ persist(state);
888
+ return createRunResult({
889
+ state,
890
+ status: state.status,
891
+ last_summary: "Late checkpoint response ignored because the run is already finalized.",
892
+ raw: {
893
+ ignored_checkpoint_response: true,
894
+ response
895
+ }
896
+ });
897
+ }
864
898
  function disabledAdapterPayload(action, context) {
865
899
  return {
866
900
  ok: false,
@@ -1431,6 +1465,8 @@ async function runRiddleProofEngineHarness(input) {
1431
1465
  const state = loadRunState(input);
1432
1466
  state.request = normalizeRunParams({ ...state.request, ...input.request });
1433
1467
  state.request.engine_state_path = nonEmptyString(input.resume_params?.state_path) || nonEmptyString(state.request.engine_state_path) || createEngineStatePath(state, input.config);
1468
+ const finalizedCheckpointResponse = finalizedCheckpointResponseWithoutPacketResult(state, input.checkpoint_response);
1469
+ if (finalizedCheckpointResponse) return finalizedCheckpointResponse;
1434
1470
  const checkpointContinuation = checkpointResponseContinuation(state, input.checkpoint_response);
1435
1471
  if (checkpointContinuation.blocker) {
1436
1472
  return blockerResult(state, null, checkpointContinuation.blocker);
package/dist/cli/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import "../chunk-EGZT3EVL.js";
1
+ import "../chunk-E7UTJ7KB.js";
2
2
  import "../chunk-PEWAIEER.js";
3
3
  import "../chunk-TWTEUS7R.js";
4
- import "../chunk-YFRPFV4U.js";
4
+ import "../chunk-ZOZLORGR.js";
5
5
  import "../chunk-YZUVEJ5B.js";
6
6
  import "../chunk-FMOYUYH2.js";
7
7
  import "../chunk-7GZY5PLT.js";
package/dist/cli.cjs CHANGED
@@ -5289,6 +5289,40 @@ function checkpointResponseContinuation(state, value) {
5289
5289
  }
5290
5290
  };
5291
5291
  }
5292
+ function finalizedCheckpointResponseWithoutPacketResult(state, value) {
5293
+ if (!value || state.checkpoint_packet || !isProtectedFinalStatus(state.status)) return null;
5294
+ const response = normalizeCheckpointResponse(value);
5295
+ if (!response) return null;
5296
+ if (isDuplicateCheckpointResponse(state, response)) return null;
5297
+ const at = timestamp3();
5298
+ state.checkpoint_history = [
5299
+ ...state.checkpoint_history || [],
5300
+ { ts: at, response }
5301
+ ].slice(-25);
5302
+ appendRunEvent(state, {
5303
+ ts: at,
5304
+ kind: "checkpoint.response.ignored",
5305
+ checkpoint: response.checkpoint,
5306
+ stage: state.current_stage || "verify",
5307
+ summary: "Late checkpoint response ignored because the run is already finalized.",
5308
+ details: compactRecord({
5309
+ status: state.status,
5310
+ decision: response.decision,
5311
+ resume_token: response.resume_token,
5312
+ source: response.source
5313
+ })
5314
+ });
5315
+ persist(state);
5316
+ return createRunResult({
5317
+ state,
5318
+ status: state.status,
5319
+ last_summary: "Late checkpoint response ignored because the run is already finalized.",
5320
+ raw: {
5321
+ ignored_checkpoint_response: true,
5322
+ response
5323
+ }
5324
+ });
5325
+ }
5292
5326
  function disabledAdapterPayload(action, context) {
5293
5327
  return {
5294
5328
  ok: false,
@@ -5859,6 +5893,8 @@ async function runRiddleProofEngineHarness(input) {
5859
5893
  const state = loadRunState(input);
5860
5894
  state.request = normalizeRunParams({ ...state.request, ...input.request });
5861
5895
  state.request.engine_state_path = nonEmptyString(input.resume_params?.state_path) || nonEmptyString(state.request.engine_state_path) || createEngineStatePath(state, input.config);
5896
+ const finalizedCheckpointResponse = finalizedCheckpointResponseWithoutPacketResult(state, input.checkpoint_response);
5897
+ if (finalizedCheckpointResponse) return finalizedCheckpointResponse;
5862
5898
  const checkpointContinuation = checkpointResponseContinuation(state, input.checkpoint_response);
5863
5899
  if (checkpointContinuation.blocker) {
5864
5900
  return blockerResult(state, null, checkpointContinuation.blocker);
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-EGZT3EVL.js";
2
+ import "./chunk-E7UTJ7KB.js";
3
3
  import "./chunk-PEWAIEER.js";
4
4
  import "./chunk-TWTEUS7R.js";
5
- import "./chunk-YFRPFV4U.js";
5
+ import "./chunk-ZOZLORGR.js";
6
6
  import "./chunk-YZUVEJ5B.js";
7
7
  import "./chunk-FMOYUYH2.js";
8
8
  import "./chunk-7GZY5PLT.js";
@@ -5218,6 +5218,40 @@ function checkpointResponseContinuation(state, value) {
5218
5218
  }
5219
5219
  };
5220
5220
  }
5221
+ function finalizedCheckpointResponseWithoutPacketResult(state, value) {
5222
+ if (!value || state.checkpoint_packet || !isProtectedFinalStatus(state.status)) return null;
5223
+ const response = normalizeCheckpointResponse(value);
5224
+ if (!response) return null;
5225
+ if (isDuplicateCheckpointResponse(state, response)) return null;
5226
+ const at = timestamp3();
5227
+ state.checkpoint_history = [
5228
+ ...state.checkpoint_history || [],
5229
+ { ts: at, response }
5230
+ ].slice(-25);
5231
+ appendRunEvent(state, {
5232
+ ts: at,
5233
+ kind: "checkpoint.response.ignored",
5234
+ checkpoint: response.checkpoint,
5235
+ stage: state.current_stage || "verify",
5236
+ summary: "Late checkpoint response ignored because the run is already finalized.",
5237
+ details: compactRecord({
5238
+ status: state.status,
5239
+ decision: response.decision,
5240
+ resume_token: response.resume_token,
5241
+ source: response.source
5242
+ })
5243
+ });
5244
+ persist(state);
5245
+ return createRunResult({
5246
+ state,
5247
+ status: state.status,
5248
+ last_summary: "Late checkpoint response ignored because the run is already finalized.",
5249
+ raw: {
5250
+ ignored_checkpoint_response: true,
5251
+ response
5252
+ }
5253
+ });
5254
+ }
5221
5255
  function disabledAdapterPayload(action, context) {
5222
5256
  return {
5223
5257
  ok: false,
@@ -5788,6 +5822,8 @@ async function runRiddleProofEngineHarness(input) {
5788
5822
  const state = loadRunState(input);
5789
5823
  state.request = normalizeRunParams({ ...state.request, ...input.request });
5790
5824
  state.request.engine_state_path = nonEmptyString(input.resume_params?.state_path) || nonEmptyString(state.request.engine_state_path) || createEngineStatePath(state, input.config);
5825
+ const finalizedCheckpointResponse = finalizedCheckpointResponseWithoutPacketResult(state, input.checkpoint_response);
5826
+ if (finalizedCheckpointResponse) return finalizedCheckpointResponse;
5791
5827
  const checkpointContinuation = checkpointResponseContinuation(state, input.checkpoint_response);
5792
5828
  if (checkpointContinuation.blocker) {
5793
5829
  return blockerResult(state, null, checkpointContinuation.blocker);
@@ -2,7 +2,7 @@ import {
2
2
  createDisabledRiddleProofAgentAdapter,
3
3
  readRiddleProofRunStatus,
4
4
  runRiddleProofEngineHarness
5
- } from "./chunk-YFRPFV4U.js";
5
+ } from "./chunk-ZOZLORGR.js";
6
6
  import "./chunk-YZUVEJ5B.js";
7
7
  import "./chunk-FMOYUYH2.js";
8
8
  import "./chunk-7GZY5PLT.js";
package/dist/index.cjs CHANGED
@@ -5952,6 +5952,40 @@ function checkpointResponseContinuation(state, value) {
5952
5952
  }
5953
5953
  };
5954
5954
  }
5955
+ function finalizedCheckpointResponseWithoutPacketResult(state, value) {
5956
+ if (!value || state.checkpoint_packet || !isProtectedFinalStatus(state.status)) return null;
5957
+ const response = normalizeCheckpointResponse(value);
5958
+ if (!response) return null;
5959
+ if (isDuplicateCheckpointResponse(state, response)) return null;
5960
+ const at = timestamp3();
5961
+ state.checkpoint_history = [
5962
+ ...state.checkpoint_history || [],
5963
+ { ts: at, response }
5964
+ ].slice(-25);
5965
+ appendRunEvent(state, {
5966
+ ts: at,
5967
+ kind: "checkpoint.response.ignored",
5968
+ checkpoint: response.checkpoint,
5969
+ stage: state.current_stage || "verify",
5970
+ summary: "Late checkpoint response ignored because the run is already finalized.",
5971
+ details: compactRecord({
5972
+ status: state.status,
5973
+ decision: response.decision,
5974
+ resume_token: response.resume_token,
5975
+ source: response.source
5976
+ })
5977
+ });
5978
+ persist(state);
5979
+ return createRunResult({
5980
+ state,
5981
+ status: state.status,
5982
+ last_summary: "Late checkpoint response ignored because the run is already finalized.",
5983
+ raw: {
5984
+ ignored_checkpoint_response: true,
5985
+ response
5986
+ }
5987
+ });
5988
+ }
5955
5989
  function disabledAdapterPayload(action, context) {
5956
5990
  return {
5957
5991
  ok: false,
@@ -6522,6 +6556,8 @@ async function runRiddleProofEngineHarness(input) {
6522
6556
  const state = loadRunState(input);
6523
6557
  state.request = normalizeRunParams({ ...state.request, ...input.request });
6524
6558
  state.request.engine_state_path = nonEmptyString(input.resume_params?.state_path) || nonEmptyString(state.request.engine_state_path) || createEngineStatePath(state, input.config);
6559
+ const finalizedCheckpointResponse = finalizedCheckpointResponseWithoutPacketResult(state, input.checkpoint_response);
6560
+ if (finalizedCheckpointResponse) return finalizedCheckpointResponse;
6525
6561
  const checkpointContinuation = checkpointResponseContinuation(state, input.checkpoint_response);
6526
6562
  if (checkpointContinuation.blocker) {
6527
6563
  return blockerResult(state, null, checkpointContinuation.blocker);
package/dist/index.js CHANGED
@@ -95,7 +95,7 @@ import {
95
95
  createDisabledRiddleProofAgentAdapter,
96
96
  readRiddleProofRunStatus,
97
97
  runRiddleProofEngineHarness
98
- } from "./chunk-YFRPFV4U.js";
98
+ } from "./chunk-ZOZLORGR.js";
99
99
  import {
100
100
  RIDDLE_PROOF_RUN_STATE_VERSION,
101
101
  appendRunEvent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.8.14",
3
+ "version": "0.8.16",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",
@@ -2109,6 +2109,8 @@ FULL_LOCATION_PATH_KEYS = (
2109
2109
  'afterUrl', 'after_url',
2110
2110
  'finalUrl', 'final_url',
2111
2111
  'currentUrl', 'current_url',
2112
+ 'observedUrl', 'observed_url',
2113
+ 'actualUrl', 'actual_url',
2112
2114
  'pathWithSearchAndHash', 'path_with_search_and_hash',
2113
2115
  'fullPath', 'full_path',
2114
2116
  )
@@ -2116,6 +2118,8 @@ PARTIAL_LOCATION_PATH_KEYS = (
2116
2118
  'route',
2117
2119
  'path',
2118
2120
  'pathname',
2121
+ 'observedPath', 'observed_path',
2122
+ 'actualPath', 'actual_path',
2119
2123
  'normalizedPath', 'normalized_path',
2120
2124
  'rawPath', 'raw_path',
2121
2125
  )
@@ -2246,6 +2250,20 @@ def expected_terminal_path_from_record(record, depth=0):
2246
2250
  candidate = expected_terminal_path_from_record(item, depth + 1)
2247
2251
  if candidate:
2248
2252
  return candidate
2253
+ for key in AFTER_STATE_KEYS:
2254
+ value = record.get(key)
2255
+ if isinstance(value, dict):
2256
+ candidate = (
2257
+ record_path_candidate_for_keys(value, EXPECTED_TERMINAL_PATH_KEYS)
2258
+ or expected_terminal_path_from_record(value, depth + 1)
2259
+ )
2260
+ if candidate:
2261
+ return candidate
2262
+ elif isinstance(value, list):
2263
+ for item in value:
2264
+ candidate = expected_terminal_path_from_record(item, depth + 1)
2265
+ if candidate:
2266
+ return candidate
2249
2267
  for key in EVIDENCE_CONTAINER_KEYS:
2250
2268
  value = record.get(key)
2251
2269
  if isinstance(value, dict):
@@ -488,6 +488,69 @@ class FakeRiddle:
488
488
  'totalPixels': 972000,
489
489
  },
490
490
  }
491
+ if 'clickedHomeNavigationOcTerminalShape' in script:
492
+ page_state = {
493
+ 'bodyTextLength': 180,
494
+ 'visibleTextSample': 'Riddle Proof homepage hero Start Free',
495
+ 'interactiveElements': 4,
496
+ 'visibleInteractiveElements': 4,
497
+ 'pathname': '/',
498
+ 'href': 'https://riddledc.com/',
499
+ 'title': 'Riddle',
500
+ 'buttons': ['Start Free'],
501
+ 'headings': ['Riddle Proof'],
502
+ 'links': [],
503
+ 'canvasCount': 0,
504
+ 'largeVisibleElements': [{'tag': 'h1', 'text': 'Riddle Proof'}],
505
+ }
506
+ proof_evidence = {
507
+ 'version': 'riddle-proof.interaction.v1',
508
+ 'start': {
509
+ 'expectedUrl': 'https://riddledc.com/proof/',
510
+ 'expectedPath': '/proof/',
511
+ 'observedUrl': 'https://riddledc.com/proof/',
512
+ 'observedPath': '/proof/',
513
+ },
514
+ 'action': {
515
+ 'type': 'click',
516
+ 'target': 'visible Riddle/Home nav link to root',
517
+ 'chosenText': 'Riddle',
518
+ 'chosenHref': '/',
519
+ 'clicked': True,
520
+ },
521
+ 'terminal': {
522
+ 'expectedUrl': 'https://riddledc.com/',
523
+ 'expectedPath': '/',
524
+ 'routeExpectationSource': 'capture_script.expectedUrl',
525
+ 'observedUrl': 'https://riddledc.com/',
526
+ 'observedPath': '/',
527
+ 'pageReady': True,
528
+ },
529
+ 'assertions': {
530
+ 'startedOnProofRoute': True,
531
+ 'clickedRootNavLink': True,
532
+ 'terminalUrlMatchedExpected': True,
533
+ 'terminalRouteMatchedRoot': True,
534
+ 'terminalMainVisible': True,
535
+ 'routeExpectationSourceMatched': True,
536
+ },
537
+ 'errors': [],
538
+ }
539
+ return {
540
+ 'ok': True,
541
+ 'screenshots': [{'url': 'https://cdn.example.com/home-after.png'}],
542
+ 'outputs': [{'name': 'after-home.png', 'url': 'https://cdn.example.com/home-after.png'}],
543
+ 'result': {'pageState': page_state, 'proofEvidence': proof_evidence},
544
+ 'console': [
545
+ 'RIDDLE_PROOF_STATE:' + json.dumps(page_state),
546
+ 'RIDDLE_PROOF_EVIDENCE:' + json.dumps(proof_evidence),
547
+ ],
548
+ 'visual_diff': {
549
+ 'diffPercentage': 1.2,
550
+ 'differentPixels': 12000,
551
+ 'totalPixels': 972000,
552
+ },
553
+ }
491
554
  if 'clickedHomeNavigation' in script:
492
555
  page_state = {
493
556
  'bodyTextLength': 180,
@@ -2768,6 +2831,56 @@ def run_verify_interaction_reverse_terminal_route_from_proof_evidence():
2768
2831
  shutil.rmtree(tempdir, ignore_errors=True)
2769
2832
 
2770
2833
 
2834
+ def run_verify_interaction_reverse_terminal_expected_url_from_nested_terminal_evidence():
2835
+ tempdir = Path(tempfile.mkdtemp(prefix='riddle-proof-interaction-reverse-oc-shape-'))
2836
+ state_path = tempdir / 'state.json'
2837
+ try:
2838
+ state = base_state(tempdir, reference='prod')
2839
+ state.update({
2840
+ 'recon_status': 'ready_for_proof_plan',
2841
+ 'author_status': 'ready',
2842
+ 'proof_plan_status': 'ready',
2843
+ 'implementation_status': 'not_required',
2844
+ 'verification_mode': 'interaction',
2845
+ 'implementation_mode': 'none',
2846
+ 'require_diff': False,
2847
+ 'allow_code_changes': False,
2848
+ 'server_path': '/proof/',
2849
+ 'prod_url': 'https://riddledc.com/proof/',
2850
+ 'prod_cdn': 'https://cdn.example.com/prod-proof.png',
2851
+ 'proof_plan': 'Start on the proof page, click the visible Riddle/Home root nav link, and trust the structured evidence for the terminal route.',
2852
+ 'capture_script': "clickedHomeNavigationOcTerminalShape(); await saveScreenshot('after-home');",
2853
+ 'recon_results': {
2854
+ 'baselines': {'prod': {'path': '/proof/', 'url': 'https://cdn.example.com/prod-proof.png'}},
2855
+ },
2856
+ })
2857
+ write_state(state_path, state)
2858
+ os.environ['RIDDLE_PROOF_STATE_FILE'] = str(state_path)
2859
+
2860
+ fake = FakeRiddle()
2861
+ load_util_with_fake(fake)
2862
+ load_module('verify_interaction_reverse_terminal_nested_expected_url', VERIFY_PATH)
2863
+ after_verify = json.loads(state_path.read_text())
2864
+
2865
+ assert after_verify['verify_status'] == 'evidence_captured'
2866
+ assert after_verify['route_expectation']['source'] == 'proof_evidence_contract'
2867
+ assert after_verify['route_expectation']['start_path'] == '/proof'
2868
+ assert after_verify['route_expectation']['expected_path'] == '/'
2869
+ route = after_verify['proof_assessment_request']['semantic_context']['route']
2870
+ assert route['expected_start_path'] == '/proof'
2871
+ assert route['expected_after_path'] == '/'
2872
+ assert route['after_observed_path'] == '/'
2873
+ assert 'wrong route' not in after_verify['verify_results']['after']['observation']['reason']
2874
+ return {
2875
+ 'ok': True,
2876
+ 'expected_path': after_verify['route_expectation']['expected_path'],
2877
+ 'after_observed_path': route['after_observed_path'],
2878
+ 'source': after_verify['route_expectation']['source'],
2879
+ }
2880
+ finally:
2881
+ shutil.rmtree(tempdir, ignore_errors=True)
2882
+
2883
+
2771
2884
  def run_verify_interaction_prose_route_noise_uses_proof_evidence():
2772
2885
  tempdir = Path(tempfile.mkdtemp(prefix='riddle-proof-interaction-prose-noise-'))
2773
2886
  state_path = tempdir / 'state.json'
@@ -3553,6 +3666,7 @@ if __name__ == '__main__':
3553
3666
  'verify_interaction_terminal_route_from_proof_evidence': run_verify_interaction_terminal_route_from_proof_evidence(),
3554
3667
  'verify_interaction_proof_evidence_overrides_stale_expected_path': run_verify_interaction_proof_evidence_overrides_stale_expected_path(),
3555
3668
  'verify_interaction_reverse_terminal_route_from_proof_evidence': run_verify_interaction_reverse_terminal_route_from_proof_evidence(),
3669
+ 'verify_interaction_reverse_terminal_expected_url_from_nested_terminal_evidence': run_verify_interaction_reverse_terminal_expected_url_from_nested_terminal_evidence(),
3556
3670
  'verify_interaction_prose_route_noise_uses_proof_evidence': run_verify_interaction_prose_route_noise_uses_proof_evidence(),
3557
3671
  'verify_interaction_hash_terminal_route_from_proof_evidence': run_verify_interaction_hash_terminal_route_from_proof_evidence(),
3558
3672
  'verify_interaction_authored_query_hash_mismatch_blocks_with_evidence': run_verify_interaction_authored_query_hash_mismatch_blocks_with_evidence(),
@@ -37,6 +37,12 @@ CASES = [
37
37
  'function': 'run_verify_interaction_reverse_terminal_route_from_proof_evidence',
38
38
  'expected_terminal': 'pass',
39
39
  },
40
+ {
41
+ 'name': 'route-change-reverse-nested-terminal-url-pass',
42
+ 'covers': ['route-changing interactions', 'proof-evidence-present'],
43
+ 'function': 'run_verify_interaction_reverse_terminal_expected_url_from_nested_terminal_evidence',
44
+ 'expected_terminal': 'pass',
45
+ },
40
46
  {
41
47
  'name': 'route-prose-noise-ignored',
42
48
  'covers': ['route-changing interactions', 'proof-evidence-present'],
@@ -109,6 +115,7 @@ CASES = [
109
115
  GENERIC_FAILURE_MARKERS = (
110
116
  'codex_invalid_json',
111
117
  'codex_no_final_response',
118
+ 'codex_timeout',
112
119
  'max_iterations_reached',
113
120
  'stage_iteration_limit_reached',
114
121
  'unhandled_checkpoint',