Skip to content

feat: reject codeint.json when $schema targets a newer codeint version - #166

Merged
avidianity merged 1 commit into
mainfrom
feat/config-schema-version-guard
Nov 22, 2026
Merged

avidianity merged 1 commit into
mainfrom
feat/config-schema-version-guard

Conversation

@avidianity

Copy link
Copy Markdown
Owner

Summary

Reject codeint.json with exit code 2 when its official $schema URL targets a newer codeint release (major.minor.patch) than the running binary, before running shape validation so users get a clear upgrade instruction instead of an unknown-key error.

Tier

Tier 2 from the tier check: updates crates/config/src/codeint_json.rs, crates/cli/src/remedy.rs, crates/cli/tests/check.rs, and documentation.

Task

Owner request in session: fail with a clear error when codeint.json assumes a newer version than the running binary.

  • Parse official codeint $schema version tags (vX.Y.Z) and reject when greater than CARGO_PKG_VERSION.
  • Allow equal/older versions, missing $schema, and custom/local $schema URLs.
  • Add actionable remedy in crates/cli/src/remedy.rs, unit tests in crates/config, and end-to-end CLI test in crates/cli/tests/check.rs.
  • Update docs/reference.md and docs/guide/configuration.md.

Fail-first test

  • Test: crates/cli/tests/check.rs::a_codeint_json_with_a_newer_schema_version_exits_2
  • Before the change: failed with unknown key future_key instead of rejecting the newer $schema version v99.0.0.
  • After the change: passed with exit code 2 and the version mismatch error + upgrade remedy.

Checks

Check Result
cargo clippy --workspace --all-targets -- -D warnings passed
cargo test --package codeint-config --locked passed (16/16)
cargo test --package codeint-cli --test check a_codeint_json_with_a_newer_schema_version_exits_2 --locked passed
cargo test --package codeint-cli --test reference --locked passed (5/5)
cargo run --package xtask -- merged-result passed
cargo run --package codeint-cli -- diff origin/main passed (0 new findings, 1 erosion finding resolved)
Pre-commit and commit-msg hooks passed

Safety proof

  • Safety fact: Version checking runs only on official https://raw.githubusercontent.com/avidianity/codeint/v.../schema/codeint.schema.json URLs, never blocks codeint update, and compiles with #![forbid(unsafe_code)].
  • Proof: Unit tests in crates/config verify newer major/minor/patch rejection and equal/older/missing/custom acceptance; crates/cli/tests/check.rs::a_codeint_json_with_a_newer_schema_version_exits_2 verifies exit code 2 end-to-end.
  • interrogate: none required below Tier 3.

Runtime evidence

  • Verified end-to-end via crates/cli/tests/check.rs::a_codeint_json_with_a_newer_schema_version_exits_2 and crates/cli/tests/reference.

Gaps

  • Deferred coverage: none
  • Pre-existing failures: none
  • Environmental failures: none

@github-actions github-actions Bot added the tier-2 Tier 2 from the tier check label Nov 22, 2026
@avidianity
avidianity merged commit 0f76ed2 into main Nov 22, 2026
13 checks passed
@avidianity
avidianity deleted the feat/config-schema-version-guard branch November 22, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tier-2 Tier 2 from the tier check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant