diff --git a/Cargo.toml b/Cargo.toml index 8096901..7a2ffef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ # file: Cargo.toml -# version: 34 +# version: 35 [workspace] resolver = "3" @@ -16,7 +16,7 @@ members = [ ] [workspace.package] -version = "0.0.3-alpha.3" +version = "0.0.3-alpha.3.fix.1" edition = "2024" publish = false repository = "https://git.sasedev.com/Sasedev/sasedev-knowledge" diff --git a/VERSION b/VERSION index 465be41..7291991 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.3-alpha.3 +0.0.3-alpha.3.fix.1 diff --git a/crates/knowledge-git-lib/tests/git_write_candidate.rs b/crates/knowledge-git-lib/tests/git_write_candidate.rs index bfca707..d876786 100644 --- a/crates/knowledge-git-lib/tests/git_write_candidate.rs +++ b/crates/knowledge-git-lib/tests/git_write_candidate.rs @@ -1,5 +1,5 @@ // file: crates/knowledge-git-lib/tests/git_write_candidate.rs -// version: 1 +// version: 2 //! Integration tests for isolated real Git candidate creation using local temporary repositories. @@ -250,7 +250,7 @@ fn candidate_commit_applies_exact_mutations_uses_explicit_identity_and_cleans_wo let source_key = knowledge_git_lib::GitSourceKey::from_source_id(&source_id); assert!(!backend.config().write_worktrees_path().join(source_key.as_str()).join("candidate").exists()); let snapshot_content = std::fs::read_to_string(snapshot.path().join("content.txt")); - assert_eq!(snapshot_content, Ok(String::from("first\n"))); + assert!(matches!(snapshot_content.as_deref(), Ok("first\n"))); assert!(snapshot.path().join("delete.txt").is_file()); let _ = std::fs::remove_dir_all(&root); return; diff --git a/deltas/0.0.3/alpha.3.fix.1.md b/deltas/0.0.3/alpha.3.fix.1.md new file mode 100644 index 0000000..517892c --- /dev/null +++ b/deltas/0.0.3/alpha.3.fix.1.md @@ -0,0 +1,173 @@ + + + +# 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. diff --git a/docs/plans/003-V0_0_3_GIT_WRITE_PLAN.md b/docs/plans/003-V0_0_3_GIT_WRITE_PLAN.md index cfb60e0..cda243e 100644 --- a/docs/plans/003-V0_0_3_GIT_WRITE_PLAN.md +++ b/docs/plans/003-V0_0_3_GIT_WRITE_PLAN.md @@ -1,5 +1,5 @@ - + # Plan 0.0.3 — écriture Git contrôlée et push gardé @@ -19,7 +19,7 @@ Knowledge start prompt prompts/003-V0_0_3_START_PROMPT.md PGR `v0.1.3` reste une provenance historique de l'adoption fermée pendant `0.0.2`. Aucune version PGR plus récente n'est une source de cette release et aucune réévaluation PGR n'est engagée. -`0.0.3-alpha.1` et `alpha.1.fix.1` sont conservées `PARTIAL` avec leurs preuves réelles. `alpha.1.fix.2` a complété la gate documentaire et technique en `PASS`, ce qui ferme le cadrage et autorise `alpha.2`. `alpha.2` matérialise maintenant uniquement le contrat d'écriture provider-neutral dans `knowledge-git-api`; le backend de worktree reste réservé à `alpha.3`. +`0.0.3-alpha.1` et `alpha.1.fix.1` sont conservées `PARTIAL` avec leurs preuves réelles. `alpha.1.fix.2` a complété la gate documentaire et technique en `PASS`. `alpha.2` a matérialisé le contrat d'écriture provider-neutral en `PASS`. `alpha.3` a ensuite introduit le worktree et le commit candidat, mais sa gate est `FAIL` sur une assertion du nouveau test d'intégration qui compare un `Result` avec `assert_eq!`. `alpha.3.fix.1` corrige uniquement cette preuve de test avant toute progression vers `alpha.4`. ## Mission @@ -174,6 +174,14 @@ La gate de `alpha.1` reste une gate de cadrage : elle valide baseline, documenta - retenir le candidat sous une référence backend interne sans mettre à jour de branche distante ; - nettoyer l'état temporaire de manière déterministe sans supprimer silencieusement un worktree préexistant. +### alpha.3.fix.1 — correction de l'assertion du test candidat + +- conserver `alpha.3 = FAIL` avec la preuve exacte de compilation `E0369` ; +- ne modifier aucun code produit de `knowledge-git-lib` ni aucun contrat public ; +- remplacer uniquement l'assertion invalide sur `Result` par une vérification du cas `Ok("first\n")` qui n'exige pas `PartialEq` sur `std::io::Error` ; +- rejouer Clippy, le test `git_write_candidate` et les tests workspace ; +- autoriser `alpha.4` uniquement après `PASS` complet du fix. + ### alpha.4 — push gardé et concurrence - observer l'état de la branche distante ; @@ -237,7 +245,7 @@ La release est fermable lorsque : - les règles/architecture décrivent l'état effectivement obtenu ; - beta et RC ont fermé les non-régressions prévues. -Le `PARTIAL` de `alpha.1` a autorisé `0.0.3-alpha.1.fix.1`. Le premier fix est resté `PARTIAL`, puis `alpha.1.fix.2` a fermé la preuve en `PASS`. `alpha.2` a ensuite matérialisé le contrat d'écriture provider-neutral et sa gate opérateur est `PASS`; son history autorise `0.0.3-alpha.3`. Tout autre statut de `alpha.3` produit d'abord son history puis un fix borné ou un REPLAN selon le diagnostic. +Le `PARTIAL` de `alpha.1` a autorisé `0.0.3-alpha.1.fix.1`. Le premier fix est resté `PARTIAL`, puis `alpha.1.fix.2` a fermé la preuve en `PASS`. `alpha.2` a ensuite matérialisé le contrat d'écriture provider-neutral avec une gate `PASS`. `alpha.3` est conservée `FAIL` à cause de l'assertion de test `E0369`; son history autorise uniquement `alpha.3.fix.1`. Un `PASS` complet de ce fix autorise `alpha.4`; tout autre statut produit d'abord son history puis un fix borné ou un REPLAN selon le diagnostic. ## Revue d'horizon diff --git a/history/0.0.3/alpha.3.fix.1.md b/history/0.0.3/alpha.3.fix.1.md new file mode 100644 index 0000000..33c3faa --- /dev/null +++ b/history/0.0.3/alpha.3.fix.1.md @@ -0,0 +1,123 @@ + + + +# History 0.0.3-alpha.3.fix.1 — correction de l'assertion du test candidat + +## Statut + +PASS + +La gate opérateur de `0.0.3-alpha.3.fix.1` exécutée le `2026-09-29` est complète et propre. Le défaut de compilation `E0369` de `alpha.3` est corrigé sans modification du code produit : l'assertion du test d'intégration vérifie désormais le cas `Ok("first\n")` sans exiger `PartialEq` sur `std::io::Error`. + +## Baseline opérateur + +`alpha.3` `FAIL` a été historisé, committé et poussé avant application du fix : + +```text +history/0.0.3/alpha.3.md FAIL +commit c3a8256 +message 0.0.3-alpha.3 +branch master +push origin/master PASS +workspace après push propre +``` + +Le push observé a avancé `origin/master` de `88a63b0` à `c3a8256`. + +## Version et documentation + +```text +VERSION 0.0.3-alpha.3.fix.1 +Cargo workspace version 0.0.3-alpha.3.fix.1 +git diff --check PASS +Markdown header audit clean (110 file(s)) +Markdown link audit clean (78 local link(s), 110 file(s)) +Markdown table audit clean (4 table(s), 110 file(s)) +``` + +## Formatage et audits Rust + +```text +cargo fmt --all PASS +cargo fmt --all -- --check PASS +Rust test-layout audit clean (9 crate(s)) +Rust blank-line audit clean (35 file(s)) +Rust item-spacing audit clean (35 file(s)) +Rust module-order audit clean (35 file(s)) +Rust trait-import-block audit clean (35 file(s)) +Rust re-export-block audit clean (35 file(s)) +Rust crate-root facade audit clean (6 crate root(s)) +Rust export completeness audit 0 candidate(s) across 9 package(s) +``` + +## Cargo, Clippy et tests + +La correction compile et l'ensemble des gates Rust passent : + +```text +cargo metadata --format-version 1 --no-deps PASS +cargo check --workspace PASS +cargo clippy --workspace --all-targets --all-features + -- -D warnings PASS +cargo test -p knowledge-git-lib --test git_read_path PASS (2) +cargo test -p knowledge-git-lib --test git_write_candidate PASS (2) +cargo test --workspace --all-targets --all-features PASS +``` + +Tests workspace observés : + +```text +knowledge-app-lib 3 PASS +knowledge-domain-lib 3 PASS +knowledge-git-api 7 PASS +knowledge-git-lib 8 unit + 4 integration PASS +knowledge-sync-api 1 PASS +knowledge-web-lib 4 PASS +launchers 0 test chacun +``` + +Les deux tests d'écriture réels prouvent maintenant : + +- create/update/delete exacts dans le candidat ; +- identité auteur/committer explicite ; +- parent candidat égal à la base demandée ; +- référence candidate interne conservée ; +- snapshot de lecture laissé inchangé ; +- nettoyage du worktree temporaire ; +- refus d'une traversée par symlink hors du worktree. + +## Contrôles spécifiques + +Le contrôle spécifique a été exécuté avec succès puis rejoué commande par commande après un problème de copier/coller terminal. Les deux passages produisent les mêmes résultats : + +```text +Knowledge 0.0.3-alpha.3.fix.1 compile-fix audit: clean +Knowledge 0.0.3-alpha.3.fix.1 text hygiene: clean (110 file(s)) +``` + +La gate confirme également : + +- `history/0.0.3/alpha.3.md = FAIL` conservé ; +- ancienne assertion `assert_eq!` absente ; +- nouvelle assertion `matches!(snapshot_content.as_deref(), Ok("first\n"))` présente ; +- aucun diff sous le code produit `knowledge-git-lib/src`, ses unit tests, `knowledge-git-api`, `knowledge-app-lib`, `Web/`, `CHANGELOG.md` ou `ROADMAP.md` ; +- crates Gitea/PostgreSQL et migrations toujours absentes ; +- `Cargo.lock` local présent, ignoré et non suivi ; +- package-lock Web présent ; +- `git diff --cached --check` propre. + +Le staging final est exactement : + +```text +M Cargo.toml +M VERSION +M crates/knowledge-git-lib/tests/git_write_candidate.rs +A deltas/0.0.3/alpha.3.fix.1.md +M docs/plans/003-V0_0_3_GIT_WRITE_PLAN.md +``` + +## Décision + +`0.0.3-alpha.3.fix.1` est `PASS`. + +La création locale du candidat est acquise. `0.0.3-alpha.4` peut implémenter l'observation distante et le push gardé avec comparaison-et-échange, conflit récupérable et tests sur remote bare local, sans introduire forge, PostgreSQL, rebase/merge automatique ni workflow applicatif de proposition.