Skip to content
Merged
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
5 changes: 4 additions & 1 deletion src/signals/focus-manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,10 @@ function normalizeSource(raw: FocusManifestSource | undefined, value: JsonValue

function normalizeOptionalGateMode(value: JsonValue | undefined, field: string, warnings: string[]): GateRuleMode | null {
if (value === undefined || value === null) return null;
if (value === "off" || value === "advisory" || value === "block") return value;
if (typeof value === "string") {
const normalized = value.trim().toLowerCase();
if (normalized === "off" || normalized === "advisory" || normalized === "block") return normalized;
}
warnings.push(`Manifest gate field "${field}" must be one of off, advisory, block; ignoring "${String(value)}".`);
return null;
}
Expand Down
12 changes: 12 additions & 0 deletions test/unit/focus-manifest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1543,6 +1543,18 @@ describe("parseFocusManifest review config", () => {
expect(parseFocusManifest({ review: reviewConfigToJson(chill.review) }).review).toEqual(chill.review);
});

it("parses gate tri-state modes case-insensitively like review.profile", () => {
const manifest = parseFocusManifest({
gate: { linkedIssue: "BLOCK", duplicates: "Advisory", size: { mode: "OFF" } },
settings: { linkedIssueGateMode: "Block" },
});
expect(manifest.gate.linkedIssue).toBe("block");
expect(manifest.gate.duplicates).toBe("advisory");
expect(manifest.gate.sizeMode).toBe("off");
expect(manifest.settings.linkedIssueGateMode).toBe("block");
expect(resolveEffectiveSettings({ linkedIssueGateMode: "off" } as RepositorySettings, manifest).linkedIssueGateMode).toBe("block");
});

it("ignores an invalid review.profile with a warning", () => {
const m = parseFocusManifest({ review: { profile: "spicy" } });
expect(m.review.profile).toBeNull();
Expand Down
Loading