Skip to content

fix: close the remaining 5 pre-existing test failures on main#9285

Open
JSONbored wants to merge 1 commit into
mainfrom
fix/remaining-main-regressions
Open

fix: close the remaining 5 pre-existing test failures on main#9285
JSONbored wants to merge 1 commit into
mainfrom
fix/remaining-main-regressions

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

Follows #9276, which fixed 8 files / 12 cases and left 4 files / 5 cases still red on main — and therefore red on every open PR, including unrelated ones like #9283. Each traced to its introducing commit. Two are real source gaps; two are stale sibling tests that a deliberate behavior change never updated.

Source fixes

src/selfhost/metrics.ts — registers two counters emitted since #9243 (loopover_orb_relay_multiple_live_enrollments_total) and #9245 (loopover_private_manifest_warnings_total) but never added to DEFAULT_METRIC_META. Without an entry, renderMetrics() emits them as bare undocumented samples with no # HELP/# TYPE — exactly the gap that drift guard exists to catch. Both commits name the new counter in their own body text, so this is a pure registration miss, not a behavior decision.

Test fixes (source verified correct in both cases)

selfhost-pg-retention — the fake Postgres still matched the pre-#9083 ctid semi-join shape, so every DELETE fell through to rowCount: 0 and nothing was ever counted as deleted. #9083 deliberately moved retention to an index-backed PK range delete with ORDER BY — the fix for prune-retention blowing its 30-minute timeout and stalling retention permanently. It updated the SQLite twin (retention.test.ts) but not the Postgres one. I verified the source is correct before touching the test: all 14 mapped PK columns are real single-column primary keys, the WHERE predicate is unchanged so the eligible set is identical, and ORDER BY only makes batches deterministically oldest-first. Retention deletes neither too much nor too little. Regex now captures whichever key column is in play, so both the mapped-PK and ctid-fallback paths stay exercised.

salvageability#9085 made an absent blocker confidence degrade to CONFIDENCE_WHEN_UNSTATED (0.5) instead of 1.0, so it is sub-floor against the 0.93 gate default and the low-confidence hold owns that case. #9085 renamed both sibling assertions in rules.test.ts but missed this third consumption site. Both calls kept deliberately — they are the only coverage in that file of the aiReviewCloseConfidence ?? DEFAULT_AI_REVIEW_CLOSE_CONFIDENCE default arm and the confidence ?? CONFIDENCE_WHEN_UNSTATED nullish arm respectively.

worker-entry-boundary — a false positive, not a real dependency leak. The check grepped whole-file text, so #9230's user-facing string "route(s) crossed the visual-diff threshold" failed a green tree over a sentence — in a file worker-reachable since #4120 that imports none of these deps. A Node-only dep can only reach the Worker bundle by being imported, so the check is now scoped to module specifiers, reusing the file's own existing parseImportSpecifiers. Bending correct user-facing copy to dodge a test regex would have been the wrong repair.

Test plan

  • All 4 originally-failing files green: npx vitest run test/unit/salvageability.test.ts test/unit/selfhost-metrics.test.ts test/unit/selfhost-pg-retention.test.ts test/unit/worker-entry-boundary.test.ts69 passed
  • Neighbouring/sibling suites still green: retention.test.ts, selfhost-pg-dialect.test.ts, alerts-metric-name-references.test.ts (builds its allowed set from the same array), rules.test.ts, selfhost-pg.test.ts191 passed, 11 skipped
  • npx tsc --noEmit -p tsconfig.json — clean
  • Verified the narrowed boundary check is still discriminating, not vacuous: injected a real import sharp from "sharp" into a worker-reachable file → check failed, naming the exact file and specifier; removed it → green. Also added a permanent test pinning both directions (flags real specifiers, ignores prose).

Follows #9276, which fixed 8 files / 12 cases and left these 4 files / 5 cases
still red on main (and therefore red on every open PR). Each diagnosed to its
introducing commit; two are real source gaps, two are stale sibling tests a
deliberate behavior change never updated.

SOURCE fixes:
- selfhost/metrics.ts: register two counters emitted since #9243 and #9245 but
  never added to DEFAULT_METRIC_META, so renderMetrics() emitted them as bare
  undocumented samples with no HELP/TYPE — exactly what that drift guard exists
  to catch. Both commits even name the counter in their own body text; a pure
  registration miss, not a behavior decision.

