From b412f16e63d0e2dc141d0f17c58c8c2ca96cc38e Mon Sep 17 00:00:00 2001 From: philluiz2323 Date: Fri, 24 Jul 2026 18:54:42 +0400 Subject: [PATCH] test(signals): cover the gittensor_root branch of metadataOnly (#8325) buildLocalScoreInput's metadataOnly condition (scorer?.mode !== "gittensor_root" && scorer?.mode !== "external_command") had zero test coverage for the "gittensor_root" comparison specifically, despite 2600+ lines of coverage for every other localScorer.mode value. Adds two tests exercising both outcomes: mode "gittensor_root" (metadataOnly false, no "metadata_only" blockedBy entry) contrasted with mode "metadata_only" (metadataOnly true, has the entry). Pure test-addition, no production logic changed. Note for a maintainer: the issue's description frames this as "gittensor_root combined with the other half... makes metadataOnly true", but the actual condition is a double !== (not ===), so mode "gittensor_root" always makes metadataOnly false, never true -- the tests here reflect the real, current behavior rather than the issue text's framing. --- test/unit/local-branch.test.ts | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/test/unit/local-branch.test.ts b/test/unit/local-branch.test.ts index 8d5fccfe27..5f307558f3 100644 --- a/test/unit/local-branch.test.ts +++ b/test/unit/local-branch.test.ts @@ -213,6 +213,46 @@ describe("local branch analysis", () => { expect(analysis.workspaceIntelligence.localScorerDiagnostics?.warnings).toHaveLength(MAX_LOCAL_SCORER_WARNING_COUNT); }); + it("REGRESSION (#8325): mode 'gittensor_root' is NOT metadata-only (the scorer ran the real gittensor_root binary, not a metadata-only fallback)", () => { + const analysis = buildLocalBranchAnalysis({ + input: { + login: "oktofeesh1", + repoFullName: repo.fullName, + changedFiles: [{ path: "src/scorer.ts", additions: 10, deletions: 0, status: "modified" }], + localScorer: { mode: "gittensor_root", sourceTokenScore: 48, totalTokenScore: 80, sourceLines: 46 }, + }, + repo, + issues: [], + pullRequests: [], + profile, + outcomeHistory, + scoringSnapshot, + scoringProfile, + }); + + expect(analysis.scorePreview.blockedBy).not.toEqual(expect.arrayContaining([expect.objectContaining({ code: "metadata_only" })])); + }); + + it("REGRESSION (#8325): mode 'metadata_only' IS metadata-only, contrasting the 'gittensor_root' case above (both operands of the metadataOnly && independently exercised)", () => { + const analysis = buildLocalBranchAnalysis({ + input: { + login: "oktofeesh1", + repoFullName: repo.fullName, + changedFiles: [{ path: "src/scorer.ts", additions: 10, deletions: 0, status: "modified" }], + localScorer: { mode: "metadata_only", sourceTokenScore: 48, totalTokenScore: 80, sourceLines: 46 }, + }, + repo, + issues: [], + pullRequests: [], + profile, + outcomeHistory, + scoringSnapshot, + scoringProfile, + }); + + expect(analysis.scorePreview.blockedBy).toEqual(expect.arrayContaining([expect.objectContaining({ code: "metadata_only" })])); + }); + it("projects a blocked local branch into a useful after-pending-merge scenario", () => { const pressuredHistory: ContributorOutcomeHistory = { ...outcomeHistory,