@riddledc/riddle-proof 0.5.28 → 0.5.29
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
package/runtime/lib/preflight.py
CHANGED
|
@@ -42,6 +42,7 @@ with open(args_file) as f:
|
|
|
42
42
|
|
|
43
43
|
mode = (s.get('mode') or '').strip().lower()
|
|
44
44
|
reference = s.get('reference', 'both')
|
|
45
|
+
requested_reference = reference
|
|
45
46
|
reference_note = ''
|
|
46
47
|
verification_mode = (s.get('verification_mode') or 'proof').strip() or 'proof'
|
|
47
48
|
s['verification_mode'] = verification_mode
|
|
@@ -68,6 +69,15 @@ if discord_url_match:
|
|
|
68
69
|
if reference not in ('prod', 'before', 'both'):
|
|
69
70
|
raise SystemExit('Invalid reference: ' + reference + '. Must be prod, before, or both.')
|
|
70
71
|
s['reference'] = reference
|
|
72
|
+
prod_url_present = bool((s.get('prod_url') or '').strip())
|
|
73
|
+
s['reference_resolution'] = {
|
|
74
|
+
'requested_reference': requested_reference,
|
|
75
|
+
'effective_reference': reference,
|
|
76
|
+
'prod_reference_requested': requested_reference in ('prod', 'both'),
|
|
77
|
+
'prod_url_present': prod_url_present,
|
|
78
|
+
'prod_reference_skipped': False,
|
|
79
|
+
'prod_reference_skip_reason': '',
|
|
80
|
+
}
|
|
71
81
|
|
|
72
82
|
# Infer a reasonable commit title during setup instead of forcing the caller to
|
|
73
83
|
# fill boilerplate that can be derived from the requested change.
|
|
@@ -77,11 +87,17 @@ if not (s.get('commit_message') or '').strip():
|
|
|
77
87
|
# Setup should not block on a missing production URL. If prod comparison was
|
|
78
88
|
# requested but prod_url is not known yet, continue with a before-only setup so
|
|
79
89
|
# the repo homework can happen first.
|
|
80
|
-
if reference in ('prod', 'both') and not
|
|
90
|
+
if reference in ('prod', 'both') and not prod_url_present:
|
|
81
91
|
s['requested_reference'] = reference
|
|
82
92
|
reference = 'before'
|
|
83
93
|
s['reference'] = reference
|
|
84
94
|
reference_note = 'prod_url not provided; setup will continue with reference=before until prod is known.'
|
|
95
|
+
s['reference_resolution'].update({
|
|
96
|
+
'effective_reference': reference,
|
|
97
|
+
'prod_reference_skipped': True,
|
|
98
|
+
'prod_reference_skip_reason': 'prod_url_not_provided',
|
|
99
|
+
'note': reference_note,
|
|
100
|
+
})
|
|
85
101
|
|
|
86
102
|
# Parse optional assertions JSON
|
|
87
103
|
parsed_assertions = None
|
|
@@ -11,6 +11,7 @@ from pathlib import Path
|
|
|
11
11
|
ROOT = Path(__file__).resolve().parents[1]
|
|
12
12
|
LIB = ROOT / 'lib'
|
|
13
13
|
UTIL_PATH = LIB / 'util.py'
|
|
14
|
+
PREFLIGHT_PATH = LIB / 'preflight.py'
|
|
14
15
|
RECON_PATH = LIB / 'recon.py'
|
|
15
16
|
VERIFY_PATH = LIB / 'verify.py'
|
|
16
17
|
AUTHOR_PATH = LIB / 'author.py'
|
|
@@ -593,6 +594,49 @@ def temporary_env(**updates):
|
|
|
593
594
|
os.environ[key] = value
|
|
594
595
|
|
|
595
596
|
|
|
597
|
+
def run_preflight_records_prod_reference_skip_reason():
|
|
598
|
+
tempdir = Path(tempfile.mkdtemp(prefix='riddle-proof-preflight-reference-'))
|
|
599
|
+
args_path = tempdir / 'args.json'
|
|
600
|
+
state_path = tempdir / 'state.json'
|
|
601
|
+
repo_dir = tempdir / 'repo'
|
|
602
|
+
try:
|
|
603
|
+
make_project(repo_dir, "export const routes = [{ path: '/pricing', element: <Pricing /> }];\n")
|
|
604
|
+
args_path.write_text(json.dumps({
|
|
605
|
+
'repo': 'example/repo',
|
|
606
|
+
'repo_dir': str(repo_dir),
|
|
607
|
+
'mode': 'static',
|
|
608
|
+
'reference': 'both',
|
|
609
|
+
'prod_url': '',
|
|
610
|
+
'change_request': 'Make the pricing CTA clearer',
|
|
611
|
+
'commit_message': 'Make the pricing CTA clearer',
|
|
612
|
+
'success_criteria': 'Pricing CTA is visible.',
|
|
613
|
+
'verification_mode': 'text',
|
|
614
|
+
'build_command': BUILD_SCRIPT,
|
|
615
|
+
'build_output': 'build',
|
|
616
|
+
'allow_static_preview_fallback': True,
|
|
617
|
+
'server_path': '/pricing',
|
|
618
|
+
}, indent=2))
|
|
619
|
+
with temporary_env(
|
|
620
|
+
RIDDLE_PROOF_ARGS_FILE=str(args_path),
|
|
621
|
+
RIDDLE_PROOF_STATE_FILE=str(state_path),
|
|
622
|
+
):
|
|
623
|
+
load_module('util_preflight_reference_skip', UTIL_PATH)
|
|
624
|
+
load_module('preflight_reference_skip', PREFLIGHT_PATH)
|
|
625
|
+
after_preflight = json.loads(state_path.read_text())
|
|
626
|
+
assert after_preflight['requested_reference'] == 'both'
|
|
627
|
+
assert after_preflight['reference'] == 'before'
|
|
628
|
+
assert after_preflight['reference_resolution']['requested_reference'] == 'both'
|
|
629
|
+
assert after_preflight['reference_resolution']['effective_reference'] == 'before'
|
|
630
|
+
assert after_preflight['reference_resolution']['prod_reference_skipped'] is True
|
|
631
|
+
assert after_preflight['reference_resolution']['prod_reference_skip_reason'] == 'prod_url_not_provided'
|
|
632
|
+
return {
|
|
633
|
+
'ok': True,
|
|
634
|
+
'reference_resolution': after_preflight['reference_resolution'],
|
|
635
|
+
}
|
|
636
|
+
finally:
|
|
637
|
+
shutil.rmtree(tempdir, ignore_errors=True)
|
|
638
|
+
|
|
639
|
+
|
|
596
640
|
def base_state(tempdir: Path, *, reference='before', prod_url=''):
|
|
597
641
|
before_dir = tempdir / 'before'
|
|
598
642
|
after_dir = tempdir / 'after'
|
|
@@ -1740,6 +1784,7 @@ def run_ship_resolves_real_pr_branch():
|
|
|
1740
1784
|
|
|
1741
1785
|
if __name__ == '__main__':
|
|
1742
1786
|
payload = {
|
|
1787
|
+
'preflight_reference_skip_reason': run_preflight_records_prod_reference_skip_reason(),
|
|
1743
1788
|
'capture_artifact_enrichment': run_capture_artifact_enrichment(),
|
|
1744
1789
|
'capture_diagnostics_redaction': run_capture_diagnostics_redact_sensitive_values(),
|
|
1745
1790
|
'apply_auth_context': run_apply_auth_context_passes_supported_auth_payloads(),
|