sdk

Radroots SDK and bindings
git clone https://radroots.dev/git/sdk.git
Log | Files | Refs | README

commit 603776a1d16d661d4a944f24dba5564c10c4e879
parent a86d62821f7fe0eb50cf11dfe0dd5c4b7bc6b9cb
Author: triesap <tyson@radroots.org>
Date:   Tue, 28 Jul 2026 22:06:29 +0000

event: replace identifier strings with canonical owned types

- migrate SDK drafts and receipts to explicit canonical event ID encoders
- propagate byte-owned trade identifiers through runtime persistence boundaries
- update feature-gated examples and tests for the breaking identifier API
- verify formatting, all-feature tests, strict linting, and architecture policy

Diffstat:
Mcrates/sdk/examples/sdk_v1_knowledge_prepare.rs | 2+-
Mcrates/sdk/examples/sdk_v1_listing_prepare.rs | 2+-
Mcrates/sdk/examples/sdk_v1_local_enqueue_and_mock_sync.rs | 2+-
Mcrates/sdk/src/farms_runtime.rs | 4++--
Mcrates/sdk/src/listings_runtime.rs | 4++--
Mcrates/sdk/src/trade_runtime.rs | 44++++++++++++++++++++++++--------------------
Mcrates/sdk/src/workflow_runtime.rs | 12++++++------
Mcrates/sdk/tests/farms_runtime.rs | 12++++++------
Mcrates/sdk/tests/listings_runtime.rs | 16++++++++--------
Mcrates/sdk/tests/sync_runtime.rs | 4++--
Mcrates/sdk/tests/unit/signer_provider_tests.rs | 4++--
Mcrates/sdk/tests/unit/sync_runtime_tests.rs | 2+-
Mcrates/sdk/tests/unit/trade_runtime_tests.rs | 12++++++------
Mcrates/sdk/tests/unit/workflow_runtime_tests.rs | 20++++++++++----------
14 files changed, 72 insertions(+), 68 deletions(-)

