Skip to content

Commit b412f16

Browse files
committed
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.
1 parent 39ee47a commit b412f16

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

test/unit/local-branch.test.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,46 @@ describe("local branch analysis", () => {
213213
expect(analysis.workspaceIntelligence.localScorerDiagnostics?.warnings).toHaveLength(MAX_LOCAL_SCORER_WARNING_COUNT);
214214
});
215215

216+
it("REGRESSION (#8325): mode 'gittensor_root' is NOT metadata-only (the scorer ran the real gittensor_root binary, not a metadata-only fallback)", () => {
217+
const analysis = buildLocalBranchAnalysis({
218+
input: {
219+
login: "oktofeesh1",
220+
repoFullName: repo.fullName,
221+
changedFiles: [{ path: "src/scorer.ts", additions: 10, deletions: 0, status: "modified" }],
222+
localScorer: { mode: "gittensor_root", sourceTokenScore: 48, totalTokenScore: 80, sourceLines: 46 },
223+
},
224+
repo,
225+
issues: [],
226+
pullRequests: [],
227+
profile,
228+
outcomeHistory,
229+
scoringSnapshot,
230+
scoringProfile,
231+
});
232+
233+
expect(analysis.scorePreview.blockedBy).not.toEqual(expect.arrayContaining([expect.objectContaining({ code: "metadata_only" })]));
234+
});
235+
236+
it("REGRESSION (#8325): mode 'metadata_only' IS metadata-only, contrasting the 'gittensor_root' case above (both operands of the metadataOnly && independently exercised)", () => {
237+
const analysis = buildLocalBranchAnalysis({
238+
input: {
239+
login: "oktofeesh1",
240+
repoFullName: repo.fullName,
241+
changedFiles: [{ path: "src/scorer.ts", additions: 10, deletions: 0, status: "modified" }],
242+
localScorer: { mode: "metadata_only", sourceTokenScore: 48, totalTokenScore: 80, sourceLines: 46 },
243+
},
244+
repo,
245+
issues: [],
246+
pullRequests: [],
247+
profile,
248+
outcomeHistory,
249+
scoringSnapshot,
250+
scoringProfile,
251+
});
252+
253+
expect(analysis.scorePreview.blockedBy).toEqual(expect.arrayContaining([expect.objectContaining({ code: "metadata_only" })]));
254+
});
255+
216256
it("projects a blocked local branch into a useful after-pending-merge scenario", () => {
217257
const pressuredHistory: ContributorOutcomeHistory = {
218258
...outcomeHistory,

0 commit comments

Comments
 (0)