v0.1.3-pre.005-fix-001

This commit is contained in:
2026-08-15 20:26:24 +02:00
parent 063b24ee1c
commit 3a479e4f43
3 changed files with 127 additions and 7 deletions

View File

@@ -1,12 +1,12 @@
# file: Cargo.toml
# version: 45
# version: 46
[workspace]
resolver = "3"
members = ["crates/ksp-config-lib", "crates/ksp-core-lib", "crates/ksp-logging-lib"]
[workspace.package]
version = "0.1.3-pre.5"
version = "0.1.3-pre.5.fix.1"
edition = "2024"
license = "MIT"
repository = "https://git.sasedev.com/Sasedev/khadhroony-solana-project"

View File

@@ -1,10 +1,11 @@
// file: crates/ksp-logging-lib/tests/runtime.rs
// version: 6
// version: 7
//! Integration tests for global initialization, takeover filtering, non-blocking outputs and hot reload.
const LOGGING_TARGET: &str = "ksp-logging-lib";
const OTHER_KSP_TARGET: &str = "ksp-store-lib";
const JSON_KSP_TARGET: &str = "ksp-logging-json-test";
const EXTERNAL_TARGET: &str = "sqlx";
fn logging_trace_enabled() -> bool {
@@ -230,7 +231,7 @@ fn global_runtime_supports_takeover_non_blocking_outputs_hot_reload_and_single_i
"runtime.jsonl",
ksp_logging_lib::FileRotation::Never,
ksp_logging_lib::LogFormat::Json,
ksp_logging_lib::OutputFilter::new(ksp_logging_lib::LogFilterLevel::Trace, std::vec![LOGGING_TARGET.to_string()], std::vec!["*".to_string()],),
ksp_logging_lib::OutputFilter::new(ksp_logging_lib::LogFilterLevel::Trace, std::vec![JSON_KSP_TARGET.to_string()], std::vec!["*".to_string()],),
),
],
);
@@ -238,6 +239,8 @@ fn global_runtime_supports_takeover_non_blocking_outputs_hot_reload_and_single_i
assert!(file_reload.is_ok());
ksp_logging_lib::info!(target: LOGGING_TARGET, "logging info \x1b[31mmarker\x1b[0m");
ksp_logging_lib::error!(target: LOGGING_TARGET, "logging error marker");
ksp_logging_lib::info!(target: JSON_KSP_TARGET, "json info marker");
ksp_logging_lib::error!(target: JSON_KSP_TARGET, "json error marker");
ksp_logging_lib::warn!(target: OTHER_KSP_TARGET, "store warning marker");
ksp_logging_lib::info!(target: OTHER_KSP_TARGET, "store info must be filtered");
tracing::error!(target: EXTERNAL_TARGET, "external marker must remain silent");
@@ -256,9 +259,9 @@ fn global_runtime_supports_takeover_non_blocking_outputs_hot_reload_and_single_i
assert!(!compact_text.contains("logging info marker"));
assert!(pretty_text.contains("logging error marker"));
assert!(!pretty_text.contains("logging info marker"));
assert!(json_text.contains("logging info marker"));
assert!(json_text.contains("logging error marker"));
assert!(json_text.contains(LOGGING_TARGET));
assert!(json_text.contains("json info marker"));
assert!(json_text.contains("json error marker"));
assert!(json_text.contains(JSON_KSP_TARGET));
assert!(!json_text.contains("store warning marker"));
assert!(!human_text.contains("external marker must remain silent"));
assert!(!compact_text.contains("external marker must remain silent"));

View File

@@ -0,0 +1,117 @@
<!-- file: deltas/0.1.3/pre.005-fix.001.md -->
<!-- version: 1 -->
# Delta 0.1.3-pre.005-fix.001
## Base requise
Livraison précédente :
```text
0.1.3-pre.005
```
Version technique de cette base :
```text
workspace.package.version = "0.1.3-pre.5"
Cargo.toml header version = 45
```
Validations utilisateur exécutées le 2026-08-15 :
```text
cargo fmt --all OK
cargo check --workspace OK
cargo clippy --workspace --all-targets OK
cargo test --workspace FAILED — 1 test d'intégration Logging
cargo tree -p ksp-logging-lib OK
cargo tree -p ksp-logging-lib -d OK — aucune duplication
cargo tree -p ksp-logging-lib -e features OK
```
Échec isolé :
```text
global_runtime_supports_takeover_non_blocking_outputs_hot_reload_and_single_initialization
assertion failed: json_text.contains("logging info marker")
```
## Cause
Le test utilisait le même event pour vérifier deux comportements différents :
```text
logging info <ANSI>marker</ANSI>
```
Cet event était envoyé à la fois au sink `Human` et au sink `Json`.
Pour le sink humain, `StripAnsiWriter` reçoit les octets ANSI bruts après formatage et les supprime, ce qui produit bien :
```text
logging info marker
```
Pour le formatter JSON, les caractères de contrôle présents dans la valeur structurée sont échappés par le JSON avant l'écriture. La représentation persistée contient donc une forme JSON échappée de l'ESC plutôt qu'une séquence terminal brute ; la sous-chaîne littérale `logging info marker` n'est alors plus contiguë.
L'échec provenait donc d'une hypothèse incorrecte du test et non d'une perte de l'event par le routing multi-sink.
## Correction
Le test d'intégration sépare désormais les responsabilités :
- `LOGGING_TARGET` continue de vérifier le sink `Human` et le stripping ANSI persistant ;
- un target KSP dédié `JSON_KSP_TARGET = "ksp-logging-json-test"` alimente le sink JSON ;
- les events JSON utilisent des messages neutres : `json info marker` et `json error marker` ;
- les assertions JSON vérifient ces marqueurs et le target JSON dédié ;
- le routing indépendant par target reste ainsi testé explicitement sans dépendre de la représentation d'échappement JSON d'un caractère de contrôle.
Aucun code runtime de `ksp-logging-lib` n'est modifié.
## Version technique
Comme un fichier Rust de test est modifié :
```text
workspace.package.version = "0.1.3-pre.5.fix.1"
Cargo.toml header version = 46
crates/ksp-logging-lib/tests/runtime.rs header version = 7
```
## Fichiers modifiés
```text
Cargo.toml
crates/ksp-logging-lib/tests/runtime.rs
```
## Fichier ajouté
```text
deltas/0.1.3/pre.005-fix.001.md
```
## Hors scope
Ce fix n'ouvre pas `pre.006` et ne modifie pas :
- le runtime multi-sink ;
- le routing `level`/`target` ;
- le futur routing structuré `domain` ;
- Config, JSON Config ou JSON Schema ;
- les dépendances ou features Cargo.
## Validations à exécuter
```bash
cargo fmt --all
cargo check --workspace
cargo clippy --workspace --all-targets
cargo test --workspace
cargo tree -p ksp-logging-lib
cargo tree -p ksp-logging-lib -d
cargo tree -p ksp-logging-lib -e features
```
Aucune validation Cargo n'est déclarée réussie tant qu'elle n'a pas été exécutée sur le workspace utilisateur.