Skip to content

test: cover lint command output and exit codes - #53

Open
FanouZeng-TT wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
FanouZeng-TT:test/lint-cli-contract
Open

test: cover lint command output and exit codes#53
FanouZeng-TT wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
FanouZeng-TT:test/lint-cli-contract

Conversation

@FanouZeng-TT

Copy link
Copy Markdown
Contributor

Description

src/linter.rs has unit coverage for individual diagnostics, but the public
ucp-schema lint command had no CLI integration tests. Other commands in
tests/cli_test.rs cover their argument handling, exit codes, and output, while
lint's command boundary remained unpinned:

fn run_lint(path: &Path, format: &str, strict: bool, quiet: bool) -> Result<(), u8>

A regression in clap wiring, the error exit code, or JSON serialization could
therefore pass all linter unit tests.

Fix: add CLI contract tests for a valid schema (exit 0), a broken internal
reference (E003, exit 1), and parseable --format json output with the
expected aggregate fields.

Category (Required)

  • Core Protocol: ...
  • Governance/Contributing: ...
  • Capability: ...
  • Documentation: ...
  • Infrastructure: ...
  • Maintenance: ...
  • SDK: ...
  • Samples / Conformance: ...
  • UCP Schema: Changes to the ucp-schema tool. (Requires Maintainer approval)

Related Issues

N/A

Checklist

  • I have followed the Contributing Guide ...
  • I have updated the documentation (if applicable).
  • My changes pass all local linting and formatting checks.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • (For Core/Capability) I have included/updated the relevant JSON schemas.
  • I have regenerated Python Pydantic models by running generate_models.sh under python_sdk. (Not applicable: ucp-schema test-only change.)

Screenshots / Logs (if applicable)

N/A — the new lint CLI tests pass 3/3; the full Rust suite passes 318/318. Full pre-commit, rustfmt, codespell, and git diff --check also pass.

@damaz91 damaz91 added status:needs-triage Signal that the PR is ready for human triage status:under-review and removed status:needs-triage Signal that the PR is ready for human triage labels Aug 14, 2026
@damaz91

damaz91 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Thanks @FanouZeng-TT !

Since run_lint also handles a couple other CLI flags and error states, we could optionally expand mod lint_command (either here or in a follow-up PR) to cover:

  • Missing path: verifying that pointing lint to a non-existent path exits with code 2.
  • --strict flag: verifying that a schema with warnings exits with code 1 when --strict is enabled.
  • --quiet flag: verifying that progress output is suppressed.

@FanouZeng-TT

Copy link
Copy Markdown
Contributor Author

Thanks for the follow-up suggestions. I’ll keep the current test-only change focused and cover the missing-path, strict-warning, and quiet-output cases together with the adjacent CLI behavior work, so they can share one coherent test matrix rather than expanding this PR piecemeal.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants