Skip to content

feat(cli): add validate command for model-level findings - #204

Merged
yordis merged 1 commit into
TrogonStack:mainfrom
enilsen16:enilsen16/feat-cli-validate
Oct 20, 2026
Merged

yordis merged 1 commit into
TrogonStack:mainfrom
enilsen16:enilsen16/feat-cli-validate

Conversation

@enilsen16

@enilsen16 enilsen16 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

trogon-atlas apply --dry-run runs only the per-entity checks. The model-level rules (storyboard entries, projection order, field provenance) run only in ValidateEventModel. The CLI has no command that calls it, so an author who uses only the CLI does not see these findings.

Change

  • Add trogon-atlas validate <namespace>/<model>[@version]. It calls ValidateEventModel for the stored model. Without @version, it validates the latest version.
  • The command uses the global --branch flag, so it validates the branch's view of the model.
  • Text output prints a severity summary and one line per finding, in the same format as branch merge --dry-run. --format json gives event_model, validation_summary and validation.
  • The command exits 1 when a finding is an error, and 6 when the model does not exist. A malformed address exits 5 before the CLI connects.
  • Add the command to the CLI README and the exit-code reference.

Test

  • Unit tests in trogon-atlas-client for the address parser.
  • CLI integration tests: a model with an event that has no swimlane exits 1 and reports EVENT_NO_SWIMLANE (text and JSON). An empty model exits 0. A model written only on a branch validates with --branch and exits 6 on baseline.
  • cargo test -p trogon-atlas-cli, cargo test -p trogon-atlas-client, and clippy with -D warnings on both crates pass.

Closes #93


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Signed-off-by: Erik Nilsen <enilsen16@live.com>
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 65dc7bb9-3ed1-407b-b810-fd47563f212f
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@enilsen16
enilsen16 marked this pull request as ready for review October 20, 2026 15:19
@cursor

cursor Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
New read-only CLI path over an existing validation RPC; behavior mirrors other view commands with documented exit codes and tests.

Overview
Adds trogon-atlas validate <namespace>/<model>[@version] so CLI users can run model-level checks (storyboard, projection order, field provenance) via the server’s ValidateEventModel RPC—rules that apply --dry-run does not cover.

A new trogon-atlas-client::validate module parses the address, resolves “latest” when @version is omitted, and honors the global --branch header. The CLI prints a severity summary and findings (same style as branch merge dry-run); --format json returns event_model, validation_summary, and validation. Exit 1 on error-level findings; missing models still use 6; bad addresses fail with 5 before gRPC connect.

Docs note validate under exit code 1, and tests cover parser unit cases, in-process integration (including branch vs baseline), and local address validation without connecting.

Reviewed by Cursor Bugbot for commit b601ec7. Bugbot is set up for automated code reviews on this repo. Configure here.

@yordis
yordis merged commit d2e2770 into TrogonStack:main Oct 20, 2026
28 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.

apply --dry-run doesn't run model-level validation rules

2 participants