fix(pi-workflow): ignore config files in UI path detection
This commit is contained in:
@@ -76,6 +76,23 @@ test("backend workflow terminology does not imply a UI prototype", () => {
|
|||||||
assert.equal(result.impact, "none");
|
assert.equal(result.impact, "none");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("configuration files named settings do not imply a UI prototype", () => {
|
||||||
|
const result = enforceUiImpact({
|
||||||
|
plannerImpact: "none",
|
||||||
|
plannerEvidence: ["Configuration inventory only"],
|
||||||
|
affectedSurfaces: [],
|
||||||
|
facts: facts({
|
||||||
|
candidatePaths: [
|
||||||
|
"/home/user/.pi/agent/settings.json",
|
||||||
|
"config/settings.yaml",
|
||||||
|
],
|
||||||
|
tags: ["configuration", "security"],
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
assert.equal(result.impact, "none");
|
||||||
|
assert.equal(result.objectiveImpact, "none");
|
||||||
|
});
|
||||||
|
|
||||||
test("generic frontend evidence does not inflate a minor change", () => {
|
test("generic frontend evidence does not inflate a minor change", () => {
|
||||||
const result = enforceUiImpact({
|
const result = enforceUiImpact({
|
||||||
plannerImpact: "minor",
|
plannerImpact: "minor",
|
||||||
|
|||||||
@@ -41,6 +41,18 @@ const NON_TRIVIAL_PATH_PARTS = [
|
|||||||
"/settings/",
|
"/settings/",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const UI_SOURCE_SUFFIXES = [
|
||||||
|
".astro",
|
||||||
|
".css",
|
||||||
|
".html",
|
||||||
|
".jsx",
|
||||||
|
".less",
|
||||||
|
".scss",
|
||||||
|
".svelte",
|
||||||
|
".tsx",
|
||||||
|
".vue",
|
||||||
|
];
|
||||||
|
|
||||||
export interface UiImpactPolicyInput {
|
export interface UiImpactPolicyInput {
|
||||||
plannerImpact: UiImpact;
|
plannerImpact: UiImpact;
|
||||||
plannerEvidence: string[];
|
plannerEvidence: string[];
|
||||||
@@ -64,7 +76,13 @@ function objectiveEvidence(facts: WorkflowFacts) {
|
|||||||
}
|
}
|
||||||
for (const candidatePath of facts.candidatePaths) {
|
for (const candidatePath of facts.candidatePaths) {
|
||||||
const normalized = `/${candidatePath.toLowerCase().replaceAll("\\", "/")}`;
|
const normalized = `/${candidatePath.toLowerCase().replaceAll("\\", "/")}`;
|
||||||
if (NON_TRIVIAL_PATH_PARTS.some((part) => normalized.includes(part))) {
|
const isUiSource = UI_SOURCE_SUFFIXES.some((suffix) =>
|
||||||
|
normalized.endsWith(suffix),
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
isUiSource &&
|
||||||
|
NON_TRIVIAL_PATH_PARTS.some((part) => normalized.includes(part))
|
||||||
|
) {
|
||||||
evidence.push(`Affected path has non-trivial UI responsibility: ${candidatePath}`);
|
evidence.push(`Affected path has non-trivial UI responsibility: ${candidatePath}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user