Skip to content

cowork: CLI error observability + --output robustness - #65

Merged
Coding-Dev-Tools merged 4 commits into
mainfrom
cowork/improve-api-contract-guardian
Oct 3, 2026
Merged

Coding-Dev-Tools merged 4 commits into
mainfrom
cowork/improve-api-contract-guardian

Conversation

@Coding-Dev-Tools

Copy link
Copy Markdown
Owner

Summary

  • Spec-load errors now print to a stderr Rich console, keeping stdout clean for CI pipelines consuming --format json/yaml output (silent-failure trap: previously errors could interleave with machine-readable output).
  • All --output writes route through a helper that creates missing parent directories instead of crashing with an unhandled FileNotFoundError.
  • Retired placeholder tests/test_dummy.py (a pass-only test that inflated pass counts) — moved to _archive/retired-tests/.
  • Added regression tests for stderr error routing and nested --output paths.

Verification

  • pytest: 191 passed (was 192 incl. dummy; net +2 real tests)
  • ruff check src tests: clean

cowork-bot commit 0047b49

- Spec-load errors now print to a stderr console so stdout stays clean for
  CI pipes consuming --format json/yaml output
- All --output writes go through a helper that creates missing parent dirs
  instead of crashing with FileNotFoundError
- Retire placeholder test_dummy.py (inflated pass counts, tested nothing)
  by moving it to _archive/retired-tests/
- Add regression tests for stderr error routing and nested --output paths
@github-actions

github-actions Bot commented Aug 23, 2026 •

Copy link
Copy Markdown

🤖 Automated Code Review

✅ Ruff Lint — No issues

⚠️ Ruff Format — Formatting needed

unformatted: File would be reformatted
   --> src/api_contract_guardian/cli.py:22:19
    |
21  |
    -     warnings.warn(
    -         "revenueholdings-license not installed; license checks skipped", stacklevel=2
    -     )
22  +     warnings.warn("revenueholdings-license not installed; license checks skipped", stacklevel=2)
23  |     _has_rh = False
--------------------------------------------------------------------------------
54  |
    - def _validate_output_format(
    -     format_name: str, allowed: tuple[str, ...], command: str
    - ) -> str:
55  + def _validate_output_format(format_name: str, allowed: tuple[str, ...], command: str) -> str:
56  |     """Reject unsupported output formats before the command runs."""
57  |     if format_name not in allowed:
58  |         allowed_list = ", ".join(allowed)
    -         raise typer.BadParameter(
    -             f"Unsupported {command} format '{format_name}'. Choose from: {allowed_list}"
    -         )
59  +         raise typer.BadParameter(f"Unsupported {command} format '{format_name}'. Choose from: {allowed_list}")
60  |     return format_name
--------------------------------------------------------------------------------
122 |     global _require_license_strict
    -     _require_license_strict = require_license_flag or bool(
    -         os.environ.get("REVENUEHOLDINGS_REQUIRE_LICENSE")
    -     )
123 +     _require_license_strict = require_license_flag or bool(os.environ.get("REVENUEHOLDINGS_REQUIRE_LICENSE"))
124 |

✅ Secret Detection — Clean

✅ Large Files — Within limits

📊 Diff Stats — 3 file(s) changed

 {tests => _archive/retired-tests}/test_dummy.py |  0
 src/api_contract_guardian/cli.py                | 64 ++++++++++++++++++-------
 tests/test_cli.py                               | 64 +++++++++++++++++++++++++
 3 files changed, 112 insertions(+), 16 deletions(-)

Verdict: ⚠️ Warnings — Lint/format issues found. Recommend fixing before merge.

Automated by Coding-Dev-Tools/.github reusable workflow.

cowork-bot and others added 2 commits August 25, 2026 15:02
…ine to stderr

Rich Console.print soft-wraps long lines at the piped console width,
corrupting --format json/yaml stdout consumed by CI. Machine payloads now
go out byte-exact via click.echo, and the human gate status line moves to
stderr for machine formats so stdout stays a parseable document.
Adds regression tests asserting piped json/yaml stdout parses.
@Coding-Dev-Tools
Coding-Dev-Tools marked this pull request as ready for review October 3, 2026 07:50
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-03T07:51:59.559497Z 4d296d1 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Coding-Dev-Tools
Coding-Dev-Tools merged commit c76713b into main Oct 3, 2026
6 checks passed
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