Skip to content

fix(test): widen timeouts on real-git miner clone/worktree tests - #6869

Merged
JSONbored merged 1 commit into
mainfrom
worktree-miner-clone-worktree-flake
Jul 17, 2026
Merged

fix(test): widen timeouts on real-git miner clone/worktree tests#6869
JSONbored merged 1 commit into
mainfrom
worktree-miner-clone-worktree-flake

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • test/unit/miner-attempt-worktree.test.ts and test/unit/miner-repo-clone.test.ts (the #5132 miner clone/worktree suite) run 4-10 real, sequential git subprocess spawns per test (init/add/commit an origin repo, then clone/fetch/checkout/reset/worktree add against it) to exercise genuine behavior rather than mocks.
  • Under concurrent full-suite load this reliably exceeds the default 15s vitest test timeout on the heaviest tests -- confirmed as a timing issue, not a logic failure: every test passes in well under 1s in isolation, and every assertion that runs passes.
  • Widens every real-git test in both files to an explicit 60000ms timeout, matching the existing convention already used for this same class of test in test/unit/agent-sdk-driver.test.ts (a real-git-subprocess test hardened the same way).
  • Discovered as a byproduct of investigating and fixing an unrelated flaky-test report (test/unit/ai-summaries.test.ts, separate PR) -- running the full suite to verify that fix surfaced these two files' pre-existing flakiness too.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • 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 -- not applicable; this is a maintainer-authored test-reliability fix discovered during unrelated work, not a contributor PR under the linked-issue policy.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally -- test-only change to test/**, which Codecov does not measure, so there is no patch-coverage obligation.
  • 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 -- not applicable; no production code changed.

Additional validation beyond the standard checklist: both files' own tests were run 5x under simulated heavy CPU contention (16 CPU-bound processes oversubscribing a 12-core machine) with zero outright failures. A full local npm run test:ci run also passed both fixed files cleanly (miner-repo-clone.test.ts and miner-attempt-worktree.test.ts both green), though that run also surfaced two additional, unrelated flakes (test/unit/github-labels.test.ts, test/unit/github-pr-actions.test.ts) that only appeared while two full 18k-test suites were running concurrently on the same machine -- self-inflicted, unrealistic contention well beyond normal CI conditions, not something observed under a single full-suite run. Flagging separately rather than expanding this PR's scope further.

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. (Not applicable -- test-only change.)
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests. (Not applicable -- no such changes.)
  • API/OpenAPI/MCP behavior is updated and tested where needed. (Not applicable -- no such changes.)
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks. (Not applicable -- no UI changes.)
  • Visible UI changes include a UI Evidence section below. (Not applicable -- no visible/UI changes.)
  • Public docs/changelogs are updated where needed. (Not applicable.)

UI Evidence

Not applicable -- test-only change, no UI/frontend/docs surface touched.

Notes

  • Companion PRs from the same investigation: the originally-reported test/unit/ai-summaries.test.ts flake, and a same-pattern fix for test/unit/agent-sdk-driver.test.ts discovered along the way.

The #5132 miner clone/worktree suite (test/unit/miner-attempt-worktree.test.ts,
test/unit/miner-repo-clone.test.ts) runs 4-10 real, sequential git subprocess spawns
per test to exercise genuine clone/fetch/checkout/reset/worktree-add behavior. Under
concurrent full-suite load this reliably exceeds the default 15s test timeout on the
heaviest tests -- not a logic failure: isolated runs pass in well under 1s, and 5x
repeated runs under simulated CPU contention (16 processes oversubscribing a 12-core
machine) all passed. Widens every real-git test in both files to an explicit 60s,
matching the existing convention used for this same class of test in
test/unit/agent-sdk-driver.test.ts.
@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 17, 2026
@JSONbored
JSONbored merged commit 4c0873d into main Jul 17, 2026
5 checks passed
@JSONbored
JSONbored deleted the worktree-miner-clone-worktree-flake branch July 17, 2026 09:40
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 17, 2026
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.64%. Comparing base (615dd46) to head (640b59f).
⚠️ Report is 25 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6869   +/-   ##
=======================================
  Coverage   93.64%   93.64%           
=======================================
  Files         685      685           
  Lines       68238    68238           
  Branches    18707    18707           
