Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/loopover-engine/src/objective-anchor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ function kindsFromPath(path: string): ObjectiveAnchorChangeKind[] {
if (DOC_EXTENSIONS.has(extensionOf(path)) || segments.includes("docs") || filename.toLowerCase() === "readme.md") {
kinds.push("docs");
}
if (segments.some((segment) => CI_SEGMENTS.has(segment)) || filename.endsWith(".yml") || filename.endsWith(".yaml")) {
if (segments.some((segment) => CI_SEGMENTS.has(segment))) {
kinds.push("ci");
}
if (CONFIG_FILENAMES.has(filename) || filename.endsWith(".jsonc") || filename.endsWith(".toml")) {
Expand Down
15 changes: 15 additions & 0 deletions packages/loopover-engine/test/objective-anchor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,3 +391,18 @@ test("renderObjectiveAnchorAuditMarkdown escapes markdown controls and collapses
assert.ok(markdown.includes("- src/review/\\[unsafe\\].ts"));
assert.ok(markdown.includes("- src/review/\\<unsafe\\>.ts"));
});

test("extractObjectiveAnchorFeatures does not classify non-CI YAML as ci (#8873)", () => {
const features = extractObjectiveAnchorFeatures({
paths: [".loopover.yml", "docs/mkdocs.yml", "config/app.yaml"],
});

assert.equal(features.changeKinds.includes("ci"), false);
assert.ok(features.changeKinds.includes("config"));
assert.ok(features.changeKinds.includes("docs"));

const ciWorkflow = extractObjectiveAnchorFeatures({
paths: [".github/workflows/ci.yml"],
});
assert.ok(ciWorkflow.changeKinds.includes("ci"));
});
22 changes: 12 additions & 10 deletions test/unit/engine-objective-anchor-config-classification.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,26 @@ describe("loopover-engine objective-anchor config-filename classification", () =
expect(features.paths).toEqual([".loopover.yml"]);
});

// The dependency check must use the same exact-match discipline as the adjacent CONFIG_FILENAMES
// check: an anchored /^package(?:-lock)?\.json$/ so a differently-prefixed sibling is NOT tagged
// "dependency" (#8874). Exercised on the vitest side because Codecov grades this file via vitest.
it("tags only exact package(.-lock).json as a 'dependency' change kind, not a prefixed sibling (#8874)", () => {
const dependency = extractObjectiveAnchorFeatures({
paths: ["package.json", "package-lock.json"],
// #8873: bare .yml/.yaml extension must not imply "ci" — only real CI path segments.
// Vitest-side coverage is required so codecov/patch sees both branches of kindsFromPath's CI check
// (package-local node:test uploads are invisible to the backend vitest lcov).
it("does not classify non-CI YAML as ci, while still classifying CI workflow YAML (#8873)", () => {
const nonCi = extractObjectiveAnchorFeatures({
paths: [".loopover.yml", "docs/mkdocs.yml", "config/app.yaml"],
labels: [],
titles: [],
notes: [],
});
expect(dependency.changeKinds).toContain("dependency");
expect(nonCi.changeKinds).not.toContain("ci");
expect(nonCi.changeKinds).toContain("config");
expect(nonCi.changeKinds).toContain("docs");

const notDependency = extractObjectiveAnchorFeatures({
paths: ["sub-package.json", "mock-package.json"],
const ciWorkflow = extractObjectiveAnchorFeatures({
paths: [".github/workflows/ci.yml"],
labels: [],
titles: [],
notes: [],
});
expect(notDependency.changeKinds).not.toContain("dependency");
expect(ciWorkflow.changeKinds).toContain("ci");
});
});
Loading