Skip to content

CI: cli suite tests assert codes, not sentences (#1089) - #1565

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

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

Conversation

@mikolalysenko

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

Copy link
Copy Markdown
Collaborator

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

Refs #1089 (cli slice of child 6). The tracking issue stays open: covgap_commands_scan_mod.rs (#1560), covgap_commands_vex.rs (#1563), the update/ and scan/ covgap files, covgap_utils_socket_cli_config.rs and coverage_fix_scan_hosted_dryrun_vendored.rs remain for later slices.

Root cause

CLI tests pin English sentences and private helpers instead of the shared --json envelope readers in tests/common/envelope.rs. A copy edit to the org-fallback warning broke five tests at once, and the JSON runs only proved the behavior through the warning's prose.

What changed (test-only, plus one doc comment)

  • cli/covgap_api_client.rs → cli/api_client_org_fallback.rs. The five --json tests assert the api_auth_fallback code in warnings[] (and that its detail names --org) through common::envelope, plus the request log as before. Only the human run pins stderr text, one check per message family (org fallback + remedy, stored-hash hint + remedy, token-shape warning). The --json run still checks the warning prints once and isn't muted; --silent still checks it is. The private json_stdout copy is gone.
  • common/envelope.rs: new output_envelope(&Output), which panics with stdout and stderr, so a run that dies before printing JSON shows why.
  • cli/covgap_output.rs → cli/prompts_tty.rs (PTY render tests; fixtures renamed off "covgap", behavior unchanged).
  • cli/covgap_commands_list.rs → cli/list_render.rs; the vlt test reads the vendored purls via mode_events(&env, "vendored") instead of searching the envelope text.
  • socket-patch-core/src/api/client.rs: a doc comment points at the renamed suite.

Sentence (4+-word .contains) assertions in these files: 10 → 4, all in human/PTY render tests.

CI cost

Same cli test binary, no new job or workflow change. A lean PR run is unchanged: about 28 Linux jobs, about 8 min wall, same job-minutes before and after.

Test evidence

  • cargo test -p socket-patch-cli --all-features --test cli: 113 passed, 0 failed (same count as main).
  • cargo fmt --all -- --check: clean. cargo clippy --locked --workspace --all-features -- -D warnings: clean.
  • cargo clippy --test cli -- -D warnings reports the same 10 pre-existing lints in prebuilt_common/mod.rs and common/mod.rs on main and on this branch; none are in the changed files.
  • /code-review high ran on the diff. Fixed: warn-once count in --json, remedy in the warning detail, hint/shape remedy pins, stderr on parse failure, the --silent check matching message bodies, the stale doc comment. Not fixed: "empty start commit". It is the agent claim marker, and a squash merge drops it.
  • prompts_tty.rs is cfg(unix), so I dispatched one full-scope run on this branch to cover macOS.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AZa8HreenUM7a9mcyWuevm


Generated by Claude Code

Assisted-by: Claude Code:claude-opus-5-5
The three covgap files in the cli test binary get names that say what
they cover: api_client_org_fallback.rs, prompts_tty.rs and
list_render.rs. A copy edit to the org-fallback warning no longer
breaks five tests: the --json runs now check the api_auth_fallback
warning code through common::envelope, and only the human run pins the
stderr text, once per message family. The vlt list test reads the
vendored purls from the envelope instead of searching its text.

Test-only; the cli binary and its CI job are unchanged.

Refs #1089

Assisted-by: Claude Code:claude-opus-5-5
Review follow-up. The --json run checks again that the org fallback
warning is printed once, the api_auth_fallback detail must still name
the --org remedy, and the human run pins the hint's remedy line and the
token-shape reason. A run that dies before printing JSON now shows its
stderr, through a shared output_envelope helper. The core doc comment
points at the renamed suite.

Refs #1089

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

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 4c2517a. Configure here.

@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Oct 15, 2026
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

Ready for review at 4c2517a.


Generated by Claude Code

@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

Final review brief: #1565 at 4c2517a

What it does: It renames three covgap_* modules in the cli test binary to descriptive names (api_client_org_fallback, list_render, prompts_tty). The org-fallback --json tests now assert the api_auth_fallback warning code through the shared common::envelope readers instead of English sentences. The only production-crate edit is one doc-comment line inside #[cfg(test)] in api/client.rs.

Risk: low. The change is tests plus one comment, and nothing changes at runtime.

Look here:

  • api_client_org_fallback.rs:21:`` assert_api_auth_fallback. Its detail check at :32 now needs only `--org`.
  • api_client_org_fallback.rs:107:``` the human stderr test still pins the full sentence.
  • api_client_org_fallback.rs:191:```` the --silent mute check.
  • common/envelope.rs:22: the new output_envelope helper.
  • list_render.rs:317: the vlt test now pins exactly [PURL] among the mode == "vendored" events. This is stronger than the old text search.

Verified:

  • Read the full diff. CHANGELOG.md is untouched and there is no debug code.
  • No coverage was lost:
    • All 113 cli tests still exist and pass.
    • Every dropped --json stderr sentence is still pinned once by the human-mode test.
    • The fixture purl renames are self-contained.
    • prompts_tty stays #[cfg(unix)], as on main.
  • Ran locally:
    • cargo test -p socket-patch-cli --test cli: 113 passed.
    • cargo test -p socket-patch-core --lib api::client: 126 passed.
    • cargo fmt --check: clean.
    • Test-target clippy: only the existing lints in prebuilt_common/common that the description names, none in changed files.
  • CI: 100/100 checks green on this head, including ci-ok and clippy. Bugbot reviewed 4c2517a with no findings, per the burn-down's comment.

Changes I made: none.

Open questions (non-blocking):

Auto-merge (squash) is armed, so approving sends this straight to the merge queue.


Generated by Claude Code

Merged via the queue into main with commit 544df96 Oct 15, 2026
332 checks passed
@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the agent/fix-ci-cli-envelope-asserts branch October 15, 2026 14:22
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) Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants