Make unanimous governance finalization retryable
This commit is contained in:
parent
fc5cce0a21
commit
06ed2c5ac2
3 changed files with 45 additions and 17 deletions
|
|
@ -532,13 +532,13 @@ fn execute(
|
|||
"time proposal is committed, stale, or belongs to another campaign".into(),
|
||||
));
|
||||
}
|
||||
if !proposal.approvals.insert(member_id) {
|
||||
return Err(KernelError::Invalid(
|
||||
"member already approved this time proposal".into(),
|
||||
));
|
||||
}
|
||||
let newly_approved = proposal.approvals.insert(member_id);
|
||||
if active_member_ids(&membership) == proposal.approvals {
|
||||
commit_governed_time_advance(store, row, campaign, proposal_row, proposal)
|
||||
} else if !newly_approved {
|
||||
Err(KernelError::Invalid(
|
||||
"member already approved this time proposal".into(),
|
||||
))
|
||||
} else {
|
||||
store
|
||||
.replace(
|
||||
|
|
@ -659,11 +659,7 @@ fn execute(
|
|||
"group-travel proposal is committed, stale, or belongs elsewhere".into(),
|
||||
));
|
||||
}
|
||||
if !proposal.approvals.insert(member_id) {
|
||||
return Err(KernelError::Invalid(
|
||||
"member already approved this group-travel proposal".into(),
|
||||
));
|
||||
}
|
||||
let newly_approved = proposal.approvals.insert(member_id);
|
||||
if active_member_ids(&membership) == proposal.approvals {
|
||||
commit_governed_group_travel(
|
||||
store,
|
||||
|
|
@ -673,6 +669,10 @@ fn execute(
|
|||
proposal,
|
||||
&membership,
|
||||
)
|
||||
} else if !newly_approved {
|
||||
Err(KernelError::Invalid(
|
||||
"member already approved this group-travel proposal".into(),
|
||||
))
|
||||
} else {
|
||||
store
|
||||
.replace(
|
||||
|
|
@ -793,13 +793,13 @@ fn execute(
|
|||
"cell-budget proposal is committed, stale, or belongs elsewhere".into(),
|
||||
));
|
||||
}
|
||||
if !proposal.approvals.insert(member_id) {
|
||||
return Err(KernelError::Invalid(
|
||||
"member already approved this cell-budget proposal".into(),
|
||||
));
|
||||
}
|
||||
let newly_approved = proposal.approvals.insert(member_id);
|
||||
if active_member_ids(&membership) == proposal.approvals {
|
||||
commit_governed_cell_budget(store, row, campaign, proposal_row, proposal)
|
||||
} else if !newly_approved {
|
||||
Err(KernelError::Invalid(
|
||||
"member already approved this cell-budget proposal".into(),
|
||||
))
|
||||
} else {
|
||||
store
|
||||
.replace(
|
||||
|
|
@ -7224,7 +7224,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn group_travel_moves_every_member_once_after_unanimous_revision_bound_approval() {
|
||||
async fn group_travel_retries_uncommitted_unanimous_approval_and_moves_every_member_once() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let store = CampaignStore::open(dir.path().join("campaign.cc")).unwrap();
|
||||
let mut seed = campaign();
|
||||
|
|
@ -7297,11 +7297,23 @@ mod tests {
|
|||
assert_eq!(campaign.revision, 0);
|
||||
assert_eq!(campaign.actors["player"].location_id, "room");
|
||||
let proposal_id = proposal.id;
|
||||
let (proposal_row, mut persisted_proposal) = store
|
||||
.load::<GroupTravelProposal>("group_travel_proposal.v1", &proposal_id)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
persisted_proposal.approvals.insert("member:guest".into());
|
||||
store
|
||||
.replace(
|
||||
&proposal_row,
|
||||
"ghostlight.group_travel_proposal.v1",
|
||||
&persisted_proposal,
|
||||
)
|
||||
.unwrap();
|
||||
let committed = kernel
|
||||
.command(WorldCommand::ApproveGroupTravel {
|
||||
expected_revision: 0,
|
||||
proposal_id: proposal_id.clone(),
|
||||
member_id: "member:guest".into(),
|
||||
member_id: "member:host".into(),
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
|
|||
|
|
@ -284,6 +284,14 @@ batch and an explicit explanation. Speech is an event in the means record;
|
|||
persuasion, obligation, relationship, and knowledge consequences are separate
|
||||
mutations.
|
||||
|
||||
Governed time, travel, and resolution-budget proposals persist approvals before
|
||||
their unanimous finalization. A fully approved but uncommitted proposal is a
|
||||
retryable commit request: any already-approved active member may invoke its
|
||||
advertised approval operation again, and the kernel revalidates the exact world
|
||||
and governance boundary before attempting the same atomic finalization. A
|
||||
duplicate vote on a proposal that is not unanimous is still rejected, and a
|
||||
committed or stale proposal can never replay.
|
||||
|
||||
Complex effects are batches, not new verbs. Giving half a medicine lot to a
|
||||
clinic composes resource split, custody transfer, and perhaps an obligation.
|
||||
Evacuating a named refugee composes relocation, population-membership transfer,
|
||||
|
|
|
|||
|
|
@ -1026,6 +1026,14 @@ region expansion restores the original local key. Reusing `road`, `harbor`, or
|
|||
a destination-shaped key under another location cannot overwrite an unrelated
|
||||
edge or make a surface-advertised route fail transition admission.
|
||||
|
||||
Governance approval and governed finalization are distinct durable states.
|
||||
When unanimous time, travel, or Persona-cell approval exists but finalization
|
||||
did not commit, the advertised approval operation retries the exact revision-
|
||||
bound finalization even for a member whose approval is already present. This
|
||||
does not add another writer: the same WorldKernel validation and atomic commit
|
||||
path runs again. Duplicate non-unanimous votes, stale boundaries, and committed
|
||||
proposals still reject.
|
||||
|
||||
Initial compiler publication is a bounded creation transaction, not a fictional
|
||||
world transition. `CampaignRegistry` owns discoverability, installs the
|
||||
approved seed into a fresh staging store with one empty-store CAS, and exposes
|
||||
|
|
|
|||
Loading…
Reference in a new issue