v0.2.5-pre.006-fix.001

This commit is contained in:
2026-08-19 17:35:14 +02:00
parent 6094d33120
commit 25edcc231e
4 changed files with 118 additions and 11 deletions

View File

@@ -1,12 +1,12 @@
# file: Cargo.toml # file: Cargo.toml
# version: 153 # version: 154
[workspace] [workspace]
resolver = "3" resolver = "3"
members = ["crates/ksp-app-config-desk", "crates/ksp-config-lib", "crates/ksp-core-lib", "crates/ksp-logging-lib", "crates/ksp-onchain-transport-lib", "crates/ksp-wallet-lib"] members = ["crates/ksp-app-config-desk", "crates/ksp-config-lib", "crates/ksp-core-lib", "crates/ksp-logging-lib", "crates/ksp-onchain-transport-lib", "crates/ksp-wallet-lib"]
[workspace.package] [workspace.package]
version = "0.2.5-pre.6" version = "0.2.5-pre.6.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"

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-wallet-lib/tests/public_api.rs // file: crates/ksp-wallet-lib/tests/public_api.rs
// version: 5 // version: 6
//! Public API canaries for the Wallet foundation. //! Public API canaries for the Wallet foundation.
@@ -96,16 +96,16 @@ fn public_pre_005_create_open_and_calibrated_defaults_are_available_from_crate_r
#[test] #[test]
fn public_pre_006_file_persistence_surface_is_available_from_crate_root() { fn public_pre_006_file_persistence_surface_is_available_from_crate_root() {
let path = std::path::Path::new("not-polled.kspwallet"); let path = std::path::Path::new("not-polled.kspwallet");
let owner_password = ksp_wallet_lib::OwnerPassword::new("public-pre006-owner-password").expect("public test OWNER password must be valid"); let owner_password = ksp_wallet_lib::OwnerPassword::new(std::string::String::from("public-pre006-owner-password"));
let create_future = let create_future =
ksp_wallet_lib::create_wallet_file_v1(path, owner_password, std::option::Option::None, ksp_wallet_lib::WalletCreateMetadataV1::default()); ksp_wallet_lib::create_wallet_file_v1(path, owner_password, std::option::Option::None, ksp_wallet_lib::WalletCreateMetadataV1::default());
drop(create_future); drop(create_future);
let view_password = ksp_wallet_lib::ViewPassword::new("public-pre006-view-password").expect("public test VIEW password must be valid"); let view_password = ksp_wallet_lib::ViewPassword::new(std::string::String::from("public-pre006-view-password"));
let view_future = ksp_wallet_lib::open_wallet_view_file_v1(path, view_password); let view_future = ksp_wallet_lib::open_wallet_view_file_v1(path, view_password);
drop(view_future); drop(view_future);
let owner_password = ksp_wallet_lib::OwnerPassword::new("public-pre006-owner-password").expect("public test OWNER password must be valid"); let owner_password = ksp_wallet_lib::OwnerPassword::new(std::string::String::from("public-pre006-owner-password"));
let owner_future = ksp_wallet_lib::open_wallet_owner_file_v1(path, owner_password); let owner_future = ksp_wallet_lib::open_wallet_owner_file_v1(path, owner_password);
drop(owner_future); drop(owner_future);

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-wallet-lib/unit_tests/persistence.rs // file: crates/ksp-wallet-lib/unit_tests/persistence.rs
// version: 1 // version: 2
fn temp_directory() -> std::io::Result<tempfile::TempDir> { fn temp_directory() -> std::io::Result<tempfile::TempDir> {
return tempfile::tempdir(); return tempfile::tempdir();
@@ -86,7 +86,7 @@ fn public_file_create_and_locked_inspect_round_trip_without_revealing_identity()
let directory = temp_directory().expect("Wallet persistence test directory must be creatable"); let directory = temp_directory().expect("Wallet persistence test directory must be creatable");
let destination = directory.path().join("created.kspwallet"); let destination = directory.path().join("created.kspwallet");
let runtime = tokio::runtime::Builder::new_current_thread().build().expect("Wallet persistence test runtime must build"); let runtime = tokio::runtime::Builder::new_current_thread().build().expect("Wallet persistence test runtime must build");
let owner_password = crate::OwnerPassword::new("pre006-owner-password").expect("test OWNER password must be valid"); let owner_password = crate::OwnerPassword::new(std::string::String::from("pre006-owner-password"));
let created = runtime let created = runtime
.block_on(crate::create_wallet_file_v1(destination.as_path(), owner_password, std::option::Option::None, crate::WalletCreateMetadataV1::default())) .block_on(crate::create_wallet_file_v1(destination.as_path(), owner_password, std::option::Option::None, crate::WalletCreateMetadataV1::default()))
.expect("native Wallet file creation must succeed"); .expect("native Wallet file creation must succeed");
@@ -95,7 +95,7 @@ fn public_file_create_and_locked_inspect_round_trip_without_revealing_identity()
assert!(!locked.view_enabled()); assert!(!locked.view_enabled());
assert_eq!(created.capability(), crate::WalletCapability::Owner); assert_eq!(created.capability(), crate::WalletCapability::Owner);
assert!(destination.exists()); assert!(destination.exists());
let second_password = crate::OwnerPassword::new("pre006-other-owner-password").expect("second test OWNER password must be valid"); let second_password = crate::OwnerPassword::new(std::string::String::from("pre006-other-owner-password"));
let second = runtime.block_on(crate::create_wallet_file_v1( let second = runtime.block_on(crate::create_wallet_file_v1(
destination.as_path(), destination.as_path(),
second_password, second_password,
@@ -113,11 +113,11 @@ fn persisted_full_vector_opens_view_and_owner_through_file_apis() {
crate::persistence::persist_new_wallet_for_test(destination.as_path(), vector).expect("full vector must publish through no-clobber persistence"); crate::persistence::persist_new_wallet_for_test(destination.as_path(), vector).expect("full vector must publish through no-clobber persistence");
let runtime = tokio::runtime::Builder::new_current_thread().build().expect("Wallet persistence test runtime must build"); let runtime = tokio::runtime::Builder::new_current_thread().build().expect("Wallet persistence test runtime must build");
let view_password = crate::ViewPassword::new("pre005-view-password").expect("test VIEW password must be valid"); let view_password = crate::ViewPassword::new(std::string::String::from("pre005-view-password"));
let view = runtime let view = runtime
.block_on(crate::open_wallet_view_file_v1(destination.as_path(), view_password)) .block_on(crate::open_wallet_view_file_v1(destination.as_path(), view_password))
.expect("persisted full vector must open through VIEW file API"); .expect("persisted full vector must open through VIEW file API");
let owner_password = crate::OwnerPassword::new("pre005-owner-password").expect("test OWNER password must be valid"); let owner_password = crate::OwnerPassword::new(std::string::String::from("pre005-owner-password"));
let owner = runtime let owner = runtime
.block_on(crate::open_wallet_owner_file_v1(destination.as_path(), owner_password)) .block_on(crate::open_wallet_owner_file_v1(destination.as_path(), owner_password))
.expect("persisted full vector must open through OWNER file API"); .expect("persisted full vector must open through OWNER file API");

View File

@@ -0,0 +1,107 @@
<!-- file: deltas/0.2.5/pre.006-fix.001.md -->
<!-- version: 1 -->
# Delta `0.2.5-pre.006-fix.001` — alignement des tests de persistence sur le contrat Password
## Base requise
```text
livraison : 0.2.5-pre.006
workspace.package.version = "0.2.5-pre.6"
```
## Motif
Les validations opérateur de `pre.006` donnent :
```text
cargo fmt --all OK
cargo check --workspace OK
cargo clippy --workspace --all-targets ECHEC dans les tests Wallet
```
Les nouveaux tests de persistence et de surface publique construisaient `ViewPassword` et `OwnerPassword` comme si leurs constructeurs avaient le contrat historique/hypothétique :
```rust
Password::new("...").expect("...")
```
Or le contrat acquis de `pre.002+` est :
```rust
ViewPassword::new(String) -> ViewPassword
OwnerPassword::new(String) -> OwnerPassword
```
Les erreurs observées sont donc :
```text
E0308 : expected `String`, found `&str`
E0599 : no method named `expect` found for `ViewPassword` / `OwnerPassword`
```
Le code de production de `pre.006` compile ; l'incohérence est limitée aux nouveaux tests.
## Correction
Les cinq constructions fautives sont alignées sur le contrat public existant avec `std::string::String::from(...)` et sans `.expect(...)` sur les wrappers Password.
Exemple :
```rust
let owner_password = crate::OwnerPassword::new(std::string::String::from("pre006-owner-password"));
```
Le correctif ne modifie pas :
- `ViewPassword` ou `OwnerPassword` ;
- les règles de validation/password ;
- la persistence no-clobber ;
- le wire `.kspwallet` V1 ;
- les paramètres ou primitives cryptographiques ;
- les dépendances ;
- les API fichier introduites par `pre.006`.
## Version Cargo
Le correctif modifie des tests Rust participant au build :
```text
0.2.5-pre.6 -> 0.2.5-pre.6.fix.1
```
## Fichiers modifiés
```text
Cargo.toml
crates/ksp-wallet-lib/unit_tests/persistence.rs
crates/ksp-wallet-lib/tests/public_api.rs
```
## Fichiers ajoutés
```text
deltas/0.2.5/pre.006-fix.001.md
```
## Fichiers supprimés
Aucun.
## Validation attendue après application
```bash
cargo fmt --all
cargo check --workspace
cargo clippy --workspace --all-targets
cargo test -p ksp-wallet-lib
cargo test --workspace
```
Le `cargo tree` de `pre.006` n'est pas modifié par ce fix ; les résultats opérateur déjà obtenus pour `tempfile@3.27.0` restent valides.
## Commit attendu
```text
v0.2.5-pre.006-fix.001
```