@riddledc/riddle-proof 0.5.12 → 0.5.14
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 +1 -1
- package/runtime/lib/recon.py +21 -2
- package/runtime/lib/setup.py +4 -0
- package/runtime/lib/util.py +211 -1
- package/runtime/lib/verify.py +11 -0
- package/runtime/tests/recon_verify_smoke.py +72 -0
package/package.json
CHANGED
package/runtime/lib/recon.py
CHANGED
|
@@ -244,7 +244,7 @@ def score_route_candidate(path, tokens):
|
|
|
244
244
|
def choose_target_path(explicit_path, prod_url, route_hints, tokens=None, explicit_source=''):
|
|
245
245
|
explicit = (explicit_path or '').strip()
|
|
246
246
|
explicit_source = (explicit_source or '').strip()
|
|
247
|
-
is_meaningful_explicit = bool(explicit) and (explicit != '/' or explicit_source
|
|
247
|
+
is_meaningful_explicit = bool(explicit) and (explicit != '/' or bool(explicit_source))
|
|
248
248
|
if is_meaningful_explicit:
|
|
249
249
|
return explicit if explicit.startswith('/') else '/' + explicit
|
|
250
250
|
candidates = route_candidates(route_hints, prod_url)
|
|
@@ -719,7 +719,7 @@ initial_target_path = choose_target_path(s.get('server_path', ''), s.get('prod_u
|
|
|
719
719
|
selected_route = next((item for item in route_options if item.get('path') == initial_target_path), None)
|
|
720
720
|
initial_hypothesis = {
|
|
721
721
|
'target_path': initial_target_path,
|
|
722
|
-
'path_source': 'state.server_path' if (s.get('server_path') or '').strip() and (s.get('server_path') != '/' or server_path_source) else ((selected_route or {}).get('reason') or 'fallback root'),
|
|
722
|
+
'path_source': ('state.server_path:' + server_path_source) if (s.get('server_path') or '').strip() and (s.get('server_path') != '/' or server_path_source) else ((selected_route or {}).get('reason') or 'fallback root'),
|
|
723
723
|
'reference': requested_reference,
|
|
724
724
|
'mode': s.get('mode', 'server'),
|
|
725
725
|
'wait_for_selector': (s.get('wait_for_selector') or '').strip(),
|
|
@@ -783,6 +783,25 @@ elif plan_history:
|
|
|
783
783
|
'changes': diff_plan(plan_history[-1], current_plan),
|
|
784
784
|
'reason': 'Resumed recon with the current state inputs.',
|
|
785
785
|
})
|
|
786
|
+
|
|
787
|
+
capture_hint = s.get('capture_hint') if isinstance(s.get('capture_hint'), dict) else {}
|
|
788
|
+
selected_hint = capture_hint.get('selected') if isinstance(capture_hint.get('selected'), dict) else {}
|
|
789
|
+
if capture_hint.get('applied') and selected_hint:
|
|
790
|
+
fallback_changes = {}
|
|
791
|
+
hinted_path = str(selected_hint.get('server_path') or '').strip()
|
|
792
|
+
hinted_selector = str(selected_hint.get('wait_for_selector') or '').strip()
|
|
793
|
+
if hinted_path and current_plan.get('target_path') != hinted_path:
|
|
794
|
+
fallback_changes['server_path'] = {'from': hinted_path, 'to': current_plan.get('target_path')}
|
|
795
|
+
if hinted_selector and current_plan.get('wait_for_selector') != hinted_selector:
|
|
796
|
+
fallback_changes['wait_for_selector'] = {'from': hinted_selector, 'to': current_plan.get('wait_for_selector')}
|
|
797
|
+
if fallback_changes:
|
|
798
|
+
capture_hint['fallback_triggered'] = True
|
|
799
|
+
capture_hint['fallback_reason'] = (
|
|
800
|
+
str(previous_assessment.get('decision') or '').strip() if has_previous_assessment else 'plan_refined'
|
|
801
|
+
) or 'plan_refined'
|
|
802
|
+
capture_hint['fallback_changes'] = fallback_changes
|
|
803
|
+
s['capture_hint'] = capture_hint
|
|
804
|
+
|
|
786
805
|
plan_history.append(current_plan)
|
|
787
806
|
|
|
788
807
|
summary_bits = []
|
package/runtime/lib/setup.py
CHANGED
|
@@ -9,6 +9,7 @@ local temp storage by default:
|
|
|
9
9
|
import json, subprocess as sp, os, sys, shutil, time, tempfile
|
|
10
10
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
11
11
|
from util import load_state, save_state, git, shell_quote
|
|
12
|
+
from util import apply_capture_hint
|
|
12
13
|
|
|
13
14
|
s = load_state()
|
|
14
15
|
repo = s['repo']
|
|
@@ -474,6 +475,9 @@ s['branch'] = branch
|
|
|
474
475
|
s['target_branch'] = target_branch
|
|
475
476
|
s['ship_target_branch'] = target_branch
|
|
476
477
|
s['worktree_root'] = WORKTREE_ROOT
|
|
478
|
+
capture_hint = apply_capture_hint(s)
|
|
479
|
+
if capture_hint and capture_hint.get('applied_fields'):
|
|
480
|
+
print('Applied last-good capture hint: ' + ', '.join(capture_hint.get('applied_fields') or []))
|
|
477
481
|
save_state(s)
|
|
478
482
|
print('Prepared workspace via ' + setup.get('source', 'workspace_core') + ': ' + repo_dir)
|
|
479
483
|
os.makedirs(WORKTREE_ROOT, exist_ok=True)
|
package/runtime/lib/util.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Shared helpers for Riddle Proof pipeline."""
|
|
2
2
|
|
|
3
|
-
import json, subprocess as sp,
|
|
3
|
+
import hashlib, json, os, re, shlex, subprocess as sp, tempfile, time
|
|
4
4
|
from urllib.parse import urljoin
|
|
5
5
|
from urllib.request import urlopen
|
|
6
6
|
|
|
@@ -18,6 +18,8 @@ CAPTURE_ARTIFACT_JSON_LIMIT = 256 * 1024
|
|
|
18
18
|
_JSON_ARTIFACT_CACHE = {}
|
|
19
19
|
CAPTURE_DIAGNOSTIC_VERSION = 'riddle-proof.capture-diagnostic.v1'
|
|
20
20
|
DEBUG_STRING_LIMIT = 2000
|
|
21
|
+
CAPTURE_HINT_CACHE_VERSION = 'riddle-proof.capture-hints.v1'
|
|
22
|
+
CAPTURE_HINT_CACHE_LIMIT = 12
|
|
21
23
|
SENSITIVE_KEY_FRAGMENTS = (
|
|
22
24
|
'authorization',
|
|
23
25
|
'apikey',
|
|
@@ -29,6 +31,14 @@ SENSITIVE_KEY_FRAGMENTS = (
|
|
|
29
31
|
'secret',
|
|
30
32
|
'token',
|
|
31
33
|
)
|
|
34
|
+
HINT_TOKEN_STOPWORDS = {
|
|
35
|
+
'about', 'after', 'agent', 'agents', 'around', 'before', 'browser', 'change',
|
|
36
|
+
'changes', 'clarify', 'component', 'copy', 'debug', 'default', 'evidence',
|
|
37
|
+
'flow', 'homepage', 'improve', 'just', 'main', 'make', 'need', 'normal',
|
|
38
|
+
'page', 'proof', 'report', 'results', 'review', 'run', 'screen', 'script',
|
|
39
|
+
'small', 'status', 'text', 'tiny', 'update', 'user', 'verify', 'visible',
|
|
40
|
+
'workflow',
|
|
41
|
+
}
|
|
32
42
|
|
|
33
43
|
|
|
34
44
|
def load_state():
|
|
@@ -41,6 +51,206 @@ def save_state(s):
|
|
|
41
51
|
json.dump(s, f, indent=2)
|
|
42
52
|
|
|
43
53
|
|
|
54
|
+
def request_shape_tokens(state, limit=8):
|
|
55
|
+
haystack = ' '.join([
|
|
56
|
+
str(state.get('change_request') or ''),
|
|
57
|
+
str(state.get('context') or ''),
|
|
58
|
+
str(state.get('success_criteria') or ''),
|
|
59
|
+
]).lower()
|
|
60
|
+
tokens = []
|
|
61
|
+
for word in re.findall(r'[a-z0-9]+', haystack):
|
|
62
|
+
if len(word) < 4 or word in HINT_TOKEN_STOPWORDS or word in tokens:
|
|
63
|
+
continue
|
|
64
|
+
tokens.append(word)
|
|
65
|
+
if len(tokens) >= limit:
|
|
66
|
+
break
|
|
67
|
+
return tokens
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def capture_hint_cache_path(state):
|
|
71
|
+
repo_key = str(state.get('repo') or state.get('repo_dir') or '').strip()
|
|
72
|
+
if not repo_key:
|
|
73
|
+
return ''
|
|
74
|
+
digest = hashlib.sha1(repo_key.encode('utf-8')).hexdigest()
|
|
75
|
+
return os.path.join(tempfile.gettempdir(), '.riddle-proof-capture-hints', digest + '.json')
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def load_capture_hint_cache(state):
|
|
79
|
+
cache_path = capture_hint_cache_path(state)
|
|
80
|
+
if not cache_path or not os.path.exists(cache_path):
|
|
81
|
+
return ({'version': CAPTURE_HINT_CACHE_VERSION, 'hints': []}, cache_path)
|
|
82
|
+
try:
|
|
83
|
+
with open(cache_path) as f:
|
|
84
|
+
payload = json.load(f)
|
|
85
|
+
except Exception:
|
|
86
|
+
return ({'version': CAPTURE_HINT_CACHE_VERSION, 'hints': []}, cache_path)
|
|
87
|
+
if not isinstance(payload, dict):
|
|
88
|
+
return ({'version': CAPTURE_HINT_CACHE_VERSION, 'hints': []}, cache_path)
|
|
89
|
+
hints = payload.get('hints') if isinstance(payload.get('hints'), list) else []
|
|
90
|
+
payload['version'] = CAPTURE_HINT_CACHE_VERSION
|
|
91
|
+
payload['hints'] = hints
|
|
92
|
+
return payload, cache_path
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def select_capture_hint(state):
|
|
96
|
+
payload, cache_path = load_capture_hint_cache(state)
|
|
97
|
+
hints = payload.get('hints') or []
|
|
98
|
+
current_tokens = request_shape_tokens(state)
|
|
99
|
+
current_mode = str(state.get('verification_mode') or '').strip().lower()
|
|
100
|
+
scored = []
|
|
101
|
+
for hint in hints:
|
|
102
|
+
if not isinstance(hint, dict):
|
|
103
|
+
continue
|
|
104
|
+
server_path = str(hint.get('server_path') or '').strip()
|
|
105
|
+
wait_for_selector = str(hint.get('wait_for_selector') or '').strip()
|
|
106
|
+
if not server_path and not wait_for_selector:
|
|
107
|
+
continue
|
|
108
|
+
hint_mode = str(hint.get('verification_mode') or '').strip().lower()
|
|
109
|
+
hint_tokens = [
|
|
110
|
+
str(item).strip().lower()
|
|
111
|
+
for item in (hint.get('request_tokens') or [])
|
|
112
|
+
if str(item).strip()
|
|
113
|
+
]
|
|
114
|
+
matched_tokens = [token for token in current_tokens if token in hint_tokens]
|
|
115
|
+
score = len(matched_tokens) * 3
|
|
116
|
+
if current_mode and hint_mode == current_mode:
|
|
117
|
+
score += 2
|
|
118
|
+
if score <= 0:
|
|
119
|
+
continue
|
|
120
|
+
scored.append({
|
|
121
|
+
'score': score,
|
|
122
|
+
'matched_tokens': matched_tokens,
|
|
123
|
+
'selection_reason': 'token_overlap_and_mode' if matched_tokens and current_mode and hint_mode == current_mode else (
|
|
124
|
+
'token_overlap' if matched_tokens else 'verification_mode_match'
|
|
125
|
+
),
|
|
126
|
+
'hint': hint,
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
if not scored:
|
|
130
|
+
return None
|
|
131
|
+
|
|
132
|
+
scored.sort(
|
|
133
|
+
key=lambda item: (
|
|
134
|
+
int(item['score']),
|
|
135
|
+
str(item['hint'].get('saved_at') or ''),
|
|
136
|
+
),
|
|
137
|
+
reverse=True,
|
|
138
|
+
)
|
|
139
|
+
selected = scored[0]
|
|
140
|
+
return {
|
|
141
|
+
'cache_path': cache_path,
|
|
142
|
+
'available_count': len(hints),
|
|
143
|
+
'score': selected['score'],
|
|
144
|
+
'matched_tokens': selected['matched_tokens'],
|
|
145
|
+
'selection_reason': selected['selection_reason'],
|
|
146
|
+
'hint': selected['hint'],
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def apply_capture_hint(state):
|
|
151
|
+
selected = select_capture_hint(state)
|
|
152
|
+
if not selected:
|
|
153
|
+
return None
|
|
154
|
+
|
|
155
|
+
hint = selected['hint']
|
|
156
|
+
applied_fields = []
|
|
157
|
+
server_path = str(hint.get('server_path') or '').strip()
|
|
158
|
+
wait_for_selector = str(hint.get('wait_for_selector') or '').strip()
|
|
159
|
+
|
|
160
|
+
if server_path and not str(state.get('server_path') or '').strip():
|
|
161
|
+
state['server_path'] = server_path
|
|
162
|
+
state['server_path_source'] = 'hint_cache'
|
|
163
|
+
applied_fields.append('server_path')
|
|
164
|
+
if wait_for_selector and not str(state.get('wait_for_selector') or '').strip():
|
|
165
|
+
state['wait_for_selector'] = wait_for_selector
|
|
166
|
+
state['wait_for_selector_source'] = 'hint_cache'
|
|
167
|
+
applied_fields.append('wait_for_selector')
|
|
168
|
+
|
|
169
|
+
if not applied_fields:
|
|
170
|
+
return None
|
|
171
|
+
|
|
172
|
+
state['capture_hint'] = {
|
|
173
|
+
'source': 'hint_cache',
|
|
174
|
+
'cache_path': selected['cache_path'],
|
|
175
|
+
'applied': True,
|
|
176
|
+
'applied_fields': applied_fields,
|
|
177
|
+
'matched_tokens': selected['matched_tokens'],
|
|
178
|
+
'selection_reason': selected['selection_reason'],
|
|
179
|
+
'available_count': selected['available_count'],
|
|
180
|
+
'selected': {
|
|
181
|
+
'saved_at': str(hint.get('saved_at') or ''),
|
|
182
|
+
'verification_mode': str(hint.get('verification_mode') or ''),
|
|
183
|
+
'server_path': server_path,
|
|
184
|
+
'wait_for_selector': wait_for_selector,
|
|
185
|
+
'observed_path': str(hint.get('observed_path') or ''),
|
|
186
|
+
'proof_profile_name': str(hint.get('proof_profile_name') or ''),
|
|
187
|
+
'request_tokens': hint.get('request_tokens') or [],
|
|
188
|
+
},
|
|
189
|
+
'fallback_triggered': False,
|
|
190
|
+
}
|
|
191
|
+
return state['capture_hint']
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def record_successful_capture_hint(state, server_path='', wait_for_selector='', observed_path='', source_stage='verify', success_signal=''):
|
|
195
|
+
server_path = str(server_path or '').strip()
|
|
196
|
+
wait_for_selector = str(wait_for_selector or '').strip()
|
|
197
|
+
if not server_path and not wait_for_selector:
|
|
198
|
+
return {'status': 'skipped_missing_inputs'}
|
|
199
|
+
|
|
200
|
+
payload, cache_path = load_capture_hint_cache(state)
|
|
201
|
+
hints = payload.get('hints') or []
|
|
202
|
+
request_tokens = request_shape_tokens(state)
|
|
203
|
+
entry = {
|
|
204
|
+
'saved_at': time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()),
|
|
205
|
+
'verification_mode': str(state.get('verification_mode') or '').strip().lower(),
|
|
206
|
+
'request_tokens': request_tokens,
|
|
207
|
+
'request_sample': compact_debug_value(str(state.get('change_request') or '')[:240]),
|
|
208
|
+
'server_path': server_path,
|
|
209
|
+
'wait_for_selector': wait_for_selector,
|
|
210
|
+
'observed_path': str(observed_path or '').strip(),
|
|
211
|
+
'proof_profile_name': str(((state.get('proof_profile') or {}).get('name')) or '').strip(),
|
|
212
|
+
'source_stage': str(source_stage or '').strip(),
|
|
213
|
+
'success_signal': str(success_signal or '').strip(),
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
deduped = []
|
|
217
|
+
for hint in hints:
|
|
218
|
+
if not isinstance(hint, dict):
|
|
219
|
+
continue
|
|
220
|
+
if (
|
|
221
|
+
str(hint.get('verification_mode') or '').strip().lower() == entry['verification_mode']
|
|
222
|
+
and str(hint.get('server_path') or '').strip() == entry['server_path']
|
|
223
|
+
and str(hint.get('wait_for_selector') or '').strip() == entry['wait_for_selector']
|
|
224
|
+
and list(hint.get('request_tokens') or []) == entry['request_tokens']
|
|
225
|
+
):
|
|
226
|
+
continue
|
|
227
|
+
deduped.append(hint)
|
|
228
|
+
|
|
229
|
+
next_payload = {
|
|
230
|
+
'version': CAPTURE_HINT_CACHE_VERSION,
|
|
231
|
+
'repo': str(state.get('repo') or state.get('repo_dir') or '').strip(),
|
|
232
|
+
'updated_at': entry['saved_at'],
|
|
233
|
+
'hints': [entry] + deduped[:CAPTURE_HINT_CACHE_LIMIT - 1],
|
|
234
|
+
}
|
|
235
|
+
try:
|
|
236
|
+
os.makedirs(os.path.dirname(cache_path), exist_ok=True)
|
|
237
|
+
with open(cache_path, 'w') as f:
|
|
238
|
+
json.dump(next_payload, f, indent=2)
|
|
239
|
+
except Exception as exc:
|
|
240
|
+
return {
|
|
241
|
+
'status': 'error',
|
|
242
|
+
'cache_path': cache_path,
|
|
243
|
+
'error': str(exc)[:240],
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return {
|
|
247
|
+
'status': 'saved',
|
|
248
|
+
'cache_path': cache_path,
|
|
249
|
+
'entry': entry,
|
|
250
|
+
'hint_count': len(next_payload['hints']),
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
|
|
44
254
|
def compact_debug_value(value, limit=DEBUG_STRING_LIMIT):
|
|
45
255
|
if isinstance(value, str) and len(value) > limit:
|
|
46
256
|
return value[:limit] + '... [truncated]'
|
package/runtime/lib/verify.py
CHANGED
|
@@ -19,6 +19,7 @@ from util import (
|
|
|
19
19
|
invoke_retry,
|
|
20
20
|
load_state,
|
|
21
21
|
prepare_server_preview,
|
|
22
|
+
record_successful_capture_hint,
|
|
22
23
|
save_state,
|
|
23
24
|
should_use_static_preview,
|
|
24
25
|
summarize_capture_artifacts,
|
|
@@ -1139,6 +1140,16 @@ if proof_evidence_required_for_mode(s.get('verification_mode')):
|
|
|
1139
1140
|
|
|
1140
1141
|
has_good_evidence = required_baseline_present and after_observation.get('valid') and not proof_evidence_blocker
|
|
1141
1142
|
|
|
1143
|
+
if has_good_evidence:
|
|
1144
|
+
s['capture_hint_saved'] = record_successful_capture_hint(
|
|
1145
|
+
s,
|
|
1146
|
+
server_path=expected_path or s.get('server_path') or '/',
|
|
1147
|
+
wait_for_selector=s.get('wait_for_selector') or '',
|
|
1148
|
+
observed_path=observed_path,
|
|
1149
|
+
source_stage='verify',
|
|
1150
|
+
success_signal='evidence_captured',
|
|
1151
|
+
)
|
|
1152
|
+
|
|
1142
1153
|
if has_good_evidence:
|
|
1143
1154
|
supervisor_request = build_supervisor_assessment_request(s, after_payload, after_observation, required_baseline_present, expected_path, evidence_bundle)
|
|
1144
1155
|
s['verify_status'] = 'evidence_captured'
|
|
@@ -207,6 +207,30 @@ class FakeRiddle:
|
|
|
207
207
|
'largeVisibleElements': [{'tag': 'button', 'text': 'Reset Game'}],
|
|
208
208
|
}),
|
|
209
209
|
}
|
|
210
|
+
if (
|
|
211
|
+
'preview.example.com' in script
|
|
212
|
+
and '/pricing' not in script
|
|
213
|
+
and '/games/tic-tac-toe' not in script
|
|
214
|
+
and '/wrong' not in script
|
|
215
|
+
):
|
|
216
|
+
return {
|
|
217
|
+
'ok': True,
|
|
218
|
+
'screenshots': [{'url': 'https://cdn.example.com/home-before.png'}],
|
|
219
|
+
'outputs': [{'name': 'before.png', 'url': 'https://cdn.example.com/home-before.png'}],
|
|
220
|
+
'console': state_console({
|
|
221
|
+
'bodyTextLength': 180,
|
|
222
|
+
'visibleTextSample': 'Riddle Proof homepage hero Start Free',
|
|
223
|
+
'interactiveElements': 4,
|
|
224
|
+
'visibleInteractiveElements': 4,
|
|
225
|
+
'pathname': '/',
|
|
226
|
+
'title': 'Riddle',
|
|
227
|
+
'buttons': ['Start Free'],
|
|
228
|
+
'headings': ['Riddle Proof'],
|
|
229
|
+
'links': [],
|
|
230
|
+
'canvasCount': 0,
|
|
231
|
+
'largeVisibleElements': [{'tag': 'button', 'text': 'Start Free'}],
|
|
232
|
+
}),
|
|
233
|
+
}
|
|
210
234
|
raise AssertionError(f'unexpected riddle_script payload: {script}')
|
|
211
235
|
raise AssertionError(f'unexpected invoke_retry tool: {tool}')
|
|
212
236
|
|
|
@@ -581,6 +605,53 @@ def run_recon_prefers_route_literals_over_import_paths():
|
|
|
581
605
|
shutil.rmtree(tempdir, ignore_errors=True)
|
|
582
606
|
|
|
583
607
|
|
|
608
|
+
def run_recon_prefers_hint_root_over_single_route_literal():
|
|
609
|
+
tempdir = Path(tempfile.mkdtemp(prefix='riddle-proof-hint-root-'))
|
|
610
|
+
state_path = tempdir / 'state.json'
|
|
611
|
+
try:
|
|
612
|
+
route_snippet = "export const routes = [{ path: '/docs/riddle-proof/markdown', element: <Docs /> }];\n"
|
|
613
|
+
state = base_state(tempdir, reference='before')
|
|
614
|
+
make_project(tempdir / 'before', route_snippet)
|
|
615
|
+
make_project(tempdir / 'after', route_snippet)
|
|
616
|
+
state.update({
|
|
617
|
+
'server_path': '/',
|
|
618
|
+
'server_path_source': 'hint_cache',
|
|
619
|
+
'capture_hint': {
|
|
620
|
+
'source': 'hint_cache',
|
|
621
|
+
'applied_fields': ['server_path'],
|
|
622
|
+
'selected': {'server_path': '/'},
|
|
623
|
+
},
|
|
624
|
+
'change_request': 'Make a tiny harmless homepage copy tweak',
|
|
625
|
+
'success_criteria': 'The homepage hero copy reflects the tiny tweak.',
|
|
626
|
+
})
|
|
627
|
+
write_state(state_path, state)
|
|
628
|
+
os.environ['RIDDLE_PROOF_STATE_FILE'] = str(state_path)
|
|
629
|
+
|
|
630
|
+
fake = FakeRiddle()
|
|
631
|
+
load_util_with_fake(fake)
|
|
632
|
+
load_module('recon_hint_root_preference', RECON_PATH)
|
|
633
|
+
after_recon = json.loads(state_path.read_text())
|
|
634
|
+
|
|
635
|
+
current_plan = after_recon['recon_results']['current_plan']
|
|
636
|
+
candidate_paths = [item['path'] for item in current_plan['route_candidates']]
|
|
637
|
+
assert current_plan['target_path'] == '/', current_plan
|
|
638
|
+
assert current_plan['path_source'] == 'state.server_path:hint_cache', current_plan
|
|
639
|
+
assert '/docs/riddle-proof/markdown' in candidate_paths, candidate_paths
|
|
640
|
+
details = after_recon['recon_results']['attempt_history'][-1]['observations']['before']['details']
|
|
641
|
+
assert details['observed_path'] == '/'
|
|
642
|
+
assert 'Start Free' in details['visible_text_sample'], details
|
|
643
|
+
assert details['buttons'] == ['Start Free'], details
|
|
644
|
+
|
|
645
|
+
return {
|
|
646
|
+
'ok': True,
|
|
647
|
+
'target_path': current_plan['target_path'],
|
|
648
|
+
'path_source': current_plan['path_source'],
|
|
649
|
+
'candidate_paths': candidate_paths,
|
|
650
|
+
}
|
|
651
|
+
finally:
|
|
652
|
+
shutil.rmtree(tempdir, ignore_errors=True)
|
|
653
|
+
|
|
654
|
+
|
|
584
655
|
def run_author_applies_supervisor_packet():
|
|
585
656
|
tempdir = Path(tempfile.mkdtemp(prefix='riddle-proof-supervisor-apply-'))
|
|
586
657
|
state_path = tempdir / 'state.json'
|
|
@@ -1182,6 +1253,7 @@ if __name__ == '__main__':
|
|
|
1182
1253
|
'verify_quality_ignores_proof_telemetry_console_text': run_verify_quality_ignores_proof_telemetry_console_text(),
|
|
1183
1254
|
'recon_then_author_request': run_recon_then_author_request(),
|
|
1184
1255
|
'recon_route_literal_preference': run_recon_prefers_route_literals_over_import_paths(),
|
|
1256
|
+
'recon_hint_root_preference': run_recon_prefers_hint_root_over_single_route_literal(),
|
|
1185
1257
|
'author_applies_supervisor_packet': run_author_applies_supervisor_packet(),
|
|
1186
1258
|
'verify_requests_supervisor_assessment': run_verify_requests_supervisor_assessment(),
|
|
1187
1259
|
'verify_structured_evidence_without_screenshot': run_verify_structured_evidence_without_screenshot(),
|