Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
a796e43
chore(ci): retire the frozen native diagram qualification pin (#4105)
schlessera Nov 16, 2026
36ac36f
Merge remote-tracking branch 'origin/main' into chore/4105-retire-nat…
schlessera Nov 16, 2026
27eaa74
Merge remote-tracking branch 'origin/main' into chore/4105-retire-nat…
schlessera Nov 16, 2026
03ebcde
Merge remote-tracking branch 'origin/main' into chore/4105-retire-nat…
schlessera Nov 17, 2026
32cbe54
Merge remote-tracking branch 'origin/main' into chore/4105-retire-nat…
schlessera Nov 17, 2026
d921382
test(ui-react): give the image markup render test its own DOM registr…
schlessera Nov 17, 2026
8550664
Merge remote-tracking branch 'origin/main' into chore/4105-retire-nat…
schlessera Nov 17, 2026
5768e75
chore(ci): drop the retired native identity from the worker audit rec…
schlessera Nov 17, 2026
add143c
docs(ci): drop the last qualification-pin wording for the retired nat…
schlessera Nov 17, 2026
f631e36
docs(ci): count the native requalifications correctly (#4105)
schlessera Nov 17, 2026
6a93dad
test(ci): keep every retired native identity out of the tree (#4105)
schlessera Nov 17, 2026
ae8811b
docs(ci): say which handoff checks still run after the native retirem…
schlessera Nov 17, 2026
9b78dcb
Merge remote-tracking branch 'origin/main' into chore/4105-retire-nat…
schlessera Nov 17, 2026
73142a9
Merge remote-tracking branch 'origin/main' into chore/4105-retire-nat…
schlessera Nov 17, 2026
c560185
Merge remote-tracking branch 'origin/main' into chore/4105-retire-nat…
schlessera Nov 17, 2026
c956cec
Merge remote-tracking branch 'origin/main' into chore/4105-retire-nat…
schlessera Nov 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .agents/skills/release/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
32 changes: 14 additions & 18 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 34 additions & 10 deletions docs/decisions/ci-utility.md
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ mutation receipts. Production pins and independently owned fixture provenance
moved together. This evidence qualifies the recorded owner only; subsequent
producer or reader drift still requires fresh proof under the procedure above.

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
Expand Down Expand Up @@ -1098,19 +1098,43 @@ 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.

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. 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.
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 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.

Two audited fixture readers consume the literal installed `axe-core/axe.min.js`
asset. Its explicit resource identity records package name/version, relative
Expand Down
5 changes: 2 additions & 3 deletions docs/process/diagnostic-installs.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ 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. 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
Expand Down
22 changes: 22 additions & 0 deletions packages/ui-react/tests/render/image-markup-dom.ts
Original file line number Diff line number Diff line change
@@ -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<void> {
if (GlobalRegistrator.isRegistered) {
// Drain React callbacks before removing the globals they still read.
await act(async () => {});
await GlobalRegistrator.unregister();
}
}
4 changes: 2 additions & 2 deletions packages/ui-react/tests/render/image-markup.test.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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 = {
Expand Down
14 changes: 4 additions & 10 deletions scripts/browser-input-closure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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"]);
Expand All @@ -47,8 +46,6 @@ export function discoverInputClosure(root: string, entrypoints: readonly string[
let runtimeBindings: BrowserRuntimeBindings = new Map();
let dispatchBindings = new Map<string, Set<string>>();
let documentBindings = new Map<string, Map<string,BrowserDocumentInputs>>();
let nativeBinding:ReturnType<typeof nativeDiagramInputs>;
let nativeDiagramDiagnostic:NativeDiagramDiagnostic|undefined;
let themeBinding: ReturnType<typeof generatedThemeInputs>;
if (activation) {
const audit = auditCommandActivation(root, activation.config, activation.selected, activation.candidates);
Expand All @@ -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<string>();
Expand Down Expand Up @@ -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<string>();
Expand Down Expand Up @@ -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;
Expand All @@ -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); }
}
}
Expand All @@ -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);
Expand Down
Loading
Loading