feat(validate): retain base-fields + enforce status enum when declared (REQ-135)#370
Merged
Merged
Conversation
…lared (REQ-135) Root cause of the status-enum cluster (#352/#354/#355/#353), verified: the merged `Schema` struct dropped `base-fields` entirely — parsed onto `SchemaFile`, never retained by `Schema::merge`, read nowhere. So `status` (a base field, stored top-level as `artifact.status`) could never be enum-validated regardless of any declared `allowed-values`. - `Schema` now carries `base_fields`, unioned by name in `merge`. - `validate` checks `artifact.status` against the `status` base-field's `allowed-values` when declared (rule `status-allowed-values`), on both the salsa and `--direct` paths. - `remediation` adds a `status-allowed-values` arm (set-to-allowed / widen-schema, "did you mean"). NON-BREAKING: with no `allowed-values` declared (today's common.yaml) the check is inert — verified rivet's own validate is unchanged (PASS, same warnings). Declaring the canonical lifecycle set in common.yaml (the maintainer's call) activates enforcement. 2 regression tests + verified end-to-end (a typo'd status flags with full remediation; a valid one passes). Implements: REQ-135 Verifies: REQ-135 Refs: REQ-004 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📐 Rivet artifact deltaNo artifact changes in this PR. Code-only changes (renderer, CLI wiring, tests) don't touch the artifact graph. |
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Rivet Criterion Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: 97f860f | Previous: 27a8b03 | Ratio |
|---|---|---|---|
traceability_matrix/1000 |
58154 ns/iter (± 212) |
44761 ns/iter (± 166) |
1.30 |
query/10000 |
121571 ns/iter (± 1633) |
96878 ns/iter (± 778) |
1.25 |
This comment was automatically generated by workflow using github-action-benchmark.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced May 31, 2026
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.
The mechanism half of the status-enum cluster (#352/#354/#355/#353), root-caused last iteration.
Root cause
The merged
Schemastruct droppedbase-fieldsentirely — parsed ontoSchemaFile, never retained bySchema::merge, read nowhere. Sostatus(a base field, stored as top-levelartifact.status) could never be enum-validated, regardless of any declaredallowed-values.Fix (non-breaking)
Schemanow carriesbase_fields, unioned by name inmerge.validatechecksartifact.statusagainst thestatusbase-field'sallowed-valueswhen declared (rulestatus-allowed-values), on both the salsa and--directpaths.remediationadds astatus-allowed-valuesarm ("set to one of […]" / "widen the schema").Inert when no values are declared (today's
common.yaml) — verified rivet's own validate is unchanged (PASS, same warning count). Declaring the canonical lifecycle set activates enforcement.Verified
2 regression tests; end-to-end on a fixture — a typo'd
implmentedflags with the full remediation block, a validapprovedpasses.Still your call (separate, deliberate)
The canonical cross-project status set to declare in
common.yaml— it's shared by downstream projects using varied statuses, so this PR ships the safe mechanism ahead of that decision. Once you confirm the set, activation is a one-line schema edit (+ reconciling rivet's 4 drift statuses).REQ-135 (mechanism implemented; canonical-set declaration +
modifyrejection +schema showlisting remain).🤖 Generated with Claude Code