diff --git a/crates/sdk/examples/sdk_v1_knowledge_prepare.rs b/crates/sdk/examples/sdk_v1_knowledge_prepare.rs @@ -28,7 +28,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { println!( "prepared knowledge claim draft: {}", - draft.expected_event_id_str() + draft.expected_event_id_hex() ); println!("knowledge manifest sha256: {manifest_hash}"); Ok(()) diff --git a/crates/sdk/examples/sdk_v1_listing_prepare.rs b/crates/sdk/examples/sdk_v1_listing_prepare.rs @@ -25,7 +25,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { let plan = sdk.listings().prepare_publish(request)?; println!("public listing: {}", plan.public_listing_addr().as_str()); - println!("expected event: {}", plan.expected_event_id().as_str()); + println!("expected event: {}", plan.expected_event_id().to_hex()); Ok(()) } diff --git a/crates/sdk/examples/sdk_v1_local_enqueue_and_mock_sync.rs b/crates/sdk/examples/sdk_v1_local_enqueue_and_mock_sync.rs @@ -58,7 +58,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { .push_outbox_with_transport(&transport, PushOutboxRequest::new().with_limit(1)) .await?; - println!("queued listing event: {}", enqueue.signed_event_id.as_str()); + println!("queued listing event: {}", enqueue.signed_event_id.to_hex()); println!("published events: {}", push.published_events); Ok(()) } diff --git a/crates/sdk/src/farms_runtime.rs b/crates/sdk/src/farms_runtime.rs @@ -768,7 +768,7 @@ fn validate_farm_publish_plan( return Err(invalid("contract or kind does not match Farm publish")); } - let expected_event_id = RadrootsEventId::parse(plan.frozen_draft.expected_event_id_str()) + let expected_event_id = RadrootsEventId::parse(plan.frozen_draft.expected_event_id_hex()) .expect("validated frozen draft has a typed event ID"); if plan.expected_event_id != expected_event_id { return Err(invalid("expected event ID does not match frozen draft")); @@ -825,7 +825,7 @@ fn farm_publish_plan( actor.pubkey().to_hex(), ) .expect("validated farm publish draft freezes"); - let expected_event_id = RadrootsEventId::parse(frozen_draft.expected_event_id_str()) + let expected_event_id = RadrootsEventId::parse(frozen_draft.expected_event_id_hex()) .expect("frozen farm draft produces a valid event id"); Ok(FarmPublishPlan { farm_addr, diff --git a/crates/sdk/src/listings_runtime.rs b/crates/sdk/src/listings_runtime.rs @@ -367,7 +367,7 @@ fn validate_listing_publish_plan( )); } - let expected_event_id = RadrootsEventId::parse(plan.frozen_draft.expected_event_id_str()) + let expected_event_id = RadrootsEventId::parse(plan.frozen_draft.expected_event_id_hex()) .expect("validated frozen draft has a typed event ID"); if plan.expected_event_id != expected_event_id { return Err(invalid("expected event ID does not match frozen draft")); @@ -415,7 +415,7 @@ fn listing_publish_plan( let mutation = RadrootsOperationalListingMutation::publish(canonical); let frozen_draft = build_operational_listing_mutation_draft(&mutation, u64::from(created_at_nostr))?; - let expected_event_id = RadrootsEventId::parse(frozen_draft.expected_event_id_str()) + let expected_event_id = RadrootsEventId::parse(frozen_draft.expected_event_id_hex()) .expect("frozen listing edit produces a valid event id"); Ok(ListingPublishPlan { public_listing_addr, diff --git a/crates/sdk/src/trade_runtime.rs b/crates/sdk/src/trade_runtime.rs @@ -217,11 +217,11 @@ impl<'client> TradeQueryService<'client> { let view = trade_status_view(self.sdk, &request.trade_id).await?; let last = last_trade_mutation_snapshot(self.sdk, &request.trade_id).await?; let checkpoint = RadrootsTradeProjectionCheckpoint { - trade_id: view.trade_id.clone(), + trade_id: view.trade_id, reducer_contract_id: RADROOTS_TRADE_REDUCER_CONTRACT_ID.to_owned(), reducer_version: RADROOTS_TRADE_REDUCER_VERSION, projection_digest: view.projection.projection_digest.clone(), - root_mutation_id: view.projection.root_mutation_id.clone(), + root_mutation_id: view.projection.root_mutation_id, negotiation_state: enum_label(&view.projection.negotiation_state)?, agreement_state: enum_label(&view.projection.agreement_state)?, evidence_state: enum_label(&view.projection.evidence_state)?, @@ -1189,7 +1189,7 @@ async fn trade_command_plan( ) })?; validate_command_private_terms(sdk, operation_kind, &canonical, acknowledged).await?; - let mutation_id = canonical.mutation_id.clone().ok_or_else(|| { + let mutation_id = canonical.mutation_id.ok_or_else(|| { trade_command_error( RadrootsSdkTradeErrorKind::InvalidEnvelope, operation_kind, @@ -1215,7 +1215,7 @@ async fn trade_command_plan( operation_kind, actor, frozen_draft, - trade_id: canonical.trade_id.clone(), + trade_id: canonical.trade_id, mutation_id, target_policy, satisfaction_policy, @@ -1248,7 +1248,7 @@ async fn trade_command_receipt( operation_state: TradeCommandLifecycleState::Committed, trade_id: plan.trade_id, mutation_id: plan.mutation_id, - expected_event_id: RadrootsEventId::parse(plan.frozen_draft.expected_event_id_str()) + expected_event_id: RadrootsEventId::parse(plan.frozen_draft.expected_event_id_hex()) .expect("trade workflow draft has a valid expected event id"), signed_event_id: enqueue.signed_event_id, local_event_seq: enqueue.local_event_seq, @@ -1452,11 +1452,13 @@ async fn ensure_private_terms_ref_available( candidate_id: &RadrootsTradeCandidateId, private_ref: &RadrootsTradePrivateTermsRefV1, ) -> Result<(), RadrootsSdkError> { + let trade_id_hex = trade_id.to_hex(); + let candidate_id_hex = candidate_id.to_hex(); let evidence = sdk ._private_store .private_terms_evidence( - trade_id.as_str(), - candidate_id.as_str(), + trade_id_hex.as_str(), + candidate_id_hex.as_str(), private_ref.artifact_id.as_str(), private_ref.schema_id.as_str(), private_ref.ciphertext_commitment.as_str(), @@ -1485,11 +1487,11 @@ async fn seal_private_artifact( let now_ms = sdk_now_ms(sdk)?; let input = SdkPrivateTradeArtifactInput { artifact_id: request.artifact_id, - trade_id: request.trade_id.as_str().to_owned(), + trade_id: request.trade_id.to_hex(), candidate_id: request .candidate_id .as_ref() - .map(|candidate_id| candidate_id.as_str().to_owned()), + .map(RadrootsTradeCandidateId::to_hex), artifact_kind: request.artifact_kind.into(), schema_id: request.schema_id, plaintext: request.plaintext, @@ -1586,7 +1588,7 @@ async fn trade_status_view( .await? .len(); Ok(TradeStatusView { - trade_id: trade_id.clone(), + trade_id: *trade_id, projection, source_event_count, private_terms, @@ -1609,7 +1611,7 @@ async fn trade_projection_for_trade( "trade is not present in the local event store", )); } - let mut input = RadrootsTradeReductionInputV1::new(trade_id.clone()); + let mut input = RadrootsTradeReductionInputV1::new(*trade_id); input.mutations = stored .iter() .map(stored_trade_mutation_record) @@ -1636,7 +1638,7 @@ async fn private_terms_views_for_trade( let evidence = private_terms_evidence_for_mutations(sdk, trade_id, &records).await?; let mut evidence_by_candidate = evidence .into_iter() - .map(|item| (item.candidate_id.clone(), item.state)) + .map(|item| (item.candidate_id, item.state)) .collect::<BTreeMap<_, _>>(); let mut views = BTreeMap::<RadrootsTradeCandidateId, TradePrivateTermsAvailabilityView>::new(); for record in records { @@ -1645,7 +1647,7 @@ async fn private_terms_views_for_trade( .remove(&candidate_id) .unwrap_or(RadrootsTradePrivateTermsStateV1::Missing); views.insert( - candidate_id.clone(), + candidate_id, TradePrivateTermsAvailabilityView { candidate_id, artifact_id: Some(private_ref.artifact_id.clone()), @@ -1667,16 +1669,18 @@ async fn private_terms_evidence_for_mutations( ) -> Result<Vec<RadrootsTradePrivateTermsEvidenceV1>, RadrootsSdkError> { let mut evidence = Vec::new(); let mut seen = BTreeSet::new(); + let trade_id_hex = trade_id.to_hex(); for record in mutations { if let Some((candidate_id, private_ref)) = candidate_private_ref(&record.mutation) { - if !seen.insert(candidate_id.clone()) { + if !seen.insert(candidate_id) { continue; } + let candidate_id_hex = candidate_id.to_hex(); evidence.push( sdk._private_store .private_terms_evidence( - trade_id.as_str(), - candidate_id.as_str(), + trade_id_hex.as_str(), + candidate_id_hex.as_str(), private_ref.artifact_id.as_str(), private_ref.schema_id.as_str(), private_ref.ciphertext_commitment.as_str(), @@ -1695,7 +1699,7 @@ fn candidate_private_ref( match &envelope.body { RadrootsTradeMutationBodyV1::Proposal { candidate } | RadrootsTradeMutationBodyV1::RevisionProposal { candidate } => { - let candidate_id = candidate.candidate_id.clone()?; + let candidate_id = candidate.candidate_id?; let private_ref = candidate.private_terms.clone()?; Some((candidate_id, private_ref)) } @@ -1708,7 +1712,7 @@ fn stored_trade_mutation_record( stored: &RadrootsStoredTradeMutation, ) -> Result<RadrootsTradeMutationRecordV1, RadrootsSdkError> { Ok(RadrootsTradeMutationRecordV1 { - transport_event_id: Some(stored.first_transport_event_id.clone()), + transport_event_id: Some(stored.first_transport_event_id), mutation: stored_trade_envelope(stored)?, }) } @@ -1903,7 +1907,7 @@ async fn inspect_evidence_views( let offset = evidence_cursor_offset(request.cursor.as_deref())?; let metadata = sdk ._private_store - .trade_artifact_metadata_for_trade(request.trade_id.as_str()) + .trade_artifact_metadata_for_trade(&request.trade_id.to_hex()) .await?; let mut items = Vec::new(); for item in metadata @@ -1948,7 +1952,7 @@ async fn last_trade_mutation_snapshot( let row = sqlx::query( "SELECT mutation_id, first_event_seq FROM trade_mutation WHERE trade_id = ? ORDER BY first_event_seq DESC, mutation_id DESC LIMIT 1", ) - .bind(trade_id.as_str()) + .bind(trade_id.to_hex()) .fetch_optional(sdk._event_store.pool()) .await .map_err(trade_query_store_error)?; diff --git a/crates/sdk/src/workflow_runtime.rs b/crates/sdk/src/workflow_runtime.rs @@ -153,7 +153,7 @@ async fn enqueue_signed_workflow_event( ), })?; let observed_at_ms = sdk_now_ms(sdk)?; - let signed_event_id = RadrootsEventId::parse(request.frozen_draft.expected_event_id_str()) + let signed_event_id = RadrootsEventId::parse(request.frozen_draft.expected_event_id_hex()) .expect("frozen workflow draft has a valid expected event id"); let delivery_plan_value = delivery_plan.delivery_plan; let mut tx = @@ -232,7 +232,7 @@ async fn enqueue_signed_trade_workflow_event( ), })?; let observed_at_ms = sdk_now_ms(sdk)?; - let signed_event_id = RadrootsEventId::parse(request.frozen_draft.expected_event_id_str()) + let signed_event_id = RadrootsEventId::parse(request.frozen_draft.expected_event_id_hex()) .expect("frozen workflow draft has a valid expected event id"); let delivery_plan_value = delivery_plan.delivery_plan; let mut tx = @@ -603,7 +603,7 @@ async fn prepare_runtime_operation_journal( let observed_at_ms = sdk_now_ms(sdk)?; let command_hash = runtime_request_digest(request, &delivery_plan.delivery_plan); let frozen_draft_json = frozen_draft_json(request.frozen_draft)?; - let expected_transport_id = request.frozen_draft.expected_event_id_str(); + let expected_transport_id = request.frozen_draft.expected_event_id_hex(); let mut tx = sdk._event_store .pool() @@ -874,7 +874,7 @@ fn workflow_receipt_result_json(receipt: &SdkWorkflowEnqueueReceipt) -> serde_js serde_json::json!({ "api_version": 1, "state": "committed", - "signed_event_id": receipt.signed_event_id.as_str(), + "signed_event_id": receipt.signed_event_id.to_hex(), "local_event_seq": receipt.local_event_seq, "outbox_operation_id": receipt.outbox_operation_id, "outbox_event_id": receipt.outbox_event_id, @@ -970,7 +970,7 @@ fn frozen_draft_json(frozen_draft: &RadrootsEventDraft) -> Result<String, Radroo "tags": frozen_draft.tags_as_vec(), "content": frozen_draft.content(), "expected_pubkey": frozen_draft.expected_pubkey().to_hex(), - "expected_event_id": frozen_draft.expected_event_id_str() + "expected_event_id": frozen_draft.expected_event_id_hex() })) .map_err(|error| RadrootsSdkError::EventStore { message: error.to_string(), @@ -1024,7 +1024,7 @@ fn runtime_request_digest( "tags": request.frozen_draft.tags_as_vec(), "content_sha256": hex::encode(Sha256::digest(request.frozen_draft.content().as_bytes())), "expected_pubkey": request.frozen_draft.expected_pubkey().to_hex(), - "expected_event_id": request.frozen_draft.expected_event_id_str() + "expected_event_id": request.frozen_draft.expected_event_id_hex() }, "delivery_plan": { "transport_profile_id": delivery_plan.transport_profile_id.as_str(), diff --git a/crates/sdk/tests/farms_runtime.rs b/crates/sdk/tests/farms_runtime.rs @@ -207,8 +207,8 @@ async fn farm_prepare_publish_is_side_effect_free() { assert_eq!(prepared.frozen_draft().kind_u32(), KIND_FARM); assert_eq!(prepared.created_at().unix_seconds(), 1_700_000_000); assert_eq!( - prepared.expected_event_id().as_str(), - prepared.frozen_draft().expected_event_id_str() + prepared.expected_event_id().to_hex(), + prepared.frozen_draft().expected_event_id_hex() ); assert_eq!( prepared.farm_addr().as_str(), @@ -229,7 +229,7 @@ async fn farm_prepare_publish_is_side_effect_free() { ); assert!( event_store - .raw_event(prepared.expected_event_id().as_str()) + .raw_event(&prepared.expected_event_id().to_hex()) .await .expect("event lookup") .is_none() @@ -616,7 +616,7 @@ async fn farm_enqueue_publish_stores_event_and_queues_signed_outbox_without_prof .expect("event store status"); assert_eq!(status.total_events, 1); let stored_event = event_store - .valid_event(receipt.signed_event_id.as_str()) + .valid_event(&receipt.signed_event_id.to_hex()) .await .expect("event lookup") .expect("stored event"); @@ -1284,8 +1284,8 @@ async fn farm_runtime_dtos_serialize_deterministically() { receipt_json, serde_json::json!({ "farm_addr": receipt.farm_addr.as_str(), - "expected_event_id": receipt.expected_event_id.as_str(), - "signed_event_id": receipt.signed_event_id.as_str(), + "expected_event_id": receipt.expected_event_id.to_hex(), + "signed_event_id": receipt.signed_event_id.to_hex(), "local_event_seq": 1, "outbox_operation_id": 1, "outbox_event_id": 1, diff --git a/crates/sdk/tests/listings_runtime.rs b/crates/sdk/tests/listings_runtime.rs @@ -168,8 +168,8 @@ async fn prepare_publish_is_side_effect_free() { assert_eq!(prepared.frozen_draft().kind_u32(), KIND_CLASSIFIED_LISTING); assert_eq!(prepared.created_at().unix_seconds(), 1_700_000_000); assert_eq!( - prepared.expected_event_id().as_str(), - prepared.frozen_draft().expected_event_id_str() + prepared.expected_event_id().to_hex(), + prepared.frozen_draft().expected_event_id_hex() ); assert_eq!( prepared.public_listing_addr().as_str(), @@ -185,7 +185,7 @@ async fn prepare_publish_is_side_effect_free() { .expect("event store"); assert!( event_store - .raw_event(prepared.expected_event_id().as_str()) + .raw_event(&prepared.expected_event_id().to_hex()) .await .expect("event lookup") .is_none() @@ -254,7 +254,7 @@ async fn enqueue_publish_stores_event_and_queues_signed_outbox_without_publish() .expect("event store"); assert!( event_store - .valid_event(receipt.signed_event_id.as_str()) + .valid_event(&receipt.signed_event_id.to_hex()) .await .expect("event lookup") .is_some() @@ -329,7 +329,7 @@ async fn prepare_then_enqueue_prepared_uses_same_event_id() { .expect("event store"); assert!( event_store - .valid_event(prepared.expected_event_id().as_str()) + .valid_event(&prepared.expected_event_id().to_hex()) .await .expect("event lookup") .is_some() @@ -343,7 +343,7 @@ async fn prepare_then_enqueue_prepared_uses_same_event_id() { .await .expect("outbox event") .expect("outbox event"); - assert_eq!(outbox_event.event_id, prepared.expected_event_id().as_str()); + assert_eq!(outbox_event.event_id, prepared.expected_event_id().to_hex()); } #[tokio::test] @@ -620,7 +620,7 @@ async fn explicit_historical_created_at_does_not_backdate_observed_at_ms() { .await .expect("event store"); let stored_event = event_store - .valid_event(receipt.signed_event_id.as_str()) + .valid_event(&receipt.signed_event_id.to_hex()) .await .expect("event lookup") .expect("stored event"); @@ -817,7 +817,7 @@ async fn enqueue_publish_rolls_back_event_and_journal_when_outbox_conflicts_afte .expect("event store"); assert!( event_store - .raw_event(prepared.expected_event_id().as_str()) + .raw_event(&prepared.expected_event_id().to_hex()) .await .expect("event lookup") .is_none() diff --git a/crates/sdk/tests/sync_runtime.rs b/crates/sdk/tests/sync_runtime.rs @@ -2861,7 +2861,7 @@ async fn push_outbox_with_transport_scopes_duplicate_endpoint_sibling_plans() { format!( "radroots-nostr-outbox-{}-1-{}-", first.outbox_event_id, - first.signed_event_id.as_str() + first.signed_event_id.to_hex() ) .as_str() ) @@ -2871,7 +2871,7 @@ async fn push_outbox_with_transport_scopes_duplicate_endpoint_sibling_plans() { format!( "radroots-nostr-outbox-{}-2-{}-", first.outbox_event_id, - first.signed_event_id.as_str() + first.signed_event_id.to_hex() ) .as_str() ) diff --git a/crates/sdk/tests/unit/signer_provider_tests.rs b/crates/sdk/tests/unit/signer_provider_tests.rs @@ -254,7 +254,7 @@ async fn local_key_provider_signs_authorized_frozen_draft() { assert!(provider.capability().nip46_permissions.is_empty()); assert_eq!(receipt.mode, RadrootsSdkSignerMode::LocalKey); assert_eq!(receipt.signer_pubkey, user_pubkey()); - assert_eq!(receipt.signed_event_id, draft.expected_event_id_str()); + assert_eq!(receipt.signed_event_id, draft.expected_event_id_hex()); assert_eq!( progress, vec![ @@ -1045,5 +1045,5 @@ async fn sdk_builder_installs_configured_signer_provider() { )) .await .expect("receipt"); - assert_eq!(receipt.signed_event_id, draft.expected_event_id_str()); + assert_eq!(receipt.signed_event_id, draft.expected_event_id_hex()); } diff --git a/crates/sdk/tests/unit/sync_runtime_tests.rs b/crates/sdk/tests/unit/sync_runtime_tests.rs @@ -924,7 +924,7 @@ async fn radrootsd_push_empty_queue_and_private_helpers_are_deterministic() { message.clone(), ) .expect("radrootsd transport error receipt"); - assert_eq!(receipt.event_id, signed_event.id_str()); + assert_eq!(receipt.event_id, *signed_event.id()); assert_eq!(receipt.final_state, PushOutboxEventState::PublishRetryable); assert_eq!(receipt.retryable_count, 1); assert!(!receipt.quorum_met); diff --git a/crates/sdk/tests/unit/trade_runtime_tests.rs b/crates/sdk/tests/unit/trade_runtime_tests.rs @@ -211,7 +211,7 @@ fn reservation( reservation_id: RadrootsDTag::parse("reservation-1").expect("reservation id"), inventory_authority_id: pubkey(seller_pubkey), inventory_epoch: 42, - candidate_id: candidate.candidate_id.clone().expect("candidate id"), + candidate_id: candidate.candidate_id.expect("candidate id"), commitments: candidate .lines .iter() @@ -233,7 +233,7 @@ fn accepted_decision( buyer_pubkey: &str, seller_pubkey: &str, ) -> RadrootsTradeMutationEnvelopeV1 { - let proposal_id = proposal.mutation_id.clone().expect("proposal id"); + let proposal_id = proposal.mutation_id.expect("proposal id"); let candidate = match &proposal.body { RadrootsTradeMutationBodyV1::Proposal { candidate } => candidate.clone(), _ => unreachable!(), @@ -242,18 +242,18 @@ fn accepted_decision( mutation_id: None, contract_id: RADROOTS_TRADE_DECISION_CONTRACT_ID.to_owned(), schema_version: RADROOTS_TRADE_SCHEMA_VERSION, - trade_id: proposal.trade_id.clone(), - root_mutation_id: Some(proposal_id.clone()), + trade_id: proposal.trade_id, + root_mutation_id: Some(proposal_id), buyer_pubkey: pubkey(buyer_pubkey), seller_pubkey: pubkey(seller_pubkey), farm_id: RadrootsDTag::parse("farm-1").expect("farm id"), - parent_mutation_ids: vec![proposal_id.clone()], + parent_mutation_ids: vec![proposal_id], author_pubkey: pubkey(seller_pubkey), counterparty_pubkey: pubkey(buyer_pubkey), authored_at_unix_s: 1_799_000_060, body: RadrootsTradeMutationBodyV1::Decision { proposal_mutation_id: proposal_id, - candidate_id: candidate.candidate_id.clone().expect("candidate id"), + candidate_id: candidate.candidate_id.expect("candidate id"), decision: RadrootsTradeDecisionV1::Accepted { reservation_assertion: Some(reservation(&candidate, seller_pubkey)), }, diff --git a/crates/sdk/tests/unit/workflow_runtime_tests.rs b/crates/sdk/tests/unit/workflow_runtime_tests.rs @@ -151,7 +151,7 @@ fn signed_event() -> RadrootsSignedEvent { let draft = frozen_draft(); let sig = "c".repeat(128); let raw_json = serde_json::json!({ - "id": draft.expected_event_id_str(), + "id": draft.expected_event_id_hex(), "pubkey": draft.expected_pubkey().to_hex(), "created_at": draft.created_at_u64(), "kind": draft.kind_u32(), @@ -161,7 +161,7 @@ fn signed_event() -> RadrootsSignedEvent { }) .to_string(); RadrootsSignedEvent::new(RadrootsSignedEventParts { - id: draft.expected_event_id_str().to_owned(), + id: draft.expected_event_id_hex().to_owned(), pubkey: draft.expected_pubkey().to_hex().to_owned(), created_at: draft.created_at_u64(), kind: draft.kind_u32(), @@ -233,7 +233,7 @@ fn workflow_digest_and_event_helpers_cover_error_and_input_paths() { assert!(input.event_store_inserted); assert_eq!( durable_event_persistence( - draft.expected_event_id_str(), + &draft.expected_event_id_hex(), &RadrootsEventPersistence::Inserted { seq: 7 }, ) .expect("inserted persistence"), @@ -241,7 +241,7 @@ fn workflow_digest_and_event_helpers_cover_error_and_input_paths() { ); assert_eq!( durable_event_persistence( - draft.expected_event_id_str(), + &draft.expected_event_id_hex(), &RadrootsEventPersistence::Duplicate { seq: 7 }, ) .expect("duplicate persistence"), @@ -249,7 +249,7 @@ fn workflow_digest_and_event_helpers_cover_error_and_input_paths() { ); assert!(matches!( durable_event_persistence( - draft.expected_event_id_str(), + &draft.expected_event_id_hex(), &RadrootsEventPersistence::NotPersisted, ), Err(RadrootsSdkError::InvalidRequest { message }) @@ -258,7 +258,7 @@ fn workflow_digest_and_event_helpers_cover_error_and_input_paths() { let frozen = frozen_draft_json(&draft).expect("frozen draft json"); assert!(frozen.contains("\"expected_event_id\"")); let receipt = SdkWorkflowEnqueueReceipt { - signed_event_id: RadrootsEventId::parse(draft.expected_event_id_str()).expect("event id"), + signed_event_id: RadrootsEventId::parse(draft.expected_event_id_hex()).expect("event id"), local_event_seq: 1, outbox_operation_id: 2, outbox_event_id: 3, @@ -670,8 +670,8 @@ async fn enqueue_signed_workflow_stores_signed_event_and_reports_idempotency_con .expect("enqueue signed workflow"); assert_eq!( - receipt.signed_event_id.as_str(), - first_draft.expected_event_id_str() + receipt.signed_event_id.to_hex(), + first_draft.expected_event_id_hex() ); assert!(receipt.local_event_seq > 0); assert!(receipt.outbox_operation_id > 0); @@ -772,8 +772,8 @@ async fn enqueue_configured_signed_workflow_uses_sdk_signer_provider() { .expect("configured enqueue"); assert_eq!( - receipt.signed_event_id.as_str(), - draft.expected_event_id_str() + receipt.signed_event_id.to_hex(), + draft.expected_event_id_hex() ); assert_eq!(receipt.idempotency_digest_prefix.len(), 12); }