=======================================
  Hits        63903    63903           
  Misses       3350     3350           
  Partials      985      985           
Flag Coverage Δ
shard-1 43.23% <ø> (-0.46%) ⬇️
shard-2 36.93% <ø> (+0.25%) ⬆️
shard-3 32.60% <ø> (-0.12%) ⬇️
shard-4 34.36% <ø> (-0.40%) ⬇️
shard-5 31.47% <ø> (+0.32%) ⬆️
shard-6 45.97% <ø> (+0.28%) ⬆️

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

JSONbored added a commit that referenced this pull request Jul 25, 2026
* fix(deps): resolve postcss + tar audit findings via overrides

npm audit flagged postcss <=8.5.17 (path traversal in previous-sourcemap
auto-loading, GHSA-r28c-9q8g-f849, high) and tar <=7.5.20 (uncontrolled
recursion DoS via crafted long-path tar, GHSA-r292-9mhp-454m, moderate),
both transitive. Pin both via overrides, matching this file's existing
pattern for other transitive-dep security fixes: bump the existing tar
override past its first-patched version (7.5.19 -> 7.5.21) and add a new
postcss override (8.5.18, first patched version).

Closes task 1 of #8588's checklist. The remaining findings in that issue
(eslint v10 bump for the brace-expansion/minimatch chain, the
@esbuild-kit->tsx trace, and the recharts v3 migration) are unrelated,
each need their own scoping, and are now tracked as sub-issues #8608,
#8609, #8610.

* build: add the missing ui-kit build step to the local test:ci gate

Discovered incidentally while running the full local gate for #8588:
test/unit/check-ui-kit-package.test.ts's own regression guard needs
packages/loopover-ui-kit/dist/ to exist, but the root test:ci script
never built that workspace before test:coverage -- unlike the real CI
validate-tests job, which already builds it via `npx turbo run build
--filter=@loopover/ui-kit` right before its own coverage step (added in
#8592 to close this exact gap, but only in the CI workflow, not the
local script this repo's own contributing guide points everyone at).
Anyone running `npm run test:ci` from a clean checkout hit a spurious
failure that real CI never showed.

Adds `npm run build --workspace @loopover/ui-kit` alongside the other
per-package builds already in the chain (engine, discovery-index, mcp,
miner), so the local script matches CI again.

* fix(mcp): stop CLI stdout truncation on >64KB piped output

Discovered incidentally while running the full local gate for #8588:
test/unit/mcp-cli-profiles.test.ts's changelog test started failing with
a JSON parse error once packages/loopover-mcp/CHANGELOG.md grew past the
OS pipe buffer size (verified: `loopover-mcp changelog --json | wc -c`
returned exactly 65536 bytes instead of the real 65603+ -- the classic
64KB pipe-buffer boundary).

Root cause: process.stdout/stderr writes to a POSIX pipe are
asynchronous, but the CLI entrypoint called process.exit() immediately
after the command's async work resolved, cutting off any pending write
larger than one pipe buffer's worth before it finished flushing. This
silently truncates any command's output over ~64KB for any real
consumer piping the CLI (not just this test) -- e.g. `loopover-mcp
changelog --json | jq` would get invalid JSON.

Fix: drain both streams (wait for their internal buffer to empty) right
before calling process.exit(), instead of changing when/whether
process.exit() itself is called -- keeps the existing fast-exit behavior
for everything else (no risk of hanging on a lingering fetch keep-alive
socket) while fixing the truncation at its actual source.

* test(miner): raise timeout for build:verify syntax-check regression guard

Discovered incidentally while running the full local gate for #8588:
this test spawns a real subprocess (node --check over every
dist/bin+dist/lib file in packages/loopover-miner) -- 5.5s in isolation,
but it exceeded the default 15s testTimeout once under the full suite's
parallel load. Genuinely necessary real subprocess work with no
redundancy to cut, matching this repo's established real-subprocess
timeout-flake pattern (agent-sdk-driver.test.ts, miner-attempt-worktree
.test.ts, miner-repo-clone.test.ts, #6869/#6871): raise to the same
evidence-based 60000ms ceiling already used for that class of test,
rather than reflexively widening without a reason.
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.

1 participant