Files
sasedev-knowledge/deltas/0.0.4/alpha.1.md
2026-10-01 10:49:09 +02:00

218 lines
9.5 KiB
Markdown

<!-- file: deltas/0.0.4/alpha.1.md -->
<!-- version: 1 -->
# Delta 0.0.4-alpha.1 — cadrage de la fondation PostgreSQL partagée
## Baseline requise
Partir de la stable autoritaire réellement publiée :
```text
tag Knowledge v0.0.3
commit Knowledge b3823972449150b72905930b806d4d15471cddce
archive SHA-256 82407dc2a83be878daa65692f975681428d0adc721ff249c3c9020e3a9d1f29d
publish report sasedev-knowledge-0.0.3-publish.001-report.md = PASS
start prompt prompts/004-V0_0_4_START_PROMPT.md
```
Le rapport post-tag fourni confirme la convergence `HEAD/tag distant/commentaire ZIP`, l'intégrité de l'archive, les douze deltas/histories `0.0.3` et `rel.1.fix.1 = PASS`.
PGR `v0.1.3` reste une provenance historique de l'adoption fermée en `0.0.2`. Aucune nouvelle version PGR n'est chargée ou adoptée.
La version devient :
```text
0.0.4-alpha.1
```
## Objet
Fermer le cadrage PostgreSQL avant toute implémentation :
- vérifier la stable `v0.0.3`, ses owners, architecture, deltas/histories, `DEFER` et revue d'horizon ;
- comparer les clients/ORM/migrations Rust actuels ;
- sélectionner `tokio-postgres` comme driver, `deadpool-postgres` comme pool et Refinery comme migrator, sans ORM ;
- retenir `knowledge-store-postgres-lib` comme owner futur du pool, des migrations et de l'état PostgreSQL ;
- borner le premier schéma à `knowledge_sources` et `knowledge_source_sync_state` ;
- définir une configuration injectée sans fuite de secrets et sans fallback caché ;
- définir une stratégie de tests PostgreSQL réels par schéma éphémère ;
- préparer l'étude `008` et le plan `004` ;
- conserver l'horizon produit existant puisqu'aucune dépendance future n'est invalidée.
Aucun code produit, aucune nouvelle crate, aucune dépendance Cargo/npm, aucune migration SQL et aucun fichier Web ne sont ajoutés dans cette tranche.
`CHANGELOG.md` reste inchangé conformément au prompt de démarrage : l'entrée `0.0.4` ne sera préparée qu'à l'approche de la stabilisation.
## Décisions retenues
```text
owner PostgreSQL knowledge-store-postgres-lib (à créer en alpha.2)
driver tokio-postgres 0.7
ORM aucun
pool deadpool-postgres 0.14
migrations SQL versionné + Refinery 0.9
premier schéma source logique + dernière révision synchronisée
test PostgreSQL URL explicite + schéma éphémère isolé
autorité contenu Git
```
Les types de `tokio-postgres`, Deadpool et Refinery restent confinés à `knowledge-store-postgres-lib`. Un backend TLS sera choisi seulement si la connexion de déploiement réellement visée l'exige.
## Horizon
Aucun REPLAN d'horizon n'est nécessaire.
Restent :
```text
0.0.5 modèles de contenu et projections
0.0.6 templates publics
0.0.7 templates d'administration
0.0.8 lecture publique Actix Web / Maud
0.0.9 administration Actix Web / Maud et autorisation
0.0.10 gestion, proposition, revue et publication
```
Gitea/forge, scheduler, recherche avancée, auth, modèles finaux de contenu, administration transverse et sujets Git avancés restent `DEFER`.
## Scope des fichiers
REPLACE :
```text
VERSION
Cargo.toml
README.md
RULES.md
docs/000-README.md
docs/architecture/001-PROJECT_PROFILE.md
docs/architecture/002-KNOWLEDGE_ARCHITECTURE.md
docs/validation/001-VALIDATION_MATRIX.md
```
ADD :
```text
docs/studies/008-V0_0_4_POSTGRES_FOUNDATION_STUDY.md
docs/plans/004-V0_0_4_POSTGRES_FOUNDATION_PLAN.md
deltas/0.0.4/alpha.1.md
```
DELETE : aucun.
`ROADMAP.md`, `CHANGELOG.md`, `prompts/`, `crates/` et `Web/` ne sont pas modifiés.
Aucun history `0.0.4-alpha.1` n'est inclus : il doit refléter uniquement la gate opérateur réelle.
## Gate opérateur
Exécuter depuis la racine du dépôt après application du delta.
### Version et baseline
```bash
test "$(cat VERSION)" = '0.0.4-alpha.1'
grep -F 'version = "0.0.4-alpha.1"' Cargo.toml
grep -F 'Knowledge stable tag v0.0.3' docs/architecture/001-PROJECT_PROFILE.md
grep -F 'Knowledge stable commit b3823972449150b72905930b806d4d15471cddce' docs/architecture/001-PROJECT_PROFILE.md
grep -F 'Knowledge archive SHA-256 82407dc2a83be878daa65692f975681428d0adc721ff249c3c9020e3a9d1f29d' docs/architecture/001-PROJECT_PROFILE.md
grep -F 'Knowledge publish report sasedev-knowledge-0.0.3-publish.001-report.md = PASS' docs/architecture/001-PROJECT_PROFILE.md
test "$(find deltas/0.0.3 -maxdepth 1 -type f -name '*.md' | wc -l)" -eq 12
test "$(find history/0.0.3 -maxdepth 1 -type f -name '*.md' | wc -l)" -eq 12
diff <(find deltas/0.0.3 -maxdepth 1 -type f -name '*.md' -printf '%f\n' | sort) <(find history/0.0.3 -maxdepth 1 -type f -name '*.md' -printf '%f\n' | sort)
grep -A2 '^## Statut$' history/0.0.3/rel.1.fix.1.md | grep -Fx 'PASS'
```
### Cadrage PostgreSQL et autonomie
```bash
test -f docs/studies/008-V0_0_4_POSTGRES_FOUNDATION_STUDY.md
test -f docs/plans/004-V0_0_4_POSTGRES_FOUNDATION_PLAN.md
test -f deltas/0.0.4/alpha.1.md
test ! -e history/0.0.4/alpha.1.md
grep -F '`tokio-postgres` comme driver PostgreSQL' docs/studies/008-V0_0_4_POSTGRES_FOUNDATION_STUDY.md
grep -F '`deadpool-postgres` comme pool' docs/studies/008-V0_0_4_POSTGRES_FOUNDATION_STUDY.md
grep -F '`refinery` comme owner technique des migrations SQL' docs/studies/008-V0_0_4_POSTGRES_FOUNDATION_STUDY.md
grep -F 'knowledge-store-postgres-lib' docs/studies/008-V0_0_4_POSTGRES_FOUNDATION_STUDY.md
grep -F 'knowledge_sources' docs/studies/008-V0_0_4_POSTGRES_FOUNDATION_STUDY.md
grep -F 'knowledge_source_sync_state' docs/studies/008-V0_0_4_POSTGRES_FOUNDATION_STUDY.md
grep -F 'KNOWLEDGE_POSTGRES_TEST_URL' docs/studies/008-V0_0_4_POSTGRES_FOUNDATION_STUDY.md
grep -F 'Ne pas rechercher, charger ni adopter automatiquement une nouvelle version de PGR.' prompts/004-V0_0_4_START_PROMPT.md
grep -F 'PGR `v0.1.3` reste une provenance historique' docs/plans/004-V0_0_4_POSTGRES_FOUNDATION_PLAN.md
test ! -e crates/knowledge-store-postgres-lib
test ! -e migrations
test ! -e history/0.0.4/alpha.1.md
test -z "$(git status --short -- crates Web CHANGELOG.md ROADMAP.md prompts)"
```
### Documentation puis formatage/audits Rust
```bash
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.4-alpha.1-metadata.json
cargo check --workspace
```
`alpha.1` ne rejoue pas Clippy, tests workspace, npm/Vite ou smokes HTTP : aucun source Rust, dépendance, frontend ou runtime n'est modifié. `cargo check --workspace` vérifie néanmoins le manifest après promotion de version.
### Structure, horizon et hygiène
```bash
python3 -c 'import json; from pathlib import Path; m=json.loads(Path("/tmp/sasedev-knowledge-0.0.4-alpha.1-metadata.json").read_text()); assert len(m["workspace_members"]) == 9; assert {p["name"] for p in m["packages"]} == {"knowledge-app-lib","knowledge-domain-lib","knowledge-git-api","knowledge-git-lib","knowledge-sync-api","knowledge-web-lib","knowledge-pgr-server","knowledge-howtos-server","knowledge-snippets-server"}; print("Knowledge 0.0.4-alpha.1 workspace audit: clean")'
grep -F -- '- `( ) 0.0.4` — fondation PostgreSQL partagée' ROADMAP.md
grep -F -- '- `(h) 0.0.5` — modèles de contenu et projections' ROADMAP.md
grep -F -- '- `(h) 0.0.10` — gestion, proposition, revue et publication' ROADMAP.md
python3 -c '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=[p for r in roots for p in ([r] if r.is_file() else r.rglob("*")) if p.is_file()]; bad=[str(p) for p in paths if (lambda b: b"\r" in b or not b.endswith(b"\n") or b.endswith(b"\n\n") or any(line != line.rstrip(" \t") for line in b.decode("utf-8").splitlines()))(p.read_bytes())]; assert not bad, bad; print(f"Knowledge 0.0.4-alpha.1 text hygiene: clean ({len(paths)} file(s))")'
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
```
## Transition
### PASS
Produire séparément :
```text
history/0.0.4/alpha.1.md
```
avec les résultats réellement observés. Après application du history, commit/push `0.0.4-alpha.1`, puis seulement préparer `0.0.4-alpha.2` qui matérialisera la crate PostgreSQL, `tokio-postgres`, `deadpool-postgres`, Refinery et la première migration.
### FAIL / PARTIAL / BLOCKED
Produire le history réel, l'appliquer et le committer avant toute correction.
Une correction bornée au cadrage utilise `0.0.4-alpha.1.fix.1`. Si le diagnostic invalide le driver/pool/migrator retenu, l'ownership, le schéma ou la stratégie de test, exécuter un REPLAN plutôt que d'absorber une architecture différente dans un fix.