Repository navigation
Assert error codes instead of sentences in remove's covgap suite and add shared JSON assertion helpers #1090
Description
[agent] Filed by the scheduled architecture audit routine (CLI and core). Register: discussion #560 register.
Kind: refactor. Source: Part 8.5 G/H (register C32). Child 1 of #1089. Measured on main @ 05ecc6e.
Problem
remove/covgap_commands_remove.rs (2,127 lines, 35 tests) pins 27 sentences of four or more words. Some examples:
"Removed 1 patch from manifest:"appears 4 times (L832, L1224, L1548, L1650)."The manifest was not modified."(L435, L985)."cannot restore pkg:npm/left-pad@1.3.0 to its upstream registry entry"(L982, L1014)."Warning: blob cleanup failed","…diffs cleanup failed"and"…packages cleanup failed"(L1654-L1662).
remove already emits the typed envelope (status, error.code, events[], summary). The file even has parse_envelope/event_purls helpers (L36-L55), but they are private to this file, while sibling suites re-implement them. Several tests are _json/_human twins over the same path, for example L332-L405.
Symptoms: none filed. The cost shows up as churn in copy-edit PRs such as #248 and #1043.
Proposed change
-
Add
tests/common/envelope.rswith:parse_envelope(stdout);assert_error_code(&Value, &str);event_codes(&Value) -> Vec<(action, code)>;event_purls(&Value, action).
Delete this file's private copies.
-
Rewrite each sentence assertion as the equivalent
--jsonassertion: the error code, event action/code, summary count, or the file bytes on disk. -
Delete each
_humantwin whose_jsonsibling covers the path. Where the human rendering is the point (the prompt text at L1854-L1862), keep one assertion per message family. -
Rename the file into the
removesuite (for exampleremove/remove_failure_paths.rs) when done.
Size and scope
- About −400/+250 test lines and no production change.
- Out of scope: other covgap files (later children of Tracking: assert stable codes instead of human sentences in CLI tests, and fold the covgap suites #1089) and any message wording change.
Acceptance criteria
- At most 3 sentence (4+-word)
.containsassertions remain in the file, each in a render-focused test. -
cargo test -p socket-patch-cli --test remove(or the renamed target) is green, as are the whole CLI tests. - Coverage of
commands/remove.rsis not lower than onmain(coverage job). -
tests/common/envelope.rsis used by this file and documented for the next children.
Dependencies
- Blocked by nothing.
- Blocks the later children of Tracking: assert stable codes instead of human sentences in CLI tests, and fold the covgap suites #1089, which reuse the helpers.
Backlog review — 2026-10-08
Consolidated into #1089. The retained tracker(s) preserve this issue’s implementation scope and acceptance criteria. Closing this separate scheduling item as not planned, not as completed.
Explicit remove-test child of the stable-error-code test tracker; keep it as a checklist step.
Activity
audit-core: file C34 decision (#1088, with C74), C32 tracking (#1089, #…
mikolalysenko commentedon Oct 7, 2026
[agent] Triaged:
priority:p3(test-suite refactor, child 1 of #1089). Not a duplicate; no open PR covers it.Generated by Claude Code