Skip to content

test(cli): validate every public command surface - #128

Merged
vinceblock99 merged 5 commits into
fix/cli-project-delete-validationfrom
test/cli-command-harness
Jul 28, 2026
Merged

vinceblock99 merged 5 commits into
fix/cli-project-delete-validationfrom
test/cli-command-harness

Conversation

@vinceblock99

@vinceblock99 vinceblock99 commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Why

We had unit tests and a few targeted harness suites, but nothing automatically checked the complete public CLI command tree. Broken or unused command surfaces could remain exposed, and skipped or failed harness steps were not always reported clearly.

What

  • Add a recursive smoke test that verifies every public command path can render --help.
  • Run the surface test with both default and --no-default-features builds.
  • Make the harness distinguish passed, failed, and skipped suites, without allowing a skip to hide an earlier failure.
  • Strengthen the semantic-diff and Vault/KG harness checks.
  • Remove the unused revise --all flag found by the surface test.

Scope

This verifies that the public CLI surface parses and that the harness reports results accurately. It does not test the full business behavior of every command.

Testing

  • cargo fmt --all -- --check
  • CLI surface tests with default and --no-default-features
  • Harness suite 09 with the real CLI binary
  • Harness suite 14 with both the real CLI binary and a fake binary
  • Skip-after-failure and clean-skip behavior

@vinceblock99

Copy link
Copy Markdown
Contributor Author

Pushed 16eb349 addressing the five defects surfaced by the harness review:

  1. query search/neighbors panic on Unicode — summary truncation now slices on char boundaries (truncate_display()); repro'd the exit-101 panic on a CJK change message before the fix, clean output after. Same latent byte-slicing fixed in plan-exec output.
  2. agent enable --all with no agents — now errors (exit 2) instead of installing hooks for every registered agent.
  3. agent disable --global codex — added the missing ~/.codex/hooks.json uninstall path (enable already supported codex).
  4. remote default never honored — bare atomic push/atomic pull now resolve the remote set via atomic remote default; an explicit argument still wins, "origin" remains the final fallback. REMOTE arg is now Option<String> with no clap default.
  5. swallowed failures — atomic git push exits non-zero when the git push fails (commit kept); pull/clone exit non-zero on download/apply/materialize errors (partial results kept on disk). Also: project/workspace/org/team/intent delete verify the target exists before the confirmation prompt.

Validation: cargo test -p atomic-cli (1660 tests) green, clippy clean, full harness 25 passed / 1 skipped (15_storage_api, needs server) / 0 failed.

@vinceblock99
vinceblock99 changed the base branch from dev to fix/cli-project-delete-validation July 24, 2026 16:09
@vinceblock99
vinceblock99 changed the base branch from fix/cli-project-delete-validation to dev July 24, 2026 16:10
@vinceblock99
vinceblock99 changed the base branch from dev to fix/cli-project-delete-validation July 24, 2026 16:14
…diff filter

- 14_vault_kg.sh: every assertion now checks exit code and expected output
  shape via run_cmd/assert_ran; previously 20 if/else sites passed in both
  branches and 4 more passed unconditionally, so the suite stayed green
  even with /usr/bin/true as the binary (now: 40/44 fail, suite exits 1).
  Also fixes a wrong vault show path and broken \| alternations in ERE
  patterns that made match branches unreachable.
- helpers.sh: skip_suite exits 1 when assertions already failed — a
  mid-suite skip (e.g. network loss after real failures) can no longer
  mask a failing suite as skipped in the runner summary.
- 09_semantic_diff_pairing.sh: extract_atomic_change_lines now drops only
  the +++/--- file headers instead of requiring a non-+/- second
  character, which silently excluded added/deleted blank lines and change
  lines whose content starts with + or -.
* fix(cli): resolve command-surface defects found by harness review

- query search/neighbors: truncate summaries on char boundaries instead
  of byte indexes; long CJK/emoji summaries no longer panic (exit 101).
  Adds truncate_display() with unit tests, and fixes the same latent
  byte-slicing in plan-exec output.
- agent enable --all: error out when no agents are detected instead of
  installing hooks for every registered agent.
- agent disable --global: add the missing codex path
  (~/.codex/hooks.json), restoring enable/disable symmetry.
- push/pull: honor the remote configured via 'atomic remote default';
  an explicit CLI argument still wins, with "origin" as the final
  fallback. REMOTE arg is now optional with no clap default.
- git push: exit non-zero when the underlying git push fails (the
  commit is kept and the user is told how to retry).
