Repository navigation
CI: scan mod tests assert codes, not sentences (#1089) - #1560
Merged
Mikola Lysenko (mikolalysenko) merged 4 commits intoOct 15, 2026
Merged
Conversation
Assisted-by: Claude Code:claude-opus-5-5
This was referenced Oct 15, 2026
Copy edits to scan's terminal output no longer break dozens of unrelated tests, and each scan path now has a --json test that checks its exit code, error code, events, warning codes and files on disk. covgap_commands_scan_mod.rs (58 tests, its own test binary) moves into the scan suite binary as four modules: - scan_failure_paths.rs: the --json contracts, with no 4+-word sentence asserts. New twins cover the total and partial detail-fetch failures, vendor-owned purls, report-only --prune, the --sync GC and the retained hosted wiring warning. - scan_render.rs: the human output, one check per message family, keeping each human run's disk-state checks. - scan_tty.rs: scan on a real terminal (unix only). - scan_fixture.rs: shared mocks, project writers and runners. Four copies of the 500 detail mock and the two patch-API mounts are merged. Refs #1089 Assisted-by: Claude Code:claude-opus-5-5
- Drop the moved mode_fold tests: cli_parse_scan.rs already runs resolve_mode_flags on --mode hosted/vendored --sync, and they mutated process env inside the shared scan binary. cli_parse_scan.rs now also requires the error to name the mode. - The vendored-skip JSON test requires the one skipped event coded vendored, and the human retained-wiring check reads the warning line. - The global-scope usage error checks the envelope invariants. - Reuse vlt_hosted_common::warning_detail, share the mock-API flags between the subprocess and PTY runners, and drop the PTY runner's unused typeahead path. Assisted-by: Claude Code:claude-opus-5-5
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
October 15, 2026 03:18
Collaborator
Author
|
BugBot review Generated by Claude Code |
…-envelope-asserts # Conflicts: # crates/socket-patch-cli/tests/scan/main.rs # docs/testing/bun-compatibility.md # scripts/ci-test-durations.json
Tanmay Singla (Tanmay182003)
approved these changes
Oct 15, 2026
Collaborator
Author
|
bugbot run Generated by Claude Code |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 883f3e7. Configure here.
Collaborator
Author
|
Ready for review — head
Slack announcement not sent this run (Slack send unavailable); next run will retry. Generated by Claude Code |
Mikola Lysenko (mikolalysenko)
deleted the
agent/fix-ci-scan-mod-envelope-asserts
branch
October 15, 2026 05:57
This was referenced Oct 15, 2026
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.
LLM Description written by Claude Code:claude-opus-5-5
Refs #1089 (child 5,
scan_modslice). This is the last covgap file in child 5; with #1556 (scan_hosted, merged) child 5 is done.What changes
tests/covgap_commands_scan_mod.rs(3,160 lines, 58 tests, its own test binary) moves into thescansuite binary as four modules:scan/scan_failure_paths.rs(24 tests): the--jsoncontracts. They check exit code,status,error.code, event actions anderrorCodes,warnings[]codes, the mock API's request log and disk state. Messages are read only for what they must name (a flag, a purl, a file). It has 0.contains("…")asserts of 4+ words; the old file had 37.patch_details_failed), partial failure (onepatch_details_failedwarning naming the purl, the resolved package stillverified), vendor-owned purls (oneskippedevent codedvendored, no download), report-only--prune,--sync/--mode agent --pruneapply-and-collect (pruned manifest, swept blob,gc), andhosted_wiring_retained.scan/scan_render.rs(35 tests): human output, one check per message family (17 sentence asserts), keeping each human run's disk-state checks. Duplicate checks were collapsed: the GC singular/plural/agent-prune tests are one table-driven test, and the two partial-failure warnings are one test over both shapes. The twobun.lockbhuman halves are also one test.scan/scan_tty.rs(4 tests, unix): scan on a real terminal, moved unchanged apart from the shared fixture helpers and dropping the PTY runner's unused typeahead path.scan/scan_fixture.rs: shared mocks, project writers and runners. It merges the four copies of the 500 detail mock and the one/two-patch API mounts, and removes the never-delayed_delayedvariants.mode_foldin-process tests are removed.cli_parse_scan.rs::mode_hosted_with_sync_errorsalready covers them, and they mutated process env inside the sharedscanbinary. That test now also requires the error to name the mode (--mode vendored cannot be used with --sync), so thecli_name()coverage stays.scripts/ci-test-durations.jsonfolds the old target's 1.81 s intoscan. The doc pointer indocs/testing/bun-compatibility.mdis updated.Observed while writing the twins (not changed here): with a paid-only catalog and no paid access, the human arm skips the by-package detail fetch, but the
--jsonarm still makes it.CI cost
No workflow change. A lean PR run stays at about 28 Linux jobs, ~8 min (~110 job-min) before and after. The
testshards link one fewer integration-test binary (scanabsorbs it).Test evidence
cargo fmt --all -- --check: clean.cargo clippy --locked --workspace --all-features -- -D warnings(the CI command): clean.cargo clippy -p socket-patch-cli --all-features --test scan -- -D warningsreports nothing in the four new files. The 19 remaining hits in that target (prebuilt_common,hosted_yarn_classic_sha1.rs, module-loaded-twice) are the same count as onmain.cargo test -p socket-patch-cli --all-features --test scan: 204 passed.--test cli_parse_scan: 48 passed.python3 -m pytest scripts/tests -q: 342 passed, 6 skipped.cfg(unix)tests, so one full-scopeci.ymlrun was dispatched oncffeede: https://github.com/SocketDev/socket-patch/actions/runs/38675513037/code-review high
Fixed in cffeede: duplicate
mode_foldtests mutating env (removed, coverage moved intocli_parse_scan.rs). The vendored-skip twin now requires theskipped/vendoredevent. The retained-wiring render check reads the warning line itself. The global-scope envelope now checks invariants. The private warning helper was dropped forvlt_hosted_common::warning_detail, the PTY runner shares the fixture'sapi_args, and the dead typeahead parameter is gone.Not fixed, and why:
common/pty_io.rswould dedupe it across six suites (rollback_render.rs,update/covgap_commands_update.rs,update_notifier_e2e.rs,cli/interactive_prompts_e2e.rs,cli/covgap_output.rs, this file). That touches five unrelated suites, so it belongs in its own Tracking: assert stable codes instead of human sentences in CLI tests, and fold the covgap suites #1089/Spawn every CLI test child through one hermetic Command builder; 10 test files inherit ambient SOCKET_* today #823 cleanup PR, not this one.warnings[]entry by code" (scan_invariants.rs,scan_nested_project_e2e.rs) predate this PR. This file adds no new copy.Merge note
#1556 merged first. Its conflicts (the
scan/main.rsmodule list, thescanline ofci-test-durations.json, now 12.35 s, and thebun-compatibility.mdsentence) are resolved in the merge ofmain. The mergedscanbinary runs 244 tests, all passing.🤖 Generated with Claude Code
https://claude.ai/code/session_011Y5j5rYtzb1JgiDLSWLQY9
Note
Low Risk
Test-only reorganization and stricter assertions; runtime CLI behavior is unchanged.
Overview
Refactors the monolithic
covgap_commands_scan_modintegration binary into modules under the existingscantest target, aligned with #1089’s goal of pinning envelope codes and structure instead of long English strings.scan_fixture.rscentralizes wiremock mounts, hermetic runners, and project seeds.scan_failure_paths.rsholds--jsoncontracts (exit codes,error.code, events, warnings, API/disk oracles).scan_render.rs(referenced in the suite) keeps human-terminal checks with fewer duplicate sentence asserts.scan_tty.rs(unix) keeps PTY behavior tests. Several former human-only scenarios gain JSON twins (detail-fetch failures, vendored skips, report-only prune, sync GC, hosted wiring retained, etc.).Removes in-process
mode_foldtests that mutated env inside the shared binary;cli_parse_scan::mode_hosted_with_sync_errorsnow requires errors to name the conflicting mode viacli_name(). Docs andci-test-durations.jsondrop the old target and fold its time intoscan. No production code changes.Reviewed by Cursor Bugbot for commit 883f3e7. Configure here.
Generated by Claude Code