diff --git a/Cargo.toml b/Cargo.toml index 6ae5516..94f4fd4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ # file: Cargo.toml -# version: 23 +# version: 24 [workspace] resolver = "3" @@ -15,7 +15,7 @@ members = [ ] [workspace.package] -version = "0.0.2-alpha.4" +version = "0.0.2-alpha.4.fix.1" edition = "2024" publish = false repository = "https://git.sasedev.com/Sasedev/sasedev-knowledge" diff --git a/VERSION b/VERSION index 38ab062..ead0ba4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.2-alpha.4 +0.0.2-alpha.4.fix.1 diff --git a/crates/knowledge-git-api/src/reference.rs b/crates/knowledge-git-api/src/reference.rs index be3d7bb..24bf3b4 100644 --- a/crates/knowledge-git-api/src/reference.rs +++ b/crates/knowledge-git-api/src/reference.rs @@ -1,5 +1,5 @@ // file: crates/knowledge-git-api/src/reference.rs -// version: 1 +// version: 2 /// Opaque Git reference requested by a caller, such as a branch, tag or object expression. #[derive(Clone, Debug, Eq, Hash, PartialEq)] @@ -8,7 +8,7 @@ pub struct GitReference(String); impl crate::GitReference { /// Create an opaque Git reference without imposing one provider's reference grammar. pub fn new(value: &str) -> crate::GitReference { - return crate::GitReference(value.to_owned()); + return Self(value.to_owned()); } /// Return the reference text. diff --git a/crates/knowledge-git-api/src/revision.rs b/crates/knowledge-git-api/src/revision.rs index 763a218..bf499e1 100644 --- a/crates/knowledge-git-api/src/revision.rs +++ b/crates/knowledge-git-api/src/revision.rs @@ -1,5 +1,5 @@ // file: crates/knowledge-git-api/src/revision.rs -// version: 1 +// version: 2 /// Resolved authoritative Git revision identity. #[derive(Clone, Debug, Eq, Hash, PartialEq)] @@ -8,7 +8,7 @@ pub struct GitRevision(String); impl crate::GitRevision { /// Create a revision identity returned by a concrete Git implementation. pub fn new(value: &str) -> crate::GitRevision { - return crate::GitRevision(value.to_owned()); + return Self(value.to_owned()); } /// Return the revision identity as text. diff --git a/deltas/0.0.2/alpha.4.fix.1.md b/deltas/0.0.2/alpha.4.fix.1.md new file mode 100644 index 0000000..e6dee89 --- /dev/null +++ b/deltas/0.0.2/alpha.4.fix.1.md @@ -0,0 +1,171 @@ + + + +# Delta 0.0.2-alpha.4.fix.1 — construction interne des types Git API + +## Base requise + +Partir de `0.0.2-alpha.4` après application de son history `FAIL`, commit et push : + +```text +history/0.0.2/alpha.4.md FAIL +``` + +La version devient : + +```text +0.0.2-alpha.4.fix.1 +``` + +Les deltas, histories et prompts historiques ne doivent pas être réécrits. + +## Diagnostic + +La séparation de `knowledge-git-api/src/lib.rs` en modules propriétaires est correcte, mais deux constructeurs ont conservé la forme antérieure via le réexport crate-root : + +```rust +return crate::GitReference(value.to_owned()); +return crate::GitRevision(value.to_owned()); +``` + +Les champs tuple sont privés à leurs modules propriétaires. Rust refuse donc ces deux constructions avec `E0423`. + +## Scope + +Corriger uniquement : + +```text +crates/knowledge-git-api/src/reference.rs +crates/knowledge-git-api/src/revision.rs +``` + +Les constructeurs doivent utiliser leur type propriétaire directement via : + +```rust +return Self(value.to_owned()); +``` + +Mettre à jour uniquement les artefacts de version/pilotage nécessaires au fix : + +```text +VERSION +Cargo.toml +docs/plans/002-V0_0_2_GIT_SYNC_PLAN.md +docs/validation/001-VALIDATION_MATRIX.md +deltas/0.0.2/alpha.4.fix.1.md +``` + +## Hors scope + +Le fix ne doit pas : + +- rendre publics les champs tuple de `GitReference` ou `GitRevision` ; +- changer l'API publique crate-root ; +- utiliser `crate::reference::GitReference(...)` ou `crate::revision::GitRevision(...)` pour contourner le contrat de façade ; +- modifier `repository.rs`, `snapshot.rs`, `knowledge-sync-api`, `knowledge-git-lib/src` ou `Web/` ; +- modifier les owners locaux, templates, audits ou le mapping PGR introduits par `alpha.4` ; +- ajouter une fonctionnalité de synchronisation réservée à `alpha.5`. + +## Gate opérateur + +Exécuter depuis la racine après application du delta : + +```bash +test "$(cat VERSION)" = '0.0.2-alpha.4.fix.1' +grep -F 'version = "0.0.2-alpha.4.fix.1"' Cargo.toml +grep -A2 '^## Statut$' history/0.0.2/alpha.4.md | grep -Fx 'FAIL' + +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 + +python3 - <<'PY' +from pathlib import Path +import tomllib + +reference = Path("crates/knowledge-git-api/src/reference.rs").read_text(encoding="utf-8") +revision = Path("crates/knowledge-git-api/src/revision.rs").read_text(encoding="utf-8") +root = Path("crates/knowledge-git-api/src/lib.rs").read_text(encoding="utf-8") + +assert "return Self(value.to_owned());" in reference +assert "return Self(value.to_owned());" in revision +assert "return crate::GitReference(value.to_owned());" not in reference +assert "return crate::GitRevision(value.to_owned());" not in revision +assert "crate::reference::GitReference(" not in reference +assert "crate::revision::GitRevision(" not in revision +assert "pub struct GitReference(String);" in reference +assert "pub struct GitRevision(String);" in revision +for module in ("mod reference;", "mod repository;", "mod revision;", "mod snapshot;"): + assert module in root, module +for item in ("GitReference", "GitRepository", "GitRevision", "GitSnapshot"): + assert f"::{item};" in root, item + +workspace = tomllib.loads(Path("Cargo.toml").read_text(encoding="utf-8")) +assert len(workspace["workspace"]["members"]) == 8 +print("Knowledge 0.0.2-alpha.4.fix.1 constructor/facade audit: clean") +PY + +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 fmt --all -- --check +cargo metadata --format-version 1 --no-deps > /tmp/sasedev-knowledge-0.0.2-alpha.4.fix.1-metadata.json +cargo check --workspace +cargo clippy --workspace --all-targets --all-features -- -D warnings +cargo test -p knowledge-git-api --all-targets --all-features +cargo test -p knowledge-sync-api --all-targets --all-features +cargo test -p knowledge-git-lib --all-targets --all-features +cargo test --workspace --all-targets --all-features + +python3 - <<'PY' +import json +from pathlib import Path + +metadata = json.loads(Path("/tmp/sasedev-knowledge-0.0.2-alpha.4.fix.1-metadata.json").read_text(encoding="utf-8")) +expected = { + "knowledge-domain-lib", + "knowledge-git-api", + "knowledge-git-lib", + "knowledge-sync-api", + "knowledge-web-lib", + "knowledge-pgr-server", + "knowledge-howtos-server", + "knowledge-snippets-server", +} +assert {package["name"] for package in metadata["packages"]} == expected +assert len(metadata["workspace_members"]) == 8 +print("Knowledge 0.0.2-alpha.4.fix.1 Cargo metadata audit: clean") +PY + +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 -z "$(git diff --name-only -- Web)" +test -z "$(git diff --name-only -- crates/knowledge-git-lib/src)" +test -z "$(git diff --name-only -- crates/knowledge-sync-api)" +test -z "$(git diff --name-only -- crates/knowledge-git-api/src/lib.rs crates/knowledge-git-api/src/repository.rs crates/knowledge-git-api/src/snapshot.rs)" +test ! -e crates/knowledge-app-lib +test ! -e crates/knowledge-forge-gitea-lib +test ! -e crates/knowledge-store-postgres-lib +test ! -e history/0.0.2/alpha.4.fix.1.md + +git add -A +git diff --cached --check +git status --short +``` + +## Transition attendue + +Si toute la gate est `PASS`, produire `history/0.0.2/alpha.4.fix.1.md`, appliquer/committer/pousser ce history puis préparer seulement ensuite `0.0.2-alpha.5`. diff --git a/docs/plans/002-V0_0_2_GIT_SYNC_PLAN.md b/docs/plans/002-V0_0_2_GIT_SYNC_PLAN.md index aea6e36..29a39b7 100644 --- a/docs/plans/002-V0_0_2_GIT_SYNC_PLAN.md +++ b/docs/plans/002-V0_0_2_GIT_SYNC_PLAN.md @@ -1,5 +1,5 @@ - + # Plan 0.0.2 — Git générique et synchronisation de lecture @@ -186,6 +186,12 @@ La revue de tranche a déclenché un REPLAN explicite : l'autonomie normative ap ### alpha.4 — autonomie normative et structure interne des crates +Statut opérateur initial : **FAIL**. + +La matérialisation normative, les audits locaux, les façades crate-root, rustfmt et les métadonnées sont propres. La compilation échoue uniquement parce que `GitReference` et `GitRevision`, déplacés dans leurs modules propriétaires, tentent encore de construire leurs tuple structs privés via les réexports crate-root. + +`alpha.4.fix.1` corrige exclusivement ces deux constructions avec `Self(...)`, sans modifier l'API publique, les owners locaux, les templates, les audits ni les comportements Git/sync. + Finaliser l'adoption PGR `v0.1.3` comme migration ponctuelle et rendre Knowledge autonome pour les sessions suivantes. Scope : diff --git a/docs/validation/001-VALIDATION_MATRIX.md b/docs/validation/001-VALIDATION_MATRIX.md index 089464e..523882f 100644 --- a/docs/validation/001-VALIDATION_MATRIX.md +++ b/docs/validation/001-VALIDATION_MATRIX.md @@ -1,5 +1,5 @@ - + # Matrice de validation Knowledge @@ -681,3 +681,22 @@ La tranche d'autonomie normative et de structure interne doit prouver : - `git diff --cached --check` propre avant commit. Le `PASS` d'`alpha.4` ferme l'adoption PGR `v0.1.3` comme migration ponctuelle et autorise uniquement la préparation de `0.0.2-alpha.5`. + +## Gate de `0.0.2-alpha.4.fix.1` + +Le correctif doit prouver : + +- `VERSION = 0.0.2-alpha.4.fix.1` et version workspace identique ; +- history `history/0.0.2/alpha.4.md` présent avec statut `FAIL` et committé avant application ; +- `GitReference::new` construit le tuple struct privé avec `Self(...)` depuis `reference.rs` ; +- `GitRevision::new` construit le tuple struct privé avec `Self(...)` depuis `revision.rs` ; +- aucune ouverture de visibilité des champs tuple et aucune construction via `crate::GitReference(...)`, `crate::GitRevision(...)` ou chemin de module propriétaire ; +- API publique crate-root inchangée et audit `audit_rust_crate_root_facades.py` toujours propre ; +- owners locaux, mapping d'adoption, templates et audits d'autonomie d'`alpha.4` inchangés et toujours valides ; +- `cargo fmt --all -- --check`, `cargo check --workspace` et Clippy strict `PASS` ; +- tests ciblés `knowledge-git-api`, `knowledge-sync-api`, `knowledge-git-lib` et tests workspace `PASS` ; +- comportement Git `alpha.3` inchangé ; +- `Web/`, `knowledge-git-lib/src` et les modules `knowledge-sync-api` sans diff ; +- `Cargo.lock` ignoré/non suivi et `git diff --cached --check` propre. + +Le `PASS` de `alpha.4.fix.1` ferme `alpha.4`, termine l'adoption PGR `v0.1.3` comme migration ponctuelle et autorise uniquement la préparation de `0.0.2-alpha.5`. diff --git a/history/0.0.2/alpha.4.fix.1.md b/history/0.0.2/alpha.4.fix.1.md new file mode 100644 index 0000000..57ccbac --- /dev/null +++ b/history/0.0.2/alpha.4.fix.1.md @@ -0,0 +1,134 @@ + + + +# History 0.0.2-alpha.4.fix.1 — fermeture de l'autonomie normative + +## Statut + +PASS + +La gate opérateur de `0.0.2-alpha.4.fix.1` exécutée le `2026-09-28` est propre. Elle corrige les deux constructeurs privés de `knowledge-git-api` sans modifier l'API publique, les owners locaux, les templates, les audits ni le comportement Git validé. + +## Baseline opérateur + +`alpha.4` `FAIL` a été historisé, committé et poussé avant application du fix : + +```text +history/0.0.2/alpha.4.md FAIL +commit 3f8c795 +message 0.0.2-alpha.4 +branch master +push origin/master PASS +workspace après push propre +``` + +Le push observé a avancé `origin/master` de `b9508b0` à `3f8c795`. + +## Version et correctif + +Les contrôles passent : + +```text +VERSION 0.0.2-alpha.4.fix.1 +Cargo workspace version 0.0.2-alpha.4.fix.1 +history alpha.4 FAIL +constructor/facade audit clean +``` + +`GitReference::new` et `GitRevision::new` construisent désormais leurs tuple structs privés avec `Self(...)` depuis leurs modules propriétaires. Les champs restent privés et les réexports crate-root restent inchangés. + +## Formatage, compilation et Clippy + +La gate opérateur exécute explicitement le formatter avant sa vérification : + +```text +cargo fmt --all PASS +cargo fmt --all -- --check PASS +cargo metadata --format-version 1 --no-deps PASS +cargo check --workspace PASS +cargo clippy --workspace --all-targets --all-features + -- -D warnings PASS +``` + +## Tests ciblés et workspace + +Les suites ciblées passent : + +```text +knowledge-git-api 1 PASS +knowledge-sync-api 1 PASS +knowledge-git-lib 8 unit PASS + 2 integration PASS +``` + +Les deux tests d'intégration Git réels continuent de passer et prouvent les comportements de refresh, résolution, snapshot, référence invalide et snapshot sale. + +La suite workspace passe intégralement : + +```text +knowledge-domain-lib : 3 PASS +knowledge-git-api : 1 PASS +knowledge-git-lib : 8 unit PASS + 2 integration PASS +knowledge-sync-api : 1 PASS +knowledge-web-lib : 4 PASS +launchers : 0 test chacun +``` + +## Audits Rust + +Après formatage, les audits Rust passent : + +```text +Rust test-layout audit: clean (8 crate(s)) +Rust blank-line audit: clean (29 file(s)) +Rust item-spacing audit: clean (29 file(s)) +Rust module-order audit: clean (29 file(s)) +Rust trait-import-block audit: clean (29 file(s)) +Rust re-export-block audit: clean (29 file(s)) +Rust crate-root facade audit: clean (5 crate root(s)) +Rust export completeness audit: 0 candidate(s) across 8 package(s) +``` + +Cette exécution confirme la règle à rendre durable : `cargo fmt --all`, puis `cargo fmt --all -- --check`, doivent précéder les audits du code Rust. + +## Métadonnées et frontières + +L'audit Cargo passe : + +```text +Knowledge 0.0.2-alpha.4.fix.1 Cargo metadata audit: clean +``` + +Les huit packages attendus sont présents. `Cargo.lock` est présent localement, ignoré et non suivi. + +Les contrôles de frontière passent : + +```text +Web/ sans diff +crates/knowledge-git-lib/src sans diff +crates/knowledge-sync-api sans diff +knowledge-git-api lib.rs/repository.rs/snapshot.rs sans diff +knowledge-app-lib absent +knowledge-forge-gitea-lib absent +knowledge-store-postgres-lib absent +``` + +Après staging, `git diff --cached --check` passe. + +## Décision + +`0.0.2-alpha.4.fix.1` est `PASS`. + +La tranche `alpha.4` est fermée. L'adoption PGR `v0.1.3` est terminée comme migration ponctuelle et Knowledge possède désormais ses règles de travail localement. + +La transition autorisée est : + +```text +appliquer ce history +-> git add / diff --cached --check / status +-> commit exact "0.0.2-alpha.4.fix.1" +-> push origin master +-> vérifier le workspace propre +-> appliquer seulement ensuite 0.0.2-alpha.5 +``` + +`alpha.5` peut matérialiser le cas d'usage partagé de synchronisation sans recharger PGR.