Commit 7c4e86d
authored
Filter publish output by registry version (cargo info) (#21)
* feat(publish): emit only crates whose local version is newer than the registry
Previously the `publish` output contained every crate with `publish != false`,
even when the local Cargo.toml version matched what was already on the
registry — so a `cargo publish -p ${{ matrix.package }}` step would fail with
"crate version already uploaded" until a human pruned the matrix.
`parseMetadata` now returns `publishCandidates: [{name, version, registry}]`
and a new async `filterPublishable` runs `cargo info <name>` (with
`--registry` when the candidate is registry-restricted) for each candidate,
keeping only those whose local version is strictly greater per a full
semver §11 compare. Crates absent from the registry are kept (first publish);
other `cargo info` failures log a warning and skip the candidate, so a
transient outage cannot republish a stale crate.
Tests: rewrote publish-related cases for the new shape and added unit tests
for `compareSemver` (prerelease precedence, numeric vs lexical, build
metadata) and `parseCargoInfoVersion`. All 28 tests pass; dist rebuilt.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Sergey Vilgelm <sergey@vilgelm.com>
* chore: bump to 1.1.0
New `publish` output filter (only crates with a newer-than-registry version)
is a user-visible feature addition; bump minor.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Sergey Vilgelm <sergey@vilgelm.com>
* fix(publish): force registry lookup in cargo info, rename colliding fixture
Two related Fixtures-CI bugs surfaced once the publish output started using
cargo info:
1. `cargo info <name>` (no `--registry`) probes the workspace at `cwd`
first and returns the *local* member's version when the name matches.
That made `local == published` for every workspace candidate and
silently emptied the publish output. Always pass `--registry` (default
`crates-io`) so cargo skips the local lookup.
2. The workspace-mixed fixture's `app` package collided with the real
`app` crate on crates.io (already at 0.6.5), so the fixture's 0.1.0 was
correctly classified as stale and excluded — but the workflow asserted
the opposite. Rename the fixture to `rma-fixture-app` (with a comment
explaining why) so it's guaranteed to be a first-publish, and update
the workspace-mixed assertions accordingly.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Sergey Vilgelm <sergey@vilgelm.com>
* review: address Copilot review comments on filter logic
Three issues called out by the PR-21 review:
1. Multi-registry candidates (`publish = ["a","b"]`) only had their first
entry queried, so a crate stale on registry "b" but absent from "a"
could still appear in the publish list. parseMetadata now emits the
full `registries: string[]` (with `[null]` for unrestricted), and the
new `getMaxPublishedVersion` queries every entry and compares against
the highest version found.
2. `getPublishedVersion` resolved to `null` when `cargo info` exited 0 but
the parser couldn't find a `version:` line — `filterPublishable` then
treated that as "first publish" and included the crate, which would
mass-republish on any future cargo output drift. Reject in that path
instead, so the catch path warns and skips (safe default).
3. `Promise.all` over every candidate spawned one `cargo info` per crate
concurrently. Replaced with a small `asyncPool` (limit 4) so resource
use stays predictable on large workspaces and we don't trip registry
rate limits.
Tests: updated publish-candidate fixtures to assert `registries: [...]`,
added a multi-registry test case, plus three asyncPool tests (order,
concurrency cap, empty input). 32/32 pass; dist rebuilt.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Sergey Vilgelm <sergey@vilgelm.com>
* review: drop unused index argument from asyncPool worker call
`asyncPool`'s JSDoc already documented the worker as `worker(item)`, but
the call site was `worker(items[i], i)` — passing an index that no caller
consumes. Flagged by github-code-quality[bot] on PR 21. Drop the second
arg so code matches the documented signature; trivially re-addable if a
future caller actually wants the index.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Sergey Vilgelm <sergey@vilgelm.com>
---------
Signed-off-by: Sergey Vilgelm <sergey@vilgelm.com>1 parent f3e4c81 commit 7c4e86d
9 files changed
Lines changed: 605 additions & 41 deletions
File tree
- .github/workflows
- dist
- tests
- fixtures/workspace-mixed/app
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
146 | 146 | | |
147 | | - | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
115 | 119 | | |
116 | 120 | | |
117 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27976 | 27976 | | |
27977 | 27977 | | |
27978 | 27978 | | |
27979 | | - | |
| 27979 | + | |
27980 | 27980 | | |
27981 | 27981 | | |
27982 | 27982 | | |
| |||
28086 | 28086 | | |
28087 | 28087 | | |
28088 | 28088 | | |
| 28089 | + | |
| 28090 | + | |
| 28091 | + | |
| 28092 | + | |
| 28093 | + | |
| 28094 | + | |
| 28095 | + | |
| 28096 | + | |
| 28097 | + | |
| 28098 | + | |
| 28099 | + | |
| 28100 | + | |
| 28101 | + | |
| 28102 | + | |
| 28103 | + | |
| 28104 | + | |
| 28105 | + | |
| 28106 | + | |
| 28107 | + | |
| 28108 | + | |
| 28109 | + | |
| 28110 | + | |
| 28111 | + | |
| 28112 | + | |
| 28113 | + | |
| 28114 | + | |
| 28115 | + | |
| 28116 | + | |
| 28117 | + | |
| 28118 | + | |
| 28119 | + | |
| 28120 | + | |
| 28121 | + | |
| 28122 | + | |
| 28123 | + | |
| 28124 | + | |
| 28125 | + | |
| 28126 | + | |
| 28127 | + | |
| 28128 | + | |
| 28129 | + | |
| 28130 | + | |
| 28131 | + | |
| 28132 | + | |
| 28133 | + | |
| 28134 | + | |
| 28135 | + | |
| 28136 | + | |
| 28137 | + | |
| 28138 | + | |
| 28139 | + | |
| 28140 | + | |
| 28141 | + | |
| 28142 | + | |
| 28143 | + | |
| 28144 | + | |
| 28145 | + | |
| 28146 | + | |
| 28147 | + | |
| 28148 | + | |
| 28149 | + | |
| 28150 | + | |
| 28151 | + | |
| 28152 | + | |
| 28153 | + | |
| 28154 | + | |
| 28155 | + | |
| 28156 | + | |
| 28157 | + | |
| 28158 | + | |
| 28159 | + | |
| 28160 | + | |
| 28161 | + | |
| 28162 | + | |
| 28163 | + | |
| 28164 | + | |
| 28165 | + | |
| 28166 | + | |
| 28167 | + | |
| 28168 | + | |
| 28169 | + | |
| 28170 | + | |
| 28171 | + | |
| 28172 | + | |
| 28173 | + | |
| 28174 | + | |
| 28175 | + | |
| 28176 | + | |
| 28177 | + | |
| 28178 | + | |
| 28179 | + | |
| 28180 | + | |
| 28181 | + | |
| 28182 | + | |
| 28183 | + | |
| 28184 | + | |
| 28185 | + | |
| 28186 | + | |
| 28187 | + | |
| 28188 | + | |
| 28189 | + | |
| 28190 | + | |
| 28191 | + | |
| 28192 | + | |
| 28193 | + | |
| 28194 | + | |
| 28195 | + | |
| 28196 | + | |
| 28197 | + | |
| 28198 | + | |
| 28199 | + | |
| 28200 | + | |
| 28201 | + | |
| 28202 | + | |
| 28203 | + | |
| 28204 | + | |
| 28205 | + | |
| 28206 | + | |
| 28207 | + | |
| 28208 | + | |
| 28209 | + | |
| 28210 | + | |
| 28211 | + | |
| 28212 | + | |
| 28213 | + | |
| 28214 | + | |
| 28215 | + | |
| 28216 | + | |
| 28217 | + | |
| 28218 | + | |
| 28219 | + | |
| 28220 | + | |
| 28221 | + | |
| 28222 | + | |
| 28223 | + | |
| 28224 | + | |
| 28225 | + | |
| 28226 | + | |
| 28227 | + | |
| 28228 | + | |
| 28229 | + | |
| 28230 | + | |
| 28231 | + | |
| 28232 | + | |
| 28233 | + | |
| 28234 | + | |
| 28235 | + | |
| 28236 | + | |
| 28237 | + | |
| 28238 | + | |
| 28239 | + | |
| 28240 | + | |
| 28241 | + | |
| 28242 | + | |
28089 | 28243 | | |
28090 | 28244 | | |
28091 | | - | |
| 28245 | + | |
28092 | 28246 | | |
28093 | 28247 | | |
28094 | 28248 | | |
28095 | 28249 | | |
28096 | 28250 | | |
28097 | 28251 | | |
28098 | | - | |
| 28252 | + | |
| 28253 | + | |
| 28254 | + | |
| 28255 | + | |
| 28256 | + | |
| 28257 | + | |
| 28258 | + | |
| 28259 | + | |
| 28260 | + | |
| 28261 | + | |
| 28262 | + | |
| 28263 | + | |
| 28264 | + | |
| 28265 | + | |
28099 | 28266 | | |
28100 | 28267 | | |
28101 | 28268 | | |
| |||
28127 | 28294 | | |
28128 | 28295 | | |
28129 | 28296 | | |
28130 | | - | |
| 28297 | + | |
28131 | 28298 | | |
28132 | 28299 | | |
28133 | 28300 | | |
28134 | 28301 | | |
28135 | 28302 | | |
28136 | 28303 | | |
28137 | | - | |
28138 | | - | |
| 28304 | + | |
| 28305 | + | |
| 28306 | + | |
| 28307 | + | |
| 28308 | + | |
| 28309 | + | |
| 28310 | + | |
| 28311 | + | |
| 28312 | + | |
| 28313 | + | |
| 28314 | + | |
| 28315 | + | |
| 28316 | + | |
| 28317 | + | |
| 28318 | + | |
| 28319 | + | |
| 28320 | + | |
| 28321 | + | |
| 28322 | + | |
| 28323 | + | |
| 28324 | + | |
| 28325 | + | |
| 28326 | + | |
| 28327 | + | |
| 28328 | + | |
| 28329 | + | |
| 28330 | + | |
| 28331 | + | |
| 28332 | + | |
| 28333 | + | |
| 28334 | + | |
| 28335 | + | |
| 28336 | + | |
| 28337 | + | |
| 28338 | + | |
| 28339 | + | |
| 28340 | + | |
| 28341 | + | |
28139 | 28342 | | |
| 28343 | + | |
28140 | 28344 | | |
28141 | 28345 | | |
28142 | 28346 | | |
| |||
28149 | 28353 | | |
28150 | 28354 | | |
28151 | 28355 | | |
28152 | | - | |
| 28356 | + | |
| 28357 | + | |
28153 | 28358 | | |
28154 | 28359 | | |
28155 | 28360 | | |
| |||
28164 | 28369 | | |
28165 | 28370 | | |
28166 | 28371 | | |
28167 | | - | |
| 28372 | + | |
| 28373 | + | |
28168 | 28374 | | |
28169 | 28375 | | |
28170 | | - | |
| 28376 | + | |
28171 | 28377 | | |
28172 | 28378 | | |
28173 | 28379 | | |
| |||
31012 | 31218 | | |
31013 | 31219 | | |
31014 | 31220 | | |
31015 | | - | |
| 31221 | + | |
31016 | 31222 | | |
31017 | 31223 | | |
31018 | 31224 | | |
| |||
0 commit comments