Repository navigation
chore(supply-chain): trust ICU4X's sffc and portable-atomic's publisher; regenerate from the PR's store - #2323
Merged
Merged
Conversation
…er; regenerate from the PR's store Coverage: #2321's dependency refresh dropped cargo-vet's fully audited count from 334 to 302. Trust entries are keyed to one publisher, and the new versions came from another: - ICU4X 2.3.x (icu_*, litemap, potential_utf, tinystr, writeable, zerotrie, zerovec-derive) is published by sffc (crates.io 128408), an ICU4X co-maintainer. The existing entries trust Manishearth only. - portable-atomic 1.15.0 is published through crates.io trusted publishing (github:taiki-e/portable-atomic). The existing entry trusts the taiki-e user. Trust those identities at safe-to-deploy and regenerate exemptions. The result is 302 -> 320 fully audited and 246 -> 228 exempted, with 18 exemptions removed. Cargo Vet Auto: these entries were first added on #2321 and could not stay there. The workflow (pull_request_target) checks out main's supply-chain/ and fetches only the PR's Cargo files, so it re-added the exemptions and pruned the publisher rows the trust entries depend on. `cargo vet --locked` then rejected audits.toml as misformatted, and the job reruns on every maintainer push. Fetch the PR's audits.toml, config.toml and imports.lock before regenerating, so a PR keeps its own supply-chain changes. These files are data that cargo-vet parses, and the job stays gated to dependabot and OWNER/MEMBER authors, who can already write supply-chain/ directly. This PR does not touch Cargo.lock, so the bot does not run on it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The workflow has unresolved repository-targeting and stale-head race conditions.
Pull request overview
Restores cargo-vet trust coverage for refreshed ICU4X and portable-atomic dependencies and updates Cargo Vet Auto to use the PR’s supply-chain data.
Changes:
- Adds publisher and trusted-publisher audit records.
- Removes corresponding exemptions.
- Updates workflow regeneration inputs.
File summaries
| File | Summary |
|---|---|
supply-chain/imports.lock |
Records publisher identities. |
supply-chain/config.toml |
Removes replaced exemptions. |
supply-chain/audits.toml |
Adds trusted publisher audits. |
.github/workflows/cargo-vet-auto.yml |
Fetches PR supply-chain data before regeneration. |
Review details
Suppressed comments (2)
.github/workflows/cargo-vet-auto.yml:98
- This hardcodes the base repository while resolving
PR_SHA. The job also allowsOWNER/MEMBERPRs, which can come from a maintainer's fork; such a commit is not addressable throughrepos/$REPO/..., so this fetch fails (and the later branch API would target the wrong repository). Either gate the job to same-repository heads or consistently usepull_request.head.repo.full_namefor the fetch and push paths with appropriate permissions.
gh api "repos/$REPO/contents/supply-chain/$f?ref=$PR_SHA" \
--jq '.content' | base64 -d > "supply-chain/$f"
.github/workflows/cargo-vet-auto.yml:98
- This fetch is keyed to the event's
PR_SHA, but the commit step later reads whatever the branch points to at that moment and applies all stagedsupply-chain/files to it. If a maintainer pushes another commit while this run is in progress, this run can therefore overwrite that newer commit'saudits.toml/imports.lockchanges with the older event snapshot. Revalidate that the PR head is stillPR_SHAimmediately before creating the tree/ref update, or serialize/cancel overlapping runs for the PR.
for f in audits.toml config.toml imports.lock; do
gh api "repos/$REPO/contents/supply-chain/$f?ref=$PR_SHA" \
--jq '.content' | base64 -d > "supply-chain/$f"
- Files reviewed: 3/4 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Two issues Copilot raised on the store fetch added in the previous commit. Stale head: the store and Cargo.lock are fetched at the event's PR_SHA, but the commit step writes the staged files onto whatever the branch points to when it runs. A push during the run would get its supply-chain/ replaced with data from the older commit. Fetching the store makes that worse: a PR's own audits.toml and imports.lock are now among the files written. The Cargo.lock race existed before this. Skip the commit when the branch head is no longer PR_SHA. The newer push starts its own run. Forks: every fetch reads repos/$REPO/contents at PR_SHA and the commit updates repos/$REPO/git/refs/heads/$BRANCH, so a maintainer's fork PR could never complete. That was already true before the store fetch. Gate the job on the head repo being this repo, so it skips cleanly instead of failing partway. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr
robcohen
added a commit
that referenced
this pull request
Sep 20, 2026
Review pass over this PR, on perf and on coverage.
Perf, which the last pass measured only on pools of two or three lots. A real
AVERAGE account accumulates lots for years before a sale, and the escalation
does a BigInt multiply per lot, so the question was the curve rather than the
constant. Timing `Inventory::reduce` directly, best of five, release:
lots escalated fast path ratio
500 0.100 ms 0.033 ms 3.0x
2000 0.408 ms 0.139 ms 2.9x
8000 1.498 ms 0.652 ms 2.3x
Linear -- 4x the lots costs 3.7-4.1x the time -- so a single pool of 8,000 lots
reduces in 1.5 ms against 0.65 ms. No quadratic hiding in the escalation.
Coverage: the property test draws pools whose lots all share a sign, so a pool
holding BOTH directions of one commodity had none, and it is where a weighted
average is least intuitive -- the numerator is a difference of products rather
than a sum of like terms. Checked first that the regime is reachable at all: a
pool of +10 {2.5} and -4 {3.5} reduces at 11/6, correctly rounded. That one
takes the fast path, so the test uses 18-decimal costs to force the escalation,
and asserts its own premise. Disabling the escalation fails it.
Also verified this pass, both claims this PR makes:
The dependency cost. `rustledger-parser`, the published crate that uses core
standalone, goes from 65 dependency crates to 69 -- bigdecimal, libm,
num-bigint and num-integer; num-traits was already there. That is the "+4 on
65" the PR body states, now measured after the change rather than predicted
before it.
The `Update Exemptions` failure is not transient. Re-running the job reproduces
it exactly: `cargo vet regenerate exemptions` cannot parse
supply-chain/audits.toml, where three entries use a `trusted-publisher` key no
released cargo-vet understands. Pre-existing since #2323, path-gated on
Cargo.lock, and tracked in #2355; this branch does not touch supply-chain/.
This was referenced Sep 20, 2026
robcohen
added a commit
that referenced
this pull request
Sep 20, 2026
…rust (#2357) * ci(vet): pin cargo-vet to 0.10.2, the version that parses publisher trust `Update Exemptions` has failed on every Cargo.lock PR since #2323: ERROR × Failed to parse toml file ╰─▶ missing field `user-id` for key `trusted.mach2` My first diagnosis was that no released cargo-vet understands the `trusted-publisher` key those entries use, and that they should be rewritten as `user-id` entries. Both halves were wrong, and testing locally is what showed it. cargo-vet 0.10.2 parses the store and vets it: "Vetting Succeeded (320 fully audited, 3 partially audited, 228 exempted)". It also suggests `cargo vet trust <crate> github:owner/repo` on its own. So the entries are valid. They are also the only form that works here. Every version we depend on -- mach2 0.6.0, pin-project-lite 0.2.17, portable-atomic 1.15.0 -- was published through trusted publishing, with NO publishing user; earlier versions of all three came from a user. A `user-id` entry would therefore match nothing and silently grant none of the trust it appears to, which is the failure #2321 was about. Rewriting them, as I had started to do, would have quietly turned three trusted crates into exemptions. The defect is the version CI installs. `taiki-e/install-action` with an unversioned `tool: cargo-vet` takes the newest GitHub RELEASE -- v0.10.0, from 2024-10-03 -- which predates the feature. Its manifest offers no 0.10.2 (checked: it lists 0.10 and 0.10.0), and there is no 0.10.2 GitHub release for its binstall fallback either, so the pin has to go through crates.io: cargo install cargo-vet --version 0.10.2 --locked Pinned in supply-chain.yml as well. That job was resolving its own version from crates.io, so the two could disagree about whether this store parses; now they cannot. Verified locally, with the exact commands CI runs: the install succeeds and yields 0.10.2, `cargo vet regenerate exemptions` exits 0, and `cargo vet --locked` succeeds. Two things found while verifying: `cargo vet check` -- what a contributor runs, without `--locked` -- fails on main for a missing `audit-as-crates-io` entry on rustledger-budget, rustledger-ops and rustledger-returns, three first-party crates absent from a list of fourteen. CI's invocation does not reach that check, which is why it went unnoticed. Added, and `check` now succeeds. `regenerate exemptions` prunes one stale exemption (rustls-webpki 0.103.15). That is the fixed automation's own output, so it ships here rather than waiting for the next dependency PR. The job is path-gated on Cargo.lock, so it will not run on this PR; the evidence is the local runs above, and re-running it on #2354 after this merges. Closes #2355 * fix(vet): keep the rustls-webpki exemption; its pruning needed imports.lock My own change broke the `Cargo Vet` job on this PR: Vetting Failed! rustls-webpki:0.103.15 missing ["safe-to-deploy"] I had kept half of one output. `cargo vet regenerate exemptions` pruned that exemption AND updated imports.lock, which is what made it prunable: the audit covering the crate came from a freshly fetched import. I reverted imports.lock to keep this PR focused on the version pin and kept the pruning, so the store claimed an exemption was unnecessary while the audit that replaced it was no longer there. It passed locally because my tree still held the fetched imports at that moment. CI runs `cargo vet --locked`, which forbids fetching them, so the crate came out unvetted. Verified the fix with `--locked` this time, the flag CI actually uses, rather than the bare command. The exemption is back, so this PR now touches only the version pin and the three missing `audit-as-crates-io` entries; exemptions are byte-identical to main. The automation can prune it on the next dependency PR, when it updates imports.lock in the same commit -- which is the point of that job, and it works again once this merges.
robcohen
added a commit
that referenced
this pull request
Sep 20, 2026
…Decimal (#2354) * fix(core): compute the pooled average cost exactly, escalating to BigDecimal #2352 stopped AVERAGE booking pooling small lots at a ZERO cost, and left the rest: a sum that loses digits without reaching zero is still divided as-is, so the average is wrong in proportion. The issue offered a cheaper trigger or exact arithmetic. Measured, only exact arithmetic is right. Three Decimal-only forms, against an exact reference, counting results more than 100 units in the last place from correct: comparable small lots whole range products, divided (main) 28,146 8,894 ratio form when a product vanished, if the ratios are well-conditioned 215 8,348 incremental weighted mean 0 123,365 exact escalation (this) 0 0 Each Decimal-only form wins one population and loses the other, because rust_decimal keeps 28 decimal PLACES, not 28 significant digits: a small product loses digits to the floor and a small ratio loses them just the same. The incremental mean is the best of them on realistic pools and the worst of them on wide ones. So the average is computed in two tiers, the shape the balance validator already uses for an over-precise residual (#1240): the Decimal sum of products while every step is exact, otherwise the same expression in BigDecimal, rounded once. Ordinary pools stay on the Decimal path, unchanged to the last digit. Writing the property test as "correctly rounded" immediately found that tracking exactness per PRODUCT is not enough. Summing exact products rounds too, once their magnitudes fill the 96-bit mantissa, and that left one class two units in the last place from correct. An exact addition keeps the larger of the two scales, so the accumulation is checked the same way the products are. The seed is committed; removing that check fails it deterministically. This makes bigdecimal a dependency of rustledger-core, which had avoided one. Nothing new enters the workspace -- it is already here for #1240 -- and the cost falls on a rustledger-parser-only consumer, which gains four crates on 65. `to_bigdecimal` is now core's canonical conversion, and rustledger-booking's precise residual delegates to it so the two cannot drift. Measured on `check --no-cache`, 24,000 transactions with 8,000 AVERAGE reductions, release, median of 7 interleaved runs: -1.2% on 18-decimal amounts and -1.9% on ordinary money, both inside the run-to-run spread. Every reduction in the 18-decimal ledger escalates -- its products need 36 decimal places and come back with 28 -- so that figure is the escalation's real cost, not a measurement of a path that never ran. The first attempt at that benchmark was invalid (Python wrote the cash amounts in exponent notation, which the grammar rejects); the assertion that the ledger loads clean is what caught it. The property test now asserts correct rounding outright, where it could only assert "no fabricated zero, and otherwise the old formula" while the fix was a heuristic. Closes #2353 * test(booking): cover a mixed-sign pool through the exact escalation Review pass over this PR, on perf and on coverage. Perf, which the last pass measured only on pools of two or three lots. A real AVERAGE account accumulates lots for years before a sale, and the escalation does a BigInt multiply per lot, so the question was the curve rather than the constant. Timing `Inventory::reduce` directly, best of five, release: lots escalated fast path ratio 500 0.100 ms 0.033 ms 3.0x 2000 0.408 ms 0.139 ms 2.9x 8000 1.498 ms 0.652 ms 2.3x Linear -- 4x the lots costs 3.7-4.1x the time -- so a single pool of 8,000 lots reduces in 1.5 ms against 0.65 ms. No quadratic hiding in the escalation. Coverage: the property test draws pools whose lots all share a sign, so a pool holding BOTH directions of one commodity had none, and it is where a weighted average is least intuitive -- the numerator is a difference of products rather than a sum of like terms. Checked first that the regime is reachable at all: a pool of +10 {2.5} and -4 {3.5} reduces at 11/6, correctly rounded. That one takes the fast path, so the test uses 18-decimal costs to force the escalation, and asserts its own premise. Disabling the escalation fails it. Also verified this pass, both claims this PR makes: The dependency cost. `rustledger-parser`, the published crate that uses core standalone, goes from 65 dependency crates to 69 -- bigdecimal, libm, num-bigint and num-integer; num-traits was already there. That is the "+4 on 65" the PR body states, now measured after the change rather than predicted before it. The `Update Exemptions` failure is not transient. Re-running the job reproduces it exactly: `cargo vet regenerate exemptions` cannot parse supply-chain/audits.toml, where three entries use a `trusted-publisher` key no released cargo-vet understands. Pre-existing since #2323, path-gated on Cargo.lock, and tracked in #2355; this branch does not touch supply-chain/. * chore: regenerate cargo-vet exemptions --------- Co-authored-by: rustledger-bot[bot] <257329324+rustledger-bot[bot]@users.noreply.github.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.
Follow-up to #2321. It restores the cargo-vet audit coverage that the dependency refresh lost, and fixes the Cargo Vet Auto bot, which kept these entries from staying on that PR.
Trust entries
#2321 dropped fully audited crates from 334 to 302. Trust entries are keyed to one publisher, and the new versions came from another. The existing entries are still in date.
icu_collections,icu_locale_core,icu_normalizer(_data),icu_properties(_data),icu_provider,litemap,potential_utf,tinystr,writeable,zerotrie,zerovec-derivesffc(crates.io 128408, ICU4X co-maintainer)Manishearth(1139) onlyicu_segmenter(_data),icu_locale_fallback(_data)sffc, fromunicode-org/icu4xportable-atomic1.15.0github:taiki-e/portable-atomictaiki-euser (33035)safe-to-deploy, added withcargo vet trust.pin-project-liteandmach2.cargo vet --lockedgoes from 302 fully audited / 246 exempted to 320 fully audited / 228 exempted, with 18 exemptions removed.Cargo Vet Auto fix
What went wrong on #2321:
pull_request_target, so it runs frommain. It checks outmain'ssupply-chain/and fetches only the PR's Cargo files.sffcpublisher rows fromimports.lock.# Shane F. Carr (sffc)comment on thoseuser-idlines only whenimports.lockknows the publisher. With those rows gone,cargo vet --lockedrejectedaudits.tomlas misformatted.The fix: a new step fetches the PR's own
audits.toml,config.tomlandimports.lockbeforecargo vet regenerate exemptions, so a PR keeps its own supply-chain changes.supply-chain/directly.Two hardening changes, from Copilot's review of this PR:
Cargo.lockare fetched at the event'sPR_SHA, but the commit step writes onto whatever the branch points to when it runs. A push during the run would have itssupply-chain/replaced with the older commit's data, and fetching the store makes that worse. The commit step now skips when the branch head is no longerPR_SHA; the newer push starts its own run. This also closes the same race that already existed forCargo.lock.repos/$REPO/contentsatPR_SHA, and the commit updatesrepos/$REPO/git/refs/heads/$BRANCH, so a maintainer's fork PR could never complete; that was true before this PR too. The job is now gated on the head repo being this repo, so a fork PR skips cleanly instead of failing partway.Rollout:
pull_request_targetreads the workflow frommain, so the fix takes effect for PRs opened or updated after this merges. This PR does not touchCargo.lock, the bot's path trigger, so the old workflow does not run here.Verification
cargo vet --locked: 320 fully audited, 3 partially audited, 228 exempted.github.event.pull_request.head.repo.full_name == github.repository. The commit step hasPR_SHAin its env and exits before committing whenCURRENT_SHA != PR_SHA, and its script passesbash -n.supply-chain/and.github/workflows/cargo-vet-auto.ymlchange.🤖 Generated with Claude Code
https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr