From 07980784fcf80d7e64fdca719c6f1ef7a3ceffb7 Mon Sep 17 00:00:00 2001 From: Dylan Roy <249851642+d6g8k5htny-coder@users.noreply.github.com> Date: Thu, 22 Oct 2026 17:34:09 -0500 Subject: [PATCH] fix(site): recover a verified successor after publication advances Preserve the original two integrity-bound requests, then acquire one bounded metadata descriptor and one separately verified keyed successor. Retain immutable transition fixtures and bounded hosted candidate evidence. --- .../current-site-transition-candidate.yml | 285 ++++++++++++++++++ docs/site/current-model.mjs | 95 +++++- .../fixture-freeze.json | 46 +++ .../identities.json | 14 + .../new-meta.json | 7 + .../new-observation.json | 55 ++++ .../new-same-length-corrupt.json | 55 ++++ .../old-meta.json | 7 + .../old-observation.json | 48 +++ .../old-same-length-corrupt.json | 48 +++ .../production-source-freeze.json | 23 ++ .../production-source-freeze.json | 24 ++ tests/test_current_site_transition.mjs | 172 +++++++++++ 13 files changed, 871 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/current-site-transition-candidate.yml create mode 100644 tests/fixtures/current_site_transition_20261022/fixture-freeze.json create mode 100644 tests/fixtures/current_site_transition_20261022/identities.json create mode 100644 tests/fixtures/current_site_transition_20261022/new-meta.json create mode 100644 tests/fixtures/current_site_transition_20261022/new-observation.json create mode 100644 tests/fixtures/current_site_transition_20261022/new-same-length-corrupt.json create mode 100644 tests/fixtures/current_site_transition_20261022/old-meta.json create mode 100644 tests/fixtures/current_site_transition_20261022/old-observation.json create mode 100644 tests/fixtures/current_site_transition_20261022/old-same-length-corrupt.json create mode 100644 tests/fixtures/current_site_transition_20261022/production-source-freeze.json create mode 100644 tests/fixtures/current_site_transition_candidate_20261022/production-source-freeze.json create mode 100644 tests/test_current_site_transition.mjs diff --git a/.github/workflows/current-site-transition-candidate.yml b/.github/workflows/current-site-transition-candidate.yml new file mode 100644 index 000000000..1982aa6ae --- /dev/null +++ b/.github/workflows/current-site-transition-candidate.yml @@ -0,0 +1,285 @@ +# PRIVATE UNBOUND CANDIDATE TEMPLATE. Not publishable until exact freeze binding and review. +# Keep the independent intentional RED draft PR499 immutable and unmerged. +name: Current reader publication transition candidate +'on': + pull_request: + branches: [main] + paths: + - 'docs/site/current-model.mjs' + - 'docs/site/current.mjs' + - 'docs/site/dependency-model.mjs' + - 'tests/test_current_site_transition.mjs' + - 'tests/fixtures/current_site_transition_20261022/**' + - 'tests/fixtures/current_site_transition_candidate_20261022/production-source-freeze.json' + - '.github/workflows/current-site-transition-candidate.yml' +permissions: + contents: read +jobs: + frozen-reader-transition-candidate: + runs-on: ubuntu-24.04 + timeout-minutes: 5 + permissions: + contents: read + steps: + - name: Record native event context and tool versions before setup + run: | + python3 -B -S - <<'PYCONTEXT' + import json, os, re, resource, signal, subprocess, sys + from pathlib import Path + output = Path(os.environ['RUNNER_TEMP']) / 'current-site-transition-candidate' + output.mkdir(parents=True, exist_ok=True) + for name in ('tap.stdout.tap', 'tap.stderr.txt'): + (output / name).write_bytes(b'') + (output / 'node-exit-code.txt').write_text('NOT_RUN\n') + event_raw = Path(os.environ['GITHUB_EVENT_PATH']).read_bytes() + event = json.loads(event_raw) + pr = event.get('pull_request') or {} + def version(command): + target = output / 'version.tmp' + child = None + def limit(): + resource.setrlimit(resource.RLIMIT_FSIZE, (128, 128)) + try: + with target.open('wb') as stream: + child = subprocess.Popen(command, stdout=stream, stderr=subprocess.DEVNULL, + start_new_session=True, preexec_fn=limit) + code = child.wait(timeout=5) + value = target.read_bytes() + if code != 0 or len(value) >= 128: + return {'status': 'UNAVAILABLE'} + value = value.decode('ascii').strip() + if not re.fullmatch(r'(?:v|Python )[0-9]+\.[0-9]+\.[0-9]+(?:[-+][A-Za-z0-9.]+)?', value): + return {'status': 'UNAVAILABLE'} + return {'status': 'OK', 'value': value, 'returncode': code} + except (OSError, UnicodeError, subprocess.TimeoutExpired): + return {'status': 'UNAVAILABLE'} + finally: + if child is not None: + try: os.killpg(child.pid, signal.SIGKILL) + except ProcessLookupError: pass + try: child.wait(timeout=5) + except subprocess.TimeoutExpired: pass + target.unlink(missing_ok=True) + context = { + 'schema_version': 1, 'scientific_effect': 'NONE', + 'event_name': os.environ.get('GITHUB_EVENT_NAME'), + 'event_sha': os.environ.get('GITHUB_SHA'), + 'event_ref': os.environ.get('GITHUB_REF'), + 'repository': os.environ.get('GITHUB_REPOSITORY'), + 'run_id': os.environ.get('GITHUB_RUN_ID'), + 'run_attempt': os.environ.get('GITHUB_RUN_ATTEMPT'), + 'pull_request_number': pr.get('number', event.get('number')), + 'pull_request_head_sha': (pr.get('head') or {}).get('sha'), + 'pull_request_base_sha': (pr.get('base') or {}).get('sha'), + 'python_version': '.'.join(str(x) for x in sys.version_info[:3]), + 'node_version': version(['node', '--version']), + 'python_command_version': version(['python3', '--version']), + 'candidate_base_commit': 'd55208a07da1522489f982bbf5aec3a4246e73b9', + 'candidate_source_guard': 'not_started', 'node_phase': 'not_started', + } + context_raw = (json.dumps(context, indent=2) + '\n').encode() + if len(context_raw) > 65536: raise SystemExit('HOLD_CONTEXT_LIMIT') + (output / 'context.json').write_bytes(context_raw) + PYCONTEXT + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 + with: + ref: ${{ github.sha }} + persist-credentials: false + - name: Require exact frozen fixtures test and candidate production source + run: | + python3 -B -S - <<'PYGUARD' + import hashlib, json, os, re, subprocess + from pathlib import Path + output = Path(os.environ['RUNNER_TEMP']) / 'current-site-transition-candidate' + context_path = output / 'context.json' + context = json.loads(context_path.read_text()) + try: + checked_commit = subprocess.check_output(['git', 'rev-parse', 'HEAD'], text=True).strip() + context['checked_commit'] = checked_commit + if checked_commit != context['event_sha']: + raise SystemExit('Checkout differs from tested event SHA') + fixture_root = Path('tests/fixtures/current_site_transition_20261022') + fixture_raw = (fixture_root / 'fixture-freeze.json').read_bytes() + if hashlib.sha256(fixture_raw).hexdigest() != '734f8837db6ea3f9bfe9d0f0adceb875c5af20c56767d89e7aa91c47184726d3': + raise SystemExit('Fixture freeze changed') + for entry in json.loads(fixture_raw)['files']: + raw = (fixture_root / entry['path']).read_bytes() + if (len(raw), hashlib.sha256(raw).hexdigest()) != (entry['bytes'], entry['sha256']): + raise SystemExit('Fixture changed: ' + entry['path']) + test_raw = Path('tests/test_current_site_transition.mjs').read_bytes() + if hashlib.sha256(test_raw).hexdigest() != 'a6434c9fc0c06a37d09d430bb3d8c043107e8472fa1585c1ab8cdff336b3f66a': + raise SystemExit('Test source changed') + if (context['event_name'] != 'pull_request' + or not re.fullmatch(r'[0-9a-f]{40}', context['event_sha'] or '') + or not re.fullmatch(r'[0-9a-f]{40}', context['pull_request_head_sha'] or '') + or context['pull_request_base_sha'] != context['candidate_base_commit']): + raise SystemExit('Unexpected candidate event head or base context') + required_candidate_freeze_sha256 = 'b487c0c08ee92e2cd0684a84a75349bac3b69b897b9e5eda6aaa39011176c39e' + if not re.fullmatch(r'[0-9a-f]{64}', required_candidate_freeze_sha256): + raise SystemExit('Unbound candidate freeze; private template is not publishable') + candidate_freeze_path = Path('tests/fixtures/current_site_transition_candidate_20261022/production-source-freeze.json') + if not candidate_freeze_path.is_file() or candidate_freeze_path.is_symlink(): + raise SystemExit('Missing or unsafe candidate production freeze') + candidate_freeze_raw = candidate_freeze_path.read_bytes() + candidate_freeze_sha256 = hashlib.sha256(candidate_freeze_raw).hexdigest() + context['candidate_freeze_path'] = candidate_freeze_path.as_posix() + context['candidate_freeze_sha256'] = candidate_freeze_sha256 + context['candidate_freeze_expected_sha256'] = required_candidate_freeze_sha256 + if candidate_freeze_sha256 != required_candidate_freeze_sha256: + raise SystemExit('Candidate production freeze changed') + freeze = json.loads(candidate_freeze_raw) + if (set(freeze) != {'schema_version', 'candidate_base_commit', 'files'} + or type(freeze['schema_version']) is not int or freeze['schema_version'] != 1 + or freeze['candidate_base_commit'] != context['candidate_base_commit']): + raise SystemExit('Unexpected candidate freeze schema or base') + expected_paths = ['docs/site/current-model.mjs', 'docs/site/current.mjs', 'docs/site/dependency-model.mjs'] + if (not isinstance(freeze['files'], list) or len(freeze['files']) != 3 + or any(not isinstance(entry, dict) for entry in freeze['files']) + or [entry.get('path') for entry in freeze['files']] != expected_paths): + raise SystemExit('Candidate freeze must bind exactly the three ordered production paths') + for entry in freeze['files']: + if (set(entry) != {'path', 'bytes', 'sha256', 'git_blob'} + or type(entry['bytes']) is not int or entry['bytes'] < 0 + or not isinstance(entry['sha256'], str) + or not re.fullmatch(r'[0-9a-f]{64}', entry['sha256']) + or not isinstance(entry['git_blob'], str) + or not re.fullmatch(r'[0-9a-f]{40}', entry['git_blob'])): + raise SystemExit('Malformed candidate production entry') + path = Path(entry['path']) + if not path.is_file() or path.is_symlink(): + raise SystemExit('Missing or unsafe candidate production path: ' + entry['path']) + raw = path.read_bytes() + blob = hashlib.sha1(b'blob ' + str(len(raw)).encode() + b'\0' + raw).hexdigest() + if (len(raw), hashlib.sha256(raw).hexdigest(), blob) != (entry['bytes'], entry['sha256'], entry['git_blob']): + raise SystemExit('Candidate production source differs: ' + entry['path']) + context['candidate_source_guard'] = 'passed' + except BaseException as error: + context['candidate_source_guard'] = 'failed' + context['candidate_source_guard_error'] = type(error).__name__ + raise + finally: + context_raw = (json.dumps(context, indent=2) + '\n').encode() + if len(context_raw) > 65536: raise SystemExit('HOLD_CONTEXT_LIMIT') + context_path.write_bytes(context_raw) + PYGUARD + - name: Capture bounded real Node TAP with a child deadline + run: | + python3 -B -S - <<'PYNODE' + import json, os, resource, signal, subprocess, time + from pathlib import Path + output = Path(os.environ['RUNNER_TEMP']) / 'current-site-transition-candidate' + context_path = output / 'context.json' + context = json.loads(context_path.read_bytes()) + def save(): + raw = (json.dumps(context, indent=2) + '\n').encode() + if len(raw) > 65536: raise SystemExit('HOLD_CONTEXT_LIMIT') + context_path.write_bytes(raw) + cap = 1048576 + def physical_limit(): + resource.setrlimit(resource.RLIMIT_FSIZE, (cap, cap)) + command = ['node', '--test', '--test-reporter=tap', 'tests/test_current_site_transition.mjs'] + context.update(node_phase='starting', node_command=command, capture_status='NOT_RUN', + capture_file_limit=cap, child_timeout_seconds=90) + save() + child = None + status = 'REFUSED_SETUP' + began = time.monotonic() + paths = [output / 'tap.stdout.tap', output / 'tap.stderr.txt'] + try: + with paths[0].open('wb') as stdout, paths[1].open('wb') as stderr: + child = subprocess.Popen(command, stdout=stdout, stderr=stderr, + start_new_session=True, preexec_fn=physical_limit) + deadline = began + 90 + while True: + if any(path.stat().st_size >= cap for path in paths): + status = 'REFUSED_OUTPUT_LIMIT'; break + code = child.poll() + if code is not None: + status = 'REFUSED_OUTPUT_LIMIT' if code == -signal.SIGXFSZ else 'COMPLETED' + break + if time.monotonic() >= deadline: + status = 'TIMEOUT'; break + time.sleep(0.05) + except OSError as error: + context['node_start_error'] = type(error).__name__ + finally: + if child is not None: + # Also remove surviving descendants after a normal leader exit. + try: os.killpg(child.pid, signal.SIGKILL) + except ProcessLookupError: pass + try: + code = child.wait(timeout=5) + except subprocess.TimeoutExpired: + status = 'REFUSED_REAP' + code = child.poll() + if code is not None: + (output / 'node-exit-code.txt').write_text(str(code) + '\n') + context['node_returncode'] = code + else: + code = None + if any(path.stat().st_size >= cap for path in paths): status = 'REFUSED_OUTPUT_LIMIT' + context.update(node_phase='completed' if child is not None else 'not_started', + capture_status=status, elapsed_seconds=round(time.monotonic()-began, 3)) + save() + if status != 'COMPLETED': raise SystemExit(1) + raise SystemExit(code if code >= 0 else 128 - code) + PYNODE + - name: Admit bounded report members and emit byte-exact log frames + id: capture_admission + if: always() + run: | + python3 -B -S - <<'PYEMIT' + import base64, hashlib, json, os + from pathlib import Path + output = Path(os.environ['RUNNER_TEMP']) / 'current-site-transition-candidate' + limits = {'context.json': 65536, 'tap.stdout.tap': 1048576, + 'tap.stderr.txt': 1048576, 'node-exit-code.txt': 32} + def setting(name, value): + with open(os.environ['GITHUB_OUTPUT'], 'a') as stream: stream.write(name + '=' + value + '\n') + setting('bounded', 'false') + try: + if any(not (output/name).is_file() or (output/name).is_symlink() for name in limits): + raise ValueError('MISSING_OR_UNSAFE_MEMBER') + sizes = {name: (output/name).stat().st_size for name in limits} + if any(sizes[name] > limits[name] for name in limits) or sum(sizes.values()) > 2162720: + raise ValueError('REPORT_BYTE_LIMIT') + members = {name: (output/name).read_bytes() for name in limits} + if any(len(members[name]) != sizes[name] for name in limits): raise ValueError('MEMBER_CHANGED') + context = json.loads(members['context.json']) + complete = (context.get('candidate_source_guard') == 'passed' and context.get('node_phase') == 'completed' + and context.get('capture_status') == 'COMPLETED' + and context.get('node_version', {}).get('status') == 'OK' + and context.get('python_command_version', {}).get('status') == 'OK' + and context.get('event_name') == 'pull_request' + and context.get('pull_request_head_sha') and context.get('pull_request_base_sha')) + exit_text = members['node-exit-code.txt'].decode('ascii').strip() + complete = bool(complete and exit_text == str(context.get('node_returncode'))) + classification = 'CAPTURE_COMPLETE_REQUIRES_TAP_REVIEW' if complete else 'HOLD' + for name, raw in members.items(): + sha = hashlib.sha256(raw).hexdigest() + print(f'CS_TRANSITION_FILE_BEGIN name={name} bytes={len(raw)} sha256={sha}') + count = 0 + for offset in range(0, len(raw), 3072): + chunk = base64.b64encode(raw[offset:offset+3072]).decode('ascii') + print(f'CS_TRANSITION_FILE_CHUNK name={name} index={count} data={chunk}') + count += 1 + print(f'CS_TRANSITION_FILE_END name={name} chunks={count} sha256={sha}') + print(f'CS_TRANSITION_EVIDENCE_END files=4 bytes={sum(sizes.values())} classification={classification}') + setting('bounded', 'true') + if not complete: raise SystemExit(1) + except Exception as error: + print('CS_TRANSITION_EVIDENCE_HOLD reason=' + type(error).__name__) + raise SystemExit(1) + PYEMIT + - name: Preserve exact bounded context TAP stderr and exit code including failures + if: always() && steps.capture_admission.outputs.bounded == 'true' + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 + with: + name: current-site-transition-candidate-${{ github.run_id }}-${{ github.run_attempt }} + path: | + ${{ runner.temp }}/current-site-transition-candidate/context.json + ${{ runner.temp }}/current-site-transition-candidate/tap.stdout.tap + ${{ runner.temp }}/current-site-transition-candidate/tap.stderr.txt + ${{ runner.temp }}/current-site-transition-candidate/node-exit-code.txt + if-no-files-found: error + retention-days: 30 diff --git a/docs/site/current-model.mjs b/docs/site/current-model.mjs index 02264b21d..e34f3e334 100644 --- a/docs/site/current-model.mjs +++ b/docs/site/current-model.mjs @@ -42,18 +42,97 @@ export async function parseVerifiedSnapshot(raw,identity,cryptoAPI=globalThis.cr } export async function fetchVerifiedSnapshot(fetcher,identity,{signal,cryptoAPI=globalThis.crypto}={}) { if(!DIGEST.test(identity?.sha256)||!Number.isSafeInteger(Number(identity?.bytes))||Number(identity.bytes)<0)throw Error('Invalid current source identity.'); - const read=async url=>{ + // Abort also bounds response-body consumption. Cancellation is best-effort; + // waiting for a stalled stream's cancel promise would defeat that budget. + const abortable=(operation,cancel)=>new Promise((resolve,reject)=>{ + let settled=false; + const finish=(complete,value)=>{ + if(settled)return; + settled=true;signal?.removeEventListener('abort',abort);complete(value); + }; + const abort=()=>{ + const error=signal?.reason??Object.assign(Error('Current source request aborted.'),{name:'AbortError'}); + finish(reject,error); + try{Promise.resolve(cancel?.()).catch(()=>{});}catch{} + }; + if(signal?.aborted){abort();return;} + signal?.addEventListener('abort',abort,{once:true}); + try{Promise.resolve(operation()).then(value=>finish(resolve,value),error=>finish(reject,error));} + catch(error){finish(reject,error);} + }); + const request=async url=>{ const response=await fetcher(url,{cache:'no-store',credentials:'omit',signal}); if(!response.ok)throw Error('Current source snapshot unavailable.'); - return parseVerifiedSnapshot(await response.arrayBuffer(),identity,cryptoAPI); + return response; + }; + const readBytes=async (response,limit,oversized,streamOnly=false)=>{ + // Metadata requires a bounded streaming reader. Preserve arrayBuffer + // support for the existing payload transport when no stream is exposed. + if(!response.body?.getReader){ + if(streamOnly)throw Error('Current source metadata bounded reading unavailable.'); + return new Uint8Array(await abortable(()=>response.arrayBuffer(),()=>response.body?.cancel())); + } + const reader=response.body.getReader(),chunks=[]; + let size=0,cancelled=false; + const cancel=()=>{ + if(cancelled)return; + cancelled=true; + try{Promise.resolve(reader.cancel()).catch(()=>{});}catch{} + }; + try{ + for(;;){ + const {done,value}=await abortable(()=>reader.read(),cancel); + if(done)break; + if(!(value instanceof Uint8Array))throw Error('Invalid current source response bytes.'); + if(value.byteLength>limit-size)throw oversized(); + if(value.byteLength){chunks.push(value.slice());size+=value.byteLength;} + } + }catch(error){cancel();throw error;} + finally{try{reader.releaseLock();}catch{}} + const bytes=new Uint8Array(size); + let offset=0; + for(const chunk of chunks){bytes.set(chunk,offset);offset+=chunk.byteLength;} + return bytes; + }; + const read=async (url,descriptor=identity)=>{ + const response=await request(url); + const bytes=await readBytes(response,Number(descriptor.bytes),()=>new SnapshotIntegrityError('Current payload byte count mismatch.')); + return abortable(()=>parseVerifiedSnapshot(bytes,descriptor,cryptoAPI)); + }; + const readMetadata=async()=>{ + const bytes=await readBytes(await request('current-meta.json'),16384,()=>Error('Oversized current source metadata.'),true); + const text=new TextDecoder('utf-8',{fatal:true}).decode(bytes); + const metadata=JSON.parse(text); + if(!metadata||typeof metadata!=='object'||Array.isArray(metadata))throw Error('Invalid current source metadata.'); + const keys=Object.keys(metadata).sort().join(','); + if(keys!=='bytes,observed_at,sha256'&&keys!=='archive,bytes,history_manifest_sha256,observed_at,sha256')throw Error('Invalid current source metadata fields.'); + // JSON.parse keeps only the last duplicate member. Inspect complete JSON + // string tokens as well, so escaped spellings cannot conceal duplicates. + const seen=new Set(); + for(const token of text.matchAll(/"(?:\\.|[^"\\])*"/g)){ + if(!/^\s*:/.test(text.slice(token.index+token[0].length)))continue; + const key=JSON.parse(token[0]); + if(seen.has(key))throw Error('Duplicate current source metadata field.'); + seen.add(key); + } + const digest=value=>typeof value==='string'&&DIGEST.test(value); + const observed=metadata.observed_at; + if(!digest(metadata.sha256)||!Number.isSafeInteger(metadata.bytes)||metadata.bytes<0||metadata.bytes>16777216|| + typeof observed!=='string'||!/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ$/.test(observed)|| + !Number.isFinite(Date.parse(observed))||new Date(observed).toISOString()!==observed.slice(0,-1)+'.000Z'|| + (seen.has('archive')&&(!digest(metadata.archive)||!digest(metadata.history_manifest_sha256))))throw Error('Invalid current source metadata identity.'); + return metadata; }; try{return await read('current.json');} - catch(error){ - if(!(error instanceof SnapshotIntegrityError))throw error; - // A mutable alias can lag the page across publication. One digest-keyed - // request may recover it; only the advertised bytes can be admitted. - return read('current.json?observation='+identity.sha256); - } + catch(error){if(signal?.aborted||!(error instanceof SnapshotIntegrityError))throw error;} + // A mutable alias can lag the page across publication. Preserve the old + // digest-keyed retry before considering one coherent successor observation. + try{return await read('current.json?observation='+identity.sha256);} + catch(error){if(signal?.aborted||!(error instanceof SnapshotIntegrityError))throw error;} + const metadata=await readMetadata(); + const snapshot=await read('current.json?observation='+metadata.sha256,metadata); + if(snapshot.observed_at!==metadata.observed_at)throw Error('Current source observation time mismatch.'); + return snapshot; } export function freshness(observed,now=Date.now()) { const age=now-Date.parse(observed); diff --git a/tests/fixtures/current_site_transition_20261022/fixture-freeze.json b/tests/fixtures/current_site_transition_20261022/fixture-freeze.json new file mode 100644 index 000000000..c3f828987 --- /dev/null +++ b/tests/fixtures/current_site_transition_20261022/fixture-freeze.json @@ -0,0 +1,46 @@ +{ + "synthetic": true, + "scientific_effect": "NONE", + "files": [ + { + "path": "identities.json", + "bytes": 373, + "sha256": "529a03e76a134680e0efb639a370924dc8f702cebbaf67a5669e8515e4ae5d64" + }, + { + "path": "new-meta.json", + "bytes": 319, + "sha256": "7d9922dc2e14ac095ba863b5a2641a8a52739d3db98e427130c98a815095848c" + }, + { + "path": "new-observation.json", + "bytes": 1555, + "sha256": "3999e53aaa093b5c484d75f17aa6f07c204802d4cc3ffaf7afff2aaa9dda7544" + }, + { + "path": "new-same-length-corrupt.json", + "bytes": 1555, + "sha256": "aa713f87ab7fc238ac23e60b556ec3820b1313b77e055e436005efee084d829f" + }, + { + "path": "old-meta.json", + "bytes": 319, + "sha256": "bf194d013761c919b211395a6fa7df6eee9f0e6a3f81086f0e783c11621142d8" + }, + { + "path": "old-observation.json", + "bytes": 1322, + "sha256": "275e20b313114ef28732e57cd1311cbc7bbbccb4a8756ba2d5b7a3cb4f6821c4" + }, + { + "path": "old-same-length-corrupt.json", + "bytes": 1322, + "sha256": "12f04a1c852805fffac000899ec39c11147c726b96f5209bfb6dbaa8a74b0d63" + }, + { + "path": "production-source-freeze.json", + "bytes": 754, + "sha256": "0e036ad58f7898954a362e6737fb9d0a98fb0f725ff4b4efed66e98b0a1b6196" + } + ] +} diff --git a/tests/fixtures/current_site_transition_20261022/identities.json b/tests/fixtures/current_site_transition_20261022/identities.json new file mode 100644 index 000000000..95bb47f5f --- /dev/null +++ b/tests/fixtures/current_site_transition_20261022/identities.json @@ -0,0 +1,14 @@ +{ + "synthetic": true, + "scientific_effect": "NONE", + "old": { + "sha256": "275e20b313114ef28732e57cd1311cbc7bbbccb4a8756ba2d5b7a3cb4f6821c4", + "bytes": 1322, + "observed_at": "2026-10-22T21:10:00Z" + }, + "new": { + "sha256": "3999e53aaa093b5c484d75f17aa6f07c204802d4cc3ffaf7afff2aaa9dda7544", + "bytes": 1555, + "observed_at": "2026-10-22T21:29:17Z" + } +} diff --git a/tests/fixtures/current_site_transition_20261022/new-meta.json b/tests/fixtures/current_site_transition_20261022/new-meta.json new file mode 100644 index 000000000..7795954e1 --- /dev/null +++ b/tests/fixtures/current_site_transition_20261022/new-meta.json @@ -0,0 +1,7 @@ +{ + "archive": "4444444444444444444444444444444444444444444444444444444444444444", + "bytes": 1555, + "history_manifest_sha256": "6666666666666666666666666666666666666666666666666666666666666666", + "observed_at": "2026-10-22T21:29:17Z", + "sha256": "3999e53aaa093b5c484d75f17aa6f07c204802d4cc3ffaf7afff2aaa9dda7544" +} diff --git a/tests/fixtures/current_site_transition_20261022/new-observation.json b/tests/fixtures/current_site_transition_20261022/new-observation.json new file mode 100644 index 000000000..5819552fb --- /dev/null +++ b/tests/fixtures/current_site_transition_20261022/new-observation.json @@ -0,0 +1,55 @@ +{ + "equations": [], + "graph": { + "data": { + "edges": [], + "nodes": { + "fixture.node": { + "classification": "OPEN_ACTIVE", + "kind": "inventory", + "source": "fixture/GRAPH.json" + } + } + }, + "identity": { + "blob": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "bytes": 10, + "commit": "dddddddddddddddddddddddddddddddddddddddd", + "path": "fixture/GRAPH.json", + "repository": "d6g8k5htny-coder/Math-", + "sha256": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + } + }, + "observed_at": "2026-10-22T21:29:17Z", + "references": [], + "repositories": [ + { + "commit": "cccccccccccccccccccccccccccccccccccccccc", + "repository": "d6g8k5htny-coder/main", + "tree": "2222222222222222222222222222222222222222" + }, + { + "commit": "dddddddddddddddddddddddddddddddddddddddd", + "repository": "d6g8k5htny-coder/Math-", + "tree": "3333333333333333333333333333333333333333" + } + ], + "schema_version": 1, + "scientific_effect": "NONE", + "sources": [ + { + "blob": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "bytes": 10, + "commit": "dddddddddddddddddddddddddddddddddddddddd", + "path": "fixture/GRAPH.json", + "repository": "d6g8k5htny-coder/Math-" + }, + { + "blob": "1111111111111111111111111111111111111111", + "bytes": 12, + "commit": "cccccccccccccccccccccccccccccccccccccccc", + "path": "fixture/NEW_SOURCE.md", + "repository": "d6g8k5htny-coder/main" + } + ] +} diff --git a/tests/fixtures/current_site_transition_20261022/new-same-length-corrupt.json b/tests/fixtures/current_site_transition_20261022/new-same-length-corrupt.json new file mode 100644 index 000000000..563ed81c0 --- /dev/null +++ b/tests/fixtures/current_site_transition_20261022/new-same-length-corrupt.json @@ -0,0 +1,55 @@ +{ + "equations": [], + "graph": { + "data": { + "edges": [], + "nodes": { + "fixture.node": { + "classification": "OPEN_ACTIVE", + "kind": "inventory", + "source": "fixture/GRAPH.json" + } + } + }, + "identity": { + "blob": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "bytes": 10, + "commit": "dddddddddddddddddddddddddddddddddddddddd", + "path": "fixture/GRAPH.json", + "repository": "d6g8k5htny-coder/Math-", + "sha256": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + } + }, + "observed_at": "2026-10-22T21:29:18Z", + "references": [], + "repositories": [ + { + "commit": "cccccccccccccccccccccccccccccccccccccccc", + "repository": "d6g8k5htny-coder/main", + "tree": "2222222222222222222222222222222222222222" + }, + { + "commit": "dddddddddddddddddddddddddddddddddddddddd", + "repository": "d6g8k5htny-coder/Math-", + "tree": "3333333333333333333333333333333333333333" + } + ], + "schema_version": 1, + "scientific_effect": "NONE", + "sources": [ + { + "blob": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "bytes": 10, + "commit": "dddddddddddddddddddddddddddddddddddddddd", + "path": "fixture/GRAPH.json", + "repository": "d6g8k5htny-coder/Math-" + }, + { + "blob": "1111111111111111111111111111111111111111", + "bytes": 12, + "commit": "cccccccccccccccccccccccccccccccccccccccc", + "path": "fixture/NEW_SOURCE.md", + "repository": "d6g8k5htny-coder/main" + } + ] +} diff --git a/tests/fixtures/current_site_transition_20261022/old-meta.json b/tests/fixtures/current_site_transition_20261022/old-meta.json new file mode 100644 index 000000000..fa200a701 --- /dev/null +++ b/tests/fixtures/current_site_transition_20261022/old-meta.json @@ -0,0 +1,7 @@ +{ + "archive": "5555555555555555555555555555555555555555555555555555555555555555", + "bytes": 1322, + "history_manifest_sha256": "7777777777777777777777777777777777777777777777777777777777777777", + "observed_at": "2026-10-22T21:10:00Z", + "sha256": "275e20b313114ef28732e57cd1311cbc7bbbccb4a8756ba2d5b7a3cb4f6821c4" +} diff --git a/tests/fixtures/current_site_transition_20261022/old-observation.json b/tests/fixtures/current_site_transition_20261022/old-observation.json new file mode 100644 index 000000000..d3641278f --- /dev/null +++ b/tests/fixtures/current_site_transition_20261022/old-observation.json @@ -0,0 +1,48 @@ +{ + "equations": [], + "graph": { + "data": { + "edges": [], + "nodes": { + "fixture.node": { + "classification": "OPEN_ACTIVE", + "kind": "inventory", + "source": "fixture/GRAPH.json" + } + } + }, + "identity": { + "blob": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "bytes": 10, + "commit": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "path": "fixture/GRAPH.json", + "repository": "d6g8k5htny-coder/Math-", + "sha256": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + } + }, + "observed_at": "2026-10-22T21:10:00Z", + "references": [], + "repositories": [ + { + "commit": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "repository": "d6g8k5htny-coder/main", + "tree": "2222222222222222222222222222222222222222" + }, + { + "commit": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "repository": "d6g8k5htny-coder/Math-", + "tree": "3333333333333333333333333333333333333333" + } + ], + "schema_version": 1, + "scientific_effect": "NONE", + "sources": [ + { + "blob": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "bytes": 10, + "commit": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "path": "fixture/GRAPH.json", + "repository": "d6g8k5htny-coder/Math-" + } + ] +} diff --git a/tests/fixtures/current_site_transition_20261022/old-same-length-corrupt.json b/tests/fixtures/current_site_transition_20261022/old-same-length-corrupt.json new file mode 100644 index 000000000..4ea8bceb3 --- /dev/null +++ b/tests/fixtures/current_site_transition_20261022/old-same-length-corrupt.json @@ -0,0 +1,48 @@ +{ + "equations": [], + "graph": { + "data": { + "edges": [], + "nodes": { + "fixture.node": { + "classification": "OPEN_ACTIVE", + "kind": "inventory", + "source": "fixture/GRAPH.json" + } + } + }, + "identity": { + "blob": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "bytes": 10, + "commit": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "path": "fixture/GRAPH.json", + "repository": "d6g8k5htny-coder/Math-", + "sha256": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + } + }, + "observed_at": "2026-10-22T21:10:01Z", + "references": [], + "repositories": [ + { + "commit": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "repository": "d6g8k5htny-coder/main", + "tree": "2222222222222222222222222222222222222222" + }, + { + "commit": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "repository": "d6g8k5htny-coder/Math-", + "tree": "3333333333333333333333333333333333333333" + } + ], + "schema_version": 1, + "scientific_effect": "NONE", + "sources": [ + { + "blob": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "bytes": 10, + "commit": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "path": "fixture/GRAPH.json", + "repository": "d6g8k5htny-coder/Math-" + } + ] +} diff --git a/tests/fixtures/current_site_transition_20261022/production-source-freeze.json b/tests/fixtures/current_site_transition_20261022/production-source-freeze.json new file mode 100644 index 000000000..cd522dac0 --- /dev/null +++ b/tests/fixtures/current_site_transition_20261022/production-source-freeze.json @@ -0,0 +1,23 @@ +{ + "source_commit": "f946932c1ee19859d8778b0a7af359211e472d73", + "files": [ + { + "path": "docs/site/current-model.mjs", + "bytes": 24442, + "sha256": "b5acd87a0afafc14e087235df5fbf390f393c6883aee11cb91578da01a72d804", + "git_blob": "02264b21daae647e7f6a0a45246ef4bd2c3d69aa" + }, + { + "path": "docs/site/dependency-model.mjs", + "bytes": 16667, + "sha256": "d64be3db1178207db5fc457d32ecfd4a0e079d6e0e6d87927a57d59b48c8a17c", + "git_blob": "cb5db5ab0a7c056674efd7244a900702a5444644" + }, + { + "path": "docs/site/current.mjs", + "bytes": 4816, + "sha256": "3ac6bf1b54b62bf786af637b807738854f46f74b75fbd6e5c328d6a873bf8b6e", + "git_blob": "936eefb4cd8bb25cba84dd74c28f257210bc0046" + } + ] +} diff --git a/tests/fixtures/current_site_transition_candidate_20261022/production-source-freeze.json b/tests/fixtures/current_site_transition_candidate_20261022/production-source-freeze.json new file mode 100644 index 000000000..9627f3193 --- /dev/null +++ b/tests/fixtures/current_site_transition_candidate_20261022/production-source-freeze.json @@ -0,0 +1,24 @@ +{ + "schema_version": 1, + "candidate_base_commit": "d55208a07da1522489f982bbf5aec3a4246e73b9", + "files": [ + { + "path": "docs/site/current-model.mjs", + "bytes": 28897, + "sha256": "42e172dcb0956051a769f0b2742658294cbe63fb7b472996f26afa338a407276", + "git_blob": "e34f3e334cac898a82064ec9a208358dc40079a7" + }, + { + "path": "docs/site/current.mjs", + "bytes": 4816, + "sha256": "3ac6bf1b54b62bf786af637b807738854f46f74b75fbd6e5c328d6a873bf8b6e", + "git_blob": "936eefb4cd8bb25cba84dd74c28f257210bc0046" + }, + { + "path": "docs/site/dependency-model.mjs", + "bytes": 16667, + "sha256": "d64be3db1178207db5fc457d32ecfd4a0e079d6e0e6d87927a57d59b48c8a17c", + "git_blob": "cb5db5ab0a7c056674efd7244a900702a5444644" + } + ] +} diff --git a/tests/test_current_site_transition.mjs b/tests/test_current_site_transition.mjs new file mode 100644 index 000000000..4ed0c62fe --- /dev/null +++ b/tests/test_current_site_transition.mjs @@ -0,0 +1,172 @@ +// Private test-first source proposal. Never run locally in the authoring unit. +// Production break caught: a publication advances current.json while an open +// document still advertises the previous digest; the reader must recover one +// coherent verified successor pair, with no admission under the old digest. +import test from 'node:test'; +import assert from 'node:assert/strict'; +import {webcrypto, createHash} from 'node:crypto'; +import {readFile} from 'node:fs/promises'; +import {fetchVerifiedSnapshot, parseVerifiedSnapshot} from '../docs/site/current-model.mjs'; + +const fixtureURL = name => new URL(`./fixtures/current_site_transition_20261022/${name}`, import.meta.url); +const raw = async name => new Uint8Array(await readFile(fixtureURL(name))); +const [oldRaw,newRaw,oldCorrupt,newCorrupt,identityRaw,oldMetaRaw,newMetaRaw] = await Promise.all([ + raw('old-observation.json'),raw('new-observation.json'),raw('old-same-length-corrupt.json'), + raw('new-same-length-corrupt.json'),raw('identities.json'),raw('old-meta.json'),raw('new-meta.json'), +]); +const decode = bytes => JSON.parse(new TextDecoder().decode(bytes)); +const identities=decode(identityRaw), oldIdentity=identities.old, newIdentity=identities.new; +const oldData=decode(oldRaw),newData=decode(newRaw),oldMeta=decode(oldMetaRaw),newMeta=decode(newMetaRaw); +const oldKey=`current.json?observation=${oldIdentity.sha256}`; +const newKey=`current.json?observation=${newIdentity.sha256}`; +const asBytes=value=>new TextEncoder().encode(JSON.stringify(value)); +const sha=bytes=>createHash('sha256').update(bytes).digest('hex'); +const reply=(url,body,status=200)=>({url,body,status}); +const transition=(metadata=newMetaRaw,body=newRaw)=>[ + reply('current.json',newRaw),reply(oldKey,newRaw),reply('current-meta.json',metadata),reply(newKey,body), +]; + +// Replace only the external transport. Production hashing, UTF-8 decoding, +// JSON parsing, snapshot validation, recovery decisions and abort propagation +// remain real. Native Response supplies the complete fetch response interface. +function transport(steps,{controller}={}) { + const calls=[]; + const fetcher=async(url,options={})=>{ + calls.push({url:String(url),options}); + if(options.signal?.aborted){const e=new Error('Fixture request aborted');e.name='AbortError';throw e;} + const step=steps[calls.length-1]; + if(!step||String(url)!==step.url)throw new Error(`Transport fixture rejected unexpected request ${String(url)}`); + if(step.waitForAbort)return new Promise((resolve,reject)=>{ + const abort=()=>{const e=new Error('Fixture request timed out');e.name='AbortError';reject(e);}; + options.signal.addEventListener('abort',abort,{once:true}); + // The timeout occurs only after this request starts; no race with crypto. + setTimeout(()=>controller.abort(),0); + }); + return new Response(step.body,{status:step.status??200,headers:{'Content-Type':'application/json'}}); + }; + return {fetcher,calls}; +} +async function outcome(fetcher,identity,signal) { + try{return {value:await fetchVerifiedSnapshot(fetcher,identity,{cryptoAPI:webcrypto,signal}),error:null};} + catch(error){return {value:null,error};} +} +function requests(calls,paths,signal) { + assert.deepEqual(calls.map(call=>call.url),paths,'The bounded recovery must use the specified same-origin requests exactly once.'); + for(const {options}of calls){ + assert.equal(options.cache,'no-store');assert.equal(options.credentials,'omit'); + assert.equal(options.method??'GET','GET');assert.equal(options.signal,signal,'One caller abort budget spans all requests.'); + } +} +function success(result,expected) { + assert.equal(result.error,null,`Expected a verified coherent observation, received ${result.error?.name}: ${result.error?.message}`); + assert.deepEqual(result.value,expected); +} +function refusal(result) {assert.equal(result.value,null);assert.ok(result.error instanceof Error,'Unverified or incoherent bytes must refuse.');} + +test('fixture positives are valid independently frozen old and new observations',async()=>{ + for(const [body,id,expected]of [[oldRaw,oldIdentity,oldData],[newRaw,newIdentity,newData]]){ + assert.equal(body.byteLength,id.bytes);assert.equal(sha(body),id.sha256); + assert.deepEqual(await parseVerifiedSnapshot(body,id,webcrypto),expected); + } + assert.notEqual(oldRaw.byteLength,newRaw.byteLength); + assert.equal(oldRaw.byteLength,oldCorrupt.byteLength);assert.notEqual(sha(oldRaw),sha(oldCorrupt)); +}); +for(const [name,body,id,expected]of [['old',oldRaw,oldIdentity,oldData],['new',newRaw,newIdentity,newData]]){ + test(`matching ${name} document and ${name} payload need exactly one verified request`,async()=>{ + const controller=new AbortController(),t=transport([reply('current.json',body)]); + success(await outcome(t.fetcher,id,controller.signal),expected);requests(t.calls,['current.json'],controller.signal); + }); +} +test('the existing digest-keyed retry still recovers an alias lagging a new document',async()=>{ + const controller=new AbortController(),t=transport([reply('current.json',oldRaw),reply(newKey,newRaw)]); + success(await outcome(t.fetcher,newIdentity,controller.signal),newData); + requests(t.calls,['current.json',newKey],controller.signal); +}); +test('old document plus newer payload automatically reacquires one verified successor pair',async()=>{ + const controller=new AbortController(),t=transport(transition()); + const result=await outcome(t.fetcher,oldIdentity,controller.signal); + // On unchanged f946 this is an AssertionError after the real count refusal, + // rather than an uncaught import/setup exception or a missing proposed API. + success(result,newData); + requests(t.calls,['current.json',oldKey,'current-meta.json',newKey],controller.signal); +}); +test('same-length digest mismatch also recovers without admitting corrupt old bytes',async()=>{ + const controller=new AbortController(),t=transport([ + reply('current.json',oldCorrupt),reply(oldKey,oldCorrupt),reply('current-meta.json',newMetaRaw),reply(newKey,newRaw), + ]); + success(await outcome(t.fetcher,oldIdentity,controller.signal),newData); + requests(t.calls,['current.json',oldKey,'current-meta.json',newKey],controller.signal); +}); +test('published legacy three-field metadata can bind a successor without an archive assumption',async()=>{ + const controller=new AbortController(),t=transport(transition(asBytes(newIdentity))); + success(await outcome(t.fetcher,oldIdentity,controller.signal),newData); + requests(t.calls,['current.json',oldKey,'current-meta.json',newKey],controller.signal); +}); + +const invalidMetadata=[ + ['malformed JSON',new TextEncoder().encode('{broken')], + ['missing digest',asBytes({bytes:newIdentity.bytes,observed_at:newIdentity.observed_at})], + ['unknown field',asBytes({...newMeta,private_url:'must not be accepted'})], + ['transient four-field schema',asBytes({...newIdentity,archive:'4'.repeat(64)})], + ['nonhex digest',asBytes({...newMeta,sha256:'not-a-digest'})], + ['string byte count',asBytes({...newMeta,bytes:String(newIdentity.bytes)})], + ['negative byte count',asBytes({...newMeta,bytes:-1})], + ['fractional byte count',asBytes({...newMeta,bytes:1.5})], + ['payload above existing 16 MiB bound',asBytes({...newMeta,bytes:16777217})], + ['invalid calendar timestamp',asBytes({...newMeta,observed_at:'2026-02-30T21:29:17Z'})], + ['invalid archive identity',asBytes({...newMeta,archive:'wrong'})], + ['invalid history identity',asBytes({...newMeta,history_manifest_sha256:'wrong'})], + ['metadata above 16 KiB',new TextEncoder().encode(JSON.stringify(newMeta).padEnd(16385,' '))], +]; +for(const [name,metadata]of invalidMetadata){ + test(`successor metadata refuses ${name} before requesting successor body`,async()=>{ + const controller=new AbortController(),t=transport(transition(metadata)); + refusal(await outcome(t.fetcher,oldIdentity,controller.signal)); + requests(t.calls,['current.json',oldKey,'current-meta.json'],controller.signal); + }); +} +test('metadata HTTP failure refuses without another body request or recovery cycle',async()=>{ + const controller=new AbortController(),steps=transition();steps[2]=reply('current-meta.json',newMetaRaw,503); + const t=transport(steps);refusal(await outcome(t.fetcher,oldIdentity,controller.signal)); + requests(t.calls,['current.json',oldKey,'current-meta.json'],controller.signal); +}); +test('verified successor body must have the metadata observation time',async()=>{ + const controller=new AbortController(),t=transport(transition(asBytes({...newMeta,observed_at:oldIdentity.observed_at}))); + refusal(await outcome(t.fetcher,oldIdentity,controller.signal)); + requests(t.calls,['current.json',oldKey,'current-meta.json',newKey],controller.signal); +}); +for(const [name,body]of [['byte count',oldRaw],['digest',newCorrupt]]){ + test(`successor ${name} mismatch refuses after four requests with no loop`,async()=>{ + const controller=new AbortController(),t=transport(transition(newMetaRaw,body)); + refusal(await outcome(t.fetcher,oldIdentity,controller.signal)); + requests(t.calls,['current.json',oldKey,'current-meta.json',newKey],controller.signal); + }); +} +for(const [name,index,paths]of [ + ['metadata',2,['current.json',oldKey,'current-meta.json']], + ['successor body',3,['current.json',oldKey,'current-meta.json',newKey]], +]){ + test(`one abort budget cancels a stalled ${name} request without another attempt`,{timeout:2000},async()=>{ + const controller=new AbortController(),steps=transition();steps[index]={url:paths.at(-1),waitForAbort:true}; + const t=transport(steps,{controller}),result=await outcome(t.fetcher,oldIdentity,controller.signal); + refusal(result);assert.equal(result.error.name,'AbortError');requests(t.calls,paths,controller.signal); + }); +} +test('an already aborted caller is refused without metadata recovery',async()=>{ + const controller=new AbortController();controller.abort();const t=transport([reply('current.json',oldRaw)]); + const result=await outcome(t.fetcher,oldIdentity,controller.signal);refusal(result);assert.equal(result.error.name,'AbortError'); + requests(t.calls,['current.json'],controller.signal); +}); +test('ordinary payload HTTP failure is not treated as a publication identity transition',async()=>{ + const controller=new AbortController(),t=transport([reply('current.json',oldRaw,503)]); + refusal(await outcome(t.fetcher,oldIdentity,controller.signal));requests(t.calls,['current.json'],controller.signal); +}); +test('invalid HTML descriptor is refused before any request',async()=>{ + const controller=new AbortController(),t=transport([]); + refusal(await outcome(t.fetcher,{sha256:'bad',bytes:oldIdentity.bytes},controller.signal));requests(t.calls,[],controller.signal); +}); +test('hash-matching invalid snapshot JSON never earns successor recovery',async()=>{ + const body=new TextEncoder().encode('{broken'),id={sha256:sha(body),bytes:body.byteLength}; + const controller=new AbortController(),t=transport([reply('current.json',body)]); + refusal(await outcome(t.fetcher,id,controller.signal));requests(t.calls,['current.json'],controller.signal); +});