- pull/clone: exit non-zero when downloads, applies, or materialize
  fail; partial results are kept on disk.
- project/workspace/org/team/intent delete: verify the target exists
  before showing the destructive confirmation prompt.

* test(cli): use escaped unicode in truncation regression tests

Replace raw CJK/emoji string literals with \u{20ac} and \u{1f680}
escape sequences so the source stays ASCII-only while keeping the
same multi-byte char-boundary coverage. Also tighten the loose
assertions in the no-panic case.

* fix(cli): skip delete existence prechecks under --force

Align workspace/org/team/intent delete with the project delete semantics
from #127: the existence precheck runs only before the interactive
confirmation, so scripted --force deletes stay a single request.

* docs(cli): correct push/pull remote resolution help text

The --help text promised 'falling back to "origin"' but
resolve_remote_name delegates to RemoteConfig::get_default, which also
returns the sole configured remote when exactly one is registered. A
repo with a single remote named something other than origin therefore
resolves to that remote, contradicting the documented behavior.

Document the real order: marked default > "origin" > sole remote >
literal "origin".

* docs(cli): simplify behavior comments
@vinceblock99
vinceblock99 merged commit 693c001 into fix/cli-project-delete-validation Jul 28, 2026
vinceblock99 added a commit that referenced this pull request Jul 28, 2026
* fix(cli): validate project before delete confirmation

* test(cli): validate every public command surface (#128)

* test(cli): validate every public command surface

* test(harness): distinguish skipped suites from passes

* docs(cli): document command harness

* test(harness): eliminate fake greens in vault suite, skip logic, and diff filter

- 14_vault_kg.sh: every assertion now checks exit code and expected output
  shape via run_cmd/assert_ran; previously 20 if/else sites passed in both
  branches and 4 more passed unconditionally, so the suite stayed green
  even with /usr/bin/true as the binary (now: 40/44 fail, suite exits 1).
  Also fixes a wrong vault show path and broken \| alternations in ERE
  patterns that made match branches unreachable.
- helpers.sh: skip_suite exits 1 when assertions already failed — a
  mid-suite skip (e.g. network loss after real failures) can no longer
  mask a failing suite as skipped in the runner summary.
- 09_semantic_diff_pairing.sh: extract_atomic_change_lines now drops only
  the +++/--- file headers instead of requiring a non-+/- second
  character, which silently excluded added/deleted blank lines and change
  lines whose content starts with + or -.

* fix(cli): correct behavior found by the command harness (#132)

* fix(cli): resolve command-surface defects found by harness review

- query search/neighbors: truncate summaries on char boundaries instead
  of byte indexes; long CJK/emoji summaries no longer panic (exit 101).
  Adds truncate_display() with unit tests, and fixes the same latent
  byte-slicing in plan-exec output.
- agent enable --all: error out when no agents are detected instead of
  installing hooks for every registered agent.
- agent disable --global: add the missing codex path
  (~/.codex/hooks.json), restoring enable/disable symmetry.
- push/pull: honor the remote configured via 'atomic remote default';
  an explicit CLI argument still wins, with "origin" as the final
  fallback. REMOTE arg is now optional with no clap default.
- git push: exit non-zero when the underlying git push fails (the
  commit is kept and the user is told how to retry).
- pull/clone: exit non-zero when downloads, applies, or materialize
  fail; partial results are kept on disk.
- project/workspace/org/team/intent delete: verify the target exists
  before showing the destructive confirmation prompt.

* test(cli): use escaped unicode in truncation regression tests

Replace raw CJK/emoji string literals with \u{20ac} and \u{1f680}
escape sequences so the source stays ASCII-only while keeping the
same multi-byte char-boundary coverage. Also tighten the loose
assertions in the no-panic case.

* fix(cli): skip delete existence prechecks under --force

Align workspace/org/team/intent delete with the project delete semantics
from #127: the existence precheck runs only before the interactive
confirmation, so scripted --force deletes stay a single request.

* docs(cli): correct push/pull remote resolution help text

The --help text promised 'falling back to "origin"' but
resolve_remote_name delegates to RemoteConfig::get_default, which also
returns the sole configured remote when exactly one is registered. A
repo with a single remote named something other than origin therefore
resolves to that remote, contradicting the documented behavior.

Document the real order: marked default > "origin" > sole remote >
literal "origin".

* docs(cli): simplify behavior comments
@vinceblock99
vinceblock99 deleted the test/cli-command-harness branch August 12, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant