Skip to content

chore(guards): #9860 items 1, 4 and 5 — derive one list, pin one registry, write down the coverage rule - #9949

Merged
JSONbored merged 2 commits into
mainfrom
chore/focus-manifest-registry-guard-9860
Jul 30, 2026
Merged

chore(guards): #9860 items 1, 4 and 5 — derive one list, pin one registry, write down the coverage rule#9949
JSONbored merged 2 commits into
mainfrom
chore/focus-manifest-registry-guard-9860

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Refs #9860. Three of its five items, bundled — each is small and independently reviewable.

Item 1 — a hand-typed list that had already drifted

loopover-mcp --help's LOOPOVER_LOGIN line named its commands as prose, and it was wrong: it omitted contributor-profile, explain-review-risk and watch, all three of which accept --login and resolve it through the same resolveLogin fallback. Anyone reading --help was told those commands would not pick up their configured login. They do.

Derived from CLI_COMMAND_SPEC now. resolveLogin is the single helper and always falls back to LOOPOVER_LOGIN ?? GITHUB_LOGIN, and its 13 call sites correspond exactly to the 13 commands declaring --login in usage — so the usage table is the fact to read, not a second list to keep in step.

Item 1's other three surfaces, and item 2, were already closed by the MCP contract epic — I verified rather than assumed. STDIO_TOOL_DESCRIPTORS derives from STDIO_TOOL_NAMES, printHelp's command list from CLI_COMMAND_SPEC, the README block is generated by mcp:tool-reference, and the stdio bin declares zero zod shapes of its own (all 119 z. uses are z.infer over contract-imported schemas). This line was the one hand-maintained list left in that surface.

Item 4 — the focus-manifest registry

FOCUS_MANIFEST_TOP_LEVEL_FIELDS is 28 hand-kept keys whose doc comment claims it is "every top-level key parseFocusManifest actually reads". Nothing checked that, and it is load-bearing both ways:

  • a key the parser reads but the list omits ⇒ the validator reports a working setting as an unknown field;
  • a key in the list the parser never reads ⇒ worse: the validator blesses it, the runtime ignores it, and the operator's setting silently does nothing while every surface says it is fine.

Now computed from the parser's own source. Currently in sync at 28/28 — this pins today's state rather than fixing a live bug, which is the point, since #9813 and #9821 each shipped from missing one of this registry's touchpoints.

Source-scanned deliberately: the failure mode is a key the parser reads and the list forgot, which by construction produces no behavioural difference to assert on. Includes an anti-vacuity check — a refactor renaming the local would otherwise empty both sets and make the assertions pass while checking nothing.

Not guarded: the parse/serialize pairing. Four parsers (AutoReview, MaxFindings, SelfHostAiModel, Visual) have no *ConfigToJson of their own because they are nested under the review config and serialized through it. A naive 1:1 check fires four false positives, and a checker that cries wolf gets muted — so I left it, rather than shipping a guard that trains people to ignore it.

Item 5 — the coverage asymmetry, written down

