Skip to content

fix(test): stop createTestEnv() default leaking the bundled self-repo manifest - #6493

Merged
JSONbored merged 1 commit into
mainfrom
fix/self-repo-manifest-test-leak
Jul 16, 2026
Merged

fix(test): stop createTestEnv() default leaking the bundled self-repo manifest#6493
JSONbored merged 1 commit into
mainfrom
fix/self-repo-manifest-test-leak

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • createTestEnv()'s LOOPOVER_DRIFT_ISSUE_REPO default was "JSONbored/gittensory" — the same literal string ~100+ generic test fixtures use as their arbitrary placeholder repo name. Since that value also matches isLoopOverSelfRepo()'s comparison, any bare createTestEnv() call whose fixture repo happened to be named "JSONbored/gittensory" silently picked up the bundled self-repo focus manifest (including its live autonomy grant), regardless of whether that specific test had any intent to exercise self-repo behavior.
  • Flips the default to a sentinel that can never collide with a real fixture, and gives the handful of tests that intentionally exercise self-repo/manifest-override resolution (ops/draftFlow/publicStats/maintainerRecap/upstreamDriftIssues, the self-dogfood route) an explicit override instead of relying on the shared default.
  • Also fixes 3 tests (2× backfill.test.ts, 1× api.test.ts) that were silently depending on a REAL, unmocked network fetch to GitHub's raw-content CDN for "JSONbored/gittensory"'s .loopover.yml — GitHub's repo-rename redirect resolves that straight through to the live, current .loopover.yml, so those assertions only passed by coincidence before this repo's autonomy config was added there. Stubs fetch deterministically instead.
  • routes-self-dogfood-registration-pack.test.ts is modernized to test against the real current self-repo identity (JSONbored/loopover) rather than pinning to the old name.

Part of a broader gittensory→loopover residue cleanup (see sibling PRs).

Validation

  • npm run test:ci (full local gate, green)
  • npm run test:coverage (unsharded, 17536 passed)
  • npm run typecheck

@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.56%. Comparing base (b7ec2d2) to head (c746d18).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #6493       +/-   ##
===========================================
+ Coverage   75.82%   95.56%   +19.74%     
===========================================
  Files         589      589               
  Lines       47121    47121               
  Branches    14989    14989               
===========================================
+ Hits        35728    45032     +9304     
+ Misses       9366     1297     -8069     
+ Partials     2027      792     -1235     
Flag Coverage Δ
shard-1 43.96% <ø> (-0.35%) ⬇️
shard-2 36.92% <ø> (?)
shard-3 32.48% <ø> (+0.14%) ⬆️
shard-4 34.60% <ø> (-0.76%) ⬇️
shard-5 30.98% <ø> (ø)
shard-6 45.38% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 208 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 16, 2026
@loopover-orb

loopover-orb Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Warning

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-16 11:32:56 UTC

14 files · 1 AI reviewer · 1 blocker · CI green · unknown

⏸️ Suggested Action - Manual Review

Review summary
This is a test-infrastructure-only fix: the shared `createTestEnv()` default for `LOOPOVER_DRIFT_ISSUE_REPO` collided with the generic placeholder repo name (`JSONbored/gittensory`) used by ~100+ unrelated fixtures, so any of those fixtures could accidentally trip `isLoopOverSelfRepo()` and pick up the bundled autonomy manifest. The fix flips the shared default to a non-colliding sentinel (`test-harness/no-self-repo-match`) and threads an explicit `LOOPOVER_DRIFT_ISSUE_REPO` override into every test that intentionally exercises self-repo/manifest-override resolution, plus stubs out three tests that were silently depending on a real unmocked GitHub CDN fetch. The diff is internally consistent — every self-repo-dependent test call site visible in the diff now supplies its own override matching the repo its fixtures/mocks assert against.

Nits — 6 non-blocking
  • The external secret-scan brief flags `test/unit/draft.test.ts:150` (`DRAFT_SECRET`) as a potential leaked secret — from the visible diff this reads as an existing local test fixture constant, not new in this diff, but worth a quick confirm it isn't a real credential.
  • No open-issue link is included in the PR description despite the fix being framed as part of a broader cleanup effort — worth confirming this closes a tracked issue per repo convention.
  • Several touched files (`api.test.ts`, `ops-wire.test.ts`, `queue-5.test.ts`, etc.) are large and only partially shown/omitted in this context, so I can't fully confirm every self-repo-dependent `createTestEnv()` call site in the suite got an explicit override — worth a final grep for `isLoopOverSelfRepo`-adjacent tests missing the new override before merge.
  • Consider a lightweight lint/test-helper assertion (e.g. a `vitest` setup check) that fails loudly if any test's fixture `repoFullName` happens to equal the new sentinel `test-harness/no-self-repo-match`, to prevent this exact class of bug from recurring under a new default.
  • In `test/unit/upstream-ruleset.test.ts`, the local `driftEnv()` helper duplicates the same override across ~30 call sites — this is fine as a mechanical mass-fix, but a follow-up could consolidate remaining bespoke `createTestEnv({ LOOPOVER_DRIFT_ISSUE_REPO: SELF_REPO })` calls in the other touched files into similar local wrappers for consistency.
  • Possible secret-shaped assignment in the diff (generic_secret_assignment) — Verify the value is not a real credential.

