Skip to content

fix: make field invariant CI pass#113

Merged
rita-aga merged 2 commits intostagingfrom
fix/pr-110-ci-field-invariants
Apr 12, 2026
Merged

fix: make field invariant CI pass#113
rita-aga merged 2 commits intostagingfrom
fix/pr-110-ci-field-invariants

Conversation

@rita-aga
Copy link
Copy Markdown
Collaborator

Supersedes #110. Preserves the field invariant and related-field cross-invariant work, fixes CI failures, and opens against staging instead of main.

Changes

  • Field invariants ([[field_invariant]]): cross-field validation on single entities with when/require predicate trees (leaves: absent, equals, empty; combinators: any_of, all_of, not)
  • Extended cross-invariant grammar: related(Target, fk).<FieldName> (in|not in) [...] for arbitrary field names (not just status)
  • Server integration: pre_upsert_field_invariant_checks wired into the OData write pipeline, new FieldInvariant violation type

CI fixes (vs #110)

  • Replaced all production .unwrap() calls flagged by Integrity & DST Patterns gate:
    • chars.next().unwrap()let Some(first) = chars.next() else { return false } in is_identifier() / is_valid_field_identifier()
    • table.get("key").unwrap()match table.get("key") in FieldPredicate::from_toml_value()
    • registry.read().unwrap()match state.registry.read() in field constraint checks
  • Fixed rustfmt drift across all changed files
  • Split field_invariant.rs tests into separate file, extracted field_constraints.rs to keep files under readability ratchet limits
  • Updated readability baseline for the net-new file count

Verification

  • cargo build --release — clean
  • cargo test --workspace — all pass
  • cargo clippy --all-targets — zero warnings
  • cargo fmt --check — clean
  • cargo test -p temper-server --test field_invariants -- --nocapture — 6/6 pass
  • cargo test -p temper-spec field_invariant — 21/21 pass
  • cargo test -p temper-spec parse_field_assert — 6/6 pass
  • Readability ratchet — all metrics pass
  • Pre-push 4-gate pipeline — all gates passed

🤖 Generated with Claude Code

rita-aga and others added 2 commits April 11, 2026 23:18
Preserves the field invariant and related-field cross-invariant work
from PR #110. Fixes:

- Replace production .unwrap() calls in field_invariant.rs (table.get
  paths), lint.rs and parser.rs (chars.next()) with explicit match/
  Option control flow to satisfy the Integrity & DST Patterns gate.
- Fix rustfmt drift across all changed files.
- Base branch corrected from main to staging.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move field invariant check into field_constraints.rs, extract tests to
field_invariant_tests.rs, compact constraint constructors, and update
the readability baseline.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rita-aga rita-aga merged commit 6e4839f into staging Apr 12, 2026
5 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