# Delta `0.3.1-pre.007` — hardening adversarial et complétude Store API ## Base ```text 0.3.1-pre.6-fix.1 ``` Le gate opérateur de `pre.006-fix.001` est intégralement propre : ```text 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.1 cargo check --workspace cargo clippy --workspace --all-targets cargo test -p ksp-store-api ``` Résultat Store API observé : 14 tests unitaires, 2 dependency-boundary, 1 external-backend, 6 public-api et doc-tests propres. ## Objet Fermer la tranche de hardening/completeness de `ksp-store-api` sans ouvrir une nouvelle famille N1 ni une couche supérieure : ```text payload/cursor/provenance adversariaux retention compare-and-transition race exports/modules/capabilities exacts frontière ksp-interface-lib / ksp-store-api scope négatif event-only + N2/N3/N4 backend/dependency firewall ``` ## Race de rétention `RawTransactionRetentionTransition` transporte déjà : ```text expected reference target ``` Le résultat manquait toutefois d'un état distinct lorsque l'état durable avait changé concurremment. `RawRetentionWriteOutcome` ajoute donc : ```text ExpectedStateMismatch ``` Sémantique requise pour un backend : ```text persisted == expected -> compare-and-transition atomique -> Applied si succès persisted == target -> AlreadyAtTarget persisted != expected && persisted != target -> ExpectedStateMismatch ``` Cette course n'est ni un input invalide ni une autorisation pour écraser le nouvel état. La décision de retry/reload reste au caller/worker policy. ## Hardening adversarial Nouveau canari : ```text crates/ksp-store-api/tests/security_hardening.rs ``` Il vérifie notamment : ```text URL/marker hostile rejeté sans echo dans Error Display/Debug RawPayload Debug sans bytes RawContentHash Debug opaque RawTransactionSignature Debug opaque RawTransaction Debug sans payload bytes RawAccountState Debug sans account bytes cursor exact à la borne accepté cursor au-dessus de la borne rejeté page limit 0 rejeté page limit u64::MAX accepté sans policy Store artificielle ExpectedStateMismatch distinct de Applied/AlreadyAtTarget ``` ## Complétude et frontières Nouveau canari : ```text crates/ksp-store-api/tests/release_completeness.rs ``` Il verrouille : ```text 60 exports crate-root exacts aucun pub mod inventaire exact src/model/capability public enums évolutifs #[non_exhaustive] 10 traits capability fins exacts aucun Store/StoreBackend runtime monolithique aucun RawLogNotification/RawSlotEvent/RawVoteEvent public aucun YellowstoneEntry aucun Structural*/Decoded*/Domain* public aucun backend PostgreSQL/MySQL dans l'API aucun modèle persistant Store réexporté par ksp-interface-lib ``` La frontière durable reste : ```text ksp-interface-lib -> contrats/wires/event-only inter-composants lorsque réellement nécessaires ksp-store-api -> modèles persistants/replayables/queryables + capabilities backend-agnostic ``` Aucun modèle event-only nouveau n'est créé par cette tranche. ## Hors scope ```text ksp-store-lib ksp-store-postgres-lib SQL/migrations Config std.store Transport -> RAW adapter RawLogNotification / RawSlotEvent / RawVoteEvent TransactionStatusObservation RawBlock / Yellowstone Entry N2 STRUCTURAL N3 DECODED N4 DOMAIN processing ledger worker/executor policy compression/archive physiques ``` ## Version Cargo La tranche suivante normale porte : ```text 0.3.1-pre.7 ``` ## Validations attendues ```text 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.1 cargo check --workspace cargo clippy --workspace --all-targets cargo test -p ksp-store-api ```