mirror of
https://github.com/mvschwarz/openrig.git
synced 2026-11-07 22:58:42 -10:00
feat(policy): activate the A3 reservation — permission_policy: none is the recorded deliberate choice
Lane-A hop 2 (qitem 4b805845), the RULED FORM OF RECORD
RULED-FORM-deliberate-none-2026-08-04.md sha256
5f37e40fbcdcf220dd103783d64fcac2e52945e96f736918abc2d8e84c768dc0
(chain: dev50-driver proposal -> acting-orch -> dev50-planner CLEAR ->
PM CONFIRM 2026-08-04 ~20:55Z):
- 'none' = the recorded deliberate choice: third origin deliberate_none,
NEVER resolves to any file (no resolvedTarget/declaringDir — the A3
no-squatting fence holds by construction), launchPosture floor —
IDENTICAL to absent; the entire change is record/provenance.
- The one vocab site (PolicyRefOrigin) extended; tsc-total consumers
widened at the rig-repository provenance setters (6 sites). policy-spec
PolicySource is a different vocabulary and is untouched.
- Discovery renders the three-way distinction: absent stays verbatim
'permission_policy absent; launch_posture=floor'; deliberate none
renders 'permission_policy: none (deliberate choice — recorded);
launch_posture=floor'.
- The sealed A3 'none'->error pin flip is this amendment's ONE sanctioned
sealed-surface change, cited by ruled-form hash in the pin (S19
precedent). New pins: never-resolves-by-construction (throwing reader),
near-miss custom-ref distinction, P1 HONESTY CRUX (absent never
rewritten/upgraded/reported as deliberate_none — discovery + persisted
rows), P2 POSTURE-IDENTITY (byte-equal floor claims, record-only
difference; provenance rows carry the choice). P3 is Lane-B's.
RED-first from assembled tip 9ed3b41a (5 pins failing pre-edit). Gates:
policy family 67/67 · daemon tsc/lint · daemon build. Never push.
Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
9ed3b41ae1
commit
05931d336a
5 files changed
+181
-11
No files matched your search
@@ -7,7 +7,9 @@
|
||||
// - a RELATIVE custom path (A2), resolved relative to the DECLARING RigSpec dir (origin=custom);
|
||||
// absolute / `..` traversal / empty segments = STRUCTURED error (a spec defect, NOT a floor
|
||||
// fallback). Reuses the established safe-path discipline (path-safety.validateSafePath).
|
||||
// - `none` (A3) is RESERVED → structured error.
|
||||
// - `none` = the RECORDED DELIBERATE choice (RULED-FORM-deliberate-none-2026-08-04,
|
||||
// sha256 5f37e40f — the A3 reservation ACTIVATED by its own amendment): third origin
|
||||
// deliberate_none, never resolves to any file, posture identical to absent (floor).
|
||||
// - ABSENT (no value) = the floor (honest absence) — the CALLER passes undefined; not an error.
|
||||
// Built-in ASSET packaging is a LATER leg: builtin resolution here is REF-SEMANTICS (prefix→origin),
|
||||
// it does NOT read or require the asset file to exist.
|
||||
@@ -20,7 +22,8 @@ import type { LaunchPosture, PolicySurface } from "./policy-spec.js";
|
||||
/** The packaged read-only built-in policy set (README v4: 3 Policy-Mode specs + Operator/YOLO). */
|
||||
export const BUILTIN_POLICY_NAMES = ["locked", "standard", "open", "yolo"] as const;
|
||||
export type BuiltinPolicyName = (typeof BUILTIN_POLICY_NAMES)[number];
|
||||
export type PolicyRefOrigin = "builtin" | "custom";
|
||||
/** deliberate_none: the ruled amendment 5f37e40f — the recorded choice; never file-backed. */
|
||||
export type PolicyRefOrigin = "builtin" | "custom" | "deliberate_none";
|
||||
|
||||
const BUILTIN_PREFIX = "builtin:";
|
||||
|
||||
@@ -48,7 +51,9 @@ export function validatePermissionPolicyRef(value: unknown, label: string): stri
|
||||
return `${label}: permission_policy must be a non-empty string ref`;
|
||||
}
|
||||
if (value === "none") {
|
||||
return `${label}: 'none' is reserved for the deliberate-none representation landing with the onboarding leg`;
|
||||
// RULED amendment (5f37e40f): the A3-reserved literal IS the recorded
|
||||
// deliberate choice — valid; classification/resolution handle it below.
|
||||
return null;
|
||||
}
|
||||
if (value.startsWith(BUILTIN_PREFIX)) {
|
||||
const name = value.slice(BUILTIN_PREFIX.length);
|
||||
@@ -158,6 +163,18 @@ export function resolvePermissionPolicyAttachment(
|
||||
declaringDir: string,
|
||||
deps: PolicyResolveDeps,
|
||||
): ResolvedPolicyAttachment {
|
||||
if (ref === "none") {
|
||||
// RULED amendment (5f37e40f): recorded deliberate choice. NEVER resolves to
|
||||
// any file (no resolvedTarget/declaringDir — the A3 no-squatting fence
|
||||
// holds because 'none' stays unreferenceable); posture IDENTICAL to absent
|
||||
// (zero privilege delta — the entire change is record/provenance).
|
||||
return {
|
||||
ref,
|
||||
origin: "deliberate_none",
|
||||
launchPosture: "floor",
|
||||
contentResolved: true, // semantics fully known by construction (like builtins)
|
||||
};
|
||||
}
|
||||
if (ref.startsWith(BUILTIN_PREFIX)) {
|
||||
const builtinName = ref.slice(BUILTIN_PREFIX.length) as BuiltinPolicyName;
|
||||
return {
|
||||
|
||||
@@ -193,7 +193,7 @@ export class RigRepository {
|
||||
setRigPolicyProvenance(
|
||||
rigId: string,
|
||||
provenance: {
|
||||
origin: "builtin" | "custom";
|
||||
origin: "builtin" | "custom" | "deliberate_none";
|
||||
resolvedTarget: string | null;
|
||||
declaringDir: string | null;
|
||||
launchPosture: "floor" | "full_bypass";
|
||||
@@ -207,7 +207,7 @@ export class RigRepository {
|
||||
|
||||
/** Seam B Guard-F1 — read the rig-level resolved attachment provenance (null when none). */
|
||||
getRigPolicyProvenance(rigId: string): {
|
||||
origin: "builtin" | "custom";
|
||||
origin: "builtin" | "custom" | "deliberate_none";
|
||||
resolvedTarget: string | null;
|
||||
declaringDir: string | null;
|
||||
launchPosture: "floor" | "full_bypass";
|
||||
@@ -226,7 +226,7 @@ export class RigRepository {
|
||||
} | undefined;
|
||||
if (!row || row.rig_policy_origin == null || row.rig_policy_launch_posture == null) return null;
|
||||
return {
|
||||
origin: row.rig_policy_origin as "builtin" | "custom",
|
||||
origin: row.rig_policy_origin as "builtin" | "custom" | "deliberate_none",
|
||||
resolvedTarget: row.rig_policy_resolved_target,
|
||||
declaringDir: row.rig_policy_declaring_dir,
|
||||
launchPosture: row.rig_policy_launch_posture as "floor" | "full_bypass",
|
||||
@@ -241,7 +241,7 @@ export class RigRepository {
|
||||
setNodePolicyProvenance(
|
||||
nodeId: string,
|
||||
provenance: {
|
||||
origin: "builtin" | "custom";
|
||||
origin: "builtin" | "custom" | "deliberate_none";
|
||||
resolvedTarget: string | null;
|
||||
declaringDir: string | null;
|
||||
launchPosture: "floor" | "full_bypass";
|
||||
@@ -256,7 +256,7 @@ export class RigRepository {
|
||||
/** Seam B (R2) — read a node's persisted policy provenance; null when none attached
|
||||
* (or pre-057 DB). Restore consumers re-derive posture from this without the spec. */
|
||||
getNodePolicyProvenance(nodeId: string): {
|
||||
origin: "builtin" | "custom";
|
||||
origin: "builtin" | "custom" | "deliberate_none";
|
||||
resolvedTarget: string | null;
|
||||
declaringDir: string | null;
|
||||
launchPosture: "floor" | "full_bypass";
|
||||
@@ -275,7 +275,7 @@ export class RigRepository {
|
||||
} | undefined;
|
||||
if (!row || row.policy_origin == null || row.policy_launch_posture == null) return null;
|
||||
return {
|
||||
origin: row.policy_origin as "builtin" | "custom",
|
||||
origin: row.policy_origin as "builtin" | "custom" | "deliberate_none",
|
||||
resolvedTarget: row.policy_resolved_target,
|
||||
declaringDir: row.policy_declaring_dir,
|
||||
launchPosture: row.policy_launch_posture as "floor" | "full_bypass",
|
||||
|
||||
@@ -184,6 +184,13 @@ export function permissionPolicyDiscoveryWarnings(
|
||||
warnings.push(`${logicalId}: permission_policy absent; launch_posture=floor`);
|
||||
continue;
|
||||
}
|
||||
if (attachment.origin === "deliberate_none") {
|
||||
// RULED amendment (5f37e40f): the three-way distinction renders — a
|
||||
// RECORDED choice is not absence; the posture claim stays byte-equal
|
||||
// to the absent floor (P2), only the record wording differs.
|
||||
warnings.push(`${logicalId}: permission_policy: none (deliberate choice — recorded); launch_posture=floor`);
|
||||
continue;
|
||||
}
|
||||
warnings.push(`${logicalId}: permission_policy ref="${attachment.ref}" origin=${attachment.origin} launch_posture=${attachment.launchPosture}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
// DELIBERATE-NONE AMENDMENT (Lane-A hop 2) — pins for the RULED FORM OF RECORD
|
||||
// `RULED-FORM-deliberate-none-2026-08-04.md` sha256
|
||||
// 5f37e40fbcdcf220dd103783d64fcac2e52945e96f736918abc2d8e84c768dc0 (PM-confirmed):
|
||||
// `permission_policy: none` = the recorded deliberate choice; third origin
|
||||
// `deliberate_none`; NEVER resolves to any file; posture IDENTICAL to absent
|
||||
// (zero privilege delta — the change is record/provenance only).
|
||||
// P1 (HONESTY CRUX) and P2 (POSTURE-IDENTITY) are the ruled form's pin-required
|
||||
// invariants for this lane; P3 (write-on-explicit-selection-only) is Lane-B's.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
resolvePermissionPolicyAttachment,
|
||||
validatePermissionPolicyRef,
|
||||
} from "../src/domain/permission-policy/policy-ref.js";
|
||||
import { rigPreflight } from "../src/domain/rigspec-preflight.js";
|
||||
import type { AgentResolverFsOps } from "../src/domain/agent-resolver.js";
|
||||
import { createFullTestDb, createTestApp } from "./helpers/test-app.js";
|
||||
|
||||
const AGENT_YAML = `name: impl
|
||||
version: "1.0.0"
|
||||
resources:
|
||||
skills: []
|
||||
profiles:
|
||||
default:
|
||||
uses:
|
||||
skills: []
|
||||
`;
|
||||
|
||||
function fsOps(): AgentResolverFsOps {
|
||||
return {
|
||||
exists: (p) => p.includes("agents/impl"),
|
||||
readFile: (p) => {
|
||||
if (p.includes("agents/impl")) return AGENT_YAML;
|
||||
throw new Error(`not found: ${p}`);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function rigYaml(policyLine: string): string {
|
||||
return `version: "0.2"
|
||||
name: deliberate-none-probe
|
||||
${policyLine}pods:
|
||||
- id: dev
|
||||
label: Dev
|
||||
members:
|
||||
- id: impl
|
||||
runtime: claude-code
|
||||
agent_ref: local:agents/impl
|
||||
profile: default
|
||||
cwd: .
|
||||
edges: []
|
||||
`;
|
||||
}
|
||||
|
||||
describe("deliberate-none resolution (ruled form 5f37e40f)", () => {
|
||||
it("resolves 'none' to origin=deliberate_none, floor posture, and NEVER touches any file (reader that throws proves never-resolves-by-construction)", () => {
|
||||
const att = resolvePermissionPolicyAttachment("none", "/any/declaring/dir", {
|
||||
readFile: () => {
|
||||
throw new Error("deliberate_none must never read a file");
|
||||
},
|
||||
});
|
||||
expect(att.ref).toBe("none");
|
||||
expect(att.origin).toBe("deliberate_none");
|
||||
expect(att.launchPosture).toBe("floor");
|
||||
expect(att.resolvedTarget).toBeUndefined(); // unreferenceable — the A3 no-squatting fence holds
|
||||
expect(att.declaringDir).toBeUndefined();
|
||||
});
|
||||
|
||||
it("EXACTLY the literal 'none' is the token — near-miss spellings remain ordinary CUSTOM refs (valid paths, never deliberate_none)", () => {
|
||||
expect(validatePermissionPolicyRef("none", "permission_policy")).toBeNull();
|
||||
// 'None' and 'none.md' pass the A2 path charset as they always did — they
|
||||
// are custom FILE refs, not the token; resolution proves the distinction:
|
||||
for (const nearMiss of ["None", "none.md"]) {
|
||||
expect(validatePermissionPolicyRef(nearMiss, "permission_policy")).toBeNull();
|
||||
const att = resolvePermissionPolicyAttachment(nearMiss, "/x", { readFile: () => { throw new Error("missing"); } });
|
||||
expect(att.origin).toBe("custom"); // never the recorded-choice origin
|
||||
expect(att.origin).not.toBe("deliberate_none");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("P1 HONESTY CRUX — an ABSENT spec is NEVER rewritten, upgraded, or reported as deliberate_none", () => {
|
||||
it("preflight discovery on an ABSENT-policy spec reports absence verbatim — no deliberate_none anywhere", async () => {
|
||||
const result = await rigPreflight({
|
||||
rigSpecYaml: rigYaml(""),
|
||||
rigRoot: "/probe/root",
|
||||
fsOps: fsOps(),
|
||||
});
|
||||
expect(result.ready).toBe(true);
|
||||
const joined = result.warnings.join("\n");
|
||||
expect(joined).toContain("dev.impl: permission_policy absent; launch_posture=floor");
|
||||
expect(joined).not.toContain("deliberate_none");
|
||||
expect(joined).not.toContain("(deliberate choice");
|
||||
});
|
||||
|
||||
it("materialize of an ABSENT-policy spec persists NO policy provenance (null rows, never a fabricated 'none' record)", async () => {
|
||||
const db = createFullTestDb();
|
||||
try {
|
||||
const setup = createTestApp(db, { podInstantiatorFsOps: fsOps() });
|
||||
const outcome = await setup.podInstantiator.materialize(rigYaml(""), "/probe/root");
|
||||
expect(outcome.ok).toBe(true);
|
||||
if (!outcome.ok) return;
|
||||
const row = db.prepare(
|
||||
"SELECT policy_origin, policy_launch_posture FROM nodes WHERE logical_id = 'dev.impl'",
|
||||
).get() as { policy_origin: string | null; policy_launch_posture: string | null };
|
||||
expect(row.policy_origin).toBeNull(); // absent means absent — a legacy spec never claims a choice nobody made
|
||||
expect(row.policy_launch_posture).toBeNull();
|
||||
const rig = db.prepare("SELECT permission_policy FROM rigs LIMIT 1").get() as { permission_policy: string | null };
|
||||
expect(rig.permission_policy).toBeNull();
|
||||
} finally {
|
||||
db.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("P2 POSTURE-IDENTITY — absent and none differ ONLY in the record", () => {
|
||||
it("discovery: both report launch_posture=floor; only the record wording differs; materialize succeeds identically (201-class outcome both)", async () => {
|
||||
const absent = await rigPreflight({ rigSpecYaml: rigYaml(""), rigRoot: "/probe/root", fsOps: fsOps() });
|
||||
const none = await rigPreflight({ rigSpecYaml: rigYaml("permission_policy: none\n"), rigRoot: "/probe/root", fsOps: fsOps() });
|
||||
expect(absent.ready).toBe(true);
|
||||
expect(none.ready).toBe(true);
|
||||
const a = absent.warnings.find((w) => w.startsWith("dev.impl: permission_policy"))!;
|
||||
const n = none.warnings.find((w) => w.startsWith("dev.impl: permission_policy"))!;
|
||||
expect(a).toMatch(/launch_posture=floor$/);
|
||||
expect(n).toMatch(/launch_posture=floor$/); // BYTE-IDENTICAL posture claim
|
||||
expect(n).toContain("deliberate choice — recorded"); // the record is the ONLY difference
|
||||
expect(a).toContain("absent");
|
||||
});
|
||||
|
||||
it("attachment posture equality: resolve('none') posture === the absent floor; persisted provenance carries the deliberate_none record", async () => {
|
||||
const att = resolvePermissionPolicyAttachment("none", "/x", { readFile: () => { throw new Error("no read"); } });
|
||||
expect(att.launchPosture).toBe("floor"); // identical privilege to absent — zero delta
|
||||
const db = createFullTestDb();
|
||||
try {
|
||||
const setup = createTestApp(db, { podInstantiatorFsOps: fsOps() });
|
||||
const outcome = await setup.podInstantiator.materialize(rigYaml("permission_policy: none\n"), "/probe/root");
|
||||
expect(outcome.ok).toBe(true);
|
||||
const row = db.prepare(
|
||||
"SELECT policy_origin, policy_launch_posture FROM nodes WHERE logical_id = 'dev.impl'",
|
||||
).get() as { policy_origin: string | null; policy_launch_posture: string | null };
|
||||
expect(row.policy_origin).toBe("deliberate_none"); // the recorded thought IS provenance
|
||||
expect(row.policy_launch_posture).toBe("floor");
|
||||
} finally {
|
||||
db.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -45,8 +45,8 @@ describe("permission_policy ref — validate (A1/A2/A3)", () => {
|
||||
expect(validatePermissionPolicyRef("a//b.md", "permission_policy")).toMatch(/empty|segment/i);
|
||||
});
|
||||
|
||||
it("reserves the literal 'none' (structured error, not floor)", () => {
|
||||
expect(validatePermissionPolicyRef("none", "permission_policy")).toMatch(/reserved/i);
|
||||
it("'none' is the recorded DELIBERATE choice — VALID per the ruled amendment (RULED-FORM-deliberate-none-2026-08-04, sha256 5f37e40f; supersedes the A3 reservation error, the amendment's ONE sanctioned sealed-surface change)", () => {
|
||||
expect(validatePermissionPolicyRef("none", "permission_policy")).toBeNull();
|
||||
});
|
||||
|
||||
it("rejects empty / whitespace-only", () => {
|
||||
|
||||
Reference in new issue
Block a user