# Delta 0.0.3-alpha.3.fix.1 — correction du test de commit candidat ## Baseline requise Partir de `0.0.3-alpha.3` après application, commit et push de son history `FAIL`. La version devient : ```text 0.0.3-alpha.3.fix.1 ``` ## Objet Corriger uniquement le défaut de compilation observé dans `crates/knowledge-git-lib/tests/git_write_candidate.rs` pendant la gate `alpha.3`. L'assertion fautive comparait directement : ```text Result ``` à un `Ok(String)`. Cette forme exige `PartialEq` sur `std::io::Error`, qui n'est pas implémenté. Le fix remplace cette comparaison par une vérification de motif sur `snapshot_content.as_deref()` afin de valider uniquement le cas `Ok("first\n")` sans comparer la variante d'erreur. Aucune logique de `knowledge-git-lib` n'est modifiée. Le worktree, les mutations, le commit candidat, la rétention de référence, le nettoyage et les contrats publics restent byte-for-byte identiques à `alpha.3`. ## Scope des fichiers REPLACE : ```text VERSION Cargo.toml crates/knowledge-git-lib/tests/git_write_candidate.rs docs/plans/003-V0_0_3_GIT_WRITE_PLAN.md ``` ADD : ```text deltas/0.0.3/alpha.3.fix.1.md ``` DELETE : aucun. `crates/knowledge-git-lib/src/`, `crates/knowledge-git-lib/unit_tests/`, `knowledge-git-api`, `knowledge-app-lib`, `Web/`, `CHANGELOG.md` et `ROADMAP.md` ne sont pas modifiés. Aucun history `alpha.3.fix.1` n'est inclus dans ce delta. ## Gate opérateur Exécuter depuis la racine du dépôt après application du delta : ```bash test "$(cat VERSION)" = '0.0.3-alpha.3.fix.1' grep -F 'version = "0.0.3-alpha.3.fix.1"' Cargo.toml git diff --check python3 -B scripts/audit_markdown_headers.py README.md RULES.md ROADMAP.md CHANGELOG.md docs prompts deltas history python3 -B scripts/audit_markdown_links.py README.md RULES.md ROADMAP.md CHANGELOG.md docs prompts deltas history python3 -B scripts/audit_markdown_tables.py README.md RULES.md ROADMAP.md CHANGELOG.md docs prompts deltas history cargo fmt --all cargo fmt --all -- --check python3 -B scripts/audit_rust_test_layout.py crates python3 -B scripts/audit_rust_blank_lines.py crates python3 -B scripts/audit_rust_item_spacing.py crates python3 -B scripts/audit_rust_module_order.py crates python3 -B scripts/audit_rust_trait_import_blocks.py crates python3 -B scripts/audit_rust_reexport_blocks.py crates python3 -B scripts/audit_rust_crate_root_facades.py crates python3 -B scripts/audit_rust_export_completeness.py --root . --summary-only cargo metadata --format-version 1 --no-deps > /tmp/sasedev-knowledge-0.0.3-alpha.3.fix.1-metadata.json cargo check --workspace cargo clippy --workspace --all-targets --all-features -- -D warnings cargo test -p knowledge-git-lib --test git_read_path cargo test -p knowledge-git-lib --test git_write_candidate cargo test --workspace --all-targets --all-features python3 - <<'PYGATE' from pathlib import Path history = Path('history/0.0.3/alpha.3.md').read_text(encoding='utf-8') assert '\nFAIL\n' in history test_source = Path('crates/knowledge-git-lib/tests/git_write_candidate.rs').read_text(encoding='utf-8') assert 'assert!(matches!(snapshot_content.as_deref(), Ok("first\\n")));' in test_source assert 'assert_eq!(snapshot_content, Ok(String::from("first\\n")));' not in test_source plan = Path('docs/plans/003-V0_0_3_GIT_WRITE_PLAN.md').read_text(encoding='utf-8') assert "### alpha.3.fix.1 — correction de l'assertion du test candidat" in plan assert '`alpha.3` est conservée `FAIL`' in plan assert 'Un `PASS` complet de ce fix autorise `alpha.4`' in plan changelog = Path('CHANGELOG.md').read_text(encoding='utf-8') assert '## 0.0.3' not in changelog assert not Path('history/0.0.3/alpha.3.fix.1.md').exists() assert not Path('crates/knowledge-forge-gitea-lib').exists() assert not Path('crates/knowledge-store-postgres-lib').exists() assert not Path('migrations').exists() print('Knowledge 0.0.3-alpha.3.fix.1 compile-fix audit: clean') PYGATE python3 - <<'PYTEXT' from pathlib import Path roots = [ Path('README.md'), Path('RULES.md'), Path('ROADMAP.md'), Path('CHANGELOG.md'), Path('docs'), Path('prompts'), Path('deltas'), Path('history'), ] paths = [] for root in roots: if root.is_file(): paths.append(root) elif root.is_dir(): paths.extend(path for path in root.rglob('*') if path.is_file()) for path in paths: data = path.read_bytes() assert b'\r' not in data, path assert data.endswith(b'\n'), path assert not data.endswith(b'\n\n'), path text = data.decode('utf-8') for number, line in enumerate(text.splitlines(), start=1): assert line == line.rstrip(' \t'), (path, number) print(f'Knowledge 0.0.3-alpha.3.fix.1 text hygiene: clean ({len(paths)} file(s))') PYTEXT test -z "$(git diff --name-only -- crates/knowledge-git-lib/src crates/knowledge-git-lib/unit_tests crates/knowledge-git-api crates/knowledge-app-lib Web CHANGELOG.md ROADMAP.md)" test ! -e history/0.0.3/alpha.3.fix.1.md test -f Cargo.lock git check-ignore -q Cargo.lock if git ls-files --error-unmatch Cargo.lock >/dev/null 2>&1; then echo 'Cargo.lock must remain untracked for Knowledge' >&2 exit 1 fi test -f Web/knowledge-template-lab/package-lock.json git add -A git diff --cached --check git status --short ``` La gate ne rejoue pas npm/Vite/HTTP : aucun fichier Web ni contrat runtime n'est modifié. ## Transition ### PASS Produire `history/0.0.3/alpha.3.fix.1.md`, l'appliquer, commit/push `0.0.3-alpha.3.fix.1`, puis préparer `0.0.3-alpha.4`. ### FAIL / PARTIAL / BLOCKED Conserver le résultat réel dans son history avant toute correction. Une nouvelle correction bornée utilise `alpha.3.fix.2`; si le diagnostic invalide les invariants du worktree ou du candidat, effectuer un REPLAN avant de poursuivre.