232 lines
6.8 KiB
Markdown
232 lines
6.8 KiB
Markdown
<!-- file: deltas/0.0.4/alpha.4.fix.1.md -->
|
|
<!-- version: 1 -->
|
|
|
|
# Delta 0.0.4-alpha.4.fix.1 — correction du smoke Rust/Cargo
|
|
|
|
## Baseline
|
|
|
|
Version attendue avant application :
|
|
|
|
```text
|
|
0.0.4-alpha.4
|
|
```
|
|
|
|
Le history `history/0.0.4/alpha.4.md` avec statut `FAIL` MUST avoir été appliqué et committé avant ce correctif.
|
|
|
|
Version après application :
|
|
|
|
```text
|
|
0.0.4-alpha.4.fix.1
|
|
```
|
|
|
|
## Objet
|
|
|
|
Corriger uniquement la procédure de smoke Rust/Cargo qui a échoué pendant la gate opérateur de `alpha.4`.
|
|
|
|
Le workspace temporaire était fonctionnel et les commandes Cargo ont réussi, mais l'adaptation de `.cargo/config.toml` remplaçait les chemins contenant `project-name` sans adapter le commentaire de guidance qui contenait encore ce placeholder. L'assertion d'absence de placeholders échouait donc avant le smoke Cargo.
|
|
|
|
Ce fix adapte explicitement ce commentaire dans la fixture temporaire avant de vérifier l'absence de placeholders.
|
|
|
|
Aucune règle, aucun skeleton, aucun template et aucun script PGR n'est ajouté ou modifié.
|
|
|
|
## Scope
|
|
|
|
REPLACE :
|
|
|
|
```text
|
|
VERSION
|
|
```
|
|
|
|
ADD :
|
|
|
|
```text
|
|
deltas/0.0.4/alpha.4.fix.1.md
|
|
```
|
|
|
|
DELETE : aucun.
|
|
|
|
Les snapshots suivants restent inchangés :
|
|
|
|
```text
|
|
deltas/0.0.4/alpha.4.md
|
|
docs/skeletons/002-RUST_CARGO_WORKSPACE.md
|
|
templates/rust-cargo/rustfmt.toml
|
|
templates/rust-cargo/clippy.toml
|
|
templates/rust-cargo/.cargo/config.toml
|
|
templates/rust-cargo/Cargo.toml
|
|
templates/rust-cargo/crates/project-core-lib/Cargo.toml
|
|
```
|
|
|
|
## Validation opérateur
|
|
|
|
```bash
|
|
test "$(cat VERSION)" = '0.0.4-alpha.4.fix.1'
|
|
test -f history/0.0.4/alpha.4.md
|
|
test -f deltas/0.0.4/alpha.4.md
|
|
test -f deltas/0.0.4/alpha.4.fix.1.md
|
|
test -f docs/skeletons/002-RUST_CARGO_WORKSPACE.md
|
|
test ! -e history/0.0.4/alpha.4.fix.1.md
|
|
|
|
grep -A2 '^## Statut$' history/0.0.4/alpha.4.md | grep -Fx 'FAIL'
|
|
|
|
python3 -B -m unittest discover -s tests -v
|
|
|
|
python3 -B scripts/audit_markdown_headers.py \
|
|
README.md RULES.md ROADMAP.md CHANGELOG.md docs deltas history prompts
|
|
python3 -B scripts/audit_markdown_tables.py \
|
|
README.md RULES.md ROADMAP.md CHANGELOG.md docs deltas history prompts
|
|
python3 -B scripts/audit_markdown_links.py \
|
|
README.md RULES.md ROADMAP.md CHANGELOG.md docs deltas history prompts
|
|
|
|
python3 -B - <<'PY'
|
|
from pathlib import Path
|
|
import re
|
|
import tomllib
|
|
|
|
expected = {
|
|
'alpha.1.md': 'PASS',
|
|
'alpha.2.md': 'PASS',
|
|
'alpha.3.md': 'PASS',
|
|
'alpha.4.md': 'FAIL',
|
|
}
|
|
histories = {path.name for path in Path('history/0.0.4').glob('*.md')}
|
|
assert histories == set(expected), histories
|
|
for name, status in expected.items():
|
|
text = Path('history/0.0.4', name).read_text(encoding='utf-8')
|
|
assert re.search(rf'## Statut\s+{status}\s', text), (name, status)
|
|
|
|
skeletons = sorted(path.name for path in Path('docs/skeletons').glob('*.md'))
|
|
assert skeletons == [
|
|
'000-README.md',
|
|
'001-PROJECT_GOVERNANCE_FOUNDATION.md',
|
|
'002-RUST_CARGO_WORKSPACE.md',
|
|
], skeletons
|
|
|
|
for path in (
|
|
Path('templates/rust-cargo/rustfmt.toml'),
|
|
Path('templates/rust-cargo/clippy.toml'),
|
|
Path('templates/rust-cargo/.cargo/config.toml'),
|
|
Path('templates/rust-cargo/Cargo.toml'),
|
|
Path('templates/rust-cargo/crates/project-core-lib/Cargo.toml'),
|
|
):
|
|
with path.open('rb') as stream:
|
|
tomllib.load(stream)
|
|
|
|
print('Rust/Cargo fix audit: clean (alpha.4 FAIL recorded, skeleton/templates unchanged)')
|
|
PY
|
|
|
|
command -v cargo
|
|
command -v rustfmt
|
|
cargo --version
|
|
rustc --version
|
|
rustfmt --version
|
|
cargo clippy --version
|
|
|
|
tmp="$(mktemp -d)"
|
|
trap 'rm -rf "$tmp"' EXIT
|
|
mkdir -p "$tmp/.cargo" "$tmp/crates/smoke-core-lib/src"
|
|
cp templates/rust-cargo/Cargo.toml "$tmp/Cargo.toml"
|
|
cp templates/rust-cargo/rustfmt.toml "$tmp/rustfmt.toml"
|
|
cp templates/rust-cargo/clippy.toml "$tmp/clippy.toml"
|
|
cp templates/rust-cargo/.cargo/config.toml "$tmp/.cargo/config.toml"
|
|
cp templates/rust-cargo/crates/project-core-lib/Cargo.toml "$tmp/crates/smoke-core-lib/Cargo.toml"
|
|
printf '1.2.3\n' > "$tmp/VERSION"
|
|
|
|
python3 -B - "$tmp" <<'PY'
|
|
from pathlib import Path
|
|
import sys
|
|
|
|
root = Path(sys.argv[1])
|
|
|
|
replacements = {
|
|
root / 'Cargo.toml': (
|
|
('# file: templates/rust-cargo/Cargo.toml', '# file: Cargo.toml'),
|
|
('members = ["crates/project-core-lib"]', 'members = ["crates/smoke-core-lib"]'),
|
|
('version = "0.1.0"', 'version = "1.2.3"'),
|
|
),
|
|
root / 'rustfmt.toml': (
|
|
('# file: templates/rust-cargo/rustfmt.toml', '# file: rustfmt.toml'),
|
|
),
|
|
root / 'clippy.toml': (
|
|
('# file: templates/rust-cargo/clippy.toml', '# file: clippy.toml'),
|
|
),
|
|
root / '.cargo/config.toml': (
|
|
('# file: templates/rust-cargo/.cargo/config.toml', '# file: .cargo/config.toml'),
|
|
(
|
|
'# Replace project-name with a unique name before using this configuration.',
|
|
'# Smoke fixture: project-specific build directory already selected.',
|
|
),
|
|
('../builds/project-name/target', 'target-smoke'),
|
|
),
|
|
root / 'crates/smoke-core-lib/Cargo.toml': (
|
|
(
|
|
'# file: templates/rust-cargo/crates/project-core-lib/Cargo.toml',
|
|
'# file: crates/smoke-core-lib/Cargo.toml',
|
|
),
|
|
('name = "project-core-lib"', 'name = "smoke-core-lib"'),
|
|
),
|
|
}
|
|
|
|
for path, pairs in replacements.items():
|
|
text = path.read_text(encoding='utf-8')
|
|
for old, new in pairs:
|
|
assert old in text, (path, old)
|
|
text = text.replace(old, new)
|
|
path.write_text(text, encoding='utf-8')
|
|
|
|
for path in root.rglob('*'):
|
|
if path.is_file() and path.name != 'Cargo.lock':
|
|
text = path.read_text(encoding='utf-8')
|
|
assert 'project-name' not in text, path
|
|
assert 'project-core-lib' not in text, path
|
|
|
|
print('Temporary Rust/Cargo template adaptation: clean')
|
|
PY
|
|
|
|
cat > "$tmp/crates/smoke-core-lib/src/lib.rs" <<'RS'
|
|
//! Minimal crate used to validate the PGR Rust/Cargo templates.
|
|
|
|
/// Returns the deterministic smoke value.
|
|
pub fn smoke_value() -> u8 {
|
|
return 1;
|
|
}
|
|
RS
|
|
|
|
(
|
|
cd "$tmp"
|
|
cargo metadata --format-version 1 --no-deps >/dev/null
|
|
cargo fmt --all -- --check
|
|
cargo check --workspace
|
|
cargo clippy --workspace --all-targets --all-features -- -D warnings
|
|
)
|
|
|
|
rm -rf "$tmp"
|
|
trap - EXIT
|
|
|
|
git diff --check
|
|
|
|
git add VERSION deltas/0.0.4/alpha.4.fix.1.md
|
|
|
|
git diff --cached --check
|
|
git status --short
|
|
```
|
|
|
|
La sortie Git attendue avant ajout du history du fix est exactement :
|
|
|
|
```text
|
|
M VERSION
|
|
A deltas/0.0.4/alpha.4.fix.1.md
|
|
```
|
|
|
|
## Transition
|
|
|
|
### PASS
|
|
|
|
Créer et appliquer séparément `history/0.0.4/alpha.4.fix.1.md`, committer et pousser le correctif, puis reprendre le plan `0.0.4` à la tranche suivante prévue.
|
|
|
|
Le history `alpha.4.fix.1` et le delta de la tranche suivante MAY être livrés ensemble sous forme de deux archives séparées après observation de la gate opérateur.
|
|
|
|
### FAIL
|
|
|
|
Rester dans `0.0.4-alpha.4.fix.M`. Le scope MUST rester limité au smoke Rust/Cargo de cette tranche tant qu'aucun défaut plus large ne justifie un REPLAN.
|