packages/loopover-engine/src/** is credited by two uploads whose hits Codecov unions, and the two runs disagree about which lines exist (c8 --all instruments files no test imports; v8 does not). A genuinely 100%-tested engine change can therefore land at ~65% on codecov/patch (hit on #9821, and again in this session). The rule is now in the contributor skill: change engine source ⇒ add the test to packages/loopover-engine/test/** as well.

This also corrects AGENTS.md, which stated that only src/** is measured. Untrue since the engine flag, and misleading in exactly the direction that costs someone a PR.

And it records the issue's own closing note: ui:typecheck is in test:ci but not in the root typecheck, so a locally-clean type change can still break apps/** (#9815 shipped exactly that).

Validation

  • Full test/unit + test/integration: 25,761 passed, 0 failures.
  • Full sweep of all 36 check-* scripts: none failing.
  • ui:lint / ui:typecheck clean (warnings only, all pre-existing); ui:test 1,092 passing.
  • Both new guards mutation-verified: dropping a declared key fails, adding an unparsed key fails, and a wrong --login list fails both help tests — including the negative direction, since login is itself a command whose name is a substring of the flag and would pass a naive check.

…verage asymmetry

Refs #9860 (items 4 and 5).

ITEM 4. FOCUS_MANIFEST_TOP_LEVEL_FIELDS is a hand-kept list of 28 keys whose doc
comment claims it is every top-level key parseFocusManifest actually reads.
Nothing checked that claim, and it is load-bearing both ways: a key the parser
reads but the list omits is reported to operators as an unknown field, while a
key in the list the parser never reads is worse -- the validator blesses it, the
runtime ignores it, and the operator's setting silently does nothing while every
surface says it is fine. #9813 and #9821 each shipped a bug from missing one of
this registry's touchpoints.

The relation is now computed from the parser's own source rather than trusted.
Currently in sync at 28/28, so this pins today's state rather than fixing a live
bug. Source-scanned deliberately: the failure is a key the parser reads and the
list forgot, which produces no behavioural difference to assert on. Includes an
anti-vacuity check, because a refactor renaming the local would otherwise empty
both sets and make the assertions pass while checking nothing.

Not guarded: the parse/serialize pairing. Four parsers (AutoReview, MaxFindings,
SelfHostAiModel, Visual) have no *ConfigToJson of their own because they are
nested under the review config and serialized through it, so a naive 1:1 check would fire
four false positives -- and a checker that cries wolf gets muted.

ITEM 5. The engine coverage asymmetry is now a contributor-facing rule rather
than folklore. packages/loopover-engine/src/** is credited by two uploads whose
hits Codecov unions, and the two runs disagree about which lines exist (c8 --all
instruments files no test imports; v8 does not), so a genuinely 100%-tested
engine change can land at ~65% on codecov/patch. The rule: change engine source,
add the test to packages/loopover-engine/test/** as well.

Also corrects AGENTS.md, which stated that only src/** is measured -- untrue
since the engine flag, and misleading in exactly the direction that costs a PR.

And records the issue's own closing note: ui:typecheck is in test:ci but not in
the root typecheck script, so a locally-clean type change can still break
apps/** (#9815).
…typing it

Refs #9860 (item 1).

The LOOPOVER_LOGIN line in `loopover-mcp --help` named its commands as hand-typed
prose, and it had already drifted: it omitted contributor-profile,
explain-review-risk and watch, all three of which accept --login and resolve it
through the same resolveLogin fallback. A user reading --help was told those
commands would not pick up their configured login. They do.

Derived from CLI_COMMAND_SPEC now -- every command declaring --login in its usage
resolves it that way, and resolveLogin is the single helper that does it, so the
usage table is the fact to read rather than a second list to keep in step.

Also drops a no-op .replace() on the usage line beside it.

Items 1 and 2 of #9860 are otherwise already closed by the MCP contract epic:
STDIO_TOOL_DESCRIPTORS derives from STDIO_TOOL_NAMES, printHelp's command list
derives from CLI_COMMAND_SPEC, the README block is generated by
mcp:tool-reference, and the stdio bin now declares no zod shapes of its own --
all 119 z. uses are z.infer over contract-imported schemas. This line was the
one hand-maintained list left in that surface.
@loopover-orb

loopover-orb Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Warning

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-30 20:29:22 UTC

5 files · 1 AI reviewer · 1 blocker · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
This PR derives the LOOPOVER_LOGIN help-line command list from CLI_COMMAND_SPEC instead of a hand-typed prose string that had already drifted (missing contributor-profile, explain-review-risk, watch), adds a scanning test that computes FOCUS_MANIFEST_TOP_LEVEL_FIELDS parity against the parser's actual reads, and documents the dual-upload Codecov gotcha for packages/loopover-engine/src. All three changes are narrow, self-verifying (tests check the derivation rather than re-asserting a hardcoded list), and the help-line change is a straightforward one-line derivation with no behavioral risk beyond the printed string. The PR explicitly ties itself to #9860 items 1, 4, and 5, satisfying the issue-linkage requirement.

Nits — 5 non-blocking
  • The focus-manifest-top-level-fields.test.ts key scan is regex-based over `record.<key>`/`record["<key>"]` text, so a future refactor renaming the local binding or restructuring the parser to read via destructuring would silently produce a false pass/fail rather than a compile error — worth a comment noting this fragility (test/unit/focus-manifest-top-level-fields.test.ts).
  • The three bundled items (1, 4, 5) touch unrelated files/domains (CLI help text, focus-manifest registry, docs); nit only since each is small and independently reviewable as the description states.
  • In loopover-mcp.ts's printHelp, the `loginDefaulting` list is now derived but not alphabetized or otherwise ordered deterministically beyond object-key insertion order in CLI_COMMAND_SPEC — fine today, but worth a one-line comment if that spec is ever reordered.
  • Consider adding a stricter parse-based (not regex-based) check for FOCUS_MANIFEST_TOP_LEVEL_FIELDS parity if the source layout changes significantly, though the current guard test (record.size > 20, has wantedPaths/gate) mitigates the main fragility risk.
  • The reference.md/AGENTS.md coverage-rule documentation (item 5) is a pure docs change; no test needed there, which is correctly reflected in the diff.

Concerns raised — review before merging

  • No linked issue detected: No closing reference or linked issue number was found in the PR metadata/body. — If this PR is intended to solve an issue, link it explicitly in the PR body.
📋 Copy for AI agents — paste into your coding agent
Fix the following blocker(s) from this PR review:

1. No linked issue detected: No closing reference or linked issue number was found in the PR metadata/body. — If this PR is intended to solve an issue, link it explicitly in the PR body.

Decision drivers

  • ❌ Code review — 1 blocker (1 reviewer)
  • ❌ Gate result — Blocking (Repo-configured hard blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ No-issue rationale PR body explains why no issue is linked.
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 (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 9 registered-repo PR(s), 8 merged, 280 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 9 PR(s), 280 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, Ruby, Go, MDX, Shell, Solidity, JavaScript
  • Official Gittensor activity: 9 PR(s), 280 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Treat this as maintainer-lane context rather than normal contributor-lane activity.
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 &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; 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.

Decision record
  • action: hold · clause: missing_linked_issue
  • config: 82ef024988adbe8aaf63f1824186b03a78b42d4412c87c3f91949c348f756e53 · pack: oss-anti-slop · ci: passed
  • record: 5cc729ce4b1608f694cf68dcfe8fbbb9ebd591dab85d8096b849010864a523d4 (schema v6, head 3036ccf)

🟩 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

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored JSONbored self-assigned this Jul 30, 2026
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.87%. Comparing base (3689891) to head (3036ccf).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9949      +/-   ##
==========================================
- Coverage   91.88%   91.87%   -0.01%     
==========================================
  Files         928      928              
  Lines      113671   113673       +2     
  Branches    27412    27412              
==========================================
- Hits       104441   104439       -2     
  Misses       7931     7931              
- Partials     1299     1303       +4     
Flag Coverage Δ
backend 95.66% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/loopover-mcp/bin/loopover-mcp.ts 70.03% <100.00%> (+0.02%) ⬆️

... and 1 file with indirect coverage changes

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 30, 2026
@JSONbored
JSONbored merged commit 9783944 into main Jul 30, 2026
8 checks passed
@JSONbored
JSONbored deleted the chore/focus-manifest-registry-guard-9860 branch July 30, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant