From 38025266b9386eaf723dc28ca27c0d12e311046c Mon Sep 17 00:00:00 2001 From: SinuS Von SifriduS Date: Mon, 28 Sep 2026 17:06:45 +0200 Subject: [PATCH] 0.0.2-alpha.2.fix.2 --- Cargo.toml | 4 +- VERSION | 2 +- .../knowledge-git-lib/unit_tests/backend.rs | 4 +- deltas/0.0.2/alpha.2.fix.2.md | 183 ++++++++++++++++++ docs/plans/002-V0_0_2_GIT_SYNC_PLAN.md | 6 +- docs/validation/001-VALIDATION_MATRIX.md | 21 +- history/0.0.2/alpha.2.fix.2.md | 164 ++++++++++++++++ 7 files changed, 376 insertions(+), 8 deletions(-) create mode 100644 deltas/0.0.2/alpha.2.fix.2.md create mode 100644 history/0.0.2/alpha.2.fix.2.md diff --git a/Cargo.toml b/Cargo.toml index 52e0c7e..83cd1f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ # file: Cargo.toml -# version: 20 +# version: 21 [workspace] resolver = "3" @@ -15,7 +15,7 @@ members = [ ] [workspace.package] -version = "0.0.2-alpha.2.fix.1" +version = "0.0.2-alpha.2.fix.2" edition = "2024" publish = false repository = "https://git.sasedev.com/Sasedev/sasedev-knowledge" diff --git a/VERSION b/VERSION index d441dc6..24414cf 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.2-alpha.2.fix.1 +0.0.2-alpha.2.fix.2 diff --git a/crates/knowledge-git-lib/unit_tests/backend.rs b/crates/knowledge-git-lib/unit_tests/backend.rs index bfd759e..037c1dd 100644 --- a/crates/knowledge-git-lib/unit_tests/backend.rs +++ b/crates/knowledge-git-lib/unit_tests/backend.rs @@ -1,5 +1,5 @@ // file: crates/knowledge-git-lib/unit_tests/backend.rs -// version: 2 +// version: 3 #[derive(Clone)] struct RecordingRunner { @@ -82,7 +82,7 @@ fn source_key_never_interpolates_raw_source_identifier_as_a_path() { }; let key = crate::GitSourceKey::from_source_id(&source_id); assert!(key.as_str().starts_with("source-")); - assert!(key.as_str().chars().all(|character| character.is_ascii_alphanumeric() || character == '-')); + assert!(key.as_str().chars().all(|character| return character.is_ascii_alphanumeric() || character == '-')); assert!(!key.as_str().contains("pgr")); assert!(!key.as_str().contains("..")); return; diff --git a/deltas/0.0.2/alpha.2.fix.2.md b/deltas/0.0.2/alpha.2.fix.2.md new file mode 100644 index 0000000..ce4c35a --- /dev/null +++ b/deltas/0.0.2/alpha.2.fix.2.md @@ -0,0 +1,183 @@ + + + +# Delta 0.0.2-alpha.2.fix.2 — retour explicite Clippy + +## Base requise + +Partir de `0.0.2-alpha.2.fix.1` après application et commit du history réel : + +```text +deltas/0.0.2/alpha.2.md présent et historique +deltas/0.0.2/alpha.2.fix.1.md présent et historique +history/0.0.2/alpha.2.md FAIL +history/0.0.2/alpha.2.fix.1.md FAIL +``` + +Les deltas historiques ne doivent pas être réécrits. + +La version devient : + +```text +0.0.2-alpha.2.fix.2 +``` + +## Objet + +Corriger uniquement le dernier défaut révélé par la gate opérateur de `alpha.2.fix.1` : + +```text +clippy::implicit_return +crates/knowledge-git-lib/unit_tests/backend.rs:85 +``` + +La closure de validation du `source-key` doit rendre explicitement son booléen avec `return` conformément aux lints workspace. + +Le fix ne modifie aucune logique du backend Git et n'ajoute aucune capacité. `refresh`, résolution vers commit et snapshot/worktree restent réservés à `alpha.3`. + +## Scope + +REPLACE : + +```text +VERSION +Cargo.toml +crates/knowledge-git-lib/unit_tests/backend.rs +docs/plans/002-V0_0_2_GIT_SYNC_PLAN.md +docs/validation/001-VALIDATION_MATRIX.md +``` + +ADD : + +```text +deltas/0.0.2/alpha.2.fix.2.md +``` + +DELETE : aucun. + +Le history `history/0.0.2/alpha.2.fix.1.md` appartient à la base requise mais n'est pas inclus dans ce delta. + +Aucun fichier sous `Web/`, `crates/knowledge-git-api/` ou `crates/knowledge-sync-api/` n'est modifié. Les fichiers fonctionnels `src/backend.rs`, `src/error.rs` et `src/lib.rs` de `knowledge-git-lib` restent inchangés. + +## Correction attendue + +Le test `source_key_never_interpolates_raw_source_identifier_as_a_path` doit remplacer le retour implicite de la closure par un retour explicite : + +```text +|character| return character.is_ascii_alphanumeric() || character == '-' +``` + +Aucun autre changement de comportement n'est attendu. + +## Gate opérateur + +Après application du history `alpha.2.fix.1`, commit/push de cet état, puis application du présent delta : + +```bash +test "$(cat VERSION)" = '0.0.2-alpha.2.fix.2' +grep -F 'version = "0.0.2-alpha.2.fix.2"' Cargo.toml +grep -A2 '^## Statut$' history/0.0.2/alpha.2.fix.1.md | grep -Fx 'FAIL' + +git diff --check + +python3 - <<'PY' +from pathlib import Path +import tomllib + +root = tomllib.loads(Path("Cargo.toml").read_text(encoding="utf-8")) +manifest = tomllib.loads(Path("crates/knowledge-git-lib/Cargo.toml").read_text(encoding="utf-8")) +assert len(root["workspace"]["members"]) == 8 +assert "crates/knowledge-git-lib" in root["workspace"]["members"] +assert set(manifest["dependencies"]) == {"knowledge-domain-lib"} + +test = Path("crates/knowledge-git-lib/unit_tests/backend.rs").read_text(encoding="utf-8") +assert "|character| return character.is_ascii_alphanumeric() || character == '-'" in test +assert "|character| character.is_ascii_alphanumeric() || character == '-'" not in test + +for path in ( + "crates/knowledge-git-lib/src/backend.rs", + "crates/knowledge-git-lib/src/error.rs", + "crates/knowledge-git-lib/src/lib.rs", +): + assert Path(path).is_file(), path + +backend = Path("crates/knowledge-git-lib/src/backend.rs").read_text(encoding="utf-8") +error = Path("crates/knowledge-git-lib/src/error.rs").read_text(encoding="utf-8") +for forbidden in ("refresh(", "resolve_revision(", "worktree add", "knowledge-app-lib"): + assert forbidden not in backend + error, forbidden + +print("Knowledge 0.0.2-alpha.2.fix.2 structural 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_export_completeness.py --root . --summary-only + +cargo fmt --all -- --check +cargo metadata --format-version 1 --no-deps > /tmp/sasedev-knowledge-0.0.2-alpha.2.fix.2-metadata.json +cargo check --workspace +cargo clippy --workspace --all-targets --all-features -- -D warnings +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.2.fix.2-metadata.json").read_text(encoding="utf-8")) +packages = {package["name"] for package in metadata["packages"]} +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 packages == expected, packages +assert len(metadata["workspace_members"]) == 8, metadata["workspace_members"] +print("Knowledge 0.0.2-alpha.2.fix.2 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-api crates/knowledge-sync-api)" +test -z "$(git diff --name-only -- crates/knowledge-git-lib/src/backend.rs crates/knowledge-git-lib/src/error.rs crates/knowledge-git-lib/src/lib.rs)" +test ! -e crates/knowledge-app-lib +test ! -e crates/knowledge-forge-gitea-lib +test ! -e crates/knowledge-store-postgres-lib + +git add -A +git diff --cached --check +git status --short +``` + +## Résultat attendu + +Le point critique est : + +```text +cargo clippy --workspace --all-targets --all-features -- -D warnings +``` + +qui doit désormais être `PASS` sans warning ni erreur. + +Le test ciblé doit conserver : + +```text +7 passed; 0 failed +``` + +Un `PASS` complet ferme `alpha.2` et autorise uniquement la préparation d'`alpha.3`. 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 3b2e4a9..5b6beec 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 @@ -141,7 +141,9 @@ La gate opérateur de `alpha.1.fix.1` est **PASS**. Statut opérateur initial : **FAIL**. -`alpha.2.fix.1` corrige exclusivement l'hygiène de fin de fichier, la portée de la gate Markdown, le formatage rustfmt et la construction interne de `GitSourceKey`. Il n'ajoute aucune capacité Git et ne modifie ni les dépendances ni les frontières de la tranche. +`alpha.2.fix.1` corrige l'hygiène de fin de fichier, la portée de la gate Markdown, le formatage rustfmt et la construction interne de `GitSourceKey`, mais sa gate reste **FAIL** sur une unique violation `clippy::implicit_return` dans une closure de test. + +`alpha.2.fix.2` corrige exclusivement ce retour implicite, sans modification du backend, de l'API, des dépendances ou du comportement Git. Le delta matérialise le premier backend réel sans encore prétendre couvrir tout le cycle de synchronisation. Les choix concrets de la tranche sont : configuration publique `GitBackendConfig`/`GitSourceConfig`, runner process strictement interne, erreurs publiques redacted par construction et `source-key` hexadécimale déterministe dérivée du `SourceId`. diff --git a/docs/validation/001-VALIDATION_MATRIX.md b/docs/validation/001-VALIDATION_MATRIX.md index 19bdae6..5958644 100644 --- a/docs/validation/001-VALIDATION_MATRIX.md +++ b/docs/validation/001-VALIDATION_MATRIX.md @@ -1,5 +1,5 @@ - + # Matrice de validation Knowledge @@ -591,3 +591,22 @@ Le fix reste strictement dans le scope `alpha.2` et doit prouver : - `git diff --cached --check` propre avant commit. Le `PASS` du fix ferme `alpha.2` et autorise uniquement la préparation de `0.0.2-alpha.3`. + +## Gate de `0.0.2-alpha.2.fix.2` + +Le second fix reste strictement dans le scope `alpha.2` et doit prouver : + +- `VERSION = 0.0.2-alpha.2.fix.2` et `[workspace.package].version` identique ; +- history `history/0.0.2/alpha.2.fix.1.md` présent avec statut réel `FAIL` et committé avant application du fix ; +- deltas historiques `alpha.2.md` et `alpha.2.fix.1.md` inchangés ; +- correction limitée à la violation `clippy::implicit_return` observée dans `unit_tests/backend.rs` ; +- retour explicite dans la closure de validation du `source-key` ; +- aucune modification fonctionnelle du backend Git, de ses erreurs publiques ou de son API ; +- huit packages Cargo exactement et dépendances de `knowledge-git-lib` inchangées ; +- absence de `refresh`, résolution de révision, worktree/snapshot, forge, PostgreSQL, scheduler ou `knowledge-app-lib` ; +- `git diff --check`, audits structurels, `cargo fmt`, `cargo metadata`, `cargo check`, Clippy strict, tests ciblés `knowledge-git-lib` et tests workspace propres ; +- `Web/`, `knowledge-git-api` et `knowledge-sync-api` sans diff ; +- `Cargo.lock` toujours ignoré/non suivi ; +- `git diff --cached --check` propre avant commit. + +Le `PASS` de `alpha.2.fix.2` ferme `alpha.2` et autorise uniquement la préparation de `0.0.2-alpha.3`. diff --git a/history/0.0.2/alpha.2.fix.2.md b/history/0.0.2/alpha.2.fix.2.md new file mode 100644 index 0000000..179b2ed --- /dev/null +++ b/history/0.0.2/alpha.2.fix.2.md @@ -0,0 +1,164 @@ + + + +# History 0.0.2-alpha.2.fix.2 — clôture du backend process minimal + +## Statut + +PASS + +La gate opérateur de `0.0.2-alpha.2.fix.2` exécutée le `2026-09-28` est propre et ferme la tranche fonctionnelle `alpha.2`. + +## Baseline opérateur + +`alpha.2.fix.1` `FAIL` a été historisé, committé et poussé avant application du second fix : + +```text +history/0.0.2/alpha.2.fix.1.md FAIL +commit ffb4721 +message 0.0.2-alpha.2.fix.1 +branch master +push origin/master PASS +workspace après push propre +``` + +Le push observé a avancé `origin/master` de `bdbd6a5` à `ffb4721`. + +## Version et prérequis + +Les contrôles passent : + +```text +VERSION 0.0.2-alpha.2.fix.2 +Cargo workspace version 0.0.2-alpha.2.fix.2 +history alpha.2.fix.1 FAIL +``` + +`git diff --check` est propre. + +## Audit structurel + +L'audit dédié passe : + +```text +Knowledge 0.0.2-alpha.2.fix.2 structural audit: clean +``` + +Il confirme notamment : + +- huit membres Cargo exactement ; +- `knowledge-git-lib` présent et dépendant uniquement de `knowledge-domain-lib` dans cette tranche ; +- retour explicite dans la closure de validation du `source-key` ; +- absence de `refresh`, `resolve_revision`, worktree/snapshot et `knowledge-app-lib` ; +- absence de dérive fonctionnelle dans `backend.rs`, `error.rs` et `lib.rs`. + +Les audits Rust structurels passent : + +```text +Rust test-layout audit: clean (8 crate(s)) +Rust blank-line audit: clean (22 file(s)) +Rust item-spacing audit: clean (22 file(s)) +Rust module-order audit: clean (22 file(s)) +Rust trait-import-block audit: clean (22 file(s)) +Rust re-export-block audit: clean (22 file(s)) +Rust export completeness audit: 0 candidate(s) across 8 package(s) +``` + +## Formatage, compilation et Clippy + +Toutes les gates passent : + +```text +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 +``` + +Le défaut `clippy::implicit_return` observé dans `alpha.2.fix.1` est donc fermé sans modification fonctionnelle du backend. + +## Tests + +Les tests ciblés de `knowledge-git-lib` passent : + +```text +cargo test -p knowledge-git-lib --all-targets --all-features +7 passed; 0 failed +``` + +Tests observés : + +```text +backend_configuration_requires_non_empty_paths PASS +source_key_never_interpolates_raw_source_identifier_as_a_path PASS +invalid_existing_mirror_is_rejected_without_deleting_it PASS +existing_mirror_is_inspected_without_clone PASS +process_errors_do_not_expose_remote_location_or_credentials PASS +local_source_clone_uses_mirror_no_local_and_argument_separator PASS +remote_source_clone_does_not_add_no_local PASS +``` + +Les tests workspace passent également : + +```text +knowledge-domain-lib : 3 PASS +knowledge-git-api : 1 PASS +knowledge-git-lib : 7 PASS +knowledge-sync-api : 1 PASS +knowledge-web-lib : 4 PASS +launchers : 0 test chacun +``` + +## Métadonnées, lockfile et frontières + +L'audit Cargo passe : + +```text +Knowledge 0.0.2-alpha.2.fix.2 Cargo metadata audit: clean +``` + +Les contrôles de frontière passent : + +```text +Web/ sans diff +crates/knowledge-git-api sans diff +crates/knowledge-sync-api sans diff +crates/knowledge-git-lib/src/backend.rs sans diff dans fix.2 +crates/knowledge-git-lib/src/error.rs sans diff dans fix.2 +crates/knowledge-git-lib/src/lib.rs sans diff dans fix.2 +crates/knowledge-app-lib absent +crates/knowledge-forge-gitea-lib absent +crates/knowledge-store-postgres-lib absent +Cargo.lock présent localement, ignoré et non suivi +``` + +Après staging, `git diff --cached --check` passe. Le staging observé avant ajout du présent history est : + +```text +M Cargo.toml +M VERSION +M crates/knowledge-git-lib/unit_tests/backend.rs +A deltas/0.0.2/alpha.2.fix.2.md +M docs/plans/002-V0_0_2_GIT_SYNC_PLAN.md +M docs/validation/001-VALIDATION_MATRIX.md +``` + +## Décision + +`0.0.2-alpha.2.fix.2` est `PASS`. + +La tranche `alpha.2` est fermée. Le backend possède maintenant sa configuration physique, sa racine d'état, sa clé de stockage sûre, son runner process sans shell et l'initialisation/inspection minimale du mirror. + +La transition autorisée est : + +```text +appliquer ce history +-> git add / diff --cached --check / status +-> commit exact "0.0.2-alpha.2.fix.2" +-> push origin master +-> vérifier le workspace propre +-> préparer seulement ensuite 0.0.2-alpha.3 +``` + +`alpha.3` peut ajouter le refresh réel, la résolution vers commit et le snapshot/worktree déterministe sur repositories Git temporaires locaux.