Skip to content

CI: apply suite asserts codes, not sentences (#1089) - #1546

Merged
Mikola Lysenko (mikolalysenko) merged 3 commits into
mainfrom
agent/fix-ci-apply-envelope-asserts
Oct 14, 2026
Merged

Mikola Lysenko (mikolalysenko) merged 3 commits into
mainfrom
agent/fix-ci-apply-envelope-asserts

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

LLM Description written by Claude Code:claude-opus-5-5

Refs #1089 (apply slice of child 3; the tracking issue stays open for the vendor silent-mute twin, which waits on #1544 to avoid a conflict, and children 4-6).

Summary

apply/covgap_commands_apply.rs pinned English sentences, so a copy edit to an apply message broke tests even when the exit code, error code, events and bytes on disk were unchanged. This PR splits it three ways inside the apply suite:

  • apply/apply_failure_paths.rs: the --json tests. They assert status, error.code, events[] (through common::envelope) and disk state. A message is read only for the paths a WrongReplacePath drift must name. 4+-word .contains sentence asserts: 0.
  • apply/apply_render.rs: the human render checks, one per message family (go drift report, stale-redirect Removed/Would remove, No patches to apply., the no-match error block, dry-run counts, --verbose labels, pnpm/bun/vlt notes, PnP refusal, gem fallback-home warning, --dry-run --vex skip). 18 sentence asserts, all in this render suite as Tracking: assert stable codes instead of human sentences in CLI tests, and fold the covgap suites #1089's target design allows.
  • apply/apply_fixture.rs: the fixtures and runner both files share.

Paths that only had human tests now also have a --json test: the OrphanReplace and WrongReplacePath drift arms (go_redirect_drift), stale-redirect pruning, the no-match package_not_installed skip, the dry-run already_patched skip, the --strict apply_failed events, and the manifest_invalid / yarn_pnp_unsupported split under a PnP layout.

coverage_fix_apply_silent_mute_exit.rs joins the apply suite as apply/apply_silent_staging_errors.rs and reuses the shared runner and manifest writer. Its stderr checks stay: the --silent stderr output is what those tests are about.

Old 4+-word sentence asserts in covgap_commands_apply.rs: 25. Now: 0 in --json tests, 18 in the render suite.

CI cost

Test-only change. A lean PR run keeps the same ~28 Linux jobs and ~8 min (about the same job-minutes before and after). There is one fewer integration test binary to link. scripts/ci-test-durations.json folds the old target's 4.05 s into apply (10.48 → 14.53 s). The split adds about 10 subprocess runs; locally the whole apply suite finishes in 6.7-7.7 s.

Test evidence

  • cargo test -p socket-patch-cli --all-features --test apply: 146 passed, 1 ignored (as on main).
  • cargo test -p socket-patch-cli --all-features --test cli envelope: 16 passed (the envelope_helper_copies ratchet).
  • python3 -m pytest scripts/tests -q: 342 passed, 6 skipped. It caught the docs/testing/vlt-coverage.json reference, so vlt_layout_prints_informational_note_in_human_mode keeps its name.
  • cargo fmt --all -- --check: clean.
  • cargo clippy -p socket-patch-cli --all-features --test apply: no warnings in the new or moved files.
  • /code-review high raised 9 findings and 8 are fixed. Not fixed: run each scenario once for both the human and --json checks. Keeping one test per contract is the design Tracking: assert stable codes instead of human sentences in CLI tests, and fold the covgap suites #1089 asks for, and the extra runs cost about a second.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BBSnJCsDWPGfUPbTm7Ataj


Note

Low Risk
Test-only reorganization with no changes to socket-patch apply production code; risk is limited to CI/runtime of the apply test binary.

Overview
Refactors the apply integration tests so machine contracts and human copy are tested separately, addressing #1089.

The monolithic covgap_commands_apply.rs is removed and replaced by apply_fixture.rs (shared runners and fixtures), apply_failure_paths.rs (--json checks on exit codes, status, error.code, events[], and disk state), and apply_render.rs (human-mode sentence pins for drift reports, layout notes, dry-run summaries, etc.). Several scenarios that previously only had human asserts now also have --json coverage (e.g. OrphanReplace / WrongReplacePath drift, stale Go redirect reconcile, package_not_installed, already_patched, strict apply_failed, PnP vs corrupt manifest).

coverage_fix_apply_silent_mute_exit moves into the apply binary as apply_silent_staging_errors.rs, reusing the shared fixture helpers; cross-suite comments point at the new path. scripts/ci-test-durations.json drops the standalone coverage_fix_apply_silent_mute_exit target and folds its budget into apply (~10.48s → ~14.53s).

Reviewed by Cursor Bugbot for commit 4d90f26. Configure here.


Generated by Claude Code

Assisted-by: Claude Code:claude-opus-5-5
The apply suite's covgap tests pinned English sentences, so a copy
edit to an apply message broke them even when the exit code, error
code, events and bytes on disk were unchanged.

covgap_commands_apply.rs splits three ways inside the apply suite:
apply_failure_paths.rs checks --json codes, events and disk state
through common::envelope (no 4+-word sentence asserts),
apply_render.rs keeps one human render check per message family, and
apply_fixture.rs holds the fixtures both share. The paths that only
had human tests (go drift arms, stale-redirect pruning, no matching
package, already-patched dry run, strict per-package failures, the
PnP refusal) now have a --json test too.

coverage_fix_apply_silent_mute_exit.rs joins the apply suite as
apply_silent_staging_errors.rs, so CI links one fewer test binary.

Refs #1089.

Assisted-by: Claude Code:claude-opus-5-5
The orphan-replace --json test no longer reads the drift sentence; the
module-keyed event already says which arm fired. The reconcile tests
pin that the envelope carries no event for a pruned redirect, the bun
and vlt render tests again check the run falls through to "No patches
to apply.", and the silent staging tests reuse the suite's runner and
manifest writer instead of private copies.

Refs #1089.

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review October 14, 2026 20:12
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-perf CI / merge-queue performance finding (profiler routine)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants