fix(#4132): verify durable runtime surface sources (#4182)

* fix(#4132): verify durable runtime surface sources

* chore(#4132): record PR number in changeset

* test(#4132): cover rejected commands source alias

* fix(#4132): reject aliased package fallback

* test(#4132): cover rejected agents source alias

* test(#4132): cover partially aliased marker provider

* fix(#4132): reject partially aliased source providers

* test(#4132): cover routed source identity probes

* fix(#4132): route installed source identity probes

* refactor(#4132): tighten installer source metadata

* test(#4132): cover corpus trust boundary attacks

* fix(#4132): close installed corpus trust gaps

* refactor(#4132): keep installer authority private

* fix(#4132): preserve private installer fallback

* test(#4132): preserve fixture source authority

* fix(#4132): reject overlapping source fallback

* fix(#4132): avoid redundant installed corpus reads

* refactor(#4132): simplify provider resolution

* test(#4132): sync install tree fixtures after rebase

---------

Co-authored-by: Tom Boucher <trekkie@nomorestars.com>
This commit is contained in:
Zy Deng
2026-09-05 21:32:52 +02:00
committed by GitHub
parent 1017898cb9
commit 4c60879b5d
49 changed files with 3956 additions and 307 deletions

View File

@@ -274,6 +274,8 @@ function setCapabilityState(
// ── Step 4: APPLY PASS ────────────────────────────────────────────────────
let pendingSurfaceForCommit: SurfaceState | undefined;
// ── Surface writes ────────────────────────────────────────────────────────
if (needsSurface && (idsToDisable.length > 0 || idsToEnable.length > 0)) {
const existing = readSurface(resolvedConfigDir);
@@ -339,7 +341,7 @@ function setCapabilityState(
}
if (surfaceChanged) {
writeSurface(resolvedConfigDir, pendingSurface);
pendingSurfaceForCommit = pendingSurface;
}
}
@@ -348,6 +350,13 @@ function setCapabilityState(
setConfigValues(cwd, pendingGateWrites);
}
// State-only callers preserve the existing direct-write behavior. A caller
// that requests materialization lets applySurface publish the candidate only
// after every artifact kind has staged and synchronized successfully.
if (pendingSurfaceForCommit && !opts?.materialize) {
writeSurface(resolvedConfigDir, pendingSurfaceForCommit);
}
// ── Materialize (optional) ────────────────────────────────────────────────
if (opts?.materialize) {
const { runtime, scope } = opts.materialize;
@@ -376,9 +385,12 @@ function setCapabilityState(
// folded:issue-1575-agent-descriptor-parity describe block in
// tests/golden-parity-single-source.test.cjs).
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
applySurface(resolvedConfigDir, layout, manifest, undefined, registry, opts?.materialize?.resolveAttribution
? { resolveAttribution: opts.materialize.resolveAttribution }
: undefined);
applySurface(resolvedConfigDir, layout, manifest, undefined, registry, {
...(pendingSurfaceForCommit ? { surfaceState: pendingSurfaceForCommit } : {}),
...(opts.materialize.resolveAttribution
? { resolveAttribution: opts.materialize.resolveAttribution }
: {}),
});
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : String(err);
// Fix C: materialise was explicitly requested — a failure is an error (non-zero exit),