lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README | LICENSE

commit f7a231eebdecf3632d3f6f5ef9201ac100d11b14
parent 2240860ecf15becfb30321761ec59d6b34bd1aa9
Author: triesap <tyson@radroots.org>
Date:   Thu, 18 Jun 2026 23:22:21 -0700

events: fix order revision contract roles

- align revision proposal authorization with seller-authored reducer semantics
- align revision decision authorization with buyer-authored reducer semantics
- extend authority role coverage for revision lifecycle contracts
- preserve existing order contract ids and event kind mappings

Diffstat:
Mcrates/authority/src/authorization.rs | 22++++++++++++++++++++++
Mcrates/events/src/contract.rs | 4++--
2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/crates/authority/src/authorization.rs b/crates/authority/src/authorization.rs @@ -283,6 +283,10 @@ mod tests { fn buyer_and_seller_contract_roles_match_current_contracts() { let listing = event_contract("radroots.listing.published.v1").expect("listing contract"); let order_request = event_contract("radroots.order.request.v1").expect("order contract"); + let order_revision_proposal = + event_contract("radroots.order.revision_proposal.v1").expect("revision proposal"); + let order_revision_decision = + event_contract("radroots.order.revision_decision.v1").expect("revision decision"); let seller = seller_actor(hex_64('a').as_str()); let buyer = buyer_actor(hex_64('b').as_str()); @@ -297,6 +301,24 @@ mod tests { authorize_actor_for_contract(&seller, order_request), Err(RadrootsAuthorityError::ActorRoleUnsatisfied { .. }) )); + assert_eq!( + order_revision_proposal.author_role, + RadrootsActorRole::Seller + ); + assert!(authorize_actor_for_contract(&seller, order_revision_proposal).is_ok()); + assert!(matches!( + authorize_actor_for_contract(&buyer, order_revision_proposal), + Err(RadrootsAuthorityError::ActorRoleUnsatisfied { .. }) + )); + assert_eq!( + order_revision_decision.author_role, + RadrootsActorRole::Buyer + ); + assert!(authorize_actor_for_contract(&buyer, order_revision_decision).is_ok()); + assert!(matches!( + authorize_actor_for_contract(&seller, order_revision_decision), + Err(RadrootsAuthorityError::ActorRoleUnsatisfied { .. }) + )); } #[test] diff --git a/crates/events/src/contract.rs b/crates/events/src/contract.rs @@ -2378,7 +2378,7 @@ static ALL_EVENT_CONTRACTS: &[RadrootsEventContract] = &[ "RadrootsOrderRevisionProposal", RadrootsEventClass::Regular, RadrootsEventPrivacy::Public, - RadrootsActorRole::Buyer, + RadrootsActorRole::Seller, RadrootsContentSchema::JsonObject, RadrootsEventDiscriminator::KindOnly, CHAINED_ORDER_TAGS, @@ -2391,7 +2391,7 @@ static ALL_EVENT_CONTRACTS: &[RadrootsEventContract] = &[ "RadrootsOrderRevisionDecision", RadrootsEventClass::Regular, RadrootsEventPrivacy::Public, - RadrootsActorRole::Seller, + RadrootsActorRole::Buyer, RadrootsContentSchema::JsonObject, RadrootsEventDiscriminator::KindOnly, CHAINED_ORDER_TAGS,