test(signals): cover the gittensor_root branch of metadataOnly (#8325)#8509
Conversation
…ored#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.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-24 17:07:18 UTC
Review summary Nits — 3 non-blocking
CI checks failing
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionPartially addressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-tests-merge)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
Summary
buildLocalScoreInput'smetadataOnlycondition (src/signals/local-branch.ts:497,scorer?.mode !== "gittensor_root" && scorer?.mode !== "external_command") had zero test coverage for the"gittensor_root"comparison, despitetest/unit/local-branch.test.ts(2600+ lines) covering every otherlocalScorer.modevalue.mode: "gittensor_root"(metadataOnly isfalse— no"metadata_only"entry inscorePreview.blockedBy) versusmode: "metadata_only"(metadataOnly istrue— the entry is present). Pure test-addition; no production code inlocal-branch.tswas changed, per the issue's explicit scope.Note for a maintainer (per the issue's own instruction to note discrepancies rather than change behavior unilaterally): the issue description frames this as "
mode: 'gittensor_root'combined with the other half... makesmetadataOnlytrue." The actual condition is a double!==(not===), somode === "gittensor_root"always makes the first operandfalse, which always makes the whole&&false—metadataOnlycan never betruewhenmodeis"gittensor_root". The tests here cover the real, current behavior (verified against the actual source and confirmed by running them) rather than the issue text's framing, which appears to have inverted the comparison. Flagging this in case it's worth a maintainer double-checking whether the intended behavior was actually the opposite of what's shipped.Closes #8325
Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally;codecov/patchrequires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
test/unit/local-branch.test.ts(test-only, nosrc/production-code change) — no UI/MCP/workers/OpenAPI surface is affected. Verified vianpx vitest run test/unit/local-branch.test.ts: 74/75 tests pass, including both new ones. The single pre-existing failure (local MCP git metadata collection > classifies a type change (regular file replaced by a symlink) as unknown, not modified) is an unrelated, local-Windows-only environment limitation (git/filesystem symlink support requires elevated privileges on Windows) — confirmed by reproducing it identically on a clean stash of this branch's base commit before any of this PR's changes existed; it exercisescollectLocalBranchMetadata's git symlink handling, a function this PR does not touch. Coverage on the changed condition (verified directly againstcoverage/lcov.info): line 497's branch shows both outcomes hit (BRDA:497,35,0,2/BRDA:497,35,1,1).Safety
UI Evidencesection below with JPG/JPEG or PNG screenshots. (N/A — no visible UI changes.)Notes