v0.3.14-pre.009-fix.001
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
# file: Cargo.toml
|
# file: Cargo.toml
|
||||||
# version: 579
|
# version: 580
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
resolver = "3"
|
resolver = "3"
|
||||||
members = ["crates/ksp-app-backfill-desk", "crates/ksp-app-config-desk", "crates/ksp-app-solprices-desk", "crates/ksp-app-store-desk", "crates/ksp-app-wallet-desk", "crates/ksp-config-lib", "crates/ksp-core-lib", "crates/ksp-interface-lib", "crates/ksp-job-api", "crates/ksp-job-backfill-lib", "crates/ksp-logging-lib", "crates/ksp-offchain-transport-lib", "crates/ksp-onchain-transport-lib", "crates/ksp-program-api", "crates/ksp-raw-transaction-lib", "crates/ksp-store-api", "crates/ksp-store-lib", "crates/ksp-store-postgres-lib", "crates/ksp-wallet-lib", "crates/ksp-worker-api", "crates/ksp-worker-raw-transaction-ingest-lib"]
|
members = ["crates/ksp-app-backfill-desk", "crates/ksp-app-config-desk", "crates/ksp-app-solprices-desk", "crates/ksp-app-store-desk", "crates/ksp-app-wallet-desk", "crates/ksp-config-lib", "crates/ksp-core-lib", "crates/ksp-interface-lib", "crates/ksp-job-api", "crates/ksp-job-backfill-lib", "crates/ksp-logging-lib", "crates/ksp-offchain-transport-lib", "crates/ksp-onchain-transport-lib", "crates/ksp-program-api", "crates/ksp-raw-transaction-lib", "crates/ksp-store-api", "crates/ksp-store-lib", "crates/ksp-store-postgres-lib", "crates/ksp-wallet-lib", "crates/ksp-worker-api", "crates/ksp-worker-raw-transaction-ingest-lib"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.3.14-pre.9"
|
version = "0.3.14-pre.9.fix.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://git.sasedev.com/Sasedev/khadhroony-solana-project"
|
repository = "https://git.sasedev.com/Sasedev/khadhroony-solana-project"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// file: crates/ksp-worker-raw-transaction-ingest-lib/src/runtime_resources.rs
|
// file: crates/ksp-worker-raw-transaction-ingest-lib/src/runtime_resources.rs
|
||||||
// version: 37
|
// version: 38
|
||||||
|
|
||||||
use sha2::Digest; // rust-rules: trait-import
|
use sha2::Digest; // rust-rules: trait-import
|
||||||
|
|
||||||
@@ -455,11 +455,8 @@ fn source_inventory_health_projection(
|
|||||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return std::result::Result::Ok(
|
let aggregate = aggregate.with_continuity_health(continuity_frontier_slot, continuity_has_open_gaps, future_target_coverage);
|
||||||
aggregate
|
return std::result::Result::Ok(aggregate.with_failed_source_losses_reconciled(failed_source_losses_reconciled));
|
||||||
.with_continuity_health(continuity_frontier_slot, continuity_has_open_gaps, future_target_coverage)
|
|
||||||
.with_failed_source_losses_reconciled(failed_source_losses_reconciled),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RawTransactionIngestSourceInventoryPublisher {
|
impl RawTransactionIngestSourceInventoryPublisher {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// file: crates/ksp-worker-raw-transaction-ingest-lib/src/snapshot.rs
|
// file: crates/ksp-worker-raw-transaction-ingest-lib/src/snapshot.rs
|
||||||
// version: 6
|
// version: 7
|
||||||
|
|
||||||
/// Runtime-neutral boxed future resolving to one newer concrete RAW transaction ingest Worker snapshot.
|
/// Runtime-neutral boxed future resolving to one newer concrete RAW transaction ingest Worker snapshot.
|
||||||
pub type RawTransactionIngestSnapshotFuture<'a> =
|
pub type RawTransactionIngestSnapshotFuture<'a> =
|
||||||
@@ -863,6 +863,9 @@ fn health_for_state(
|
|||||||
snapshot: &crate::RawTransactionIngestSnapshot,
|
snapshot: &crate::RawTransactionIngestSnapshot,
|
||||||
) -> ksp_worker_api::WorkerHealth {
|
) -> ksp_worker_api::WorkerHealth {
|
||||||
if state == ksp_worker_api::WorkerState::Running && snapshot.continuity_policy_observed {
|
if state == ksp_worker_api::WorkerState::Running && snapshot.continuity_policy_observed {
|
||||||
|
let source_total = snapshot.source_total;
|
||||||
|
let source_active = snapshot.source_active;
|
||||||
|
let source_failed = snapshot.source_failed;
|
||||||
if snapshot.source_reconnecting > 0
|
if snapshot.source_reconnecting > 0
|
||||||
|| snapshot.continuity_has_open_gaps
|
|| snapshot.continuity_has_open_gaps
|
||||||
|| snapshot.continuity_frontier_slot != snapshot.processing_frontier_slot
|
|| snapshot.continuity_frontier_slot != snapshot.processing_frontier_slot
|
||||||
@@ -870,14 +873,14 @@ fn health_for_state(
|
|||||||
{
|
{
|
||||||
return ksp_worker_api::WorkerHealth::Unhealthy;
|
return ksp_worker_api::WorkerHealth::Unhealthy;
|
||||||
}
|
}
|
||||||
if snapshot.source_total > 0 && snapshot.source_active == snapshot.source_total {
|
if source_total > 0 && source_active == source_total {
|
||||||
return ksp_worker_api::WorkerHealth::Healthy;
|
return ksp_worker_api::WorkerHealth::Healthy;
|
||||||
}
|
}
|
||||||
if snapshot.source_total > 0
|
if source_total > 0
|
||||||
&& snapshot.source_active < snapshot.source_total
|
&& source_active < source_total
|
||||||
&& snapshot.source_failed > 0
|
&& source_failed > 0
|
||||||
&& snapshot.failed_source_losses_reconciled
|
&& snapshot.failed_source_losses_reconciled
|
||||||
&& snapshot.source_failed == snapshot.source_total - snapshot.source_active
|
&& source_failed == source_total - source_active
|
||||||
{
|
{
|
||||||
return ksp_worker_api::WorkerHealth::Degraded;
|
return ksp_worker_api::WorkerHealth::Degraded;
|
||||||
}
|
}
|
||||||
|
|||||||
178
deltas/0.3.14/pre.009-fix.001.md
Normal file
178
deltas/0.3.14/pre.009-fix.001.md
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
<!-- file: deltas/0.3.14/pre.009-fix.001.md -->
|
||||||
|
<!-- version: 1 -->
|
||||||
|
|
||||||
|
# Delta `0.3.14-pre.009-fix.001` — rétablissement des canaris de health multi-source
|
||||||
|
|
||||||
|
## Base requise
|
||||||
|
|
||||||
|
```text
|
||||||
|
0.3.14-pre.009
|
||||||
|
workspace.package.version = 0.3.14-pre.9
|
||||||
|
deltas/0.3.14/pre.009.md présent
|
||||||
|
```
|
||||||
|
|
||||||
|
## Objectif
|
||||||
|
|
||||||
|
Corriger strictement les deux échecs de `tests/hardening.rs` observés après `pre.009`, sans modifier la politique fonctionnelle de health :
|
||||||
|
|
||||||
|
```text
|
||||||
|
rendre explicite le garde source_active < source_total attendu par le canari historique pre.010
|
||||||
|
rendre explicite le pont aggregate.with_continuity_health attendu par le canari pre.009
|
||||||
|
préserver exactement Healthy / Degraded / Unhealthy / Faulted et les preuves de continuité de pre.009
|
||||||
|
```
|
||||||
|
|
||||||
|
## Défaut observé
|
||||||
|
|
||||||
|
Le gate opérateur de `0.3.14-pre.009` a produit :
|
||||||
|
|
||||||
|
```text
|
||||||
|
cargo fmt --all : PASS
|
||||||
|
cargo fmt --all -- --check : PASS
|
||||||
|
audit Rust workspace rules : PASS
|
||||||
|
audit Markdown tables : PASS
|
||||||
|
cargo check --workspace : PASS
|
||||||
|
cargo clippy --workspace --all-targets --all-features -- -D warnings : PASS
|
||||||
|
cargo test -p ksp-worker-raw-transaction-ingest-lib --all-targets --all-features : FAIL
|
||||||
|
```
|
||||||
|
|
||||||
|
Les suites précédant `hardening` passent, dont `143` unit tests. Deux canaris textuels échouent :
|
||||||
|
|
||||||
|
```text
|
||||||
|
v0_3_13_pre_010_multi_source_health_is_conservative_counted_and_redacted
|
||||||
|
required pre.010 health guard missing: source_active < source_total
|
||||||
|
|
||||||
|
v0_3_14_pre_009_health_policy_is_present_future_coverage_gated_and_source_neutral
|
||||||
|
required pre.009 inventory-health bridge missing: aggregate.with_continuity_health
|
||||||
|
```
|
||||||
|
|
||||||
|
## Cause
|
||||||
|
|
||||||
|
Les deux invariants sont présents sémantiquement mais ne sont plus visibles sous les formes textuelles exactes attendues par les canaris :
|
||||||
|
|
||||||
|
```text
|
||||||
|
snapshot.source_active < snapshot.source_total
|
||||||
|
aggregate\n .with_continuity_health(...)
|
||||||
|
```
|
||||||
|
|
||||||
|
Le hardening recherche volontairement les formes explicites historiques afin de protéger les invariants de health et le pont Inventory -> Continuity -> Snapshot.
|
||||||
|
|
||||||
|
## Correction
|
||||||
|
|
||||||
|
`health_for_state` matérialise des variables locales source-neutres :
|
||||||
|
|
||||||
|
```text
|
||||||
|
source_total
|
||||||
|
source_active
|
||||||
|
source_failed
|
||||||
|
```
|
||||||
|
|
||||||
|
La condition `Degraded` exprime donc explicitement :
|
||||||
|
|
||||||
|
```text
|
||||||
|
source_active < source_total
|
||||||
|
```
|
||||||
|
|
||||||
|
Le pont de projection matérialise ensuite :
|
||||||
|
|
||||||
|
```text
|
||||||
|
let aggregate = aggregate.with_continuity_health(...)
|
||||||
|
```
|
||||||
|
|
||||||
|
avant d'ajouter `failed_source_losses_reconciled`.
|
||||||
|
|
||||||
|
Ces changements sont algébriquement équivalents au code de `pre.009` et ne changent aucune décision runtime.
|
||||||
|
|
||||||
|
## Fichiers ajoutés
|
||||||
|
|
||||||
|
```text
|
||||||
|
deltas/0.3.14/pre.009-fix.001.md
|
||||||
|
```
|
||||||
|
|
||||||
|
## Fichiers modifiés
|
||||||
|
|
||||||
|
```text
|
||||||
|
Cargo.toml
|
||||||
|
crates/ksp-worker-raw-transaction-ingest-lib/src/runtime_resources.rs
|
||||||
|
crates/ksp-worker-raw-transaction-ingest-lib/src/snapshot.rs
|
||||||
|
```
|
||||||
|
|
||||||
|
## Fichiers supprimés
|
||||||
|
|
||||||
|
```text
|
||||||
|
aucun
|
||||||
|
```
|
||||||
|
|
||||||
|
## Version Cargo
|
||||||
|
|
||||||
|
Le correctif modifie du code Rust production ; conformément à `VER-ID-007` et `VER-ID-010` :
|
||||||
|
|
||||||
|
```text
|
||||||
|
header Cargo.toml : 579 -> 580
|
||||||
|
workspace.package.version : 0.3.14-pre.9 -> 0.3.14-pre.9.fix.1
|
||||||
|
```
|
||||||
|
|
||||||
|
Versions de fichiers :
|
||||||
|
|
||||||
|
```text
|
||||||
|
src/runtime_resources.rs : 37 -> 38
|
||||||
|
src/snapshot.rs : 6 -> 7
|
||||||
|
```
|
||||||
|
|
||||||
|
## Frontières préservées
|
||||||
|
|
||||||
|
```text
|
||||||
|
aucune modification de TargetCoverage
|
||||||
|
aucune modification du gap ledger
|
||||||
|
aucune modification des coverage epochs
|
||||||
|
aucune modification du continuity frontier
|
||||||
|
aucune modification de la classification source-loss
|
||||||
|
aucun respawn Worker
|
||||||
|
aucun nouveau scheduler ou task
|
||||||
|
aucun changement Transport
|
||||||
|
aucune nouvelle requête HTTP
|
||||||
|
aucune nouvelle dépendance ou feature
|
||||||
|
aucun accès Config
|
||||||
|
aucun Job Backfill
|
||||||
|
aucun backend Store physique
|
||||||
|
aucune croissance de surface publique
|
||||||
|
```
|
||||||
|
|
||||||
|
## Validations exécutées
|
||||||
|
|
||||||
|
Dans le sandbox de préparation :
|
||||||
|
|
||||||
|
```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
|
||||||
|
vérification ciblée des deux tokens de hardening
|
||||||
|
contrôle du diff exact
|
||||||
|
contrôle d'inventaire ZIP
|
||||||
|
unzip -t
|
||||||
|
réapplication du delta sur la base pre.009 et comparaison byte-à-byte
|
||||||
|
```
|
||||||
|
|
||||||
|
## Validations non exécutées
|
||||||
|
|
||||||
|
Le toolchain Rust/Cargo n'est pas disponible dans le sandbox de préparation. Le gate opérateur reste requis :
|
||||||
|
|
||||||
|
```text
|
||||||
|
cargo fmt --all
|
||||||
|
cargo fmt --all -- --check
|
||||||
|
cargo check --workspace
|
||||||
|
cargo clippy --workspace --all-targets --all-features -- -D warnings
|
||||||
|
cargo test -p ksp-worker-raw-transaction-ingest-lib --all-targets --all-features
|
||||||
|
```
|
||||||
|
|
||||||
|
## Décisions prises
|
||||||
|
|
||||||
|
```text
|
||||||
|
corriger les formes explicites attendues plutôt que relâcher ou supprimer les canaris
|
||||||
|
ne pas ajouter de #[allow(...)]
|
||||||
|
ne pas modifier la sémantique de health validée par les unit tests pre.009
|
||||||
|
```
|
||||||
|
|
||||||
|
## Questions ouvertes
|
||||||
|
|
||||||
|
```text
|
||||||
|
aucune pour ce correctif
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user