airvzxf / airvzxf/voxora

check-cratesio-deps.py does not honor cargo's pre-release exclusion rule

Chiusa
#110 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
bug infrastructure
Lingua principale
Rust
Stelle
0
Fork
1
Merge medio
11m
PR unite (30g)
77

Descrizione

## What

The Python semver matcher at `.github/scripts/check-cratesio-deps.py`
(introduced in #108) does not enforce cargo's pre-release exclusion
rule. Cargo excludes pre-release versions from a requirement
unless the requirement's lower bound names that pre-release
explicitly. The script's `key()` function inverts pre-release
ordering (releases sort BEFORE pre-releases of the same
`x.y.z`), and the caret/tilde/comparison branches use native
tuple comparison instead of routing through a corrected
comparator.

## Why it matters

For the current 0.4.2 → 0.4.3 cycle the rule is moot because no
pre-release has been published. If a future hotfix ever ships a
`voxora-traits-v0.4.3-rc1` for a dry-run, the guard would say
"✓ satisfied by voxora-traits 0.4.3-rc1" while `cargo publish`
would fail at dep-resolution time — the exact failure mode the
guard was added in #94/#108 to prevent.

## Reproduction (against the committed script)

```
$ printf "0.4.2\n0.4.3-rc1\n" | python3 .github/scripts/check-cratesio-deps.py '^0.4.2'
0.4.3-rc1 ← guard says satisfied

$ printf "0.4.2\n0.4.3\n0.4.3-rc1\n" | python3 .github/scripts/check-cratesio-deps.py '~0.4.2'
0.4.3-rc1 ← guard says satisfied
```

Versus cargo (verified with the `semver = "1.0.28"` crate that
`Cargo.lock:1` pins): `0.4.3-rc.1.matches("^0.4.2")` →
`false`. The pre-flight check would print "✓ voxora-traits
^0.4.2 satisfied by voxora-traits 0.4.3-rc.1 on crates.io" and
then `cargo publish` would fail at dep-resolution time.

## Recipe

Two coordinated changes in `.github/scripts/check-cratesio-deps.py`:

1. `key()` should return `(t[0], t[1], t[2], 0 if t[3] else 1, t[3])`
so pre-releases sort BEFORE the corresponding normal version
(semver 2.0 §11).
2. The caret / tilde / comparison branches should drop any
candidate whose `pv[3]` is non-empty unless the requirement's
lower bound names that pre-release exactly. Add a
`req_has_pre(req) -> bool` gate.

Then add a unit-test invocation to the `ci` job (or a
follow-up `.github/scripts/test-check-cratesio-deps.py`) that
exercises the pre-release rejection case.

## Acceptance

- `check-cratesio-deps.py '^0.4.2' 0.4.2 0.4.3-rc.1 0.4.3`
returns `0.4.3` (not `0.4.3-rc.1`).
- `check-cratesio-deps.py '>=0.4.0, <0.5.0' 0.4.2-rc.5` returns
nothing (pre-release excluded unless explicitly required).
- A regression test runs the script against a representative
pre-release candidate set on every CI build.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start with .github/scripts/check-cratesio-deps.py, especially key() and the caret, tilde, and comparison branches, then run the reproduction commands from the issue. Add coverage for excluded and explicitly required pre-releases, and wire a representative regression invocation into the ci job or a follow-up .github/scripts/test-check-cratesio-deps.py; the listed acceptance commands should produce the stated results.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python, rust
Ambito
ci-cd, tooling
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Attiva
Chiarezza
Specificata chiaramente
Idoneità per principianti
72/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.