From a796e43bd0fe2e028208602e6241f38b6b744d8c Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Mon, 16 Nov 2026 23:25:18 +0000 Subject: [PATCH 1/7] chore(ci): retire the frozen native diagram qualification pin (#4105) The pin let a ready PR retain browser proof from an earlier run, but the hybrid ruling moved browser proof to the squash's main run, where it is always fresh. All three pinned source files had also drifted, so the binding could no longer qualify. Its only effect left was to fail unit on every dependency change until a manual Docker requalification moved it; three requalifications produced byte-identical output. Remove the binding and its self-test, and stop the browser input closure, worker audit and inclusion inputs from carrying its identity. The container boundary and the producer's run-time checks are unchanged. A guard test keeps the retired identities from being pinned again. ci-proof.ts and visual.mjs still read the now-absent field; they are audited sources, so that dead branch goes at their next re-audit. The maintainer ruling of 2026-11-16 is recorded in ci-utility.md, superseding the 2026-11-02 and 2026-11-11 requalification rulings. Co-Authored-By: Claude Opus 5.5 --- CONTRIBUTING.md | 32 +++---- docs/decisions/ci-utility.md | 32 +++++-- docs/process/diagnostic-installs.md | 3 +- scripts/browser-input-closure.ts | 14 +-- scripts/browser-worker-audit.ts | 5 +- scripts/inclusion-inputs.ts | 4 +- scripts/native-diagram-inputs.ts | 92 ------------------- scripts/proof-inputs.ts | 6 ++ scripts/test-shard-costs.json | 1 - tests/browser-worker-audit.test.ts | 8 +- tests/native-diagram-inputs.test.ts | 127 --------------------------- tests/native-diagram-retired.test.ts | 30 +++++++ 12 files changed, 87 insertions(+), 267 deletions(-) delete mode 100644 scripts/native-diagram-inputs.ts delete mode 100644 tests/native-diagram-inputs.test.ts create mode 100644 tests/native-diagram-retired.test.ts diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ca628ae45f..a834207ca3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -84,30 +84,26 @@ Before instrumenting installed dependencies, follow [dependency diagnostic preparation](docs/process/diagnostic-installs.md): worktrees alone do not isolate Bun cache hardlinks. -The frozen native diagram control also requires the independently qualified -installation bytes and modes. An `installation-mismatch` with matching frozen -source is an install problem: keep its source revision, 859-file inventory and -qualification fingerprints unchanged. A frozen lockfile does not repair a -modified shared package cache, and copying that cache copies the modifications -([#1980](https://github.com/schlessera/brain-kit/issues/1980)). Recover only the -owned checkout through a fresh private cache and independent file copies, -**under umask `022`**. The installation identity includes file modes, and the -installer's umask narrows them. The qualified install was made under `022`, so -an install under any other umask, such as `0077`, never matches, even though its -package, file and byte counts are identical. The preparation script sets its own umask so -your own umask is unchanged: +The native diagram producer has no frozen qualification pin +([#4105](https://github.com/schlessera/brain-kit/issues/4105)): adding, +removing or upgrading a dependency needs no requalification, and its proof +runs fresh in the producer's Docker boundary. A frozen lockfile still does not +repair a modified shared package cache, and copying that cache copies the +modifications ([#1980](https://github.com/schlessera/brain-kit/issues/1980)). +When a check fails on installed bytes, recover only the owned checkout through +a fresh private cache and independent file copies, under umask `022`; the +preparation script sets its own umask so yours is unchanged: ```sh # Preserve evidence and move aside this owned checkout's node_modules first. sh scripts/prepare-diagnostic-install.sh -bun run test ./tests/native-diagram-inputs.test.ts ``` -Retain the failed and restored installation identities. Verify any suspected -package edits against the lockfile's archive integrity; never normalize unknown -bytes or modes to force qualification. Leave shared caches and other checkouts -alone. Use the same preparation before future dependency instrumentation; retain the -original failure evidence as described in the diagnostic guide. +Verify any suspected package edits against the lockfile's archive integrity; +never normalize unknown bytes or modes to force a pass. Leave shared caches and +other checkouts alone. Use the same preparation before future dependency +instrumentation; retain the original failure evidence as described in the +diagnostic guide. The Linux backend nonpersistence tests require `bubblewrap` and permitted user namespaces. They launch the installed Claude and pi adapters with a loopback diff --git a/docs/decisions/ci-utility.md b/docs/decisions/ci-utility.md index 530166972e..6f82a27907 100644 --- a/docs/decisions/ci-utility.md +++ b/docs/decisions/ci-utility.md @@ -1084,13 +1084,31 @@ retains the original SVG/reference zero-request replay and raster/font/PDF assertions. Different launches never share a prepared output root. The browser-side pinned font cache remains a separately owned browser input. -Qualification is tied to the exact operation, source and installed identities; -unknown readers, drift or missing inputs retain complete fresh proof. The fresh -shard independently passes its computed identity to host preparation and checks -installation/runtime identity again before emitting its existing receipt. Both -shards, independent immutable source/current validation and whole-workflow -successful eligibility retain the existing complete-domain protocol. Local proof -is not a hosted baseline, retention hit or permission to use a failed workflow. +**The frozen qualification is retired (maintainer, 2026-11-16, +[#4105](https://github.com/schlessera/brain-kit/issues/4105)).** #2293 pinned the +producer's source (`e8502b6f…`, the frozen #2293 snapshot), its installation +(a hash over every package, file, byte and mode in `node_modules`) and three +source files. That let a ready PR retain browser proof from an earlier green +run. The pin no longer protected anything live: + +- Under the [hybrid ruling](#hybrid-post-merge-heavy-proof), ready confirmation + no longer runs browser proof, and the squash's main run is always fresh. +- All three pinned source files had drifted, so the binding could not qualify + on the current tree in any case. +- Any dependency change moved the installation hash and turned `unit` red. That + needed a manual requalification run on a Docker host and a second merge + cycle. It happened three times (#3320, #3968, #4102), and the frozen + producer's SVG and PNG came out byte-identical every time. + +The binding (`scripts/native-diagram-inputs.ts`) and its self-test are +removed, and the browser input closure no longer binds the producer's reads. +The browser domain therefore always runs fresh. This supersedes the +requalification rulings of 2026-11-02 (#2509/#3320) and 2026-11-11 (#3968). +The container boundary above, the producer's own run-time identity checks and +the browser's validation of the handoff are unchanged. If browser retention +returns to ready confirmation, its qualification is designed afresh then. +Local proof is not a hosted baseline, retention hit or permission to use a +failed workflow. Two audited fixture readers consume the literal installed `axe-core/axe.min.js` asset. Its explicit resource identity records package name/version, relative diff --git a/docs/process/diagnostic-installs.md b/docs/process/diagnostic-installs.md index af12fbe708..c6a72d652c 100644 --- a/docs/process/diagnostic-installs.md +++ b/docs/process/diagnostic-installs.md @@ -35,8 +35,7 @@ copy alone proves neither provenance nor pristine package bytes. Keep the original and recovered observations separate. Do not change package versions, locks, assertions, qualification pins or file modes to force a pass. Rebuild as required and rerun the original focused check through its offline -wrapper. For the frozen native diagram fixture, retain the failed/restored -installation identities and run `bun run test ./tests/native-diagram-inputs.test.ts`. +wrapper. Once evidence is retained and no process uses it, remove only the owned old installation. Never delete or repair shared caches while others may use them. Repeat preparation before a new independent diagnostic; an installation you diff --git a/scripts/browser-input-closure.ts b/scripts/browser-input-closure.ts index 7c0a9485e6..1248e9a817 100644 --- a/scripts/browser-input-closure.ts +++ b/scripts/browser-input-closure.ts @@ -5,7 +5,6 @@ import { builtinModules } from "node:module"; import { dirname, isAbsolute, join, relative, resolve } from "node:path"; import ts from "typescript"; import { auditCommandActivation, type CommandCandidate } from "./browser-command-activation"; -import { nativeDiagramInputs, type NativeDiagramIdentity, type NativeDiagramDiagnostic } from "./native-diagram-inputs"; import { generatedThemeInputs } from "./generated-theme-inputs"; import { sourceBrowserDispatch } from "./source-browser-dispatch"; import { boundBrowserDocuments, type BrowserDocumentInputs } from "./bound-browser-documents"; @@ -27,7 +26,7 @@ export interface IndirectInput { observation?: "linux-proc-self-identity"; } export interface InputDeclaration { owner: string; inputs: IndirectInput[]; } -export interface InputClosure { files: string[]; directories?: string[]; external?: LockedBrowserAsset[]; nativeDiagram?:NativeDiagramIdentity; nativeDiagramDiagnostic?:NativeDiagramDiagnostic; unresolved: string[]; } +export interface InputClosure { files: string[]; directories?: string[]; external?: LockedBrowserAsset[]; unresolved: string[]; } const builtins = new Set(builtinModules.flatMap(name => [name, `node:${name}`])); const sourceExtension = /\.[cm]?[jt]sx?$/; const readOperations = new Set(["readFile", "readFileSync", "readdir", "readdirSync", "readlink", "readlinkSync", "createReadStream", "open", "openSync", "opendir", "opendirSync", "access", "accessSync", "existsSync", "stat", "statSync", "lstat", "lstatSync", "watch", "watchFile", "spawn", "spawnSync", "exec", "execSync", "execFile", "execFileSync", "fork"]); @@ -47,8 +46,6 @@ export function discoverInputClosure(root: string, entrypoints: readonly string[ let runtimeBindings: BrowserRuntimeBindings = new Map(); let dispatchBindings = new Map>(); let documentBindings = new Map>(); - let nativeBinding:ReturnType; - let nativeDiagramDiagnostic:NativeDiagramDiagnostic|undefined; let themeBinding: ReturnType; if (activation) { const audit = auditCommandActivation(root, activation.config, activation.selected, activation.candidates); @@ -60,7 +57,6 @@ export function discoverInputClosure(root: string, entrypoints: readonly string[ dispatchBindings = sourceBrowserDispatch(root, audit.files, importers); documentBindings = boundBrowserDocuments(root, audit.files, importers); themeBinding = generatedThemeInputs(root, audit.files, importers); - nativeBinding = nativeDiagramInputs(root, audit.files, importers,value=>{nativeDiagramDiagnostic=value;}); } if (!audit.unresolved.length) for (const candidate of audit.candidates) { const names = inactive.get(candidate.owner) ?? new Set(); @@ -98,7 +94,7 @@ export function discoverInputClosure(root: string, entrypoints: readonly string[ for (const entry of readdirSync(absolute).sort()) visit(normalized ? `${normalized}/${entry}` : entry, scanOnly, sourceOnly); return; } - if (scanOnly) return; // Byte inventories: Tailwind text or exact mount-bound native inputs. + if (scanOnly) return; // Byte inventories: Tailwind text or exact mount-bound inputs. if (file.endsWith(".css")) { const css = cssInputs(readFileSync(absolute, "utf8")); const uses = new Set(); @@ -276,8 +272,6 @@ export function discoverInputClosure(root: string, entrypoints: readonly string[ const literalPayload = /\.(?:fulfill|setContent)$/.test(originalCallee) && sourceBrowserPayload(root, normalized, expression); const boundRuntime = runtimeBindings.get(normalized)?.get(expression); const boundDispatch = dispatchBindings.get(normalized)?.has(expression) === true; - const boundNative = nativeBinding?.sites.get(normalized)?.has(expression)===true; - if(boundNative)for(const target of nativeBinding!.files)visit(target,true); const boundDocument = documentBindings.get(normalized)?.get(expression); if(boundDocument){for(const target of boundDocument.runtime)visit(target);for(const target of boundDocument.bytes)visit(target,true);} const generatedTheme = themeBinding?.owner===normalized && themeBinding.read===expression ? themeBinding : undefined; @@ -293,7 +287,7 @@ export function discoverInputClosure(root: string, entrypoints: readonly string[ } const matching = inputDeclarations(node); if (matching.some(declaration => declaration.observation && !kernelObservation(node, declaration))) unresolved.add(`Invalid runner observation ${normalized}: ${expression}`); - if (!matching.length && !generated && !locked && !literalPayload && !boundRuntime && !boundDispatch && !generatedTheme && !boundDocument && !boundNative) unresolved.add(`Undeclared input ${normalized}: ${expression}`); + if (!matching.length && !generated && !locked && !literalPayload && !boundRuntime && !boundDispatch && !generatedTheme && !boundDocument) unresolved.add(`Undeclared input ${normalized}: ${expression}`); else for (const declaration of matching) { uses.add(inputKey(declaration)); for (const target of declaration.targets) visit(target); } } } @@ -310,7 +304,7 @@ export function discoverInputClosure(root: string, entrypoints: readonly string[ }; for (const file of [...entrypoints,...executionRoots]) visit(file); for (const owner of declared.keys()) if (!files.has(owner)) unresolved.add(`Unused declaration owner: ${owner}`); - return { ...(nativeBinding?{nativeDiagram:nativeBinding.identity}:{}), ...(nativeDiagramDiagnostic?{nativeDiagramDiagnostic}:{}), files: [...files].sort(), directories: [...directories].sort(), ...(external.size ? { external: [...external.values()].sort((a,b) => `${a.package}/${a.asset}`.localeCompare(`${b.package}/${b.asset}`)) } : {}), unresolved: [...unresolved].sort() }; + return { files: [...files].sort(), directories: [...directories].sort(), ...(external.size ? { external: [...external.values()].sort((a,b) => `${a.package}/${a.asset}`.localeCompare(`${b.package}/${b.asset}`)) } : {}), unresolved: [...unresolved].sort() }; } export function closureSelects(changed: readonly string[], closure: InputClosure, broad: boolean): boolean { const inputs = new Set(closure.files); diff --git a/scripts/browser-worker-audit.ts b/scripts/browser-worker-audit.ts index 8d5db6ee5e..855c5bd2f8 100644 --- a/scripts/browser-worker-audit.ts +++ b/scripts/browser-worker-audit.ts @@ -24,7 +24,7 @@ function workerAuditMaterial(root:string,closure:InputClosure,selected:readonly return [file,stat.mode&0o777,createHash("sha256").update(readFileSync(absolute)).digest("hex")]; }).sort((a,b)=>String(a[0]).localeCompare(String(b[0]))); const inventory=selected.map(({file,project})=>({file,project})).sort((a,b)=>a.project.localeCompare(b.project)||a.file.localeCompare(b.file)); - return {version:1,files,directories:[...(closure.directories??[])].sort(),external:closure.external??[],...(closure.nativeDiagram?{nativeDiagram:closure.nativeDiagram}:{}),inventory}; + return {version:1,files,directories:[...(closure.directories??[])].sort(),external:closure.external??[],inventory}; }catch{return;} } export function workerAuditIdentity(root:string,closure:InputClosure,selected:readonly Spec[]):string|undefined{ @@ -55,8 +55,7 @@ export function inspectWorkerAudit(root:string,closure:InputClosure,selected:rea const owner=prefix?input.slice(prefix[0].length).split(":")[0]:undefined; return{code:prefix?.[1]??"unsupported-input",...(owner&&owner.length<256&&/^[A-Za-z0-9_./@-]+$/.test(owner)&&closure.files.includes(owner)?{owner}:{})}; }); - const expectedNative=Object.fromEntries(["source","installation","runtime"].flatMap(key=>typeof audit?.sourceAudit?.native?.[key]==="string"&&/^[a-f0-9]{64}$/.test(audit.sourceAudit.native[key])?[[key,audit.sourceAudit.native[key]]]:[])); - const diagnostic={version:1,expectedIdentity,actualIdentity,enforcementValid:Boolean(enforcementValid),admissionSupported:Boolean(material),selected:selected.length,files:closure.files.length,unresolvedCount:closure.unresolved.length,unresolved:labels,expectedNative,native:closure.nativeDiagramDiagnostic,material:diagnosticMaterial}; + const diagnostic={version:1,expectedIdentity,actualIdentity,enforcementValid:Boolean(enforcementValid),admissionSupported:Boolean(material),selected:selected.length,files:closure.files.length,unresolvedCount:closure.unresolved.length,unresolved:labels,material:diagnosticMaterial}; if(JSON.stringify(diagnostic).length>768*1024)return{qualified:false,diagnostic:{version:1,expectedIdentity,actualIdentity,reason:"bounded manifest exceeded"}}; return{qualified,diagnostic}; } diff --git a/scripts/inclusion-inputs.ts b/scripts/inclusion-inputs.ts index 823af8c197..9c55239790 100644 --- a/scripts/inclusion-inputs.ts +++ b/scripts/inclusion-inputs.ts @@ -117,8 +117,8 @@ export function inclusionInputs(root: string, category: Reusable, inventory: Spe const partitions = balanceBrowserSpecs(selected.map(spec => ({ key: `${spec.project}::${spec.file}`, project: spec.project })), PROOF_SHARDS[category], readBrowserCosts(join(snapshot, "scripts/browser-shard-costs.json"))).map(part => part.map(spec => spec.key)); const files = entries.filter(entry => included.has(entry.path)); - const material = { version: 2, category, runner, inventory, partitions, directories: closure.directories ?? [], external: closure.external ?? [], ...(closure.nativeDiagram?{nativeDiagram:closure.nativeDiagram}:{}), files }; - return { version: 2, category, runner, inventory, partitions, excluded: [], ...(closure.nativeDiagram?{nativeDiagram:closure.nativeDiagram}:{}), + const material = { version: 2, category, runner, inventory, partitions, directories: closure.directories ?? [], external: closure.external ?? [], files }; + return { version: 2, category, runner, inventory, partitions, excluded: [], fingerprint: createHash("sha256").update(JSON.stringify(material)).digest("hex") }; } finally { rmSync(snapshot, { recursive: true, force: true }); } } diff --git a/scripts/native-diagram-inputs.ts b/scripts/native-diagram-inputs.ts deleted file mode 100644 index 5001b073f4..0000000000 --- a/scripts/native-diagram-inputs.ts +++ /dev/null @@ -1,92 +0,0 @@ -/** One fixed mount-bound native SVG/PNG/PDF operation; drift keeps fresh proof. */ -import {createHash} from "node:crypto"; -import {existsSync,lstatSync,readFileSync,readdirSync,realpathSync} from "node:fs"; -import {resolve} from "node:path"; -import {diagramSourceDomains,diagramSourceSetup,diagramSourceIdentity} from "./diagram-export-source.mjs"; -import {diagramInstallationIdentity} from "./diagram-export-installation.mjs"; -import {diagramProducerRuntime} from "./diagram-export-producer.mjs"; -import type {BrowserImporters} from "./bound-browser-runtime-inputs"; -export interface NativeDiagramIdentity {source:string;installation:string;runtime:string;} -export interface NativeDiagramDiagnostic { - version:1;status:string;stage:string;expected:{source:string;installation:string}; - actual?:Partial;sourceInputs?:number; - installation?:{packages:number;files:number;bytes:number}; - pins?:{path:string;expected:string;actual?:string;owned:boolean}[];errorCode?:string;recovery?:string; -} - -// Candidate qualification is exact: all source/installation drift requires fresh -// execution and requalification. The separate Docker mount boundary closes -// active initialization/shared-library reads; byte hashes alone do not. -const qualified:Omit={source:"e8502b6ffb3c575f2e9a1c93dea8dbf5ceda93ece367da9d542cb10b1c9ac32b",installation:"ea866695f2a83f9da2fcf18e75e95e936668ecb28e1449845a2584aa1025b728"}; -// The installation identity includes file modes, which the installer's umask -// narrows: the qualified install was made under umask 022, and any other umask -// (such as 0077) can never match. Recovery replaces only this owned install. -const installationRecovery="Preserve evidence and move aside this owned checkout's node_modules, then run sh scripts/prepare-diagnostic-install.sh. It sets umask 022 and installs the unchanged lock through a fresh private cache and copyfile. The installation identity includes file modes, so an install under any other umask (such as 0077) never matches. See CONTRIBUTING.md; never refresh qualification pins."; -const caller="packages/ui-kit/vitest.config.ts",owner="packages/ui-react/tests/browser/diagram-export-command.ts"; -const sourcePins:Record={ - "packages/ui-kit/vitest.config.ts": "e724696a55955e9f32d396b2031214600086533c3f9b8baabcc1c6bb7311f1db", - "packages/ui-react/tests/browser/diagram-export-command.ts": "f7c3d14ccf96438bf4e28ecc1929b1208fb99520d21a9947086bb43bca933328", - "scripts/ci-proof.ts": "c58de06eba788b6b892416ddda3abb28fa1e8e908f25c0800482fbe05e0de678" -}; -/** The same complete source family the trusted host preparer enumerates. */ -export function nativeDiagramSourceInventory(root:string){ - const inputs:{path:string;mode:string;sha256:string}[]=[]; - const read=(path:string)=>{const absolute=resolve(root,path),stat=lstatSync(absolute); - if(realpathSync(absolute)!==absolute||stat.isSymbolicLink())throw Error("Unsupported native source alias"); - if(stat.isDirectory()){for(const entry of readdirSync(absolute).sort())read(`${path}/${entry}`);} - else if(stat.isFile())inputs.push({path,mode:stat.mode&0o111?"100755":"100644",sha256:createHash("sha256").update(readFileSync(absolute)).digest("hex")}); - else throw Error("Unsupported native source entry");}; - for(const file of diagramSourceSetup)read(file); - for(const domain of diagramSourceDomains)read(`packages/${domain}`); - return{inputs,sha256:diagramSourceIdentity(inputs)}; -} -/** Input identity supplements the existing complete fresh-shard receipt. */ -export function nativeDiagramInputs(root:string,files:readonly string[],importers:BrowserImporters,observe?:(value:NativeDiagramDiagnostic)=>void){ - const diagnostic:NativeDiagramDiagnostic={version:1,status:"unavailable",stage:"role",expected:{...qualified}}; - const report=()=>observe?.(diagnostic); - if(![caller,owner].every(path=>files.includes(path)))return; - if(!qualified.source||!qualified.installation||[...(importers.get(owner)??[])].some(path=>path!==caller)){diagnostic.status="unsealed-role";report();return;} - try{ - diagnostic.stage="pins"; - diagnostic.pins=Object.entries(sourcePins).map(([path,expected])=>{const absolute=resolve(root,path),owned=existsSync(absolute)&&realpathSync(absolute)===absolute;return{path,expected,owned,...(owned?{actual:createHash("sha256").update(readFileSync(absolute)).digest("hex")}:{} )};}); - if(diagnostic.pins.some(pin=>!pin.owned||pin.actual!==pin.expected)){diagnostic.status="source-pin-mismatch";report();return;} - diagnostic.stage="source";const source=nativeDiagramSourceInventory(root);diagnostic.actual={source:source.sha256};diagnostic.sourceInputs=source.inputs.length; - diagnostic.stage="installation";const installation=diagramInstallationIdentity(root);diagnostic.actual.installation=installation.sha256;diagnostic.installation={packages:installation.packages,files:installation.files,bytes:installation.bytes}; - diagnostic.stage="runtime";const runtime=diagramProducerRuntime();diagnostic.actual.runtime=runtime.sha256; - if(source.sha256!==qualified.source||installation.sha256!==qualified.installation){if(source.sha256!==qualified.source)diagnostic.status="source-mismatch";else{diagnostic.status="installation-mismatch";diagnostic.recovery=installationRecovery;}report();return;} - const sites=new Map>([ - [owner,new Set([ - "readFileSync(resolve(prepared,\"producer.json\"),\"utf8\")", - "readFileSync(resolve(prepared,name))", - "readFileSync(resolve(directory,\"release.svg\"),\"utf8\")", - "readFileSync(resolve(directory,\"release.png\"))", - "page.setContent(`${svg}`)" -])], - ["scripts/diagram-export-producer.mjs",new Set([ - "accessSync(path,constants.X_OK)", - "statSync(path)", - "readFileSync(executable)", - "readFileSync(join(repo,\"tmp/diagram-export-source.json\"),\"utf8\")", - "readdirSync(join(repo,\"node_modules\"))", - "readdirSync(join(repo,\"node_modules\",top))", - "spawnSync(\"docker\",[\"run\",\"--rm\",\"--pull=never\",\"--read-only\",\"--network=none\",\"--shm-size=256m\",\"--user\",`${process.getuid()}:${process.getgid()}`,\"--tmpfs\",\"/tmp:rw,exec,nosuid,nodev,mode=1777\",\"-v\",`${source}:${source}:ro`,\"-v\",`${modules}:${join(repo,\"node_modules\")}:ro`,\"-v\",`${executable}:/usr/local/bin/bun:ro`,\"-v\",`${output}:/proof`,\"-w\",source,\"-e\",\"HOME=/tmp/home\",runtime.image,\"/usr/local/bin/bun\",\"-e\",program],{encoding:\"utf8\",maxBuffer:4*1024*1024})", - "readFileSync(join(output,name))" -])], - ["scripts/diagram-export-source.mjs",new Set([ - 'readFileSync(archivePath(repo))','existsSync(target)','lstatSync(source)','readFileSync(source)', - 'readFileSync(join(target,"packages",name,"package.json"),"utf8")','existsSync(installed)', - 'readdirSync(join(repo,"node_modules"))','readdirSync(join(repo,"node_modules",entry))' - ])], - ["scripts/diagram-export-installation.mjs",new Set([ - 'lstatSync(absolute)','lstatSync(real)','readlinkSync(absolute)','readdirSync(absolute)','readFileSync(absolute)', - 'readdirSync(join(repo,"node_modules"))','readdirSync(join(repo,"node_modules",top))','readFileSync(join(base,"package.json"),"utf8")' - ])] - ]); - diagnostic.status="qualified";diagnostic.stage="complete";report(); - return{identity:{source:source.sha256,installation:installation.sha256,runtime:runtime.sha256},files:source.inputs.map(entry=>entry.path),sites}; - }catch(error){ - const safeMessages=["Unsupported native dependency alias","Unbounded native dependency inventory","Unsupported native dependency entry","Unbounded native dependency packages","NATIVE_DEPENDENCY_ORIGIN_CHANGED","Unsupported native dependency identity"]; - const message=error instanceof Error?error.message:""; - diagnostic.errorCode=safeMessages.includes(message)?message.replaceAll(" ","_").toUpperCase():"UNAVAILABLE";report();return; - } -} diff --git a/scripts/proof-inputs.ts b/scripts/proof-inputs.ts index b1fa7b2ee6..c4e099b9be 100644 --- a/scripts/proof-inputs.ts +++ b/scripts/proof-inputs.ts @@ -11,6 +11,12 @@ export interface Checkout { sha: string; tree: string; parents: string[]; } export interface Inputs { version: 2; category: Reusable; fingerprint: string; runner: string; inventory: Spec[]; partitions: string[][]; excluded: string[]; + /** + * Never produced since #4105 retired the frozen native diagram qualification. + * `scripts/ci-proof.ts` and `scripts/visual.mjs` still read it, and do + * nothing when it is absent; they are audited sources, so the dead branches + * go when those files next change under their own re-audit. + */ nativeDiagram?:{source:string;installation:string;runtime:string}; } export function git(root: string, ...args: string[]): string { diff --git a/scripts/test-shard-costs.json b/scripts/test-shard-costs.json index f3c0bfeece..0a2362a14b 100644 --- a/scripts/test-shard-costs.json +++ b/scripts/test-shard-costs.json @@ -1115,7 +1115,6 @@ "tests/module-hygiene-queries.test.ts": 0.785, "tests/module-public-imports.test.ts": 0.1, "tests/native-dead-root-trace.test.ts": 0.1, - "tests/native-diagram-inputs.test.ts": 18.314, "tests/native-event-log.test.ts": 0.1, "tests/offline-test-launcher.test.ts": 0.123, "tests/opportunity-cli-agreement.test.ts": 2.381, diff --git a/tests/browser-worker-audit.test.ts b/tests/browser-worker-audit.test.ts index 32de985611..0e2aa67f87 100644 --- a/tests/browser-worker-audit.test.ts +++ b/tests/browser-worker-audit.test.ts @@ -53,15 +53,13 @@ test("covered byte drift stays unavailable and the bounded manifest names only t expect(JSON.stringify(after.diagnostic).length).toBeLessThan(768*1024); }); -test("unknown native inputs expose bounded evidence without admission material",()=>{ +test("unknown inputs expose bounded evidence without admission material",()=>{ const {root,closure,selected}=fixture(); - const unknown={...closure,unresolved:[pdfWorkerInput,"Undeclared input spec.ts: readFile(secretSourceContents)"],nativeDiagramDiagnostic:{version:1 as const,status:"source-mismatch",stage:"runtime",expected:{source:"a".repeat(64),installation:"b".repeat(64)},actual:{source:"c".repeat(64),installation:"b".repeat(64),runtime:"d".repeat(64)}}}; + const unknown={...closure,unresolved:[pdfWorkerInput,"Undeclared input spec.ts: readFile(secretSourceContents)"]}; expect(workerAuditIdentity(root,unknown,selected),"UNSUPPORTED_INPUT_HAS_NO_ADMISSION_IDENTITY").toBeUndefined(); const inspected=inspectWorkerAudit(root,unknown,selected),diagnostic=inspected.diagnostic as any; - expect(inspected.qualified,"UNKNOWN_NATIVE_INPUT_ALWAYS_REQUIRES_FRESH").toBe(false); + expect(inspected.qualified,"UNKNOWN_INPUT_ALWAYS_REQUIRES_FRESH").toBe(false); expect(diagnostic.admissionSupported).toBe(false); - expect(diagnostic.native?.status,"UNKNOWN_NATIVE_DIAGNOSTIC_IS_NON_NULL").toBe("source-mismatch"); - expect(diagnostic.native.actual.source).toBe("c".repeat(64)); expect(diagnostic.material.files.some((entry:any)=>entry[0]==="data.json")).toBe(true); expect(diagnostic.unresolved).toContainEqual({code:"undeclared-input",owner:"spec.ts"}); expect(JSON.stringify(diagnostic)).not.toContain(root); diff --git a/tests/native-diagram-inputs.test.ts b/tests/native-diagram-inputs.test.ts deleted file mode 100644 index e16bae7e31..0000000000 --- a/tests/native-diagram-inputs.test.ts +++ /dev/null @@ -1,127 +0,0 @@ -import {afterEach,expect,test} from "bun:test"; -import assert from "node:assert/strict"; -import {chmodSync,cpSync,lstatSync,mkdirSync,mkdtempSync,readFileSync,readdirSync,realpathSync,rmSync,symlinkSync,writeFileSync} from "node:fs"; -import {tmpdir} from "node:os"; -import {dirname,join,resolve} from "node:path"; -import {diagramSourceSetup,diagramSourceDomains} from "../scripts/diagram-export-source.mjs"; -import {nativeDiagramInputs,nativeDiagramSourceInventory,type NativeDiagramDiagnostic} from "../scripts/native-diagram-inputs"; -const repo=resolve(import.meta.dir,".."),roots:string[]=[],owner="packages/ui-react/tests/browser/diagram-export-command.ts",caller="packages/ui-kit/vitest.config.ts"; -// Delivered #2293 owns the qualified bytes. Never substitute HEAD/worktree bytes, -// Git archive filters, or a newly computed candidate fingerprint for this control. -const frozen="0d780605fe1ea9a281cce947b1f0074f3f3e7acc"; -const qualifiedSource="e8502b6ffb3c575f2e9a1c93dea8dbf5ceda93ece367da9d542cb10b1c9ac32b"; -const qualifiedInstallation="ea866695f2a83f9da2fcf18e75e95e936668ecb28e1449845a2584aa1025b728"; -const ownedPaths=[...diagramSourceSetup,...diagramSourceDomains.map(name=>`packages/${name}`),owner,caller,"scripts/ci-proof.ts"]; -afterEach(()=>{for(const root of roots.splice(0))rmSync(root,{recursive:true,force:true});}); -function fixture(current=false,install?:(modules:string)=>void){ - const root=mkdtempSync(join(tmpdir(),"odysseus-native-inputs-"));roots.push(root); - const tree=Bun.spawnSync(["git","ls-tree","-r","-z",current?"HEAD":frozen,"--",...ownedPaths],{cwd:repo,stdout:"pipe",stderr:"pipe"}); - expect(tree.exitCode,"FROZEN_SOURCE_OWNER_MUST_BE_AVAILABLE_OFFLINE").toBe(0); - const entries=tree.stdout.toString().split("\0").filter(Boolean).map(row=>{const tab=row.indexOf("\t"),[mode,kind,oid]=row.slice(0,tab).split(" ");expect(kind).toBe("blob");expect(["100644","100755"]).toContain(mode);return{mode,oid,path:row.slice(tab+1)};}); - // Match the repository's immutable source protocol: read raw objects in one - // batch, verifying each header/length and complete output before using it. - const batch=Bun.spawnSync(["git","cat-file","--batch"],{cwd:repo,stdin:Buffer.from(entries.map(entry=>entry.oid).join("\n")+"\n"),stdout:"pipe",stderr:"pipe"}); - expect(batch.exitCode).toBe(0);const bytes=Buffer.from(batch.stdout);let offset=0; - for(const entry of entries){ - const end=bytes.indexOf(10,offset);expect(end).toBeGreaterThanOrEqual(offset); - const [oid,kind,length]=bytes.subarray(offset,end).toString("ascii").split(" "),size=Number(length); - expect(oid).toBe(entry.oid);expect(kind).toBe("blob");expect(Number.isSafeInteger(size)&&size>=0&&end+1+size`${top}/${name}`):[top];for(const name of names){if(name.startsWith("@schlessera/"))continue;const target=join(root,"node_modules",name);mkdirSync(dirname(target),{recursive:true});symlinkSync(realpathSync(join(repo,"node_modules",name)),target,"dir");}} - let diagnostic:NativeDiagramDiagnostic|undefined; - const importers=new Map([[owner,new Set([caller])]]),bind=()=>nativeDiagramInputs(root,[owner,caller],importers,value=>{diagnostic=value;}); - return{root,importers,bind,diagnostic:()=>diagnostic}; -} -function sourceRefused(control:ReturnType,name:string){ - expect(control.bind(),name).toBeUndefined();const diagnostic=control.diagnostic(); - assert(diagnostic,"UNKNOWN_NATIVE_BINDING_MUST_REPORT_DIAGNOSTIC"); - expect(diagnostic.status,"UNKNOWN_NATIVE_BINDING_HAS_REASON").toBe("source-mismatch"); - assert(diagnostic.actual?.source,"SOURCE_REFUSAL_MUST_REPORT_ACTUAL_IDENTITY"); - expect(diagnostic.expected.source).toBe(qualifiedSource); - expect(diagnostic.actual.source).not.toBe(diagnostic.expected.source); - expect(diagnostic.actual.installation).toBe(qualifiedInstallation); - expect(JSON.stringify(diagnostic)).not.toContain(control.root); -} -test("fixed native qualification binds the independently frozen complete source without Docker or image lookup",()=>{ - const control=fixture(),path=process.env.PATH,bin=join(control.root,"commands");mkdirSync(bin);symlinkSync(realpathSync(process.execPath),join(bin,"bun")); - try{ - process.env.PATH=bin;const binding=control.bind(); - expect(control.diagnostic(),"FROZEN_NATIVE_INSTALLATION_MUST_MATCH_QUALIFIED_BYTES: reinstall this owned checkout under umask 022 from a fresh private cache (CONTRIBUTING.md); never refresh qualification pins").toMatchObject({ - status:"qualified",stage:"complete",sourceInputs:859, - actual:{source:qualifiedSource,installation:qualifiedInstallation}, - installation:{packages:930,files:66881,bytes:1374331961} - }); - expect(binding?.files.length,"COMPLETE_NATIVE_QUALIFICATION_WITHOUT_DOCKER_OR_IMAGE_LOOKUP").toBe(859); - expect(binding?.files.toSorted()).toEqual(nativeDiagramSourceInventory(control.root).inputs.map(entry=>entry.path).toSorted()); - expect(binding?.identity.source).toBe(qualifiedSource);expect(binding?.identity.installation).toBe(qualifiedInstallation); - expect(control.diagnostic()?.status).toBe("qualified"); - }finally{if(path===undefined)delete process.env.PATH;else process.env.PATH=path;} -}); -test("an additional native importer requires fresh proof",()=>{ - const control=fixture();control.importers.get(owner)!.add("new-caller.ts"); - expect(control.bind(),"NATIVE_IMPORTER_REQUIRES_FRESH_PROOF").toBeUndefined();expect(control.diagnostic()?.status).toBe("unsealed-role"); -}); -test.each([owner,caller,"scripts/ci-proof.ts"])("changed pinned native input %s requires fresh proof",file=>{ - const control=fixture(),target=join(control.root,file);writeFileSync(target,readFileSync(target,"utf8")+"\n// changed native operation\n"); - expect(control.bind(),"NATIVE_PIN_REQUIRES_FRESH_PROOF").toBeUndefined();expect(control.diagnostic()?.status).toBe("source-pin-mismatch"); - const pin=control.diagnostic()?.pins?.find(pin=>pin.path===file); - assert(pin,"PIN_REFUSAL_MUST_REPORT_EXPECTED_PIN");assert(pin.actual,"PIN_REFUSAL_MUST_REPORT_ACTUAL_PIN"); - expect(pin.actual).not.toBe(pin.expected); -}); -test("added package source requires native requalification",()=>{ - const control=fixture();writeFileSync(join(control.root,"packages/core/src/unused-native-probe.ts"),"export const Odysseus=1;"); - sourceRefused(control,"NATIVE_SOURCE_ADDITION_REQUIRES_REQUALIFICATION"); -}); -test("changed package content requires native requalification",()=>{ - const control=fixture(),target=join(control.root,"packages/core/src/cli/brain.ts");writeFileSync(target,readFileSync(target,"utf8")+"\n// changed package content\n"); - sourceRefused(control,"NATIVE_SOURCE_CONTENT_REQUIRES_REQUALIFICATION"); -}); -test("changed package executable mode requires native requalification",()=>{ - const control=fixture(),target=join(control.root,"packages/core/src/cli/brain.ts");chmodSync(target,(lstatSync(target).mode&0o777)^0o111); - sourceRefused(control,"NATIVE_SOURCE_MODE_REQUIRES_REQUALIFICATION"); -}); -// An installer's umask narrows the modes it writes, and the installation identity -// includes modes. Simulate one package written under each umask. -const syntheticInstall=(mask:number)=>(modules:string)=>{ - const previous=process.umask(mask); - try{ - const base=join(modules,"odysseus-ledger");mkdirSync(join(base,"bin"),{recursive:true,mode:0o755}); - writeFileSync(join(base,"package.json"),JSON.stringify({name:"odysseus-ledger",version:"1.0.0"}),{mode:0o644}); - writeFileSync(join(base,"bin/ledger.js"),"#!/usr/bin/env bun\nconsole.log(\"Ithaca\");\n",{mode:0o755}); - }finally{process.umask(previous);} -}; -test("an install under umask 0077 is refused with the umask 022 recovery, and that recovery restores its identity",()=>{ - const restrictive=fixture(false,syntheticInstall(0o077)),reference=fixture(false,syntheticInstall(0o022)); - expect(restrictive.bind(),"RESTRICTIVE_UMASK_INSTALL_IS_REFUSED").toBeUndefined(); - const refused=restrictive.diagnostic();assert(refused,"RESTRICTIVE_UMASK_REFUSAL_MUST_REPORT_DIAGNOSTIC"); - expect(refused.status).toBe("installation-mismatch");expect(refused.actual?.source).toBe(qualifiedSource); - expect(refused.recovery,"INSTALLATION_REFUSAL_NAMES_THE_REQUIRED_UMASK").toContain("umask 022"); - expect(refused.recovery,"INSTALLATION_REFUSAL_NAMES_THE_INSTALL_COMMAND").toContain("sh scripts/prepare-diagnostic-install.sh"); - expect(JSON.stringify(refused)).not.toContain(restrictive.root); - reference.bind();const expected=reference.diagnostic();assert(expected?.actual?.installation,"REFERENCE_INSTALL_MUST_REPORT_IDENTITY"); - // Same packages, files and bytes: only the modes differ. - expect(refused.installation).toEqual(expected.installation);expect(refused.actual?.installation).not.toBe(expected.actual.installation); - // The documented recovery: replace the owned install under umask 022. - rmSync(join(restrictive.root,"node_modules/odysseus-ledger"),{recursive:true});syntheticInstall(0o022)(join(restrictive.root,"node_modules")); - restrictive.bind();expect(restrictive.diagnostic()?.actual?.installation,"UMASK_022_RECOVERY_RESTORES_THE_IDENTITY").toBe(expected.actual.installation); -}); -test("relocated installed native dependency requires fresh proof",()=>{ - const control=fixture(),clone=join(control.root,"relocated/marked");mkdirSync(dirname(clone));cpSync(realpathSync(join(control.root,"node_modules/marked")),clone,{recursive:true});rmSync(join(control.root,"node_modules/marked"));symlinkSync(clone,join(control.root,"node_modules/marked"),"dir"); - expect(control.bind(),"NATIVE_INSTALLED_ORIGIN_REQUIRES_FRESH_PROOF").toBeUndefined();expect(control.diagnostic()?.stage).toBe("installation");expect(control.diagnostic()?.errorCode,"UNKNOWN_INSTALLED_ORIGIN_HAS_BOUNDED_REASON").toBe("NATIVE_DEPENDENCY_ORIGIN_CHANGED"); -}); -test("the actual current candidate qualifies only when its complete frozen source and pins match",()=>{ - const control=fixture(true),source=nativeDiagramSourceInventory(control.root),binding=control.bind(),diagnostic=control.diagnostic(); - assert(diagnostic,"CURRENT_CANDIDATE_MUST_REPORT_DIAGNOSTIC"); - // A legitimate new file or pinned proof/caller edit is an unsupported operation, - // not a broken positive fixture. The frozen positive above must still qualify. - if(source.sha256===qualifiedSource&&diagnostic.pins?.every(pin=>pin.owned&&pin.actual===pin.expected)){ - expect(binding?.identity.source).toBe(qualifiedSource);expect(diagnostic?.status).toBe("qualified"); - }else{ - expect(binding,"CHANGED_CANDIDATE_MUST_KEEP_FRESH_NATIVE_PROOF").toBeUndefined();expect(["source-mismatch","source-pin-mismatch"]).toContain(diagnostic.status); - } -}); diff --git a/tests/native-diagram-retired.test.ts b/tests/native-diagram-retired.test.ts new file mode 100644 index 0000000000..a1bdb35f4b --- /dev/null +++ b/tests/native-diagram-retired.test.ts @@ -0,0 +1,30 @@ +// The frozen native diagram qualification is retired (#4105, maintainer ruling +// 2026-11-16). Its pins made every dependency change fail `unit` until a +// manual Docker requalification moved them. Nothing in the scripts or tests +// may pin those identities again: the producer's proof runs fresh in its +// container boundary, and its own run-time checks verify what it mounts. +import { expect, test } from "bun:test"; +import { readFileSync } from "node:fs"; +import { join, resolve } from "node:path"; + +const root = resolve(import.meta.dir, ".."); + +const RETIRED = [ + "e8502b6ffb3c575f2e9a1c93dea8dbf5ceda93ece367da9d542cb10b1c9ac32b", // frozen #2293 source + "ea866695f2a83f9da2fcf18e75e95e936668ecb28e1449845a2584aa1025b728", // last qualified installation + "e724696a55955e9f32d396b2031214600086533c3f9b8baabcc1c6bb7311f1db", // pinned ui-kit vitest config + // The diagram export command's own hash (`f7c3d14c…`) is not listed: the + // bound-browser-documents audit pins that file independently. + "c58de06eba788b6b892416ddda3abb28fa1e8e908f25c0800482fbe05e0de678", // pinned ci-proof +]; + +test("no script or test pins the retired native diagram qualification", () => { + // Two patterns: Bun's glob matches nothing when a brace alternative holds a `/`. + const files = ["{scripts,tests}/**/*.{ts,tsx,mjs,js}", "packages/*/{tests,scripts}/**/*.{ts,tsx,mjs,js}"] + .flatMap((pattern) => [...new Bun.Glob(pattern).scanSync({ cwd: root, dot: false })]) + .filter((file) => !file.includes("node_modules") && file !== "tests/native-diagram-retired.test.ts"); + // The scan must see the files the binding lived in, or an empty glob passes vacuously. + expect(files, "SCAN_COVERS_THE_PROOF_SCRIPTS").toContain("scripts/browser-input-closure.ts"); + const pinned = files.flatMap((file) => RETIRED.filter((hash) => readFileSync(join(root, file), "utf8").includes(hash)).map((hash) => `${file}: ${hash.slice(0, 8)}`)); + expect(pinned, "NATIVE_DIAGRAM_QUALIFICATION_STAYS_RETIRED").toEqual([]); +}); From d921382182f5b15a0d9fe338ec21672b04de6830 Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Tue, 17 Nov 2026 01:44:22 +0000 Subject: [PATCH 2/7] test(ui-react): give the image markup render test its own DOM registration It shared ask-user-dom.ts, whose body runs once per process. When ask-user's test ran first in the same worker, its afterAll unregistered the DOM and the image markup test failed with "document is not defined". Retiring the native diagram test reshuffled unit partitions and put the two together. A sibling module per file is the contract ask-user-dom.ts documents. Co-Authored-By: Claude Opus 5.5 --- .../ui-react/tests/render/image-markup-dom.ts | 22 +++++++++++++++++++ .../tests/render/image-markup.test.tsx | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 packages/ui-react/tests/render/image-markup-dom.ts diff --git a/packages/ui-react/tests/render/image-markup-dom.ts b/packages/ui-react/tests/render/image-markup-dom.ts new file mode 100644 index 0000000000..1120a11e90 --- /dev/null +++ b/packages/ui-react/tests/render/image-markup-dom.ts @@ -0,0 +1,22 @@ +// happy-dom registration for the image markup render test, a sibling of +// `ask-user-dom.ts` on purpose: a registration module's body runs once per +// process, so a second test file sharing one gets no DOM when an earlier file +// in the same worker has already unregistered it. This module is imported by +// `image-markup.test.tsx` alone, so its body runs exactly when that file +// loads, and the file's `afterAll` unregisters again before the next file. +// Import it FIRST, before any component module. +import { GlobalRegistrator } from "@happy-dom/global-registrator"; +import { act } from "react"; + +if (!GlobalRegistrator.isRegistered) { + GlobalRegistrator.register(); +} +(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true; + +export async function unregisterImageMarkupDom(): Promise { + if (GlobalRegistrator.isRegistered) { + // Drain React callbacks before removing the globals they still read. + await act(async () => {}); + await GlobalRegistrator.unregister(); + } +} diff --git a/packages/ui-react/tests/render/image-markup.test.tsx b/packages/ui-react/tests/render/image-markup.test.tsx index 14f0abe750..7ed42ec27f 100644 --- a/packages/ui-react/tests/render/image-markup.test.tsx +++ b/packages/ui-react/tests/render/image-markup.test.tsx @@ -1,7 +1,7 @@ // `request_image_markup` in the app (#3975): the frame opens the editor, the // layer is uploaded rather than sent on the socket, closing declines, and the // transcript shows the receipt or the refusal in the result's own words. -import { unregisterAskUserDom } from "./ask-user-dom.js"; +import { unregisterImageMarkupDom } from "./image-markup-dom.js"; import { afterAll, afterEach, beforeAll, describe, expect, test } from "bun:test"; import { act, cleanup, fireEvent, render } from "@testing-library/react"; @@ -20,7 +20,7 @@ import { createBrainUiRoot, type BrainUiRoot } from "../../src/root.js"; import type { MarkupRequest } from "../../src/stores/markup-state.js"; afterEach(cleanup); -afterAll(unregisterAskUserDom); +afterAll(unregisterImageMarkupDom); beforeAll(() => registerBuiltinRenderers()); const payload = { From 5768e75a5db5f74a3179a32ddca4d0b4def27093 Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Tue, 17 Nov 2026 01:49:48 +0000 Subject: [PATCH 3/7] chore(ci): drop the retired native identity from the worker audit record (#4105) The record's sourceAudit.native still held the frozen #2293 source, installation and runtime hashes, though nothing reads them since the binding was removed; qualification compares the computed identity and counts, never those bytes. The retirement guard now scans JSON as well, and fails first on the old record. Co-Authored-By: Claude Opus 5.5 --- scripts/browser-worker-audit.json | 10 +--------- tests/native-diagram-retired.test.ts | 4 +++- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/scripts/browser-worker-audit.json b/scripts/browser-worker-audit.json index e3226e5ddd..73f4f70766 100644 --- a/scripts/browser-worker-audit.json +++ b/scripts/browser-worker-audit.json @@ -8,15 +8,7 @@ "base": "b03e6550688723f644b5efc4b97d243c832963a0", "selected": 309, "files": 2295, - "scope": "Complete 309-pair selected source/import/configuration/command inventory, including the separate network-disabled read-only-root native Docker producer. All six source families and preparation inputs, copied external installation membership/bytes/modes/internal aliases, actual immutable manifest reference and captured private Bun bytes join current identity. The producer mounts only private source/install/Bun and initially empty owned output; HOME/tmp/shared-memory are fresh container filesystems. Host checkout/state mount counterfactuals fail the named absent-data assertions. Imported initialization and shared helpers remain active inside this finite filesystem boundary. Fresh per-launch output session, captured validated artifact bytes, artifact hashes, exact native entry/configuration/core-dispatch guards and original generated SVG/reference consumers remain enforced. Source or installation drift makes the binding unavailable; runtime drift changes its fingerprint. All resource/Worker guards, complete fresh same-PR two-shard proof and whole-workflow success remain mandatory. Metadata is not passing proof; historical observations retain their scope and source. Reviewed exact source deltas include bounded compilation, restricted IPC, private-parent masking, observational build receipts and repeat-identity observation, and the delivered conversation modules. The complete selected closure has 2,295 files. The two added callout project/file pairs use the exact reviewed diagramCapture caller and producers. Directory and external identities remain unchanged. The complete 859-input diagram source identity is qualified by actual offline SVG/PNG/PDF execution on the same private hosted-mode installation and runtime. The original enforced PDF Worker exception remains the sole unresolved input. The hosted installation mode identity is qualified by actual offline SVG/PNG/PDF execution on an independent normalized copy, not by accepting drift. This metadata update still requires fresh complete selected browser execution and whole-workflow success before any retention. The latest reviewed selected-source changes are per-case callout ownership/drain and separated proof scenarios, plus the ordinary safe builder that refuses unqualified persistent output reuse. The observational receipt and repeat observer remain inputs; these two source changes leave directory, external and native identities unchanged. No new native execution or whole-workflow result is inferred from this projection.", - "native": { - "source": "e8502b6ffb3c575f2e9a1c93dea8dbf5ceda93ece367da9d542cb10b1c9ac32b", - "installation": "0c2758c046f2b69d5f33b66521baf3098db5f44256b73ec96961c98d381e6245", - "trackedInputs": 859, - "packages": 843, - "installedBytes": 1833832361, - "runtime": "bf65590d9d594d238c2c7b6e01e038a26402a676ccf16a1caf596f1179bdc9fb" - } + "scope": "Complete 309-pair selected source/import/configuration/command inventory, including the separate network-disabled read-only-root native Docker producer. All six source families and preparation inputs, copied external installation membership/bytes/modes/internal aliases, actual immutable manifest reference and captured private Bun bytes join current identity. The producer mounts only private source/install/Bun and initially empty owned output; HOME/tmp/shared-memory are fresh container filesystems. Host checkout/state mount counterfactuals fail the named absent-data assertions. Imported initialization and shared helpers remain active inside this finite filesystem boundary. Fresh per-launch output session, captured validated artifact bytes, artifact hashes, exact native entry/configuration/core-dispatch guards and original generated SVG/reference consumers remain enforced. Source or installation drift makes the binding unavailable; runtime drift changes its fingerprint. All resource/Worker guards, complete fresh same-PR two-shard proof and whole-workflow success remain mandatory. Metadata is not passing proof; historical observations retain their scope and source. Reviewed exact source deltas include bounded compilation, restricted IPC, private-parent masking, observational build receipts and repeat-identity observation, and the delivered conversation modules. The complete selected closure has 2,295 files. The two added callout project/file pairs use the exact reviewed diagramCapture caller and producers. Directory and external identities remain unchanged. The complete 859-input diagram source identity is qualified by actual offline SVG/PNG/PDF execution on the same private hosted-mode installation and runtime. The original enforced PDF Worker exception remains the sole unresolved input. The hosted installation mode identity is qualified by actual offline SVG/PNG/PDF execution on an independent normalized copy, not by accepting drift. This metadata update still requires fresh complete selected browser execution and whole-workflow success before any retention. The latest reviewed selected-source changes are per-case callout ownership/drain and separated proof scenarios, plus the ordinary safe builder that refuses unqualified persistent output reuse. The observational receipt and repeat observer remain inputs; these two source changes leave directory, external and native identities unchanged. No new native execution or whole-workflow result is inferred from this projection." }, "historicalDiagnostic": { "base": "b0b4340cd", diff --git a/tests/native-diagram-retired.test.ts b/tests/native-diagram-retired.test.ts index a1bdb35f4b..df591c7872 100644 --- a/tests/native-diagram-retired.test.ts +++ b/tests/native-diagram-retired.test.ts @@ -20,11 +20,13 @@ const RETIRED = [ test("no script or test pins the retired native diagram qualification", () => { // Two patterns: Bun's glob matches nothing when a brace alternative holds a `/`. - const files = ["{scripts,tests}/**/*.{ts,tsx,mjs,js}", "packages/*/{tests,scripts}/**/*.{ts,tsx,mjs,js}"] + // JSON too: an audit record or manifest can carry a pin as well as code can. + const files = ["{scripts,tests}/**/*.{ts,tsx,mjs,js,json}", "packages/*/{tests,scripts}/**/*.{ts,tsx,mjs,js,json}"] .flatMap((pattern) => [...new Bun.Glob(pattern).scanSync({ cwd: root, dot: false })]) .filter((file) => !file.includes("node_modules") && file !== "tests/native-diagram-retired.test.ts"); // The scan must see the files the binding lived in, or an empty glob passes vacuously. expect(files, "SCAN_COVERS_THE_PROOF_SCRIPTS").toContain("scripts/browser-input-closure.ts"); + expect(files, "SCAN_COVERS_THE_AUDIT_RECORDS").toContain("scripts/browser-worker-audit.json"); const pinned = files.flatMap((file) => RETIRED.filter((hash) => readFileSync(join(root, file), "utf8").includes(hash)).map((hash) => `${file}: ${hash.slice(0, 8)}`)); expect(pinned, "NATIVE_DIAGRAM_QUALIFICATION_STAYS_RETIRED").toEqual([]); }); From add143c17813d88cccb8e55bfec62423c11b74df Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Tue, 17 Nov 2026 01:54:10 +0000 Subject: [PATCH 4/7] docs(ci): drop the last qualification-pin wording for the retired native binding (#4105) The release skill and diagnostic guide no longer tell a contributor to keep qualification pins unchanged, ci-utility.md calls the native fixture's container a boundary rather than a binding, and the worker audit record's scope gains a dated note that its native qualification statements are historical. Co-Authored-By: Claude Opus 5.5 --- .agents/skills/release/SKILL.md | 4 ++-- docs/decisions/ci-utility.md | 2 +- docs/process/diagnostic-installs.md | 2 +- scripts/browser-worker-audit.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.agents/skills/release/SKILL.md b/.agents/skills/release/SKILL.md index 013c6eb884..f1e0d12e85 100644 --- a/.agents/skills/release/SKILL.md +++ b/.agents/skills/release/SKILL.md @@ -202,8 +202,8 @@ harnesses refuse runtime bytes they do not own. Reinstall the same lock as copies using [dependency diagnostic preparation](../../../docs/process/diagnostic-installs.md): preserve evidence, move aside only the owned checkout's `node_modules`, then run `sh scripts/prepare-diagnostic-install.sh`. A fresh private cache avoids modified -shared-cache bytes; copyfile alone does not verify provenance. Keep the lock and -qualification pins unchanged, rebuild, and rerun. Retain the old failed receipt; +shared-cache bytes; copyfile alone does not verify provenance. Keep the lock unchanged, +rebuild, and rerun. Retain the old failed receipt; a changed installation requires fresh proof, even with an unchanged lock. Do not skip or edit the tests. diff --git a/docs/decisions/ci-utility.md b/docs/decisions/ci-utility.md index 6fa892201b..ace990be47 100644 --- a/docs/decisions/ci-utility.md +++ b/docs/decisions/ci-utility.md @@ -1051,7 +1051,7 @@ Only a reviewed re-audit moves the audited revision re-audit moves that owner and refreshes the reader's pins in both maps together. -The native diagram SVG/PNG/PDF fixture has a separate finite operation binding. +The native diagram SVG/PNG/PDF fixture runs inside a separate finite operation boundary. The host launches each engine's native producer in a separate network-disabled, read-only-root Docker container, using the existing pinned Playwright image's actual immutable manifest reference. The only host mounts are the private six-workspace diff --git a/docs/process/diagnostic-installs.md b/docs/process/diagnostic-installs.md index c6a72d652c..1423f18f97 100644 --- a/docs/process/diagnostic-installs.md +++ b/docs/process/diagnostic-installs.md @@ -33,7 +33,7 @@ the extracted files with installed bytes. An unchanged lockfile or a single-link copy alone proves neither provenance nor pristine package bytes. Keep the original and recovered observations separate. Do not change package -versions, locks, assertions, qualification pins or file modes to force a pass. +versions, locks, assertions or file modes to force a pass. Rebuild as required and rerun the original focused check through its offline wrapper. Once evidence is retained and no process uses it, remove only the owned old diff --git a/scripts/browser-worker-audit.json b/scripts/browser-worker-audit.json index 73f4f70766..a255bf32ad 100644 --- a/scripts/browser-worker-audit.json +++ b/scripts/browser-worker-audit.json @@ -8,7 +8,7 @@ "base": "b03e6550688723f644b5efc4b97d243c832963a0", "selected": 309, "files": 2295, - "scope": "Complete 309-pair selected source/import/configuration/command inventory, including the separate network-disabled read-only-root native Docker producer. All six source families and preparation inputs, copied external installation membership/bytes/modes/internal aliases, actual immutable manifest reference and captured private Bun bytes join current identity. The producer mounts only private source/install/Bun and initially empty owned output; HOME/tmp/shared-memory are fresh container filesystems. Host checkout/state mount counterfactuals fail the named absent-data assertions. Imported initialization and shared helpers remain active inside this finite filesystem boundary. Fresh per-launch output session, captured validated artifact bytes, artifact hashes, exact native entry/configuration/core-dispatch guards and original generated SVG/reference consumers remain enforced. Source or installation drift makes the binding unavailable; runtime drift changes its fingerprint. All resource/Worker guards, complete fresh same-PR two-shard proof and whole-workflow success remain mandatory. Metadata is not passing proof; historical observations retain their scope and source. Reviewed exact source deltas include bounded compilation, restricted IPC, private-parent masking, observational build receipts and repeat-identity observation, and the delivered conversation modules. The complete selected closure has 2,295 files. The two added callout project/file pairs use the exact reviewed diagramCapture caller and producers. Directory and external identities remain unchanged. The complete 859-input diagram source identity is qualified by actual offline SVG/PNG/PDF execution on the same private hosted-mode installation and runtime. The original enforced PDF Worker exception remains the sole unresolved input. The hosted installation mode identity is qualified by actual offline SVG/PNG/PDF execution on an independent normalized copy, not by accepting drift. This metadata update still requires fresh complete selected browser execution and whole-workflow success before any retention. The latest reviewed selected-source changes are per-case callout ownership/drain and separated proof scenarios, plus the ordinary safe builder that refuses unqualified persistent output reuse. The observational receipt and repeat observer remain inputs; these two source changes leave directory, external and native identities unchanged. No new native execution or whole-workflow result is inferred from this projection." + "scope": "Complete 309-pair selected source/import/configuration/command inventory, including the separate network-disabled read-only-root native Docker producer. All six source families and preparation inputs, copied external installation membership/bytes/modes/internal aliases, actual immutable manifest reference and captured private Bun bytes join current identity. The producer mounts only private source/install/Bun and initially empty owned output; HOME/tmp/shared-memory are fresh container filesystems. Host checkout/state mount counterfactuals fail the named absent-data assertions. Imported initialization and shared helpers remain active inside this finite filesystem boundary. Fresh per-launch output session, captured validated artifact bytes, artifact hashes, exact native entry/configuration/core-dispatch guards and original generated SVG/reference consumers remain enforced. Source or installation drift makes the binding unavailable; runtime drift changes its fingerprint. All resource/Worker guards, complete fresh same-PR two-shard proof and whole-workflow success remain mandatory. Metadata is not passing proof; historical observations retain their scope and source. Reviewed exact source deltas include bounded compilation, restricted IPC, private-parent masking, observational build receipts and repeat-identity observation, and the delivered conversation modules. The complete selected closure has 2,295 files. The two added callout project/file pairs use the exact reviewed diagramCapture caller and producers. Directory and external identities remain unchanged. The complete 859-input diagram source identity is qualified by actual offline SVG/PNG/PDF execution on the same private hosted-mode installation and runtime. The original enforced PDF Worker exception remains the sole unresolved input. The hosted installation mode identity is qualified by actual offline SVG/PNG/PDF execution on an independent normalized copy, not by accepting drift. This metadata update still requires fresh complete selected browser execution and whole-workflow success before any retention. The latest reviewed selected-source changes are per-case callout ownership/drain and separated proof scenarios, plus the ordinary safe builder that refuses unqualified persistent output reuse. The observational receipt and repeat observer remain inputs; these two source changes leave directory, external and native identities unchanged. No new native execution or whole-workflow result is inferred from this projection. Retired 2026-11-16 (#4105): the native identity is no longer recorded or bound, and the browser domain always runs fresh; the qualification statements above are historical." }, "historicalDiagnostic": { "base": "b0b4340cd", From f631e36d48f85f76ba2261614925df139b36d1b5 Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Tue, 17 Nov 2026 01:56:45 +0000 Subject: [PATCH 5/7] docs(ci): count the native requalifications correctly (#4105) Two requalifications ran (#3320, #3968); #4102 was blocked, not requalified. Co-Authored-By: Claude Opus 5.5 --- docs/decisions/ci-utility.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/decisions/ci-utility.md b/docs/decisions/ci-utility.md index ace990be47..e8c36df2ff 100644 --- a/docs/decisions/ci-utility.md +++ b/docs/decisions/ci-utility.md @@ -1100,8 +1100,9 @@ run. The pin no longer protected anything live: on the current tree in any case. - Any dependency change moved the installation hash and turned `unit` red. That needed a manual requalification run on a Docker host and a second merge - cycle. It happened three times (#3320, #3968, #4102), and the frozen - producer's SVG and PNG came out byte-identical every time. + cycle. Two requalifications ran (#3320, #3968), and the frozen producer's + SVG and PNG came out byte-identical both times; #4102 was the third + dependency change, blocked until this retirement. The binding (`scripts/native-diagram-inputs.ts`) and its self-test are removed, and the browser input closure no longer binds the producer's reads. From 6a93dadee1ed1345f13270575933fc3ad38a57c3 Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Tue, 17 Nov 2026 01:59:23 +0000 Subject: [PATCH 6/7] test(ci): keep every retired native identity out of the tree (#4105) The guard now also names #2293's installation and the qualified producer runtime, the two identities removed from the worker audit record. Co-Authored-By: Claude Opus 5.5 --- tests/native-diagram-retired.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/native-diagram-retired.test.ts b/tests/native-diagram-retired.test.ts index df591c7872..d36d84edfa 100644 --- a/tests/native-diagram-retired.test.ts +++ b/tests/native-diagram-retired.test.ts @@ -12,6 +12,8 @@ const root = resolve(import.meta.dir, ".."); const RETIRED = [ "e8502b6ffb3c575f2e9a1c93dea8dbf5ceda93ece367da9d542cb10b1c9ac32b", // frozen #2293 source "ea866695f2a83f9da2fcf18e75e95e936668ecb28e1449845a2584aa1025b728", // last qualified installation + "0c2758c046f2b69d5f33b66521baf3098db5f44256b73ec96961c98d381e6245", // #2293's installation, in the worker audit record + "bf65590d9d594d238c2c7b6e01e038a26402a676ccf16a1caf596f1179bdc9fb", // the qualified producer runtime "e724696a55955e9f32d396b2031214600086533c3f9b8baabcc1c6bb7311f1db", // pinned ui-kit vitest config // The diagram export command's own hash (`f7c3d14c…`) is not listed: the // bound-browser-documents audit pins that file independently. From ae8811bf21a56fc3832d4fe56c0a275744c73d4f Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Tue, 17 Nov 2026 02:01:50 +0000 Subject: [PATCH 7/7] docs(ci): say which handoff checks still run after the native retirement (#4105) The browser still checks the handoff session, checkout and artifact hashes; the comparisons against an expected source, installation or runtime identity took it from the retired binding and no longer run. Co-Authored-By: Claude Opus 5.5 --- docs/decisions/ci-utility.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/decisions/ci-utility.md b/docs/decisions/ci-utility.md index e8c36df2ff..24ba679032 100644 --- a/docs/decisions/ci-utility.md +++ b/docs/decisions/ci-utility.md @@ -1081,8 +1081,9 @@ mounts qualify the mount restriction. Only a successful, drained native process publishes its artifact identities into a fresh per-launch handoff directory. The browser validates the preparation -session, checkout, source/installation/runtime identities and all three artifact -hashes, writes those exact validated bytes into its private consumer view, then +session, checkout and all three artifact hashes, and the source, installation +and runtime identities when a caller supplies expected ones (since #4105 none +does). It writes those exact validated bytes into its private consumer view, then retains the original SVG/reference zero-request replay and raster/font/PDF assertions. Different launches never share a prepared output root. The browser-side pinned font cache remains a separately owned browser input. @@ -1108,8 +1109,12 @@ The binding (`scripts/native-diagram-inputs.ts`) and its self-test are removed, and the browser input closure no longer binds the producer's reads. The browser domain therefore always runs fresh. This supersedes the requalification rulings of 2026-11-02 (#2509/#3320) and 2026-11-11 (#3968). -The container boundary above, the producer's own run-time identity checks and -the browser's validation of the handoff are unchanged. If browser retention +The container boundary above, the producer's own run-time checks and the +browser's validation of the handoff session, checkout and artifact hashes are +unchanged. The comparisons against an expected source, installation or +runtime identity (`diagram-export-command.ts`, `prepare-diagram-export-source.mjs`, +`ci-proof.ts`) take that identity from the retired binding, so they no longer +run. If browser retention returns to ready confirmation, its qualification is designed afresh then. Local proof is not a hosted baseline, retention hit or permission to use a failed workflow.