105 lines
3.6 KiB
Markdown
105 lines
3.6 KiB
Markdown
<!-- file: deltas/0.3.3/pre.009-fix.006.md -->
|
|
<!-- version: 1 -->
|
|
|
|
# Delta `0.3.3-pre.009-fix.006` — restauration `schema.rs` et classification du drift appliqué
|
|
|
|
## 1. Base et diagnostic
|
|
|
|
Base opérateur :
|
|
|
|
```text
|
|
0.3.3-pre.9.fix.5
|
|
```
|
|
|
|
Deux faits distincts sont corrigés.
|
|
|
|
Premièrement, l'overlay `pre.009-fix.005` a accidentellement tronqué la fin de `crates/ksp-store-postgres-lib/src/schema.rs` lors de la généralisation de la normalisation PostgreSQL. Les éléments privés suivants avaient disparu de l'archive alors qu'ils restent requis :
|
|
|
|
```rust
|
|
fn schema_incompatible<T>(phase: &'static str) -> std::result::Result<T, crate::PostgresBackendError>
|
|
fn schema_query_error<T>(phase: &'static str) -> std::result::Result<T, crate::PostgresBackendError>
|
|
|
|
#[cfg(test)]
|
|
#[path = "../unit_tests/schema.rs"]
|
|
mod tests;
|
|
```
|
|
|
|
L'opérateur les a restaurés et le gate standard est redevenu entièrement propre. `fix.006` réembarque explicitement le fichier complet afin que l'historique d'overlays soit autonome.
|
|
|
|
Deuxièmement, le live PostgreSQL 17 progresse maintenant jusqu'au scénario qui supprime volontairement l'index géré puis rouvre le backend avec `schema_autoupdate=false`. Le backend renvoyait `MigrationFailed`, alors que le contrat live attend `MigrationMismatch`.
|
|
|
|
## 2. Version
|
|
|
|
```text
|
|
workspace.package.version = 0.3.3-pre.9.fix.6
|
|
```
|
|
|
|
## 3. Classification corrigée
|
|
|
|
Dans `verify_or_repair_applied_migrations`, une ressource `Missing` d'une migration déjà présente dans l'historique signifie que l'état physique ne correspond plus au schéma déclaré. Lorsque `schema_autoupdate=false`, KSP ne tente aucune réparation et retourne désormais :
|
|
|
|
```text
|
|
PostgresBackendErrorKind::MigrationMismatch
|
|
phase = schema_autoupdate_disabled
|
|
```
|
|
|
|
Cette correction est volontairement limitée à ce chemin. Les cas où aucune divergence appliquée n'existe mais où une mutation est interdite par policy, notamment `migration_pending` ou `schema_autocreate_disabled`, restent classés `MigrationFailed`.
|
|
|
|
## 4. Canari
|
|
|
|
Un helper privé `schema_autoupdate_disabled_error()` centralise la classification et le test unitaire vérifie exactement :
|
|
|
|
```text
|
|
kind = MigrationMismatch
|
|
phase = schema_autoupdate_disabled
|
|
```
|
|
|
|
## 5. Migrations inchangées
|
|
|
|
Aucun SQL V000/V001 n'est modifié. Checksums attendus inchangés :
|
|
|
|
```text
|
|
V000 d29068b8c13b9dc0cc9ef6aaadd0fa12d41e0fe4c56541a1118c4bfc846a1450
|
|
V001 31488cda2f08f3f46c4cdbdbb6c18c243662fada02eac4487040c8735d72cc51
|
|
```
|
|
|
|
## 6. Scope
|
|
|
|
Aucun changement de runtime RawTransaction, pagination/cursor, rétention, Store API, façade, Config ou `RawAccountState`.
|
|
|
|
## 7. Fichiers modifiés
|
|
|
|
```text
|
|
Cargo.toml
|
|
crates/ksp-store-postgres-lib/src/migration.rs
|
|
crates/ksp-store-postgres-lib/src/schema.rs
|
|
crates/ksp-store-postgres-lib/unit_tests/migration.rs
|
|
docs/validation/020-V0_3_3_STORE_POSTGRES_RAW_TRANSACTION.md
|
|
deltas/0.3.3/pre.009-fix.006.md
|
|
```
|
|
|
|
Aucune suppression.
|
|
|
|
## 8. Gate opérateur attendu
|
|
|
|
```bash
|
|
cargo fmt --all
|
|
python3 scripts/audit_rust_workspace_rules.py
|
|
python3 scripts/audit_markdown_tables.py README.md RULES.md ROADMAP.md CHANGELOG.md docs prompts crates deltas/0.3.3
|
|
cargo check --workspace
|
|
cargo clippy --workspace --all-targets
|
|
cargo test -p ksp-store-api
|
|
cargo test -p ksp-store-lib
|
|
cargo test -p ksp-store-postgres-lib
|
|
cargo test -p ksp-config-lib
|
|
cargo check -p ksp-store-lib --no-default-features
|
|
```
|
|
|
|
Puis :
|
|
|
|
```bash
|
|
read -rsp "Dedicated PostgreSQL URI: " KSP_PG_TEST_URI; echo
|
|
printf '%s\n' "$KSP_PG_TEST_URI" | cargo test -p ksp-store-postgres-lib --test postgres_raw_transaction_live -- --ignored --nocapture --test-threads=1
|
|
unset KSP_PG_TEST_URI
|
|
```
|