Skip to content

Commit 27ea32e

Browse files
RealDiligentRealDiligent
andauthored
test(signals): exercise the gittensor_root arm of local-branch's metadataOnly condition (#8522)
metadataOnly is scorer?.mode !== "gittensor_root" && scorer?.mode !== "external_command" (local-branch.ts:497). Every other mode had cases; the literal "gittensor_root" appeared nowhere in this 2600-line suite, so that value was never exercised. Adds cases for gittensor_root (no metadata_only caveat), external_command (no caveat), and metadata_only / no-scorer (caveat present), asserting through the user-facing scorePreview.blockedBy entry the condition ultimately drives. Closes #8325 Co-authored-by: RealDiligent <nft.gold.eth@gmail.com>
1 parent 584bbbb commit 27ea32e

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

test/unit/local-branch.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2225,6 +2225,38 @@ describe("local MCP git metadata collection", () => {
22252225
expect(analysis.scenarioSummary.eligibilityNotes.length).toBeGreaterThan(0);
22262226
});
22272227

2228+
it("#8325: covers both operands of the metadataOnly condition, including the gittensor_root arm", () => {
2229+
// metadataOnly = scorer?.mode !== "gittensor_root" && scorer?.mode !== "external_command"
2230+
// (local-branch.ts:497). Every other mode was covered; "gittensor_root" had zero test cases, so the
2231+
// FIRST operand's false arm was never taken. These three cases exercise each operand independently.
2232+
const analyze = (localScorer?: { mode: string }) =>
2233+
buildLocalBranchAnalysis({
2234+
input: {
2235+
login: "oktofeesh1",
2236+
repoFullName: repo.fullName,
2237+
changedFiles: [{ path: "src/cache.ts", additions: 5, deletions: 0, status: "modified" }],
2238+
...(localScorer ? { localScorer: localScorer as never } : {}),
2239+
},
2240+
repo,
2241+
issues: [],
2242+
pullRequests: [],
2243+
profile,
2244+
outcomeHistory,
2245+
scoringSnapshot,
2246+
scoringProfile,
2247+
});
2248+
const hasMetadataOnly = (analysis: ReturnType<typeof buildLocalBranchAnalysis>) =>
2249+
analysis.scorePreview.blockedBy.some((entry) => entry.code === "metadata_only");
2250+
2251+
// Operand 1 FALSE (short-circuits): a real gittensor_root scorer ran, so the preview is NOT metadata-only.
2252+
expect(hasMetadataOnly(analyze({ mode: "gittensor_root" }))).toBe(false);
2253+
// Operand 1 TRUE, operand 2 FALSE: external_command is the other real-scorer mode.
2254+
expect(hasMetadataOnly(analyze({ mode: "external_command" }))).toBe(false);
2255+
// BOTH TRUE: any other mode (or no scorer at all) leaves the preview metadata-only.
2256+
expect(hasMetadataOnly(analyze({ mode: "metadata_only" }))).toBe(true);
2257+
expect(hasMetadataOnly(analyze())).toBe(true);
2258+
});
2259+
22282260
it("populates scenarioSummary.blockerNotes when the score preview has metadata-only signals", () => {
22292261
const analysis = buildLocalBranchAnalysis({
22302262
input: {

0 commit comments

Comments
 (0)