Skip to content

Commit d821cbd

Browse files
authored
fix(engine): protect the real post-#6203 autonomy/guardrail-config paths, not just their src/ shims (#8128)
src/settings/autonomy.ts and src/review/guardrail-config.ts are now 5-line re-export shims after #4879/#6203 moved the real logic into @loopover/engine. ENGINE_DECISION_GUARDRAIL_GLOBS still only listed the shim paths, so a PR editing the real autonomy deny-by-default dial, or silently narrowing this guardrail list itself, would touch only the packages/loopover-engine files and never trip the manual- review hold it should. Adds the real packages/loopover-engine paths alongside the existing shim entries. Closes #8012.
1 parent fbcba1e commit d821cbd

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

packages/loopover-engine/src/review/guardrail-config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ export const ENGINE_DECISION_GUARDRAIL_GLOBS = [
2727
"src/settings/agent-actions.ts",
2828
"src/settings/agent-execution.ts",
2929
"src/settings/agent-sweep.ts",
30+
// #8012: src/settings/autonomy.ts is now a 5-line re-export shim (#4879's #6203-era migration) -- the real,
31+
// substantive autonomy deny-by-default logic lives at the packages/loopover-engine path below. Both are kept:
32+
// the shim is still a real (if thin) file, and listing the real path is what actually protects the logic a
33+
// PR edit could otherwise change without ever touching the shim.
3034
"src/settings/autonomy.ts",
35+
"packages/loopover-engine/src/settings/autonomy.ts",
3136
"src/queue/**",
3237
"src/github/pr-actions.ts",
3338
"src/github/app.ts",
@@ -38,7 +43,11 @@ export const ENGINE_DECISION_GUARDRAIL_GLOBS = [
3843
"src/scoring/**",
3944
"src/auth/**",
4045
"src/review/safety.ts",
46+
// #8012: same shim/real split as autonomy.ts above -- src/review/guardrail-config.ts (this file's own
47+
// pre-migration twin) is a re-export shim; the real list edited here lives at the packages/loopover-engine
48+
// path below, so a PR silently narrowing DEFAULT_HARD_GUARDRAIL_GLOBS itself must trip this same guardrail.
4149
"src/review/guardrail-config.ts",
50+
"packages/loopover-engine/src/review/guardrail-config.ts",
4251
"src/review/cutover-gate.ts",
4352
"src/review/linked-issue-hard-rules.ts",
4453
"src/review/outcomes-wire.ts",

test/unit/guardrail-config.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import { describe, expect, it } from "vitest";
22
import {
33
CONFIG_AS_CODE_GUARDRAIL_GLOBS,
44
DEFAULT_HARD_GUARDRAIL_GLOBS,
5+
ENGINE_DECISION_GUARDRAIL_GLOBS,
56
resolveHardGuardrailGlobs,
67
} from "../../src/review/guardrail-config";
8+
import { isGuardrailHit } from "../../src/signals/change-guardrail";
79

810
describe("CONFIG_AS_CODE_GUARDRAIL_GLOBS", () => {
911
it("guards the .loopover.* config files", () => {
@@ -14,6 +16,27 @@ describe("CONFIG_AS_CODE_GUARDRAIL_GLOBS", () => {
1416
});
1517
});
1618

19+
// #8012: src/settings/autonomy.ts and src/review/guardrail-config.ts (the #6203-era migration's pre-migration
20+
// paths, still listed above for their own sake) are now 5-line re-export shims -- the real, substantive logic
21+
// a contributor PR could edit lives at the packages/loopover-engine paths below. A PR touching only the real
22+
// path, never the shim, must still trip the guardrail.
23+
describe("ENGINE_DECISION_GUARDRAIL_GLOBS — post-#6203-migration real paths (#8012)", () => {
24+
it("lists both the real autonomy.ts and guardrail-config.ts engine-package paths, alongside their src/ shims", () => {
25+
expect(ENGINE_DECISION_GUARDRAIL_GLOBS).toContain("packages/loopover-engine/src/settings/autonomy.ts");
26+
expect(ENGINE_DECISION_GUARDRAIL_GLOBS).toContain("src/settings/autonomy.ts");
27+
expect(ENGINE_DECISION_GUARDRAIL_GLOBS).toContain("packages/loopover-engine/src/review/guardrail-config.ts");
28+
expect(ENGINE_DECISION_GUARDRAIL_GLOBS).toContain("src/review/guardrail-config.ts");
29+
});
30+
31+
it("a PR touching only the real autonomy.ts path (never its shim) still trips the hard guardrail", () => {
32+
expect(isGuardrailHit(["packages/loopover-engine/src/settings/autonomy.ts"], DEFAULT_HARD_GUARDRAIL_GLOBS)).toBe(true);
33+
});
34+
35+
it("a PR touching only the real guardrail-config.ts path (never its shim) still trips the hard guardrail", () => {
36+
expect(isGuardrailHit(["packages/loopover-engine/src/review/guardrail-config.ts"], DEFAULT_HARD_GUARDRAIL_GLOBS)).toBe(true);
37+
});
38+
});
39+
1740
describe("resolveHardGuardrailGlobs", () => {
1841
it("uses invariant guardrails when effective settings omit hardGuardrailGlobs", () => {
1942
expect(resolveHardGuardrailGlobs(undefined)).toEqual(DEFAULT_HARD_GUARDRAIL_GLOBS);

0 commit comments

Comments
 (0)