v0.3.16-pre.002-fix.001

This commit is contained in:
2026-09-21 08:40:18 +02:00
parent b0deefddb7
commit 05cdb4e2ab
5 changed files with 165 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-store-api/src/model/raw_outcome.rs
// version: 2
// version: 3
/// Outcome for one canonical RAW entity in an idempotent persistence operation.
#[non_exhaustive]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
@@ -13,6 +13,7 @@ pub enum RawEntityWriteOutcome {
/// Normal persistence skipped a durable purged tombstone.
SkippedPurged,
}
/// Outcome for one deterministic acquisition observation write.
#[non_exhaustive]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
@@ -24,12 +25,14 @@ pub enum RawObservationWriteOutcome {
/// No observation was recorded because the associated RAW entity was intentionally skipped.
NotRecorded,
}
/// Combined outcome of one atomic canonical RAW entity plus observation acquisition.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct RawAcquisitionWriteOutcome {
entity: crate::RawEntityWriteOutcome,
observation: crate::RawObservationWriteOutcome,
}
impl RawAcquisitionWriteOutcome {
/// Creates one backend-independent atomic acquisition outcome.
#[must_use]
@@ -42,6 +45,7 @@ impl RawAcquisitionWriteOutcome {
pub const fn entity(&self) -> crate::RawEntityWriteOutcome {
return self.entity;
}
/// Returns the acquisition observation write outcome.
#[must_use]
pub const fn observation(&self) -> crate::RawObservationWriteOutcome {

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-store-api/src/model/raw_transaction.rs
// version: 2
// version: 3
/// Durable backend-independent identity of one canonical RAW transaction.
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
@@ -7,6 +7,7 @@ pub struct RawTransactionReference {
network: crate::RawNetworkId,
signature: crate::RawTransactionSignature,
}
impl RawTransactionReference {
/// Creates one durable transaction identity from network and canonical Solana signature.
#[must_use]
@@ -19,6 +20,7 @@ impl RawTransactionReference {
pub fn network(&self) -> &crate::RawNetworkId {
return &self.network;
}
/// Returns the canonical transaction signature.
#[must_use]
pub const fn signature(&self) -> crate::RawTransactionSignature {
@@ -32,6 +34,7 @@ impl RawTransactionReference {
/// `content_hash`, provider identity, canonicality or any physical database key layout.
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RawTransactionVariantId(u64);
impl RawTransactionVariantId {
/// Creates one non-zero stable variant identifier.
pub fn try_new(value: u64) -> crate::Result<Self> {
@@ -54,6 +57,7 @@ pub struct RawTransactionVariantReference {
transaction: crate::RawTransactionReference,
variant_id: crate::RawTransactionVariantId,
}
impl RawTransactionVariantReference {
/// Creates one durable variant reference from logical transaction identity and surrogate id.
#[must_use]
@@ -83,6 +87,7 @@ pub enum RawTransactionVariantOrigin {
/// Explicitly synthesized canonical RAW representation derived from preserved parent variants.
Synthetic,
}
impl RawTransactionVariantOrigin {
/// Returns the stable persistence code for this origin.
#[must_use]
@@ -109,6 +114,7 @@ pub enum RawTransactionVariantRelation {
/// No contradiction must be asserted, but no safe dominance relation is proved.
Incomparable,
}
impl RawTransactionVariantRelation {
/// Returns the stable persistence/diagnostic code for this relation.
#[must_use]
@@ -149,6 +155,7 @@ pub enum RawTransactionVariantRelationReason {
/// Canonical representations differ but the current comparator cannot prove equality, dominance or contradiction safely.
UnsupportedCanonicalDifference,
}
impl RawTransactionVariantRelationReason {
/// Returns the stable persistence/diagnostic code for this reason.
#[must_use]
@@ -173,6 +180,7 @@ pub struct RawTransactionVariantComparison {
reason: crate::RawTransactionVariantRelationReason,
relation: crate::RawTransactionVariantRelation,
}
impl RawTransactionVariantComparison {
/// Creates one relation/reason pair and rejects semantically inconsistent combinations.
pub fn try_new(relation: crate::RawTransactionVariantRelation, reason: crate::RawTransactionVariantRelationReason) -> crate::Result<Self> {
@@ -204,6 +212,7 @@ pub enum RawTransactionConflictStatus {
/// The conflict currently has an explicit durable resolution while history remains preserved.
Resolved,
}
impl RawTransactionConflictStatus {
/// Returns the stable persistence code for this status.
#[must_use]
@@ -228,12 +237,14 @@ pub struct RawTransaction {
reference: crate::RawTransactionReference,
slot: u64,
}
impl RawTransaction {
/// Creates one complete canonical RAW transaction.
#[must_use]
pub fn new(reference: crate::RawTransactionReference, slot: u64, block_time: std::option::Option<crate::RawTimestamp>, payload: crate::RawPayload) -> Self {
return Self { block_time, payload, reference, slot };
}
/// Returns the optional canonical block timestamp.
#[must_use]
pub const fn block_time(&self) -> std::option::Option<crate::RawTimestamp> {
@@ -245,6 +256,7 @@ impl RawTransaction {
pub fn payload(&self) -> &crate::RawPayload {
return &self.payload;
}
/// Returns the durable backend-independent transaction identity.
#[must_use]
pub fn reference(&self) -> &crate::RawTransactionReference {
@@ -257,6 +269,7 @@ impl RawTransaction {
return self.slot;
}
}
/// Persistable acquisition observation linked to one canonical RAW transaction.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct RawTransactionObservation {
@@ -264,12 +277,14 @@ pub struct RawTransactionObservation {
provenance: crate::RawAcquisitionProvenance,
transaction: crate::RawTransactionReference,
}
impl RawTransactionObservation {
/// Creates one successful observation of a complete canonical RAW transaction.
#[must_use]
pub fn new(observation_key: crate::RawObservationKey, transaction: crate::RawTransactionReference, provenance: crate::RawAcquisitionProvenance) -> Self {
return Self { observation_key, provenance, transaction };
}
/// Returns the deterministic producer-owned observation idempotence key.
#[must_use]
pub const fn observation_key(&self) -> crate::RawObservationKey {
@@ -281,6 +296,7 @@ impl RawTransactionObservation {
pub fn provenance(&self) -> &crate::RawAcquisitionProvenance {
return &self.provenance;
}
/// Returns the durable transaction identity observed by this acquisition.
#[must_use]
pub fn transaction(&self) -> &crate::RawTransactionReference {

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-store-api/tests/release_completeness.rs
// version: 4
// version: 5
//! Release-level boundary and completeness canaries for the backend-neutral Store API RAW surface.
#[test]
@@ -102,6 +102,7 @@ fn v0_3_8_pre_003_exact_crate_root_export_inventory_is_stable() {
assert!(!crate_root.contains("pub mod "));
return;
}
#[test]
fn v0_3_8_pre_003_exact_production_module_inventory_is_raw_only() {
let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
@@ -131,6 +132,7 @@ fn v0_3_8_pre_003_exact_production_module_inventory_is_raw_only() {
assert_eq!(capability_names, std::vec!["raw_account.rs", "raw_retention.rs", "raw_transaction.rs"]);
return;
}
#[test]
fn pre_007_public_evolutive_enums_remain_non_exhaustive() {
let sources = [
@@ -158,6 +160,7 @@ fn pre_007_public_evolutive_enums_remain_non_exhaustive() {
}
return;
}
#[test]
fn pre_007_interface_store_ownership_and_negative_scope_remain_explicit() {
let interface_root = include_str!("../../ksp-interface-lib/src/lib.rs");
@@ -199,6 +202,7 @@ fn pre_007_interface_store_ownership_and_negative_scope_remain_explicit() {
}
return;
}
#[test]
fn v0_3_8_pre_003_capability_inventory_stays_fine_grained_without_runtime_facade() {
let sources = [
@@ -236,6 +240,7 @@ fn v0_3_8_pre_003_capability_inventory_stays_fine_grained_without_runtime_facade
assert_eq!(traits, expected);
return;
}
fn assert_non_exhaustive(sources: &[&str], enum_name: &str) {
let needle = "#[non_exhaustive]\n";
let declaration = std::format!("pub enum {enum_name}");
@@ -251,6 +256,7 @@ fn assert_non_exhaustive(sources: &[&str], enum_name: &str) {
assert!(found, "public evolutive enum not found: {enum_name}");
return;
}
fn rust_file_names(directory: &std::path::Path) -> std::io::Result<std::vec::Vec<std::string::String>> {
let entries = match std::fs::read_dir(directory) {
std::result::Result::Ok(value) => value,