v0.3.11-pre.004
This commit is contained in:
135
deltas/0.3.11/pre.004.md
Normal file
135
deltas/0.3.11/pre.004.md
Normal file
@@ -0,0 +1,135 @@
|
||||
<!-- file: deltas/0.3.11/pre.004.md -->
|
||||
<!-- version: 1 -->
|
||||
|
||||
# Delta `0.3.11-pre.004` — start, handle, lifecycle et terminal Worker
|
||||
|
||||
## Base requise
|
||||
|
||||
```text
|
||||
0.3.11-pre.003-fix.001
|
||||
workspace.package.version = 0.3.11-pre.3.fix.1
|
||||
```
|
||||
|
||||
Le gate opérateur du 8 septembre 2026 est vert après le fix `pre.003-fix.001` sur `fmt`, audits Rust/Markdown, `cargo check --workspace`, Clippy strict et les dix tests de la crate Worker.
|
||||
|
||||
## Objectif
|
||||
|
||||
Matérialiser uniquement la responsabilité `pre.004` du plan `032` : start synchrone sur runtime Tokio caller-owned, handle clonable, stop idempotent, lifecycle générique `ksp-worker-api` et future terminal boxed, sans ouvrir le supervisor de tâches enfants, l'admission, la canonicalisation, la persistence, les snapshots concrets ou une source live.
|
||||
|
||||
## Version
|
||||
|
||||
```text
|
||||
identifiant de livraison : 0.3.11-pre.004
|
||||
workspace.package.version : 0.3.11-pre.4
|
||||
```
|
||||
|
||||
## Contrat public ajouté
|
||||
|
||||
```text
|
||||
ERROR_CODE_RAW_TRANSACTION_INGEST_RUNTIME_INVALID
|
||||
RawTransactionIngestWorker
|
||||
RawTransactionIngestHandle
|
||||
RawTransactionIngestTerminalFuture
|
||||
RawTransactionIngestWorker::start(settings, Arc<Store>)
|
||||
RawTransactionIngestHandle::request_stop()
|
||||
RawTransactionIngestHandle::wait_terminal()
|
||||
```
|
||||
|
||||
`start` exige un runtime Tokio courant, vérifie le réseau du Store avant spawn et conserve le Store par `Arc` sans le fermer ni l'utiliser encore pour une écriture.
|
||||
|
||||
`request_stop()` partage `WorkerStopToken` et retourne `true` uniquement lors de la première demande acceptée. Le task racine est réveillé par un `watch<bool>` privé ; la disparition de tous les handles ferme ce channel et provoque également une terminaison coopérative.
|
||||
|
||||
`wait_terminal()` retourne une future boxed `Send`. Elle attend un `WorkerState` terminal puis la fermeture du sender d'état par le task racine ; aucun `JoinHandle` public n'est nécessaire.
|
||||
|
||||
## Lifecycle de fondation
|
||||
|
||||
```text
|
||||
Starting -> Running -> Stopping -> Stopped
|
||||
Starting -> Stopping -> Stopped si stop immédiat
|
||||
```
|
||||
|
||||
Les transitions utilisent `WorkerLifecycle`. Un invariant impossible devient `Faulted(worker_raw_transaction_ingest.runtime_invalid)` sans payload, worker id, réseau ou erreur externe dans le diagnostic.
|
||||
|
||||
## Hors scope conservé
|
||||
|
||||
```text
|
||||
JoinSet / tasks enfants
|
||||
mpsc / admission
|
||||
canonicalisation common RAW
|
||||
observation key
|
||||
persistence Store
|
||||
snapshots concrets / WorkerSnapshotSource
|
||||
source live / Transport
|
||||
Config
|
||||
```
|
||||
|
||||
Les méthodes de snapshot prévues par la surface finale restent différées à `pre.008`. `pre.005` introduit le supervisor et l'ownership des tâches enfants autour du wake-up de stop déjà minimalement nécessaire ici.
|
||||
|
||||
## Tests ajoutés ou étendus
|
||||
|
||||
Les tests couvrent statiquement ou via harness runtime privé :
|
||||
|
||||
```text
|
||||
runtime Tokio courant obligatoire
|
||||
network Store mismatch sûr
|
||||
stop immédiat idempotent
|
||||
Running -> stop via clone de handle
|
||||
drop du dernier handle -> sortie du task racine
|
||||
surface publique start/handle/terminal future
|
||||
absence de JoinHandle public et du scope pre.005+
|
||||
```
|
||||
|
||||
## Fichiers ajoutés
|
||||
|
||||
```text
|
||||
crates/ksp-worker-raw-transaction-ingest-lib/src/runtime.rs
|
||||
crates/ksp-worker-raw-transaction-ingest-lib/unit_tests/runtime.rs
|
||||
deltas/0.3.11/pre.004.md
|
||||
```
|
||||
|
||||
## Fichiers modifiés
|
||||
|
||||
```text
|
||||
Cargo.toml
|
||||
crates/ksp-worker-raw-transaction-ingest-lib/src/error.rs
|
||||
crates/ksp-worker-raw-transaction-ingest-lib/src/lib.rs
|
||||
crates/ksp-worker-raw-transaction-ingest-lib/tests/dependency_boundary.rs
|
||||
crates/ksp-worker-raw-transaction-ingest-lib/tests/public_api.rs
|
||||
docs/plans/032-V0_3_11_RAW_TRANSACTION_INGEST_WORKER_FOUNDATION_PLAN.md
|
||||
docs/validation/028-V0_3_11_RAW_TRANSACTION_INGEST_WORKER_FOUNDATION.md
|
||||
```
|
||||
|
||||
## Fichiers supprimés
|
||||
|
||||
Aucun.
|
||||
|
||||
## Validations exécutées dans l'environnement d'assemblage
|
||||
|
||||
```text
|
||||
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
|
||||
scan statique des interdits/scope runtime
|
||||
```
|
||||
|
||||
L'environnement d'assemblage ne fournit ni `cargo`, ni `rustc`, ni `rustfmt`. Aucun gate Cargo de `pre.004` n'est déclaré PASS localement.
|
||||
|
||||
## Gate opérateur demandé
|
||||
|
||||
```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
|
||||
cargo check --workspace
|
||||
cargo clippy --workspace --all-targets --all-features -- -D warnings
|
||||
cargo test -p ksp-worker-raw-transaction-ingest-lib
|
||||
cargo tree -p ksp-worker-raw-transaction-ingest-lib --edges normal
|
||||
cargo tree -p ksp-worker-raw-transaction-ingest-lib -e features
|
||||
```
|
||||
|
||||
## Décision
|
||||
|
||||
`pre.005` reste bloquée jusqu'à validation opérateur verte de cette tranche.
|
||||
|
||||
## Questions ouvertes
|
||||
|
||||
Aucune nouvelle question architecturale. Le supervisor/tasks enfants, l'admission, la persistence et les snapshots restent dans leurs tranches planifiées.
|
||||
Reference in New Issue
Block a user