test(signals): exercise the gittensor_root arm of local-branch's metadataOnly condition - #8522
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
…dataOnly condition 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 JSONbored#8325
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-24 18:15:02 UTC
Review summary Nits — 4 non-blocking
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.
|
Summary
src/signals/local-branch.ts:497computes:"gittensor_root"appeared nowhere intest/unit/local-branch.test.ts(2600+ lines, every other mode covered) —grep -c gittensor_rootreturned0. This PR exercises that value, asserting through the user-facing effect the flag actually drives: themetadata_onlyentry inscorePreview.blockedBy("Preview used metadata-only inputs, so token and density estimates are rough.").Cases added:
localScorer.modemetadata_onlycaveatgittensor_rootexternal_commandmetadata_onlyTwo corrections to the issue's premise — flagged, not silently "fixed"
The issue asked me to note discrepancies for maintainer triage rather than change behavior. There are two:
1. The expected direction is inverted. The issue says to cover "one case where
mode: "gittensor_root"… makesmetadataOnlytrue". It cannot:gittensor_rootis the first thing the condition excludes, so that mode makesmetadataOnlyfalse — the mode means a real scorer ran, so the preview is not metadata-only. My tests assert the actual (and sensible) behavior. No production change made.2. This does not move a Codecov number, and I won't claim it does. The issue expects to "confirm via
npm run test:coveragethat the previously-uncoveredgittensor_rootbranch is now covered". I measured it: v8 emits exactly two branch entries for line 497 (BRDA:497,35,0/BRDA:497,35,1), and both were already taken before this PR — the existingexternal_commandtests already drive the conjunction's false arm. Baseline showed(497,'1'),(497,'1'); with my tests(497,'4'),(497,'3'). Both non-zero either way.So the gap this closes is semantic, not lcov-measurable: the specific
gittensor_rootvalue was never exercised, and v8's per-line branch model can't distinguish which operand caused the false result. The test's real value is pinning that a genuine scorer mode does not emit the metadata-only caveat to contributors — worth having, but I'd rather state its actual scope than overclaim a coverage delta.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.Closes #123) — a linked open issue is required for every contributor PR.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:
tsc --noEmitis clean andgit diff --checkpasses.codecov/patchhas no changed production lines to score; the scoped coverage run emits a non-emptycoverage/lcov.infocontainingsrc/signals/local-branch.ts(the suite imports it directly), satisfying the "Verify coverage report exists" step.test/unit/local-branch.test.ts's "classifies a type change (regular file replaced by a symlink) as unknown, not modified" fails on my Windows checkout because the sandbox cannot create real symlinks. I verified it fails identically with my change stashed, so it is environmental and untouched by this PR; the other 73 tests in the file pass.Safety
UI Evidencesection below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.UI Evidence
Not applicable — a unit-test addition; no visible UI, frontend, docs, or extension change.