diff --git a/.github/scripts/dispatch-demo-runtime.py b/.github/scripts/dispatch-demo-runtime.py index 11448b0796..43d105614c 100644 --- a/.github/scripts/dispatch-demo-runtime.py +++ b/.github/scripts/dispatch-demo-runtime.py @@ -6,7 +6,6 @@ import base64 import hashlib import importlib.util import json -import datetime import re import os from pathlib import Path @@ -131,61 +130,68 @@ def payload(mode, environ=os.environ): 'binary': base64.b64encode(binary).decode(), 'version_file': base64.b64encode(version_file).decode()} -NATIVE_PATHS = ('.github/scripts/demo-runtime-transaction.py', - '.github/scripts/dispatch-demo-runtime.py', - '.github/scripts/tests/demo_runtime_native.py', - '.github/workflows/demo-runtime-native.yml') +NATIVE_JOBS = { + '.github/workflows/release-convergence.yml': + 'Converge stable demo / Prove demo transaction / Native demo systemd/Caddy proof', + '.github/workflows/recover-demo-server.yml': + 'Prove demo transaction / Native demo systemd/Caddy proof', +} def require_native(environ=os.environ): - """Fail closed before SSH; a metadata/component pass is not native proof.""" + """Require the same attempt's secret-free native prerequisite before SSH. + + Path-filtered main history can be empty and is not a production prerequisite + scheduler. Both consumers now run the reviewed native workflow themselves; + a previous attempt, another source or a component pass cannot admit mutation. + """ sha, repository = environ['GITHUB_SHA'], environ['GITHUB_REPOSITORY'] - if not re.fullmatch(r'[0-9a-f]{40}', sha) or repository != 'rcourtman/Pulse': + run_id, attempt = environ['GITHUB_RUN_ID'], environ['GITHUB_RUN_ATTEMPT'] + if (not re.fullmatch(r'[0-9a-f]{40}', sha) or repository != 'rcourtman/Pulse' + or not re.fullmatch(r'[1-9][0-9]*', run_id) + or not re.fullmatch(r'[1-9][0-9]*', attempt)): raise ValueError('native-source-identity') - since = (datetime.datetime.now(datetime.timezone.utc).date() - datetime.timedelta(days=6)).isoformat() - base = f'repos/{repository}/actions/workflows/demo-runtime-native.yml/runs?branch=main&event=push&per_page=5' def read(query): result = subprocess.run(['gh', 'api', query], capture_output=True, timeout=30, check=False) if result.returncode: raise ValueError('native-evidence-unavailable') - rows = json.loads(result.stdout)['workflow_runs'] - if not isinstance(rows, list) or any(not isinstance(row, dict) for row in rows): + value = json.loads(result.stdout) + if not isinstance(value, dict): raise ValueError('native-evidence-malformed') - for row in rows: - if (type(row.get('id')) is not int or not re.fullmatch(r'[0-9a-f]{40}', str(row.get('head_sha'))) - or type(row.get('run_attempt')) is not int or not isinstance(row.get('updated_at'), str) - or not isinstance(row.get('created_at'), str)): - raise ValueError('native-evidence-malformed') - return rows + return value - rows = read(base + '&created=' + since + '..*') - if len(rows) < 5: - rows += read(base) - merged = {} - for row in rows: - old = merged.get(row['id']) - if old is None or (row['run_attempt'], row['updated_at']) > (old['run_attempt'], old['updated_at']): - merged[row['id']] = row - for row in sorted(merged.values(), key=lambda r: (r['created_at'], r['id']), reverse=True): - head = row['head_sha'] - if (row.get('event') != 'push' or row.get('head_branch') != 'main' - or row.get('path') != '.github/workflows/demo-runtime-native.yml'): - raise ValueError('native-run-identity') - ancestor = subprocess.run(['git', 'merge-base', '--is-ancestor', head, sha], capture_output=True) - if ancestor.returncode != 0: - continue - matching = subprocess.run(['git', 'diff', '--quiet', head, sha, '--', *NATIVE_PATHS], capture_output=True) - if matching.returncode == 1: - continue - if matching.returncode != 0: - raise ValueError('native-source-unavailable') - # Never select an older green sample over a newer matching failure or - # pending run. The native driver exits success only with full cleanup. - if row.get('status') != 'completed' or row.get('conclusion') != 'success': - raise ValueError('native-acceptance-not-passed') - return {'run_id': row['id'], 'run_attempt': row['run_attempt'], 'source_sha': head} - raise ValueError('native-acceptance-missing') + base = f'repos/{repository}/actions/runs/{run_id}' + run = read(base) + if (type(run.get('id')) is not int or run['id'] != int(run_id) + or type(run.get('run_attempt')) is not int or run['run_attempt'] != int(attempt) + or run.get('head_sha') != sha or run.get('head_branch') != 'main' + or run.get('event') != 'workflow_dispatch' + or not isinstance(run.get('path'), str) or run['path'] not in NATIVE_JOBS + or not isinstance(run.get('repository'), dict) + or run['repository'].get('full_name') != repository): + raise ValueError('native-run-identity') + # The attempt-specific endpoint cannot borrow a successful job from a prior + # rerun. Refuse incomplete pagination rather than infer an absent proof. + result = read(base + f'/attempts/{attempt}/jobs?per_page=100') + jobs = result.get('jobs') + if (not isinstance(jobs, list) or type(result.get('total_count')) is not int + or result['total_count'] != len(jobs) or len(jobs) > 100 + or any(not isinstance(job, dict) for job in jobs)): + raise ValueError('native-evidence-malformed') + matches = [job for job in jobs if job.get('name') == NATIVE_JOBS[run['path']]] + if len(matches) != 1: + raise ValueError('native-acceptance-missing') + job = matches[0] + if (type(job.get('id')) is not int or job['id'] <= 0 + or type(job.get('run_id')) is not int or job['run_id'] != int(run_id) + or type(job.get('run_attempt')) is not int or job['run_attempt'] != int(attempt) + or job.get('head_sha') != sha): + raise ValueError('native-job-identity') + if job.get('status') != 'completed' or job.get('conclusion') != 'success': + raise ValueError('native-acceptance-not-passed') + return {'run_id': int(run_id), 'run_attempt': int(attempt), 'source_sha': sha, + 'job_id': job['id']} def prepare_runtime(): diff --git a/.github/scripts/tests/test_demo_runtime_transaction.py b/.github/scripts/tests/test_demo_runtime_transaction.py index c4d3f77773..fb252e6bb1 100644 --- a/.github/scripts/tests/test_demo_runtime_transaction.py +++ b/.github/scripts/tests/test_demo_runtime_transaction.py @@ -7,6 +7,7 @@ import os from pathlib import Path import signal import subprocess +import sys import tempfile import unittest from unittest.mock import patch @@ -948,54 +949,119 @@ class PortableTransactionFixtureTest(unittest.TestCase): class NativeGateTest(unittest.TestCase): - def row(self, run_id=10, **fields): - return {'id': run_id, 'head_sha': 'a' * 40, 'run_attempt': 1, - 'created_at': '2026-10-03T01:00:00Z', 'updated_at': '2026-10-03T01:10:00Z', - 'path': '.github/workflows/demo-runtime-native.yml', 'event': 'push', 'head_branch': 'main', + def environment(self): + return {'GITHUB_SHA': 'b' * 40, 'GITHUB_REPOSITORY': 'rcourtman/Pulse', + 'GITHUB_RUN_ID': '123', 'GITHUB_RUN_ATTEMPT': '2'} + + def run_record(self, **fields): + return {'id': 123, 'run_attempt': 2, 'head_sha': 'b' * 40, + 'head_branch': 'main', 'event': 'workflow_dispatch', + 'path': '.github/workflows/release-convergence.yml', + 'repository': {'full_name': 'rcourtman/Pulse'}, **fields} + + def job(self, **fields): + return {'id': 10, 'run_id': 123, 'run_attempt': 2, 'head_sha': 'b' * 40, + 'name': dispatcher.NATIVE_JOBS['.github/workflows/release-convergence.yml'], 'status': 'completed', 'conclusion': 'success', **fields} - def check(self, rows, history=None, read_exit=0, same=True): + def check(self, *, run=None, jobs=None, listing=None, read_exit=0, environ=None): calls = [] + run = self.run_record() if run is None else run + jobs = [self.job()] if jobs is None else jobs + listing = {'total_count': len(jobs), 'jobs': jobs} if listing is None else listing def command(argv, **kwargs): calls.append(argv) - if argv[0] == 'gh': - payload = rows if 'created=' in argv[-1] else (history if history is not None else rows) - return subprocess.CompletedProcess(argv, read_exit, json.dumps({'workflow_runs': payload}).encode()) - return subprocess.CompletedProcess(argv, 0 if argv[1] == 'merge-base' or same else 1) + self.assertEqual(argv[:2], ['gh', 'api']) + self.assertEqual(kwargs, {'capture_output': True, 'timeout': 30, 'check': False}) + body = run if len(calls) == 1 else listing + return subprocess.CompletedProcess(argv, read_exit, json.dumps(body).encode()) with patch.object(dispatcher.subprocess, 'run', side_effect=command): - result = dispatcher.require_native({'GITHUB_SHA': 'b' * 40, 'GITHUB_REPOSITORY': 'rcourtman/Pulse'}) + result = dispatcher.require_native(self.environment() if environ is None else environ) return result, calls - def test_matching_reviewed_native_source_passes_with_current_first_inventory(self): - result, calls = self.check([self.row()]) - self.assertEqual(result['run_id'], 10) - reads = [c for c in calls if c[0] == 'gh'] - self.assertEqual(len(reads), 2) - self.assertIn('created=', reads[0][-1]); self.assertNotIn('created=', reads[1][-1]) - self.assertEqual(set(calls[-1][6:]), set(dispatcher.NATIVE_PATHS)) + def test_same_run_current_attempt_native_job_passes_without_history_or_git(self): + result, calls = self.check() + self.assertEqual(result, {'run_id': 123, 'run_attempt': 2, 'source_sha': 'b' * 40, 'job_id': 10}) + self.assertEqual([call[-1] for call in calls], [ + 'repos/rcourtman/Pulse/actions/runs/123', + 'repos/rcourtman/Pulse/actions/runs/123/attempts/2/jobs?per_page=100']) - def test_newer_matching_failure_or_pending_run_cannot_use_older_green(self): - for fields in ({'conclusion': 'failure'}, {'status': 'in_progress', 'conclusion': None}): + def test_fixed_recovery_consumer_requires_its_own_native_job(self): + path = '.github/workflows/recover-demo-server.yml' + result, _ = self.check(run=self.run_record(path=path), + jobs=[self.job(name=dispatcher.NATIVE_JOBS[path])]) + self.assertEqual(result['job_id'], 10) + with self.assertRaisesRegex(ValueError, 'missing'): + self.check(run=self.run_record(path=path)) + + def test_prior_attempt_or_other_source_run_cannot_enable_mutation(self): + for fields in ({'id': 122}, {'run_attempt': 1}, {'head_sha': 'a' * 40}, + {'head_branch': 'release-candidate/fixture'}, {'event': 'pull_request'}, + {'path': '.github/workflows/build-and-test.yml'}, {'path': []}, + {'repository': {'full_name': 'rcourtman/pulse-pro'}}, + {'repository': []}, {'id': True}): + with self.subTest(fields=fields), self.assertRaisesRegex(ValueError, 'run-identity'): + self.check(run=self.run_record(**fields)) + + def test_prior_attempt_or_other_source_job_cannot_enable_mutation(self): + for fields in ({'run_id': 122}, {'run_attempt': 1}, {'head_sha': 'a' * 40}, + {'id': True}, {'id': 0}, {'run_attempt': True}, {'run_id': True}): + with self.subTest(fields=fields), self.assertRaisesRegex(ValueError, 'job-identity'): + self.check(jobs=[self.job(**fields)]) + + def test_failed_pending_or_skipped_native_proof_never_admits_mutation(self): + for fields in ({'conclusion': 'failure'}, {'status': 'in_progress', 'conclusion': None}, + {'conclusion': 'skipped'}, {'conclusion': 'cancelled'}, + {'conclusion': 'timed_out'}, {'conclusion': 'neutral'}): with self.subTest(fields=fields), self.assertRaisesRegex(ValueError, 'not-passed'): - self.check([self.row(11, **fields), self.row(10)]) + self.check(jobs=[self.job(**fields)]) - def test_latest_duplicate_attempt_retains_failure(self): - with self.assertRaisesRegex(ValueError, 'not-passed'): - self.check([self.row()], [self.row(run_attempt=2, conclusion='failure')]) + def test_missing_component_only_or_duplicate_proof_never_admits_mutation(self): + for jobs in ([], [self.job(name='Script smoke tests & backend build')], + [self.job(), self.job(id=11)]): + with self.subTest(jobs=jobs), self.assertRaisesRegex(ValueError, 'missing'): + self.check(jobs=jobs) - def test_missing_changed_or_misidentified_proof_cannot_enable_mutation(self): - for rows, same in (([], True), ([self.row()], False), ([self.row(event='workflow_dispatch')], True)): - with self.subTest(rows=rows, same=same), self.assertRaises(ValueError): - self.check(rows, same=same) + def test_truncated_or_malformed_job_collection_is_not_proof(self): + for listing in ({'total_count': 101, 'jobs': [self.job()]}, + {'total_count': 0, 'jobs': {}}, + {'total_count': True, 'jobs': [self.job()]}, + {'total_count': 1, 'jobs': [None]}, {}): + with self.subTest(listing=listing), self.assertRaisesRegex(ValueError, 'malformed'): + self.check(listing=listing) + + def test_invalid_launch_identity_stops_before_any_read(self): + for fields in ({'GITHUB_SHA': 'main'}, {'GITHUB_REPOSITORY': 'rcourtman/pulse-pro'}, + {'GITHUB_RUN_ID': '0'}, {'GITHUB_RUN_ATTEMPT': '../1'}): + with self.subTest(fields=fields), patch.object(dispatcher.subprocess, 'run') as child: + with self.assertRaisesRegex(ValueError, 'source-identity'): + dispatcher.require_native({**self.environment(), **fields}) + child.assert_not_called() def test_refused_read_has_no_history_fallback_or_ssh(self): - calls = [] - def denied(argv, **kwargs): - calls.append(argv); return subprocess.CompletedProcess(argv, 1, b'') - with patch.object(dispatcher.subprocess, 'run', side_effect=denied), self.assertRaises(ValueError): - dispatcher.require_native({'GITHUB_SHA': 'b' * 40, 'GITHUB_REPOSITORY': 'rcourtman/Pulse'}) - self.assertEqual(len(calls), 1) - self.assertEqual(calls[0][0:2], ['gh', 'api']) + for fail_on in (1, 2): + calls = [] + def denied(argv, **kwargs): + calls.append(argv) + return subprocess.CompletedProcess(argv, 1 if len(calls) == fail_on else 0, + json.dumps(self.run_record()).encode()) + with self.subTest(fail_on=fail_on), patch.object(dispatcher.subprocess, 'run', side_effect=denied): + with self.assertRaisesRegex(ValueError, 'evidence-unavailable'): + dispatcher.require_native(self.environment()) + self.assertEqual(len(calls), fail_on) + self.assertTrue(all(call[:2] == ['gh', 'api'] for call in calls)) + + def test_main_refuses_before_payload_or_production_ssh(self): + with patch.object(dispatcher, 'require_native', side_effect=ValueError('native-acceptance-missing')), \ + patch.object(dispatcher, 'payload') as payload, \ + patch.object(dispatcher.subprocess, 'run') as child, \ + patch.object(sys, 'argv', ['dispatch-demo-runtime.py', 'update']), \ + patch('sys.stdout', new_callable=io.StringIO) as output: + self.assertEqual(dispatcher.main(), 1) + self.assertEqual(json.loads(output.getvalue()), { + 'schema_version': 2, 'status': 'refused', 'mutated': False, + 'failure': 'native-acceptance-unavailable'}) + payload.assert_not_called(); child.assert_not_called() if __name__ == "__main__": diff --git a/.github/workflows/demo-runtime-native.yml b/.github/workflows/demo-runtime-native.yml index cbdf441eb0..5e50238ed4 100644 --- a/.github/workflows/demo-runtime-native.yml +++ b/.github/workflows/demo-runtime-native.yml @@ -1,5 +1,6 @@ name: Demo transaction native acceptance on: + workflow_call: pull_request: paths: - '.github/scripts/demo-runtime-transaction.py' @@ -16,10 +17,11 @@ on: permissions: contents: read concurrency: - group: demo-native-${{ github.event.pull_request.number || github.ref }} + group: demo-native-${{ github.run_id }}-${{ github.run_attempt }} cancel-in-progress: true jobs: native: + name: Native demo systemd/Caddy proof runs-on: ubuntu-24.04 timeout-minutes: 35 steps: diff --git a/.github/workflows/recover-demo-server.yml b/.github/workflows/recover-demo-server.yml index ddf1b12932..41c35e00f5 100644 --- a/.github/workflows/recover-demo-server.yml +++ b/.github/workflows/recover-demo-server.yml @@ -14,7 +14,14 @@ concurrency: cancel-in-progress: false jobs: + native_acceptance: + name: Prove demo transaction + permissions: + contents: read + uses: ./.github/workflows/demo-runtime-native.yml + recover: + needs: native_acceptance runs-on: ubuntu-24.04 timeout-minutes: 90 environment: demo-stable diff --git a/.github/workflows/update-demo-server.yml b/.github/workflows/update-demo-server.yml index 92daef758f..d288255fff 100644 --- a/.github/workflows/update-demo-server.yml +++ b/.github/workflows/update-demo-server.yml @@ -186,9 +186,17 @@ jobs: done <<< "$PROFILE_OUTPUT" printf 'Resolved target-compatible demo runtime profile for %s:\n%s\n' "$TAG" "$PROFILE_OUTPUT" - update-demo: + native_acceptance: + name: Prove demo transaction needs: resolve - if: needs.resolve.outputs.skip != 'true' + if: inputs.verify_only != true && needs.resolve.outputs.skip != 'true' + permissions: + contents: read + uses: ./.github/workflows/demo-runtime-native.yml + + update-demo: + needs: [resolve, native_acceptance] + if: ${{ !cancelled() && needs.resolve.result == 'success' && needs.resolve.outputs.skip != 'true' && (inputs.verify_only == true || needs.native_acceptance.result == 'success') }} runs-on: ubuntu-24.04 timeout-minutes: 90 environment: ${{ needs.resolve.outputs.environment_name }} diff --git a/docs/release-control/v6/internal/DEMO_RUNTIME_TRANSACTION.md b/docs/release-control/v6/internal/DEMO_RUNTIME_TRANSACTION.md index 7c1fb4eb34..fde7fcb38a 100644 --- a/docs/release-control/v6/internal/DEMO_RUNTIME_TRANSACTION.md +++ b/docs/release-control/v6/internal/DEMO_RUNTIME_TRANSACTION.md @@ -108,7 +108,7 @@ job and artifact before judging that result. Before treating this route as restored, the exact reviewed source must return native disposable systemd/SSH-loss receipts and signed published-runtime forward/reverse data/identity results. Then reconcile actual demo workflow and -public browser readback through the release owner; source tests do not establish +public browser readback through Delivery; source tests do not establish an installed recovery. Delivery owns that continuation and the remaining ingress migration. Unrestricted root/Tailscale administration can still bypass a source transaction; this candidate is not host enforcement. Workers neither install @@ -118,7 +118,7 @@ Retained failed/unknown estates require the operational owner's reconciliation; do not remove a lock, intent or snapshot merely to permit a fresh sample. A later frontend/network failure is not authority for a second SSH session to stop a committed or unrelated service. Keep the signed packet, failure and -native/browser acceptance distinct in the release judgment. +native/browser acceptance distinct in the operational record. ## Returned footprint defect and chosen correction (3 October 2026) @@ -145,10 +145,30 @@ snapshot and both runtime file identities are checked through forward/recovery watches. Data rollback remains quiescent and retained; startup may naturally write new data. This is not a claim to restore every general-installer effect. -The CI dispatcher refuses production SSH mutation until the newest matching -main native run passes. It checks ancestry and final content of the engine, -dispatcher, native driver and workflow; an unrelated later main commit does not -invalidate unchanged proof. A matching failure/pending run cannot select an -older favourable sample. Refused/malformed reads have no fallback. Only the -normal recent-first/history-fill inventory rule is used for successful reads. -Native and signed installed acceptance are still separate; absence fails closed. +## Same-attempt native prerequisite (2 November 2026) + +The path-filtered native workflow is not an on-demand prerequisite scheduler. +Convergence run 41389692448 at 977719a1 refused before mutation with +`native-acceptance-unavailable`; both live main-push inventories were empty. +No production transaction or native pass follows from the other green jobs. + +Both mutating consumers now call the same secret-free native workflow as a job +dependency, without inheriting secrets, inputs or write permission. Only after +its successful completion may their production environment job start. The +verification-only route skips native execution and still never submits a +transaction; the explicit consumer condition admits that skipped prerequisite +only for verification, never for mutation. Native concurrency is bound to the +caller run and attempt so another main or PR proof cannot cancel it. + +Before SSH submission, the dispatcher reads the current run and its exact +attempt's jobs. It requires the fixed main/workflow-dispatch consumer, exact +control SHA, repository/run/attempt identities and one successful named native +job from that consumer. Truncated, malformed, failed, pending, skipped, +duplicate, unrelated-source or old-attempt evidence refuses. There is no history +lookup, older-green fallback, rerun, dispatch or token expansion. The native +job's success still requires full real-clock forward/recovery and cleanup and +its separate source/command receipts; a component pass cannot stand in for it. +The signed archive, actual retained transaction, cohost state and consuming +public browser checks remain separate operational evidence. Delivery owns +that follow-through after protected publication; this source change is not +an installed update or an assertion that the missing native result passed. diff --git a/docs/release-control/v6/internal/HIGH_RISK_RELEASE_VERIFICATION_MATRIX.md b/docs/release-control/v6/internal/HIGH_RISK_RELEASE_VERIFICATION_MATRIX.md index cdb6ccab9c..a452591d62 100644 --- a/docs/release-control/v6/internal/HIGH_RISK_RELEASE_VERIFICATION_MATRIX.md +++ b/docs/release-control/v6/internal/HIGH_RISK_RELEASE_VERIFICATION_MATRIX.md @@ -1394,3 +1394,19 @@ as verification progresses: - Source reconstruction is not private payload compatibility, successful signing, a published patch or installed forward/reverse recovery. The infrastructure train's no-publication rehearsal and independent exact-head CI are separate. + + +## Demo native proof belongs to the consuming attempt + +- Both update and recovery require the secret-free reusable native job before + their production environment job. Verification-only skips it without gaining + a transaction path. The promotion-policy suite checks those exact graphs, + the read-only permission ceiling and absence of inherited secrets or inputs. +- `NativeGateTest` exercises successful same-run/attempt identities and refusal + for old attempts, changed source/repository/consumer, component-only, duplicate, + failed/pending/skipped jobs, malformed/truncated lists and read failure. The + actual CLI refusal creates no payload and makes no production SSH call. +- Native fixtures retain their full real-clock forward/recovery and cleanup; + source checks do not replace their terminal artifact or the subsequent signed + installed transaction and public-browser evidence. No workflow retry, release + decision or worker production authority is added. diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md index ae5d0a6e90..7fba2f67d9 100644 --- a/docs/release-control/v6/internal/subsystems/deployment-installability.md +++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md @@ -1580,6 +1580,21 @@ before service operations. Neither this driver nor worker source tests install host policy. Production activation still requires independent review and the operational owner's acceptance of the native result and published-source path. +The native proof is also an explicit dependency of both production consumers, +without secret inheritance, inputs or write permission. Path-filtered push +history is not required to schedule that proof. The dispatcher instead binds +one successful native job to the current main workflow-dispatch run, exact +control SHA and attempt, using the attempt-specific job list. Old-attempt, +other-source, pending/failed/skipped, duplicate or incomplete evidence cannot +admit production SSH. No read failure falls back to history or another query. +Verification-only skips the native job and remains non-mutating; only its +explicit condition can admit that skip. A different run cannot cancel the +proof through shared concurrency. Full 300-second forward/recovery, owned +cleanup, signed runtime, production lease and later browser checks are unchanged. +`NativeGateTest` executes the admission/refusal decision; the promotion-policy +suite checks the actual reusable workflow and both consuming dependency graphs. +Passing source controls is not actual native execution or installed convergence. + ### Workflow trust scanning reuses patterns, not decisions `scripts/check_workflow_trust.py` retains at most 64 escaped-key pattern strings diff --git a/scripts/installtests/demo_transaction_test.go b/scripts/installtests/demo_transaction_test.go index c0135f7b33..10608925e8 100644 --- a/scripts/installtests/demo_transaction_test.go +++ b/scripts/installtests/demo_transaction_test.go @@ -66,7 +66,7 @@ func TestDemoNativeAcceptanceIsSecretFreeDisposableAndKeepsRealWindows(t *testin } text := string(data) for _, required := range []string{ - "pull_request:", "branches: [main]", "contents: read", "runs-on: ubuntu-24.04", "timeout-minutes: 35", + "pull_request:", "workflow_call:", "branches: [main]", "contents: read", "runs-on: ubuntu-24.04", "timeout-minutes: 35", "persist-credentials: false", "actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1", "demo_runtime_native.py", "if: always()", "demo-native-result.json", "if-no-files-found: error", } { diff --git a/scripts/release_control/release_promotion_policy_test.py b/scripts/release_control/release_promotion_policy_test.py index 9b2d748d73..841e0ccc82 100644 --- a/scripts/release_control/release_promotion_policy_test.py +++ b/scripts/release_control/release_promotion_policy_test.py @@ -3481,6 +3481,36 @@ else: login = read("frontend-modern/src/utils/localStorage.ts") self.assertIn("DEMO_AUTO_LOGIN: 'pulse-demo-auto-login'", login) + def test_demo_mutation_waits_for_same_attempt_native_prerequisite(self) -> None: + native = yaml.safe_load(read('.github/workflows/demo-runtime-native.yml')) + triggers = native.get('on', native.get(True)) + self.assertIn('workflow_call', triggers) + self.assertEqual(native['permissions'], {'contents': 'read'}) + self.assertEqual(native['jobs']['native']['name'], 'Native demo systemd/Caddy proof') + self.assertEqual(native['concurrency']['group'], 'demo-native-${{ github.run_id }}-${{ github.run_attempt }}') + for path, consumer in (('update-demo-server.yml', 'update-demo'), + ('recover-demo-server.yml', 'recover')): + with self.subTest(workflow=path): + jobs = yaml.safe_load(read('.github/workflows/' + path))['jobs'] + proof = jobs['native_acceptance'] + self.assertEqual(proof['name'], 'Prove demo transaction') + self.assertEqual(proof['uses'], './.github/workflows/demo-runtime-native.yml') + self.assertEqual(proof['permissions'], {'contents': 'read'}) + self.assertNotIn('secrets', proof) + self.assertNotIn('with', proof) + self.assertNotIn('continue-on-error', proof) + needs = jobs[consumer]['needs'] + self.assertIn('native_acceptance', [needs] if isinstance(needs, str) else needs) + self.assertNotIn('continue-on-error', jobs[consumer]) + if path == 'update-demo-server.yml': + self.assertEqual(proof['needs'], 'resolve') + self.assertEqual(proof['if'], "inputs.verify_only != true && needs.resolve.outputs.skip != 'true'") + self.assertEqual(jobs[consumer]['if'], + "${{ !cancelled() && needs.resolve.result == 'success' && needs.resolve.outputs.skip != 'true' && (inputs.verify_only == true || needs.native_acceptance.result == 'success') }}") + else: + self.assertNotIn('if', proof) + self.assertNotIn('if', jobs[consumer]) + def test_stable_demo_recovery_is_fixed_current_bits_only(self) -> None: workflow = read(".github/workflows/recover-demo-server.yml") recovery = read(".github/scripts/recover-demo-runtime.sh")