@riddledc/riddle-proof 0.8.15 → 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.
@@ -5221,7 +5221,7 @@ function checkpointResponseContinuation(state, value) {
5221
5221
  };
5222
5222
  }
5223
5223
  function finalizedCheckpointResponseWithoutPacketResult(state, value) {
5224
- if (!value || state.checkpoint_packet || !state.finalized || !isProtectedFinalStatus(state.status)) return null;
5224
+ if (!value || state.checkpoint_packet || !isProtectedFinalStatus(state.status)) return null;
5225
5225
  const response = normalizeCheckpointResponse(value);
5226
5226
  if (!response) return null;
5227
5227
  if (isDuplicateCheckpointResponse(state, response)) return null;
@@ -2,7 +2,7 @@ import {
2
2
  createDisabledRiddleProofAgentAdapter,
3
3
  readRiddleProofRunStatus,
4
4
  runRiddleProofEngineHarness
5
- } from "../chunk-RW4OUHN4.js";
5
+ } from "../chunk-ZOZLORGR.js";
6
6
  import "../chunk-YZUVEJ5B.js";
7
7
  import "../chunk-FMOYUYH2.js";
8
8
  import "../chunk-7GZY5PLT.js";
@@ -5758,7 +5758,7 @@ function checkpointResponseContinuation(state, value) {
5758
5758
  };
5759
5759
  }
5760
5760
  function finalizedCheckpointResponseWithoutPacketResult(state, value) {
5761
- if (!value || state.checkpoint_packet || !state.finalized || !isProtectedFinalStatus(state.status)) return null;
5761
+ if (!value || state.checkpoint_packet || !isProtectedFinalStatus(state.status)) return null;
5762
5762
  const response = normalizeCheckpointResponse(value);
5763
5763
  if (!response) return null;
5764
5764
  if (isDuplicateCheckpointResponse(state, response)) return null;
@@ -6,7 +6,7 @@ import {
6
6
  } from "../chunk-NGX4SUQN.js";
7
7
  import {
8
8
  engine_harness_exports
9
- } from "../chunk-RW4OUHN4.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-RW4OUHN4.js";
25
+ } from "./chunk-ZOZLORGR.js";
26
26
  import {
27
27
  createCheckpointResponseTemplate
28
28
  } from "./chunk-4FOHZ7JG.js";
@@ -862,7 +862,7 @@ function checkpointResponseContinuation(state, value) {
862
862
  };
863
863
  }
864
864
  function finalizedCheckpointResponseWithoutPacketResult(state, value) {
865
- if (!value || state.checkpoint_packet || !state.finalized || !isProtectedFinalStatus(state.status)) return null;
865
+ if (!value || state.checkpoint_packet || !isProtectedFinalStatus(state.status)) return null;
866
866
  const response = normalizeCheckpointResponse(value);
867
867
  if (!response) return null;
868
868
  if (isDuplicateCheckpointResponse(state, response)) return null;
package/dist/cli/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import "../chunk-KTIDPXE2.js";
1
+ import "../chunk-E7UTJ7KB.js";
2
2
  import "../chunk-PEWAIEER.js";
3
3
  import "../chunk-TWTEUS7R.js";
4
- import "../chunk-RW4OUHN4.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
@@ -5290,7 +5290,7 @@ function checkpointResponseContinuation(state, value) {
5290
5290
  };
5291
5291
  }
5292
5292
  function finalizedCheckpointResponseWithoutPacketResult(state, value) {
5293
- if (!value || state.checkpoint_packet || !state.finalized || !isProtectedFinalStatus(state.status)) return null;
5293
+ if (!value || state.checkpoint_packet || !isProtectedFinalStatus(state.status)) return null;
5294
5294
  const response = normalizeCheckpointResponse(value);
5295
5295
  if (!response) return null;
5296
5296
  if (isDuplicateCheckpointResponse(state, response)) return null;
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-KTIDPXE2.js";
2
+ import "./chunk-E7UTJ7KB.js";
3
3
  import "./chunk-PEWAIEER.js";
4
4
  import "./chunk-TWTEUS7R.js";
5
- import "./chunk-RW4OUHN4.js";
5
+ import "./chunk-ZOZLORGR.js";
6
6
  import "./chunk-YZUVEJ5B.js";
7
7
  import "./chunk-FMOYUYH2.js";
8
8
  import "./chunk-7GZY5PLT.js";
@@ -5219,7 +5219,7 @@ function checkpointResponseContinuation(state, value) {
5219
5219
  };
5220
5220
  }
5221
5221
  function finalizedCheckpointResponseWithoutPacketResult(state, value) {
5222
- if (!value || state.checkpoint_packet || !state.finalized || !isProtectedFinalStatus(state.status)) return null;
5222
+ if (!value || state.checkpoint_packet || !isProtectedFinalStatus(state.status)) return null;
5223
5223
  const response = normalizeCheckpointResponse(value);
5224
5224
  if (!response) return null;
5225
5225
  if (isDuplicateCheckpointResponse(state, response)) return null;
@@ -2,7 +2,7 @@ import {
2
2
  createDisabledRiddleProofAgentAdapter,
3
3
  readRiddleProofRunStatus,
4
4
  runRiddleProofEngineHarness
5
- } from "./chunk-RW4OUHN4.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
@@ -5953,7 +5953,7 @@ function checkpointResponseContinuation(state, value) {
5953
5953
  };
5954
5954
  }
5955
5955
  function finalizedCheckpointResponseWithoutPacketResult(state, value) {
5956
- if (!value || state.checkpoint_packet || !state.finalized || !isProtectedFinalStatus(state.status)) return null;
5956
+ if (!value || state.checkpoint_packet || !isProtectedFinalStatus(state.status)) return null;
5957
5957
  const response = normalizeCheckpointResponse(value);
5958
5958
  if (!response) return null;
5959
5959
  if (isDuplicateCheckpointResponse(state, response)) return null;
package/dist/index.js CHANGED
@@ -95,7 +95,7 @@ import {
95
95
  createDisabledRiddleProofAgentAdapter,
96
96
  readRiddleProofRunStatus,
97
97
  runRiddleProofEngineHarness
98
- } from "./chunk-RW4OUHN4.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.15",
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'],