Concerns raised — review before merging

  • No linked issue detected — 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 — 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: 33 registered-repo PR(s), 26 merged, 326 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 33 PR(s), 326 issue(s).
Improvement ℹ️ Insufficient signal risk: clean · value: insufficient-signal
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: 33 PR(s), 326 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.

🟩 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

… manifest

createTestEnv()'s LOOPOVER_DRIFT_ISSUE_REPO default was "JSONbored/gittensory" — the
same literal string ~100+ generic test fixtures use as their arbitrary placeholder repo
name. Since that value also happens to match isLoopOverSelfRepo()'s matching input,
any bare createTestEnv() call whose fixture repo was named "JSONbored/gittensory"
silently picked up the bundled self-repo focus manifest (including its live autonomy
grant), regardless of whether that test had any intent to exercise self-repo behavior.

Flip the default to a sentinel that can never collide with a real fixture, and give the
handful of tests that intentionally exercise self-repo/manifest-override resolution
(ops/draftFlow/publicStats/maintainerRecap/upstreamDriftIssues, the self-dogfood route)
an explicit override instead of relying on the shared default.

Also fixes 3 tests (2x backfill.test.ts, 1x api.test.ts) that were silently depending on
a REAL, unmocked network fetch to GitHub's raw-content CDN for "JSONbored/gittensory"'s
.loopover.yml — GitHub's repo-rename redirect resolves that straight through to the
live, current .loopover.yml, so those assertions passed only by coincidence before this
repo's autonomy config was added there. Stub fetch deterministically instead.

routes-self-dogfood-registration-pack.test.ts is modernized to test against the real
current self-repo identity (JSONbored/loopover) rather than pinning to the old name.
@JSONbored
JSONbored force-pushed the fix/self-repo-manifest-test-leak branch from eec28ff to c746d18 Compare July 16, 2026 11:28
@JSONbored
JSONbored merged commit 07abff8 into main Jul 16, 2026
17 checks passed
@JSONbored
JSONbored deleted the fix/self-repo-manifest-test-leak branch July 16, 2026 11:32
nghetienhiep pushed a commit to nghetienhiep/gittensory that referenced this pull request Jul 16, 2026
…ection

Moves commentMode/publicAudienceMode/publicSignalLevel/checkRunMode/
checkRunDetailLevel/publicSurface/includeMaintainerAuthors/backfillEnabled
off DB-backed upsertRepositorySettings() fixture calls onto
upsertRepoFocusManifest() manifest injection (70 call sites) -- a pure
plumbing move with identical resolved test behavior, ahead of these
fields moving off repository_settings entirely. Also removes a handful of
now-redundant LOOPOVER_DRIFT_ISSUE_REPO overrides that JSONbored#6493 made obsolete.

Part of JSONbored#6440, part of JSONbored#6442
glorydavid03023 pushed a commit to glorydavid03023/gittensory that referenced this pull request Jul 16, 2026
…ection

Moves commentMode/checkRunMode/publicSurface/regateSweepOrderMode off
DB-backed upsertRepositorySettings() fixture calls onto
upsertRepoFocusManifest() manifest injection (69 call sites) -- a pure
plumbing move with identical resolved test behavior, ahead of these
fields moving off repository_settings entirely. Also removes now-redundant
LOOPOVER_DRIFT_ISSUE_REPO overrides that JSONbored#6493 made obsolete.

Part of JSONbored#6440, part of JSONbored#6442
glorydavid03023 pushed a commit to glorydavid03023/gittensory that referenced this pull request Jul 16, 2026
…o manifest injection

Moves commentMode/checkRunMode/publicSurface (queue.test.ts) and
commentMode/checkRunMode/includeMaintainerAuthors/publicAudienceMode/
publicSurface (queue-5.test.ts) off DB-backed upsertRepositorySettings()
fixture calls onto upsertRepoFocusManifest() manifest injection (58 + 55
call sites) -- a pure plumbing move with identical resolved test behavior,
ahead of these fields moving off repository_settings entirely. Also
removes now-redundant LOOPOVER_DRIFT_ISSUE_REPO overrides that JSONbored#6493 made
obsolete, and corrects two stale comments referencing that same removed
workaround.

Part of JSONbored#6440, part of JSONbored#6442
glorydavid03023 pushed a commit to glorydavid03023/gittensory that referenced this pull request Jul 16, 2026
… manifest injection

Moves commentMode/checkRunMode/publicSurface off DB-backed
upsertRepositorySettings() fixture calls onto upsertRepoFocusManifest()
manifest injection in test/unit/queue-3.test.ts (46 call sites) and
test/unit/queue-lifecycle-guards.test.ts (9 call sites) -- a pure plumbing
move with identical resolved test behavior, ahead of these fields moving
off repository_settings entirely. Also removes now-redundant
LOOPOVER_DRIFT_ISSUE_REPO overrides that JSONbored#6493 made obsolete.

Part of JSONbored#6440, part of JSONbored#6442
glorydavid03023 pushed a commit to glorydavid03023/gittensory that referenced this pull request Jul 16, 2026
JSONbored#6493 fixed the root cause (createTestEnv()'s default no longer matches
any real fixture repo name), making the earlier per-test
LOOPOVER_DRIFT_ISSUE_REPO: "unrelated-org/unrelated-repo" workaround in
these two files redundant.
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