Skip to content

test(cli): ratchet that every leaf is wrapped by the --json envelope - #1660

Open
napetrov wants to merge 1 commit into
intel:mainfrom
napetrov:test/cli-emits-ratchet
Open

napetrov wants to merge 1 commit into
intel:mainfrom
napetrov:test/cli-emits-ratchet

Conversation

@napetrov

@napetrov napetrov commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

Part of #94 (F2, the --json envelope on every leaf). #94 stays open.

Summary

Adds a ratchet for the envelope wrap. A leaf is wrapped when its parser sets emits_cli_output. The new test fails on:

  • a leaf that is not wrapped and not listed in tests/data/cli_emits_unwrapped.txt (new commands must opt in);
  • a listed leaf that is now wrapped, or no longer exists (its row must be deleted).

No behaviour change: no parser default, no route and no output changes. Wrapping a leaf without --json is a no-op, so the list tracks what F2 still has to wrap.

Numbers on main 19e52226c: 115 leaves, 39 wrapped, 76 listed. Every listed leaf has no --json today.

Input errors and next[]

One-off probe (a script, not in the tree) of the 39 wrapped leaves with a runtime InputError under --json:

  • 3 give a next[] entry: tools preference, eval personas discover, eval skill-coverage (input_help_next).
  • 36 give next: []: every other wrapped leaf, including agent run and agent replay.

Argparse usage errors already name a --help step for every --json leaf (test_a_usage_error_document_names_a_help_command_that_works). The gap is runtime input errors only. Fixing it means making input_help_next the default in _exit_with_document. That changes the output of 36 leaves and contradicts the "no next by design" invariant in test_cli_output.py, so this PR leaves it for a decision.

Evidence

  • tests/test_cli_emits_ratchet.py: 3 tests. Red first: removing a row fails the new-leaf test; adding backends and a stale name fails the shrink test. Restored, all 3 pass.
  • make ci-local CI_LOCAL_ARGS=--offline on this branch: see the CI verdict in the report.

Merge danger

  • Sibling PRs of this wave wrap leaves (--json on paid leaves, guards). Each one that wraps a listed leaf must delete its row in the same PR, or it fails this test. The list is a shared file, so adjacent row deletions can conflict on rebase: resolve by taking the deletions.
  • Whichever lands second rebases onto the shorter list.

🤖 Generated with Claude Code

A leaf is wrapped when its parser sets emits_cli_output. The new test fails on an
unwrapped leaf that is not listed in tests/data/cli_emits_unwrapped.txt, and on a
listed leaf that is now wrapped or gone. The list holds the 76 leaves unwrapped on
main; no behaviour change.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
@napetrov
napetrov requested a review from a team as a code owner December 6, 2026 06:23
Copilot AI balanced review requested due to automatic review settings December 6, 2026 06:23

Copilot AI 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.

🟢 Approval recommended

No actionable issues were found in the reviewed changes.

No open issues 🎉

What changed in this PR

0 new findings; nothing to fix.

Adds tests tracking CLI envelope adoption for #94 F2, without changing runtime behavior.

Changes:

  • Requires each CLI leaf to be wrapped or explicitly allowlisted.
  • Rejects wrapped, removed, or duplicate allowlist entries.
  • Records the 76 currently unwrapped leaves.
File Description
dokimi/​tests/​test_cli_emits_ratchet.py Adds three envelope-adoption and allowlist consistency tests.
dokimi/​tests/​data/​cli_emits_unwrapped.txt Lists existing unwrapped CLI leaves.

Review effort: Balanced

@exai-bot

exai-bot commented Dec 6, 2026 •

Copy link
Copy Markdown

✅ OpenCodeReview: Review complete: 0 finding(s) across 2 selected item(s).

CI at 561e4ce: 19 passing, 3 skipped.

Review details
  • Commit reviewed: 561e4ce against merge base 19e5222
  • Coverage: 2 files in 1 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 99k tokens (57k from cache), 21s
  • Tool calls: 14 (5 file_read, 4 code_search, 1 ci_status, 1 file_find, 1 linked_items, 1 local_check_results, 1 pr_comments)
  • small change set: 2 files

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.43%. Comparing base (19e5222) to head (561e4ce).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1660      +/-   ##
==========================================
- Coverage   96.44%   96.43%   -0.02%     
==========================================
  Files         585      585              
  Lines       76600    76600              
  Branches    13175    13175              
==========================================
- Hits        73876    73867       -9     
- Misses       1671     1674       +3     
- Partials     1053     1059       +6     

see 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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.

4 participants