Skip to content

test(signals): exercise the gittensor_root arm of local-branch's metadataOnly condition - #8522

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-gittensor-root-cov-8325
Jul 24, 2026
Merged

test(signals): exercise the gittensor_root arm of local-branch's metadataOnly condition#8522
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-gittensor-root-cov-8325

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

src/signals/local-branch.ts:497 computes:

metadataOnly: scorer?.mode !== "gittensor_root" && scorer?.mode !== "external_command",

"gittensor_root" appeared nowhere in test/unit/local-branch.test.ts (2600+ lines, every other mode covered) — grep -c gittensor_root returned 0. This PR exercises that value, asserting through the user-facing effect the flag actually drives: the metadata_only entry in scorePreview.blockedBy ("Preview used metadata-only inputs, so token and density estimates are rough.").

Cases added:

localScorer.mode metadata_only caveat operand exercised
gittensor_root ❌ absent 1st operand false (short-circuits)
external_command ❌ absent 1st true, 2nd false
metadata_only ✅ present both true
(no scorer) ✅ present both true, undefined-scorer path

Two 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" … makes metadataOnly true". It cannot: gittensor_root is the first thing the condition excludes, so that mode makes metadataOnly false — 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:coverage that the previously-uncovered gittensor_root branch 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 existing external_command tests 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_root value 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

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires ≥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:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • Test-only diff (one file, +32 lines): no workflow, MCP, UI, worker, or dependency surface is touched, so those checks are not exercised. Root tsc --noEmit is clean and git diff --check passes.
  • codecov/patch has no changed production lines to score; the scoped coverage run emits a non-empty coverage/lcov.info containing src/signals/local-branch.ts (the suite imports it directly), satisfying the "Verify coverage report exists" step.
  • Pre-existing unrelated failure: 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

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section 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.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

UI Evidence

Not applicable — a unit-test addition; no visible UI, frontend, docs, or extension change.

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 24, 2026 18:06
@superagent-security

Copy link
Copy Markdown
Contributor

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
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 24, 2026
@loopover-orb

loopover-orb Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-24 18:15:02 UTC

1 file · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
The AI review returned non-blocking notes for this change but did not include a separate narrative summary. Review the nits below before deciding this PR.

Nits — 4 non-blocking
  • The test references issue `Add test coverage for local-branch.ts's gittensor_root metadataOnly branch #8325` in its name/comments while the PR itself is numbered test(signals): exercise the gittensor_root arm of local-branch's metadataOnly condition #8522 — worth double-checking that `Add test coverage for local-branch.ts's gittensor_root metadataOnly branch #8325` is in fact the tracked issue this closes, since a mismatched number in test titles can mislead future readers.
  • The four assertions in the single `it` block each check a different operand combination; splitting into four `it.each` or separate `it` blocks would make failures more precisely localized, though this is purely stylistic given the existing file's convention of large multi-assertion tests.
  • Consider using `it.each` for the four `(mode, expected)` pairs in test/unit/local-branch.test.ts to reduce duplication and make the operand-coverage mapping table in the description directly visible in code.
  • If the issue's coverage-tool claim is verifiably wrong as stated in the PR body, consider a one-line comment in the test itself referencing that this exercises the branch for behavioral confidence, not for closing a coverage gap, since a future reader skimming just the test won't see the PR description's caveat.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #8325
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 366 registered-repo PR(s), 146 merged, 37 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 366 PR(s), 37 issue(s).
Improvement ℹ️ Insufficient signal risk: clean · value: insufficient-signal · LLM: minor
Linked issue satisfaction

Partially addressed
The PR adds a test that exercises the gittensor_root mode and asserts the metadataOnly-derived caveat behaves as designed, and independently exercises the external_command operand and the true/true case, which is real progress on the coverage gap. However, the PR explicitly states that the gittensor_root branch was already covered by existing external_command tests at the branch-coverage level (bo

Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 366 PR(s), 37 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask 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.

  • @loopover ask <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

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.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 27ea32e into JSONbored:main Jul 24, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add test coverage for local-branch.ts's gittensor_root metadataOnly branch

1 participant