Keep optional openings out of compilation readiness
This commit is contained in:
parent
6ff6d3ff4c
commit
c52c7a96b1
5 changed files with 110 additions and 4 deletions
|
|
@ -1116,6 +1116,12 @@ impl SessionZeroRegistry {
|
|||
"session zero directory must contain its one matching state row"
|
||||
));
|
||||
}
|
||||
let (row, mut state) = store
|
||||
.load::<SessionZeroState>("session_zero.v1", &id.to_string())?
|
||||
.ok_or_else(|| anyhow!("session zero state vanished during load"))?;
|
||||
if demote_legacy_optional_opening_suggestions(&mut state) {
|
||||
store.replace(&row, "ghostlight.session_zero.v1", &state)?;
|
||||
}
|
||||
found.insert(
|
||||
id,
|
||||
SessionZeroRuntime {
|
||||
|
|
@ -2231,7 +2237,7 @@ pub fn session_zero_surface(
|
|||
serde_json::json!({"expected_revision":state.revision}),
|
||||
&["topic", "level"],
|
||||
),
|
||||
serde_json::json!({"id":"session-zero.decision.counter","kind":"control.input.textarea","props":{"label":"Counterproposal","rows":3,"placeholder":"State the replacement you want the table or DM to consider."},"stateBindings":[local_draft_binding("counter", "string")],"children":[]}),
|
||||
serde_json::json!({"id":"session-zero.decision.counter","kind":"control.input.textarea","props":{"label":"Counterproposal","rows":3,"maxLength":2000,"placeholder":"State the replacement you want the table or DM to consider (up to 2,000 characters)."},"stateBindings":[local_draft_binding("counter", "string")],"children":[]}),
|
||||
];
|
||||
for boundary in &private_boundaries {
|
||||
children.push(serde_json::json!({
|
||||
|
|
@ -3258,6 +3264,24 @@ fn decision_has_typed_payload(decision: &SessionZeroDecision) -> bool {
|
|||
.is_some_and(|patch| patch != &CharacterDraftPatch::default())
|
||||
}
|
||||
|
||||
fn demote_legacy_optional_opening_suggestions(state: &mut SessionZeroState) -> bool {
|
||||
let mut changed = false;
|
||||
for decision in state.decisions.values_mut() {
|
||||
let generated_opening = decision.id.starts_with("opening:")
|
||||
&& decision.owner_member_id.is_none()
|
||||
&& decision.proposed_contract_patch.is_some()
|
||||
&& decision.prompt.starts_with("Use '")
|
||||
&& decision
|
||||
.prompt
|
||||
.ends_with("' as the starting frame for further Session Zero discussion?");
|
||||
if generated_opening && decision.material {
|
||||
decision.material = false;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
changed
|
||||
}
|
||||
|
||||
fn validate_counter_replacement(
|
||||
countered: &SessionZeroDecision,
|
||||
member_id: Option<&str>,
|
||||
|
|
@ -4227,6 +4251,78 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn legacy_generated_openings_are_demoted_without_advancing_session_state() {
|
||||
let mut draft = state();
|
||||
let revision = draft.revision;
|
||||
let shared_epoch = draft.shared_epoch;
|
||||
draft.decisions.insert(
|
||||
"opening:legacy".into(),
|
||||
SessionZeroDecision {
|
||||
schema: "ghostlight.session_zero_decision.v1".into(),
|
||||
id: "opening:legacy".into(),
|
||||
owner_member_id: None,
|
||||
prompt: "Use 'A Legacy Opening' as the starting frame for further Session Zero discussion?".into(),
|
||||
proposed_resolution: "An optional generated opening.".into(),
|
||||
proposed_extraordinary_permission: None,
|
||||
proposed_contract_patch: Some(CampaignContractPatch {
|
||||
starting_where: Some("Somewhere the player did not choose".into()),
|
||||
..Default::default()
|
||||
}),
|
||||
proposed_character_patch: None,
|
||||
evidence_receipt_ids: vec![],
|
||||
pending_counter: None,
|
||||
material: true,
|
||||
resolved: false,
|
||||
},
|
||||
);
|
||||
|
||||
assert!(demote_legacy_optional_opening_suggestions(&mut draft));
|
||||
assert!(!draft.decisions["opening:legacy"].material);
|
||||
assert_eq!(draft.revision, revision);
|
||||
assert_eq!(draft.shared_epoch, shared_epoch);
|
||||
assert!(!demote_legacy_optional_opening_suggestions(&mut draft));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn registry_load_persists_the_legacy_opening_demotion() {
|
||||
let root = tempdir().unwrap();
|
||||
let mut draft = state();
|
||||
let id = draft.id;
|
||||
let revision = draft.revision;
|
||||
draft.decisions.insert(
|
||||
"opening:persisted-legacy".into(),
|
||||
SessionZeroDecision {
|
||||
schema: "ghostlight.session_zero_decision.v1".into(),
|
||||
id: "opening:persisted-legacy".into(),
|
||||
owner_member_id: None,
|
||||
prompt: "Use 'Persisted Legacy' as the starting frame for further Session Zero discussion?".into(),
|
||||
proposed_resolution: "An old optional suggestion.".into(),
|
||||
proposed_extraordinary_permission: None,
|
||||
proposed_contract_patch: Some(CampaignContractPatch {
|
||||
premise: Some("An opening the player may ignore".into()),
|
||||
..Default::default()
|
||||
}),
|
||||
proposed_character_patch: None,
|
||||
evidence_receipt_ids: vec![],
|
||||
pending_counter: None,
|
||||
material: true,
|
||||
resolved: false,
|
||||
},
|
||||
);
|
||||
let directory = root.path().join(id.to_string());
|
||||
fs::create_dir(&directory).unwrap();
|
||||
let store = CampaignStore::open(directory.join("session-zero.cc")).unwrap();
|
||||
SessionZeroKernel::initialize(&store, &draft).unwrap();
|
||||
drop(store);
|
||||
|
||||
let registry = SessionZeroRegistry::new(root.path()).unwrap();
|
||||
registry.load_existing().await.unwrap();
|
||||
let loaded = registry.snapshot(id).await.unwrap();
|
||||
assert!(!loaded.decisions["opening:persisted-legacy"].material);
|
||||
assert_eq!(loaded.revision, revision);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn actor_filtered_surface_never_projects_other_private_state_or_account_hashes() {
|
||||
let dir = tempdir().unwrap();
|
||||
|
|
|
|||
|
|
@ -79,7 +79,10 @@ receipts unchanged.
|
|||
|
||||
Generated opening and role suggestions are non-material decisions: the player
|
||||
may accept, counter, discuss, or ignore them without blocking a fully custom
|
||||
draft. Material decisions preserve the distinction between discussion and consent.
|
||||
draft. On daemon load, the registry demotes pre-cut generated opening records
|
||||
whose old `material` flag would otherwise veto a custom draft; this migration
|
||||
uses an exact CultCache replacement and does not advance the Session Zero
|
||||
revision or shared epoch. Material decisions preserve the distinction between discussion and consent.
|
||||
Every acceptable decision carries at least one non-empty typed contract,
|
||||
character, or extraordinary-permission payload. A question or a prose promise
|
||||
without an exact state change remains DM speech or a suggested reply; it cannot
|
||||
|
|
|
|||
|
|
@ -58,7 +58,10 @@ semantics. Accepted receipts may clear named drafts; rejection and stale
|
|||
conflict preserve them. An omitted clear-binding list means clear the surface's
|
||||
drafts; an explicit empty list means clear nothing. Operations that capture no
|
||||
editable bindings therefore cannot erase an unrelated composer, channel
|
||||
selection, boundary draft, or counterproposal.
|
||||
selection, boundary draft, or counterproposal. Provider-authored length limits
|
||||
lower onto editable controls before submission; Ghostlight still validates the
|
||||
same bound at ingress. Denied command receipts use an accessible alert region
|
||||
and survive authoritative surface refreshes alongside the preserved draft.
|
||||
|
||||
## Authentication membrane
|
||||
|
||||
|
|
|
|||
|
|
@ -575,6 +575,10 @@ assumptions, public party cards, and only the current viewer's private ledger.
|
|||
Generated openings are optional shared typed decisions; accepting one amends
|
||||
the draft for discussion and triggers three optional grounded role decisions in
|
||||
each private DM channel. Ignoring them cannot block a custom start or character.
|
||||
At registry load, exact legacy `opening:*` suggestion records from the pre-cut
|
||||
runtime are demoted from material to optional with a CultCache compare-and-swap;
|
||||
fictional revision and shared epoch do not move. The persisted typed draft,
|
||||
not stale suggestion materiality, owns compilation readiness.
|
||||
Custom starts and characters use the same draft. The browser returns
|
||||
only decision commands and cannot echo a rewritten candidate into compilation.
|
||||
Candidate IDs, text, list sizes, and evidence references receive local
|
||||
|
|
|
|||
2
vendor/eve
vendored
2
vendor/eve
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit af05248af58368753840d9628b361cdb6bc289f9
|
||||
Subproject commit 3a5e2057e088448b56bd614239942c73961dd4af
|
||||
Loading…
Reference in a new issue