Repository navigation
fix(decode): apply array element contracts in AttrValue::from_term_at - #2047
Merged
norrietaylor merged 4 commits intoOct 7, 2026
Merged
Conversation
The array branch iterated elements raw, so an attr whose validate is Array C accepted any element on every consumer path. Apply the array's pending contracts to each element, mirroring the record branch, so a bad element is rejected.
Contributor
|
Warning Review limit reached
This review includes 1 billable file and costs up to $0.25. Or wait 23 minutes for your next included review. View limit detailsLimit details: You’ve used all 2 included reviews currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (1)
Comment |
mitodrummer
approved these changes
Oct 7, 2026
Member
|
/review |
Contributor
|
Approved: no findings at Nothing to do. Clobber: none: |
norrietaylor
approved these changes
Oct 7, 2026
norrietaylor
deleted the
inbox-patch/fix-decode-array-contracts-6f54facd0fb0d8c3
branch
October 7, 2026 07:25
1 of 2 tasks
bryan-minimal
added a commit
that referenced
this pull request
Oct 14, 2026
…; comment after #2047 Review (mitodrummer, 10-10): resetting revision to 0 on a bump while a build patch survives produced a bump PR that fails the ledger rule. The counter restarts at 0 only when no patch survives, else 1 (spec REV-002 amended to match); test pins both states. The eager-fold comment now gives its real reason (per-entry messages), since #2047 applies element contracts on the consumer path too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bryan-minimal
added a commit
that referenced
this pull request
Oct 14, 2026
…sequence syntax Review (mitodrummer, 10-10): resetting revision to 0 on an upstream bump while a build patch survives produced a bump PR the ledger rule refuses to load. The counter restarts at 0 only when no patch survives, else 1 (spec REV-002, gominimal/pkgmgr-rs#962); a test pins both states. CveId now follows CVE syntax: a four-digit sequence may be zero-padded, five or more digits may not start with zero (CodeRabbit). The eager-fold comment gives its real reason after #2047. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bryan-minimal
added a commit
that referenced
this pull request
Oct 16, 2026
…st it (#1277) * feat(stdlib): revision counter and typed patch ledger in Attrs Two attrs for the security-patch convention in gominimal/inbox#511: a `revision` counting the patch-sets applied on top of upstream_version, and a typed `patches[]` ledger naming what each one fixed. Entries are contract-enforced, so a blank cve or origin refuses to parse rather than producing an SBOM row that asserts nothing. `upstream_version` gains a contract: it never carries an `-rN` suffix, because it is the advisory-matching key that feeds and `pkgmgr check` compare against. None of the registry's recipes violate it. Attrs is a closed schema, so recipes may set these only once every consumer carries this stdlib. The publish-boundary `qualified_version()` in pkgmgr renders `-rN` into SBOM, OpenVEX and secdb output. Refs: gominimal/inbox#511, gominimal/pkgmgr-rs#750 * feat(stdlib): type the patch ledger by kind, and check revision against it A ledger entry carries a kind of security, build or vendor; only a security fix must name its CVE and upstream commit, and the records are closed so a build or vendor entry cannot carry one. The ledger is checked entry by entry when the attribute is, because a consumer that reads attrs as values sees an array's elements without their contracts. Across attributes, a non-empty ledger needs revision >= 1, and neither revision nor patches is accepted without an upstream_version to qualify. An attr that fails now says why. decode gains the tests the spec names for REV-001, REV-003 and REV-011. stdlib 0.0.22. Refs: gominimal/inbox#511 * fix(stdlib): restart revision at 1 when a patch survives a bump; CVE sequence syntax Review (mitodrummer, 10-10): resetting revision to 0 on an upstream bump while a build patch survives produced a bump PR the ledger rule refuses to load. The counter restarts at 0 only when no patch survives, else 1 (spec REV-002, gominimal/pkgmgr-rs#962); a test pins both states. CveId now follows CVE syntax: a four-digit sequence may be zero-padded, five or more digits may not start with zero (CodeRabbit). The eager-fold comment gives its real reason after #2047. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Routing-Key: inbox-route/I_kwDOSUhdos8AAAABVhE3CQ
AttrValue::from_term_atapplies each record field's pending contracts before descending, but the array branch iterated elements raw. Any attr whosevalidateisArray Ctherefore accepted whatever its elements held on every consumer path (e.g.env_dir_mappings = [42]evaluated without error despite theArray { read_only | Bool, path | String, class | [| 'Credential, 'State |] }contract).The array branch now applies the array's pending contracts to each element, mirroring the record branch, so a bad element is rejected.
Behaviour change: configs with array elements that break their declared contract now fail to decode, with a 'contract broken' error that names the element.
Verification
cargo fmt --all --check --manifest-path Cargo.toml — clean
cargo clippy --workspace --all-targets --locked --manifest-path Cargo.toml -- -D warnings — Finished, no warnings
cargo test --locked --manifest-path Cargo.toml -p decode — 71 passed; 0 failed