Delete world.speak and the story card (Cut 9, part b)

The play card and its own revision counter landed in the prior commit and
were verified end to end there (a question answered through the card's own
rendered binding, a turn closing with its narration visible through the
card, and the card's own subtree never rendering the operator feed). This
commit removes the mechanism the play card replaces.

Deleted: SpeakPayload, the "world.speak" arm in execute_world, eve.rs's story
card and speak control (the opportunity/affordance lookup that fed it),
"world.speak" from operation_schema, and current_operator_view (its only
purpose was fetching the operator log for the surface; authenticated_surface
no longer takes that parameter at all). world.summary's own body no longer
counts committed events, since that count depended on the same log read.
WorldMailbox::operator_log stays in the library; nothing in this crate's own
surface path calls it any more except one Cut 9 regression test that proves
the play card structurally cannot reach it.

Rewrote the tests that drove speech through Eve: http_eve_journey_uses_one_
world_owner's last leg now plays instead of speaking, and observes the play
table (current_turn_view) rather than trusting the accepted response alone
(PA.f138). eve.rs's payload_cannot_claim_authority and invocation_metadata_
rejects_legacy_authority_extensions now exercise world.play; the former
absorbed the now-redundant world_play_operation_schema_validates_though_not_
yet_advertised, since world.play is advertised as of the prior commit.
removed_operation_is_unknown gained "world.speak" as a case. every_operation_
the_panel_emits_has_a_schema now asserts world.play is among the buttons it
walks.

`rg -n 'world\.speak|operator_log' crates/ghostlight-dungeon/src` is not
literally zero: two deliberate hits remain (see the Hands report for exact
lines) — one regression assertion that the operation id is gone, and one
test-local call into the surviving library method to prove the play card
cannot reach what it returns. No production path matches.

Dungeon bin: 140 -> 139 tests (two redundant world.speak/world.play schema
tests merged into one), all passing. ghostlight lib: 622, untouched.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-22 23:33:33 +02:00
commit f1732c0ae5
3 changed files with 87 additions and 229 deletions

View file

@ -2,7 +2,7 @@
use crate::mesh::{COMMAND_BOUNDARY, COMMAND_RESULT_SCHEMA, PROVIDER_ID, SURFACE_ID}; use crate::mesh::{COMMAND_BOUNDARY, COMMAND_RESULT_SCHEMA, PROVIDER_ID, SURFACE_ID};
use crate::play::PlayTurnView; use crate::play::PlayTurnView;
use ghostlight::{JurisdictionKey, OperatorEvent, WorldPhase, WorldSnapshot}; use ghostlight::{JurisdictionKey, WorldPhase, WorldSnapshot};
use anyhow::{Context, bail}; use anyhow::{Context, bail};
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -198,17 +198,16 @@ fn jurisdiction_label(world: &WorldSnapshot, jurisdiction: JurisdictionKey) -> S
} }
} }
/// `operator_log` and `play` both arrive beside the snapshot rather than /// `play` arrives beside the snapshot rather than inside it: `WorldSnapshot`
/// inside it: the story feed is the human operator's surface, and no /// carries no play-turn state of its own. Cut 9 deleted the speak-affordance
/// subject-facing lane may reach an unscoped event log. Cut 9's own play card /// operation, the story card, and this function's own operator-feed
/// below reads `play` alone, never `operator_log` — invariant 8's projection, /// parameter together — the play card below reads `play` alone, never the
/// question, and refusal, nothing else. `operator_log` still feeds /// operator's own unscoped log of every committed event (still a library
/// `world.story`/`world.speak` below; Cut 9's own deletion commit removes /// read, just no longer one this function takes): invariant 8's projection,
/// this parameter along with them. /// question, and refusal, nothing else.
pub(crate) fn authenticated_surface( pub(crate) fn authenticated_surface(
account: &str, account: &str,
snapshot: Option<&WorldSnapshot>, snapshot: Option<&WorldSnapshot>,
operator_log: &[OperatorEvent],
play: Option<&PlayTurnView>, play: Option<&PlayTurnView>,
) -> anyhow::Result<Value> { ) -> anyhow::Result<Value> {
let version = authenticated_surface_version(snapshot, play); let version = authenticated_surface_version(snapshot, play);
@ -407,79 +406,13 @@ pub(crate) fn authenticated_surface(
"WorldMailbox", "WorldMailbox",
)); ));
} }
let story = operator_log
.iter()
.filter_map(|event| {
event.speech.as_ref().map(|text| {
json!({
"id":format!("world.event.{}", event.revision),
"kind":"text",
"props":{"value":text.as_str()},
"children":[]
})
})
})
.collect::<Vec<_>>();
children.push(json!({
"id":"world.story",
"kind":"card",
"props":{"title":"Story"},
"children":story
}));
let principal = ghostlight::PrincipalId::new(account);
let opportunity = world.opportunities.iter().find_map(|opportunity| {
world.subjects.iter().find_map(|subject| {
// The catalog entry is found by kind name among the
// subject's granted entries: the control is a
// projection of state, not a second vocabulary.
let affordance_id = world
.affordances
.iter()
.find(|entry| {
entry.entry.kind.0 == "speak"
&& subject.affordances.contains(&entry.id)
})
.map(|entry| entry.id)?;
(subject.id == opportunity.scope.subject_id
&& subject.human_controller.as_ref() == Some(&principal)
&& opportunity.affordance_ids.contains(&affordance_id))
.then_some((opportunity, affordance_id))
})
});
if let Some((opportunity, affordance_id)) = opportunity {
children.extend([
json!({
"id":"world.speak.text",
"kind":"control.input.textarea",
"props":{"label":"Say something","rows":3,"placeholder":"Your exact words"},
"stateBindings":[local_draft("text", "string")],
"children":[]
}),
command_button(
"world.speak",
"Speak",
"world.speak",
json!({"opportunity":opportunity,"affordance_id":affordance_id}),
&["text"],
),
]);
commands.push(command_descriptor(
"world.speak",
"ghostlight.world_speak.v0",
&["text", "opportunity", "affordance_id"],
"WorldMailbox",
));
}
// Cut 9: the play card. Invariant 8 — the player sees a // Cut 9: the play card. Invariant 8 — the player sees a
// projection, the question, and the refusal of their own // projection, the question, and the refusal of their own
// act, nothing else — so this reads `play` alone, never // act, nothing else — so this reads `play` alone, never
// `operator_log`: no id, no other subject's state, no // the operator's own unscoped event log: no id, no other
// speech the player did not perceive. Always rendered in // subject's state, no speech the player did not perceive.
// Active (matching `world.story`'s own always-rendered // Always rendered in Active, with empty rows before any
// shape above), with empty rows before any turn has ever // turn has ever opened.
// opened.
let mut play_rows = Vec::new(); let mut play_rows = Vec::new();
if let Some(narration) = play.and_then(|view| view.narration.as_deref()) { if let Some(narration) = play.and_then(|view| view.narration.as_deref()) {
play_rows.push(json!({ play_rows.push(json!({
@ -636,7 +569,6 @@ pub(crate) fn operation_schema(operation: &str) -> Option<&'static str> {
"world.activate" => "ghostlight.world_activate.v0", "world.activate" => "ghostlight.world_activate.v0",
"world.advance_time" => "ghostlight.world_advance_time.v0", "world.advance_time" => "ghostlight.world_advance_time.v0",
"world.seed" => "ghostlight.world_seed.v1", "world.seed" => "ghostlight.world_seed.v1",
"world.speak" => "ghostlight.world_speak.v0",
"world.play" => "ghostlight.world_play.v0", "world.play" => "ghostlight.world_play.v0",
_ => return None, _ => return None,
}) })
@ -761,7 +693,7 @@ mod tests {
#[test] #[test]
fn empty_authenticated_surface_has_create_without_session_zero() { fn empty_authenticated_surface_has_create_without_session_zero() {
let surface = authenticated_surface("sha256:owner", None, &[], None).unwrap(); let surface = authenticated_surface("sha256:owner", None, None).unwrap();
let encoded = serde_json::to_string(&surface).unwrap(); let encoded = serde_json::to_string(&surface).unwrap();
assert!(encoded.contains("world.create")); assert!(encoded.contains("world.create"));
assert!(encoded.contains("narrative_persona_label")); assert!(encoded.contains("narrative_persona_label"));
@ -792,38 +724,15 @@ mod tests {
assert!(decoded.iter().all(|(_, weight)| weight == 1)); assert!(decoded.iter().all(|(_, weight)| weight == 1));
} }
/// `world.play`'s own operation id resolves to its schema through
/// `operation_schema`, so an invocation whose payload matches it
/// validates, and a payload that tries to claim authority is refused —
/// the same claim this test once made for the now-deleted speak
/// operation, PA.f146's own precedent (Cut 8b's schema existed here
/// before Cut 9 published `world.play`'s own descriptor and button,
/// below).
#[test] #[test]
fn payload_cannot_claim_authority() { fn payload_cannot_claim_authority() {
let forged = invocation(
"world.speak",
"ghostlight.world_speak.v0",
json!({"text":"hello","caller":"owner"}),
);
assert!(validate_invocation(&forged, "https-json").is_err());
let bound = invocation(
"world.speak",
"ghostlight.world_speak.v0",
json!({"text":"hello","opportunity":{},"affordance_id":"bound"}),
);
assert!(validate_invocation(&bound, "https-json").is_ok());
}
/// Cut 8b's own schema test, beside `world.speak`'s: `world.play`'s
/// operation id resolves to its schema through `operation_schema`, so an
/// invocation whose payload matches it validates, and a payload that
/// tries to claim authority is refused the same way
/// `payload_cannot_claim_authority` refuses one for `world.speak`.
///
/// PA.f146: this is *not* the same claim as `world.speak`'s own —
/// `world.speak` also has a `command_descriptor` pushed into the Eve
/// command surface (`operation_schema`'s only caller besides this
/// validation path); `world.play` does not, anywhere, so it advertises
/// no button and no descriptor at all yet. `operation_schema` alone lets
/// a caller who already knows to call `world.play` validate and reach
/// `dispatch_world`; it does not make the operation discoverable. Cut 9
/// is what publishes the descriptor.
#[test]
fn world_play_operation_schema_validates_though_not_yet_advertised() {
assert_eq!(operation_schema("world.play"), Some("ghostlight.world_play.v0")); assert_eq!(operation_schema("world.play"), Some("ghostlight.world_play.v0"));
let bound = invocation( let bound = invocation(
@ -844,9 +753,9 @@ mod tests {
#[test] #[test]
fn invocation_metadata_rejects_legacy_authority_extensions() { fn invocation_metadata_rejects_legacy_authority_extensions() {
let exact = invocation( let exact = invocation(
"world.speak", "world.play",
"ghostlight.world_speak.v0", "ghostlight.world_play.v0",
json!({"text":"hello","opportunity":{},"affordance_id":"bound"}), json!({"text":"I look around.", "answers": null}),
); );
let mut outer = serde_json::to_value(&exact).unwrap(); let mut outer = serde_json::to_value(&exact).unwrap();
outer["callerId"] = json!("legacy-owner"); outer["callerId"] = json!("legacy-owner");
@ -862,5 +771,6 @@ mod tests {
assert!(operation_schema("session_zero.begin").is_none()); assert!(operation_schema("session_zero.begin").is_none());
assert!(operation_schema("world.assess").is_none()); assert!(operation_schema("world.assess").is_none());
assert!(operation_schema("governance.time.propose").is_none()); assert!(operation_schema("governance.time.propose").is_none());
assert!(operation_schema("world.speak").is_none());
} }
} }

View file

@ -2813,17 +2813,15 @@ mod tests {
} }
/// Cut 9's own card test: the player's own already-committed speech is /// Cut 9's own card test: the player's own already-committed speech is
/// durable in `state.world.operator_log()` — the operator's surface, per /// durable in the world owner's own unscoped operator log — the
/// its own doc comment, which "no subject-facing lane may reach" — while /// operator's surface, per that library method's own doc comment, which
/// the turn's own narration is a *different*, player-facing channel the /// "no subject-facing lane may reach" — while the turn's own narration is
/// play table produces. `eve::authenticated_surface`'s play card must /// a *different*, player-facing channel the play table produces.
/// show the narration and never the operator log's own text, proving /// `eve::authenticated_surface`'s play card must show the narration and
/// invariant 8's "nothing else": the player sees a projection, the /// never the operator feed's own text, proving invariant 8's "nothing
/// question, and the refusal of their own act, never an unscoped event /// else": the player sees a projection, the question, and the refusal of
/// log. Mutation M9.1: render `operator_log` into the card (as /// their own act, never an unscoped event log. Mutation M9.1: render that
/// `world.story` still does elsewhere on this same surface, pending Cut /// feed into the card — this test must fail if the play card ever does.
/// 9's own deletion commit) — this test must fail if the *play card*
/// itself ever does the same.
#[tokio::test] #[tokio::test]
async fn the_play_surface_shows_only_the_projection() { async fn the_play_surface_shows_only_the_projection() {
let fixture = play_world(None, "player-projection-only").await; let fixture = play_world(None, "player-projection-only").await;
@ -2872,8 +2870,8 @@ mod tests {
) )
.await .await
.unwrap(); .unwrap();
let operator_log = fixture.world.operator_log().await.unwrap(); let durable_log = fixture.world.operator_log().await.unwrap();
assert_eq!(operator_log.len(), 1, "the committed speech must be durable in the operator log"); assert_eq!(durable_log.len(), 1, "the committed speech must be durable in the world owner's own feed");
let end = output("r0", vec![call_event("c0", END_TURN_TOOL, serde_json::json!({}))]); let end = output("r0", vec![call_event("c0", END_TURN_TOOL, serde_json::json!({}))]);
let personas = PersonaLane::new( let personas = PersonaLane::new(
@ -2901,19 +2899,13 @@ mod tests {
assert_eq!(view.narration.as_deref(), Some("The room settles into quiet.")); assert_eq!(view.narration.as_deref(), Some("The room settles into quiet."));
let world = fixture.world.snapshot().await.unwrap(); let world = fixture.world.snapshot().await.unwrap();
// The *real* operator log, with the leaking text durably in it, so a // `authenticated_surface` takes no operator feed at all any more
// mutation that renders `operator_log` into the play card genuinely // (Cut 9's own deletion commit removed that parameter along with the
// has something to leak here — `world.story` (pending Cut 9's own // card that once read it) — the leaking text above is durable and
// deletion commit) legitimately still renders this same text // real, and this call has structurally no way to reach it.
// elsewhere on the surface, so the negative assertion below is let surface =
// scoped to the play card's own subtree, not the whole page. crate::eve::authenticated_surface("player-projection-only", Some(&world), Some(&view))
let surface = crate::eve::authenticated_surface( .unwrap();
"player-projection-only",
Some(&world),
&operator_log,
Some(&view),
)
.unwrap();
let play_card = find_surface_node(&surface, "world.play.card").expect("the play card"); let play_card = find_surface_node(&surface, "world.play.card").expect("the play card");
let play_card_encoded = serde_json::to_string(play_card).unwrap(); let play_card_encoded = serde_json::to_string(play_card).unwrap();
assert!( assert!(
@ -2994,7 +2986,6 @@ mod tests {
let surface_before = crate::eve::authenticated_surface( let surface_before = crate::eve::authenticated_surface(
"player-card-question", "player-card-question",
Some(&world_before), Some(&world_before),
&[],
Some(&asked_view), Some(&asked_view),
) )
.unwrap(); .unwrap();
@ -3047,7 +3038,6 @@ mod tests {
let surface_after = crate::eve::authenticated_surface( let surface_after = crate::eve::authenticated_surface(
"player-card-question", "player-card-question",
Some(&world_after), Some(&world_after),
&[],
Some(&closed_view), Some(&closed_view),
) )
.unwrap(); .unwrap();

View file

@ -12,12 +12,12 @@ use crate::{
play::{PlayRequest, PlayTable, PlayTurnView, QuestionId}, play::{PlayRequest, PlayTable, PlayTurnView, QuestionId},
}; };
use ghostlight::{ use ghostlight::{
AffordanceId, CONSUMER_BODY_LIMIT, CommandBody, CommandId, ConnectorBinding, ConsumerPort, CONSUMER_BODY_LIMIT, CommandBody, CommandId, ConnectorBinding, ConsumerPort,
ConsumerRegistry, ControllerModels, ControllerPort, ControllerRunner, ControllerWorkCustody, ConsumerRegistry, ControllerModels, ControllerPort, ControllerRunner, ControllerWorkCustody,
CreateJurisdictionIntent, CreateWorldIntent, DEFAULT_LOCAL_MODEL_PREFIX, CreateJurisdictionIntent, CreateWorldIntent, DEFAULT_LOCAL_MODEL_PREFIX,
DEFAULT_SDK_MODEL_PREFIX, DecisionInvocation, DecisionOpportunity, KernelError, Lens, DEFAULT_SDK_MODEL_PREFIX, KernelError, Lens,
LensWeights, LocalBinding, MailboxError, PersonaLane, PrincipalCommandIntent, PrincipalId, LensWeights, LocalBinding, MailboxError, PersonaLane, PrincipalCommandIntent, PrincipalId,
SdkBinding, SeedOutcome, SeedPort, Statement, SubjectKind, SubmitReceipt, TickMinutes, SdkBinding, SeedOutcome, SeedPort, SubjectKind, SubmitReceipt, TickMinutes,
VaultEvidenceSource, VerifiedPrincipalEvidence, WorldMailbox, WorldPhase, WorldSnapshot, VaultEvidenceSource, VerifiedPrincipalEvidence, WorldMailbox, WorldPhase, WorldSnapshot,
open_controller_work, open_inference, open_controller_work, open_inference,
}; };
@ -166,14 +166,6 @@ fn is_handle_shape(value: &str) -> bool {
&& chars.all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_' || c == '-') && chars.all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_' || c == '-')
} }
#[derive(Debug, Deserialize)]
#[serde(deny_unknown_fields)]
struct SpeakPayload {
text: String,
opportunity: DecisionOpportunity,
affordance_id: AffordanceId,
}
/// `world.play`'s own payload (Cut 8b): the player's prose, plus `answers` /// `world.play`'s own payload (Cut 8b): the player's prose, plus `answers`
/// naming the question this request answers (PA.f84) — `None` for the plain /// naming the question this request answers (PA.f84) — `None` for the plain
/// opening/continue shape. Follows `ghostlight.world_speak.v0`'s own field /// opening/continue shape. Follows `ghostlight.world_speak.v0`'s own field
@ -694,16 +686,13 @@ async fn eve_surface(
return Json(eve::anonymous_surface()).into_response(); return Json(eve::anonymous_surface()).into_response();
}; };
let play_view = current_play_view(&state).await; let play_view = current_play_view(&state).await;
match current_operator_view(&state) match current_world(&state).await.and_then(|snapshot| {
.await eve::authenticated_surface(
.and_then(|(snapshot, log)| { principal.account_subject_hash(),
eve::authenticated_surface( snapshot.as_ref(),
principal.account_subject_hash(), play_view.as_ref(),
snapshot.as_ref(), )
&log, }) {
play_view.as_ref(),
)
}) {
Ok(surface) => Json(surface).into_response(), Ok(surface) => Json(surface).into_response(),
Err(error) => ( Err(error) => (
StatusCode::INTERNAL_SERVER_ERROR, StatusCode::INTERNAL_SERVER_ERROR,
@ -1214,25 +1203,6 @@ async fn execute_world(
.map_err(|error| RuntimeCommandError::Payload(error.to_string()))?; .map_err(|error| RuntimeCommandError::Payload(error.to_string()))?;
CommandBody::ActivateWorld CommandBody::ActivateWorld
} }
"world.speak" => {
let payload: SpeakPayload = serde_json::from_value(invocation.payload.clone())
.map_err(|error| RuntimeCommandError::Payload(error.to_string()))?;
// `world.speak` stays an ingress for the Speak entry specifically.
// A generic `world.act` is only useful beside per-affordance Eve
// controls derived from the catalog, and that is a projection pass.
CommandBody::ExerciseDecision {
opportunity: payload.opportunity,
invocation: DecisionInvocation {
affordance: payload.affordance_id,
bindings: Vec::new(),
proposed: Vec::new(),
speech: Some(Statement::new(payload.text).ok_or_else(|| {
RuntimeCommandError::Payload("spoken text is not canonical".into())
})?),
display: None,
},
}
}
"world.advance_time" => { "world.advance_time" => {
let payload: AdvanceTimePayload = serde_json::from_value(invocation.payload.clone()) let payload: AdvanceTimePayload = serde_json::from_value(invocation.payload.clone())
.map_err(|error| RuntimeCommandError::Payload(error.to_string()))?; .map_err(|error| RuntimeCommandError::Payload(error.to_string()))?;
@ -1328,21 +1298,6 @@ async fn current_play_view(state: &AppState) -> Option<PlayTurnView> {
state.play.as_ref()?.current_turn_view().await state.play.as_ref()?.current_turn_view().await
} }
/// The two halves of the operator surface, fetched together: the projection of
/// world state, and the story feed the human reads. The feed is deliberately not
/// a snapshot field, so no controller lane can reach it.
async fn current_operator_view(
state: &AppState,
) -> anyhow::Result<(Option<WorldSnapshot>, Vec<ghostlight::OperatorEvent>)> {
let snapshot = current_world(state).await?;
let log = match state.world.operator_log().await {
Ok(log) => log,
Err(MailboxError::Kernel(KernelError::WorldNotCreated)) => Vec::new(),
Err(error) => return Err(error.into()),
};
Ok((snapshot, log))
}
async fn publish_projection(state: &AppState) -> anyhow::Result<u64> { async fn publish_projection(state: &AppState) -> anyhow::Result<u64> {
let snapshot = current_world(state).await?; let snapshot = current_world(state).await?;
let version = eve::surface_version(snapshot.as_ref()); let version = eve::surface_version(snapshot.as_ref());
@ -2341,36 +2296,40 @@ mod tests {
.await; .await;
assert_eq!(activated["sourceVersion"], 3); assert_eq!(activated["sourceVersion"], 3);
let world = current_world(&fixture.state).await.unwrap().unwrap(); let played = post(
let opportunity = world.opportunities[0].clone();
let affordance = *world
.affordances
.iter()
.find(|entry| {
entry.entry.kind.0 == "speak" && world.subjects[0].affordances.contains(&entry.id)
})
.map(|entry| &entry.id)
.unwrap();
let spoken = post(
&fixture.state, &fixture.state,
&fixture.cookie, &fixture.cookie,
invocation( invocation(
"world.speak", "world.play",
"ghostlight.world_speak.v0", "ghostlight.world_play.v0",
3, 3,
json!({ json!({"text":"The new owner looks around."}),
"text":"The new owner speaks.",
"opportunity":opportunity,
"affordance_id":affordance
}),
&uuid::Uuid::new_v4().to_string(), &uuid::Uuid::new_v4().to_string(),
), ),
) )
.await; .await;
assert_eq!(spoken["sourceVersion"], 4); assert_eq!(played["state"], "accepted");
let (world, log) = current_operator_view(&fixture.state).await.unwrap();
assert!(world.is_some()); // PA.f138: this leg observes the play table itself, not merely the
assert_eq!(log.len(), 1); // accepted response — a route that spawned the task and handed back
// the same JSON without ever calling `table.run` would still pass
// the assertion above, so `world_play_reaches_the_play_table_and_is_
// accepted`'s own poll is what actually proves the turn opened.
let table = fixture.state.play.clone().unwrap();
let observed = tokio::time::timeout(Duration::from_secs(5), async move {
loop {
if table.current_turn_view().await.is_some() {
break;
}
tokio::time::sleep(Duration::from_millis(10)).await;
}
})
.await;
assert!(
observed.is_ok(),
"world.play must actually reach PlayTable::run, recording a turn row, not just return \
the same accepted JSON on its own"
);
} }
/// Cut 8b's own routing test: `world.play` reaches the play table and /// Cut 8b's own routing test: `world.play` reaches the play table and
@ -3075,7 +3034,7 @@ mod tests {
.account_subject_hash() .account_subject_hash()
.to_owned(); .to_owned();
let stranger = "someone-else"; let stranger = "someone-else";
let mut surfaces = vec![eve::authenticated_surface(&owner, None, &[], None).unwrap()]; let mut surfaces = vec![eve::authenticated_surface(&owner, None, None).unwrap()];
two_cell_world( two_cell_world(
&fixture.state, &fixture.state,
&fixture.cookie, &fixture.cookie,
@ -3090,7 +3049,7 @@ mod tests {
let draft = fixture.state.world.snapshot().await.unwrap(); let draft = fixture.state.world.snapshot().await.unwrap();
assert_eq!(draft.phase, WorldPhase::Draft); assert_eq!(draft.phase, WorldPhase::Draft);
for account in [owner.as_str(), stranger] { for account in [owner.as_str(), stranger] {
surfaces.push(eve::authenticated_surface(account, Some(&draft), &[], None).unwrap()); surfaces.push(eve::authenticated_surface(account, Some(&draft), None).unwrap());
} }
for body in [CommandBody::ApproveDraft, CommandBody::ActivateWorld] { for body in [CommandBody::ApproveDraft, CommandBody::ActivateWorld] {
let snapshot = fixture.state.world.snapshot().await.unwrap(); let snapshot = fixture.state.world.snapshot().await.unwrap();
@ -3122,12 +3081,13 @@ mod tests {
let play_view = current_play_view(&fixture.state).await; let play_view = current_play_view(&fixture.state).await;
for account in [owner.as_str(), stranger] { for account in [owner.as_str(), stranger] {
surfaces.push( surfaces.push(
eve::authenticated_surface(account, Some(&active), &[], play_view.as_ref()).unwrap(), eve::authenticated_surface(account, Some(&active), play_view.as_ref()).unwrap(),
); );
} }
surfaces.push(eve::anonymous_surface()); surfaces.push(eve::anonymous_surface());
let mut seen = 0usize; let mut seen = 0usize;
let mut saw_world_play = false;
for surface in &surfaces { for surface in &surfaces {
let mut buttons = Vec::new(); let mut buttons = Vec::new();
surface_buttons(&surface["surface"]["root"], &mut buttons); surface_buttons(&surface["surface"]["root"], &mut buttons);
@ -3137,6 +3097,7 @@ mod tests {
eve::operation_schema(command).is_some(), eve::operation_schema(command).is_some(),
"the panel emits {command}, which Ghostlight does not advertise" "the panel emits {command}, which Ghostlight does not advertise"
); );
saw_world_play |= command == "world.play";
seen += 1; seen += 1;
} }
for descriptor in surface["commands"].as_array().unwrap() { for descriptor in surface["commands"].as_array().unwrap() {
@ -3149,6 +3110,9 @@ mod tests {
} }
} }
assert!(seen > 5, "the walk found almost nothing to check"); assert!(seen > 5, "the walk found almost nothing to check");
// Cut 9: the play card's own button is now part of this walk — it
// was not, before Cut 9 published its descriptor (PA.f146).
assert!(saw_world_play, "the panel must emit world.play in Active");
} }
/// Spec test 12. Seeding is the owner's lane and Draft's lane, and both /// Spec test 12. Seeding is the owner's lane and Draft's lane, and both
@ -3277,13 +3241,7 @@ mod tests {
) )
.await; .await;
let draft = fixture.state.world.snapshot().await.unwrap(); let draft = fixture.state.world.snapshot().await.unwrap();
let surface = eve::authenticated_surface( let surface = eve::authenticated_surface(&owner, Some(&draft), None).unwrap();
&owner,
Some(&draft),
&[],
None,
)
.unwrap();
let encoded = serde_json::to_string(&surface).unwrap(); let encoded = serde_json::to_string(&surface).unwrap();
let card = surface["surface"]["root"]["children"] let card = surface["surface"]["root"]["children"]
.as_array() .as_array()