Coverage audit: 39 bug fixes + test extension to 98.2% line coverage - #236
Open
Mikola Lysenko (mikolalysenko) wants to merge 3 commits into
Open
Coverage audit: 39 bug fixes + test extension to 98.2% line coverage#236Mikola Lysenko (mikolalysenko) wants to merge 3 commits into
Mikola Lysenko (mikolalysenko) wants to merge 3 commits into
Conversation
…mand flows Full-coverage audit of never-executed code paths (host+docker lcov at d5e1815) surfaced 120 suspected bugs; 39 survived 3-reviewer adversarial refutation panels and every one reproduced with a failing test before its fix. Classes: - orphaned vendor-artifact husks on failure paths (npm_common, npm_lock, composer_lock, pnpm_lock_legacy, gem): missing done_failure_unstage twins of the fixed cargo shape - keep_artifact / --preserve-state contract violations (bun_lock, gem, pnpm_lock_legacy): empty-wiring revert refusal fired despite documented skip; legacy revert helpers missed already-converged liveness checks - drift-keep gates missing in pypi revert family (pipenv/poetry/pdm): vendored wheel dir deleted while a drift-skipped lock still references it - wired-rebuild safety: gem/nuget_feed/composer/pypi rebuild failures deleted the live artifact dir the wired lock still points at; pypi in-sync rebuild now honors the wired sha256/wheel-path pin - NuGet packageSourceMapping: nuget.org seed suppressed by whole-file substring probe -> socket-only exclusive mapping (NU1100 for every other package); insert_nuget_source replacen could drop the source while mapping+ledger were still recorded - scan --prune: RevertOutcome::kept_artifact ignored (drift-kept entries pruned + artifacts destroyed); corrupt vendor ledger silently defeated every vendored prune safeguard - redirect: requirements.txt rewriter silently dropped unparseable granted deps (entry-not-found parity warning added); pnpm-trust removal lacked the duplicate-occurrence guard; remove_fragment_once newline-eat merged the following line; takeover alias-keyed edits stranded/mis-claimed - registry_fetch: 128MB cap enforced only after full read; composer flat zip layouts refused; vendor/mod zip-entry cap gated on declared size (unbounded read_to_end) - get --json double JSON document on engine hard error; rollback --ecosystems replayed other ecosystems' leftover hosted edits; scan hosted --dry-run previewed against vendored wiring; apply --silent exited 1 mutely when patch sources unavailable; repair --vendor pre-delete destroyed healthy soft-reconstructed artifacts - pnpm-workspace.yaml flow-sequence packages parsed as zero members (pre-existing RED tests un-ignored); authed batch 404 no longer an empty success; cargo config inline-table crates-io entries now visible to remove/read; uv: dependency-groups-only deps refused up front, empty overrides array no longer renders malformed, direct-URL requires-dist fails closed; golang missing-target precheck no longer fails healthy wired re-runs 5311 tests green (196 binaries, full workspace). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Implements the audited test plans for every uncovered-but-testable range found by the full-coverage audit at d5e1815 (936 worthwhile ranges across 92 files): inline #[cfg(test)] additions plus 30 new per-module covgap_* integration suites (conflict-free placement; shared suites untouched). An adversarial review pass (46 reviewers + 3-vote refutation panels over the full diff) confirmed 42 findings, all applied: - fix residuals: uv revert convergence carve-outs (drift-keep gate no longer keeps converged reverts forever), requirements-flavor vendor_revert_residual_reference keep signal, fail-closed in-sync rebuild pin guard (corrupt/missing state.json now refuses instead of rebuilding blind), redirect nuget open-tag/single-quote tolerance matching the nuget_feed twin, scan --prune now reports keptVendoredEntries + remediation hint (dry preview documented as drift-blind), takeover scope-aware name probe, golang hot-path gate strengthened to full redirect_in_sync equivalence, multi-line pnpm-workspace flow sequences, fetch-stage online-failure silent-mode envelope - unfixed twins found by review: bun_lock + pnpm v9 post-pack failure paths ported to done_failure_unstage (a new test had enshrined the husk behavior; now asserts the fixed contract) - test hygiene: geteuid()==0 root guards on all new chmod-based tests, SOCKET_*/VIRTUAL_ENV scrubs in spawned-CLI harnesses, telemetry disabled in covgap_commands_vex (was POSTing to production), hermetic Gemfile.lock fixtures replacing real bundle probes, cfg(unix)/path- separator gates, vacuous tests repaired or deleted 6,597 tests green (196 binaries, full workspace). Coverage (host, default features): 94.18% → 98.2%+ lines; 72-77% of the 5,720 never-executed production lines from the baseline audit now covered; the remainder is classified defensive/unreachable/interactive-only/ platform-gated in the audit record. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…maining files Re-triage of the 923 missed lines remaining after the main waves, with fresh post-fix line numbers. Each of the 14 files' uncovered ranges was either covered by a stable test or formally classified untestable with a per-range reason (129 declared: match-exhaustiveness arms proven dead by construction, assertion-failure format args inside test modules, interactive-only and platform-gated paths). Two prior-wave skips were overturned where a stable approach existed (pnpm-v9 packages-key diagnosis, yarn-berry compressionLevel:0). 6,762 tests green (full workspace). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
September 2, 2026 16:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Full audit of CLI test coverage at
d5e1815, executed as a multi-agent pipeline: measure → audit every uncovered range → fix confirmed bugs → implement test plans → adversarial review → targeted mop-up.Coverage (host, default features): 94.18% → 98.47% lines (94.73% → 98.26% regions; 6,441 → 2,138 missed lines). Tests: 5,220 → 6,762 (full workspace, green, also green under instrumentation). Baseline was cross-checked against CI's merged docker-e2e lcov for the same commit (docker legs added only 18 lines beyond host coverage, so host numbers are authoritative).
Commit 1 —
fix:39 adversarially-confirmed bugs (0b7714b)120 bugs were claimed by per-file auditors over never-executed code; 39 survived 3-reviewer refutation panels, and every fix landed with a failing repro test first. Classes:
done_failure_unstagekeep_artifact/--preserve-statecontract violations (bun, gem, pnpm-legacy): empty-wiring refusals fired despite documented skip; legacy revert helpers missed already-converged liveness checksinsert_nuget_sourcecould drop the source while mapping+ledger were still recorded; open-tag/single-quote tolerance now consistent between the redirect and nuget_feed twinsscan --prune:RevertOutcome::kept_artifactwas ignored (drift-kept entries pruned, artifacts destroyed); corrupt vendor ledger silently defeated every vendored prune safeguard; apply output now reportskeptVendoredEntries+ remediation hint (CLI_CONTRACT.md updated; dry preview documented as drift-blind)get --jsonprinted two JSON documents on engine hard errors;apply --silentexited 1 with zero output when patch sources were unavailable; rollback--ecosystemsreplayed other ecosystems' leftover hosted edits; scan hosted--dry-runpreviewed against vendored wiring;repair --vendorpre-delete destroyed healthy soft-reconstructed artifactsread_to_end); registry_fetch 128MB cap enforced only after full read; pnpm-workspace flow-sequencepackages: [a, b]parsed to zero members (pre-existing RED tests un-ignored); cargo config inline-tablecrates-ioinvisible to remove/read; uv dependency-groups/empty-overrides/direct-URL defects; takeover alias-collision edits stranded or mis-claimed (now scope-aware)Commit 2 —
test:coverage extension + review findings (4a29cc1)#[cfg(test)]additions plus 30 new per-modulecovgap_*integration suitesSOCKET_*/VIRTUAL_ENVscrubs, telemetry disabled in spawned-CLI suites — one suite was POSTing to production, hermetic Gemfile.lock fixtures, cfg gates, vacuous tests repaired or deleted)Commit 3 —
test:final mop-up (9e45492)165 targeted tests over the 14 worst remaining files (fresh post-fix line numbers); 129 remaining ranges formally classified untestable with per-range reasons (match-exhaustiveness arms proven dead by construction, assertion-failure format args inside test modules, interactive-only/platform-gated paths). Two prior skips overturned where a stable approach existed.
Known residuals (flagged, deliberately not fixed here)
vendor/maven_repo.rswired-leg rebuild failure has the same remove-live-feed-dir shape fixed for gem/nuget/composer — needs its own passpkg[extra]==v) line matching is a recorded TS-parity residual; this PR adds the entry-not-found warning only (same shape as PR fix(hosted): never redirect bundled npm entries; warn on misses #189 for npm)scan --prunedry preview remains drift-blind (backends return before wiring replay on dry runs); documented in CLI_CONTRACT.md rather than half-mirroredNote on CI:
hosted-e2e,e2e (windows, safety_cargo), andrelease-readinessare red on main (traitobject unpublish + npm wrapper lock, PR #234 territory) — failures there are pre-existing and unrelated.🤖 Generated with Claude Code
Note
Medium Risk
Changes affect prune/GC, rollback hosted replay, vendor repair, and lockfile migration paths where incorrect behavior can delete or orphan committed patch/vendor state; mitigated by extensive new tests and fail-closed guards.
Overview
This PR tightens socket-patch-cli behavior around garbage collection, diagnostics, and vendor/hosted migrations, and adds a large unit/integration test expansion (the diff is mostly tests pinning contracts).
scan --prune/ GC now surfaces drift-kept vendored entries askeptVendoredEntriesin apply JSON (plus a human remediation line), documents the preview vs wet difference inCLI_CONTRACT.md, and aborts manifest prune/blob sweep when the manifest is missing or corrupt instead of treating it as empty. Corrupt vendor ledgers no longer drop vendored packages from discovery: scan falls back to manifest + live.socket/vendor/<eco>/<uuid>dirs so prune cannot delete still-vendored state.User-visible CLI fixes: fetch/apply staging prints hard errors under
--silent(only--jsonsuppresses stderr);get --jsonavoids emitting a second JSON document when the download engine already returned anerrorenvelope;rollbackwith--ecosystemsno longer replays record-less hosted redirect edits for other ecosystems; hostedscan --dry-runpreviews vendored→hosted takeover through the same revert path and counts those purls as redirected instead of failing against still-vendored locks;repair --vendormoves aside uuid dirs before rebuild and restores them when dispatch fails (instead of leaving ENOENT on wired locks).Smaller changes:
format_patch_optionfor interactivegetselection;overlay_dircopy fallback when hardlink fails (cross-filesystem temps).Reviewed by Cursor Bugbot for commit 9e45492. Configure here.