Repository navigation
feat(cli): cg diff drift check (exit 0 clean, 1 drift, 2 error) - #465
Merged
Merged
Conversation
…oyed stable version Exit 0 no drift, 1 drift or not deployed, 2 check could not run. Reads only. Moves the pure field diff to src/contract_diff.rs so the CLI and POST /contracts/diff share it. Tests: tests/cli_diff.rs. Docs: docs/cg-diff-reference.md.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Nov 26, 2026
Merged
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
cg diff, a read-only drift check: each local contract YAML is compared with the latest stable version on the gateway. It exits non-zero on drift so a scheduled job or PR check can fail on it.Correction to the brief:
cg diffdid not exist before this PR (RFC-015 reserved the name and deferred it), so there was no earlier exit code to change and nothing in CI or elsewhere called it. This PR adds the command.--fail-on-remote-only)--namematched nothing). Error wins over driftMatches
cg testandcg synth(0 clean, 1 findings, 2 harness problem). A missing key still exits 11 and a bad config 10, as for push and pull.Flags:
--dir,--name,--fail-on-remote-only,--json.Notes
cg pullwrites andcg pushsends. Field-level changes are listed using thePOST /contracts/difflogic.src/infer_diff.rstosrc/contract_diff.rs(library).infer_diffre-exports it; the HTTP endpoint is unchanged and its 9 unit tests still pass..github/,actions/,scripts/,integrations/,examples/or the SDKs callsdiff.Tests
tests/cli_diff.rs: 13 tests against an in-process stub gateway (no drift, whitespace-only, changed field, comment-only, not deployed, no stable version (the real 409), remote-only with and without the flag,--name, bad file, error beats drift, gateway 500, unreachable, empty dir).src/cli/commands/diff.rs.required_changed; an undeployed file gives exit 1; bad key gives exit 2; no key gives exit 11.Docs:
docs/cg-diff-reference.md,docs/STATUS.mdentry, RFC-015 note. (The repo has no root CHANGELOG; release notes are generated from PRs.)