fix(reference)!: preserve exclusion rule provenance

Record the exact matching pattern and distinguish project, default, caller, and configured-sensitive exclusions without changing ignore ordering. Include that provenance in graph commitments and validate the contract through compiled CLI and MCP consumers.

BREAKING CHANGE: Pattern-based reference graph exclusions require pattern and distinguish project-ignored and default-ignored reasons. Re-import saved graphs that omit matching patterns.
This commit is contained in:
morluto
2026-10-11 04:15:26 +08:00
parent be44b5098e
commit 6585293c56
9 changed files with 318 additions and 32 deletions
+26 -2
View File
@@ -175,7 +175,11 @@ describe("historical source graph", () => {
},
(input: HistoricalSourceGraphInput) => {
input.exclusions = [
{ path: "private.env", reason: "configured-secret" },
{
path: "private.env",
reason: "configured-secret",
pattern: ".env",
},
];
input.inventory_state = "partial";
},
@@ -188,6 +192,20 @@ describe("historical source graph", () => {
}
});
it("commits the matched pattern for each exclusion", () => {
const graphWith = (pattern: string) =>
createHistoricalSourceGraph({
...graphInput(),
inventory_state: "partial",
exclusions: [
{ path: "private.env", reason: "configured-secret", pattern },
],
});
expect(graphWith(".env").root_sha256).not.toBe(
graphWith("*.env").root_sha256,
);
});
it("retains actual external targets and rejects placeholder targets", () => {
const input = { ...graphInput(), inventory_state: "partial" as const };
input.entries[2] = symlinkEntry({
@@ -300,7 +318,13 @@ describe("partial historical source graphs", () => {
{ entries: partial.entries },
{ parse_failures: partial.parse_failures },
{
exclusions: [{ path: "secret", reason: "configured-secret" as const }],
exclusions: [
{
path: "secret",
reason: "configured-secret" as const,
pattern: "secret",
},
],
},
{ limitations: ["Incomplete"] },
{