172 lines
6.0 KiB
Markdown
172 lines
6.0 KiB
Markdown
<!-- file: deltas/0.0.2/alpha.4.fix.1.md -->
|
|
<!-- version: 1 -->
|
|
|
|
# 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`.
|