TEST fixes (source verified correct in both cases):
- selfhost-pg-retention: the fake Postgres still matched the pre-#9083 ctid
  semi-join, so every DELETE fell through to rowCount 0. #9083 deliberately
  moved retention to an index-backed PK range delete with ORDER BY (the fix for
  prune-retention blowing its timeout and stalling permanently); it updated the
  SQLite twin but not the Postgres one. Regex now captures whichever key column
  is in play, keeping BOTH the mapped-PK and ctid-fallback paths exercised.
- salvageability: #9085 made an absent blocker confidence degrade to
  CONFIDENCE_WHEN_UNSTATED (0.5) instead of 1.0, so it is sub-floor against the
  0.93 default and the low-confidence hold owns the case. It renamed both
  sibling assertions in rules.test.ts but missed this third consumption site.
  Both calls kept — they are the only coverage of the default-floor arm and the
  nullish-confidence arm respectively.
- worker-entry-boundary: false positive, not a real dependency leak. The check
  grepped whole-file text, so #9230's user-facing string "crossed the
  visual-diff threshold" failed a green tree over a sentence, in a file
  worker-reachable since #4120 that imports none of these deps. Narrowed to scan
  module specifiers (reusing the file's own parseImportSpecifiers) — the only
  way a Node-only dep can actually reach the bundle. Added a discriminating test
  so it cannot pass vacuously; verified by injecting a real `import sharp` and
  confirming it fails, naming the file and specifier.
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.54%. Comparing base (f7dda79) to head (50c8d6c).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #9285       +/-   ##
===========================================
+ Coverage   75.38%   88.54%   +13.16%     
===========================================
  Files         275      836      +561     
  Lines       58023   109515    +51492     
  Branches     6181    26084    +19903     
===========================================
+ Hits        43739    96971    +53232     
+ Misses      14014    11562     -2452     
- Partials      270      982      +712     
Flag Coverage Δ
backend 93.54% <ø> (?)

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

Files with missing lines Coverage Δ
src/selfhost/metrics.ts 100.00% <ø> (ø)

... and 698 files with indirect coverage changes

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 27, 2026
@loopover-orb

loopover-orb Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Warning

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-27 12:10:52 UTC

4 files · 1 AI reviewer · 2 blockers · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
This PR registers two previously-unregistered metric names in DEFAULT_METRIC_META (metrics.ts) and updates three stale test files to match deliberate behavior changes from prior PRs (#9083 retention delete shape, #9085 confidence-degrade default, #9230 worker-boundary check narrowed to import specifiers rather than raw file content). Each test fix is traced to a specific prior commit with a clear rationale, and the salvageability test now correctly asserts `toBeUndefined()` where it previously (incorrectly) asserted `toBeDefined()` post-#9085. The worker-entry-boundary regex change (scanning import specifiers instead of raw content) is a legitimate fix for a real false-positive class (prose containing forbidden words), and the added self-test for the regex's discriminating power is a reasonable coverage addition, not fabricated.

Nits — 4 non-blocking
  • metrics.ts: the two new HELP strings are quite long (multi-clause with inline issue refs) compared to most existing entries — consider trimming for readability, though this is consistent with a few other recent entries in the file.
  • worker-entry-boundary.test.ts: the new self-test duplicates literal specifier strings ('sharp', 'pixelmatch', etc.) already encoded in FORBIDDEN_IDENTIFIERS — fine for a meta-test but worth a one-line comment noting it's intentionally redundant with the regex definition.
  • Consider adding a short changelog-style comment near DEFAULT_METRIC_META noting that new counters must be registered here at introduction time, to prevent the next unregistered-counter drift the PR description flags.
  • No further changes needed for merge from a code-correctness standpoint; verify only that the linked issue-closing convention is satisfied per repo policy.

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.
  • Maintainer requires a linked issue: This repo's maintainer focus manifest requires every PR to reference a tracked issue. — Link the relevant issue (for example Closes #123) before opening the PR.
📋 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.

2. Maintainer requires a linked issue: This repo's maintainer focus manifest requires every PR to reference a tracked issue. — Link the relevant issue (for example `Closes #123`) before opening the PR.

Decision drivers

  • ❌ Code review — 2 blockers (1 reviewer)
  • ❌ Gate result — Blocking (Repo-configured hard blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
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: 13 registered-repo PR(s), 13 merged, 307 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 13 PR(s), 307 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
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: not available
  • Official Gittensor activity: 13 PR(s), 307 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Then work through the remaining 2 steps in the Signals table above.
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.

🟩 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 added the manual-review Gittensor contributor context label Jul 27, 2026
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. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant