From f013c1d22f8af09b2514ca5fb0256f163c490ec4 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 5 Sep 2026 02:30:30 +0200 Subject: [PATCH] Trim the cover's unread surfaces and report the tick Cut the accessors, fields, and re-exports the pass added without a live consumer: `Cell::id`, `Cell::tick`, `Cell::resolution`, the grouped capture's receipt vector, and the `CoverBudgetError` re-export. The resolution a row records is derived from the row's own shape, and the capture's receipts were a second copy of what its outputs already carry. In exchange the tick driver now reads what it runs. One debug line per coarse cell names the cell, its resolution, how many turns it offered, how many committed, and how many gaps it produced. The gap between offered and committed is the number that says a batch buys one inference and never one admission rule. Co-Authored-By: Claude Opus 5 --- crates/ghostlight-dungeon/src/runtime.rs | 51 ++++++++++++++--- .../src/world/controllers.rs | 55 ++++++++++++++++--- crates/ghostlight-dungeon/src/world/cover.rs | 21 ------- crates/ghostlight-dungeon/src/world/mod.rs | 3 +- 4 files changed, 89 insertions(+), 41 deletions(-) diff --git a/crates/ghostlight-dungeon/src/runtime.rs b/crates/ghostlight-dungeon/src/runtime.rs index 4972f25..aa0d45e 100644 --- a/crates/ghostlight-dungeon/src/runtime.rs +++ b/crates/ghostlight-dungeon/src/runtime.rs @@ -1680,13 +1680,46 @@ async fn run_cover_tick(state: &AppState) { return; }; match runner.run_cell(&cell).await { - Ok(run) => { - if let CellRun::Grouped(grouped) = &run - && let Some(reason) = grouped.pending - { - tracing::debug!(?reason, "a coarse cell did not finish its submissions"); - } + // A tick that reports nothing is a tick nobody can debug. One + // line per coarse cell, naming what it consumed and what it + // could not: a batch buys one inference, never one admission + // rule, and the gap between turns offered and turns committed + // is the number that says so. + Ok(CellRun::Grouped(grouped)) => { + let committed = grouped + .submissions + .iter() + .filter(|entry| { + matches!( + entry.submission, + SubmissionDisposition::Completed(_) + | SubmissionDisposition::PreviouslyConfirmed(_) + ) + }) + .count(); + tracing::debug!( + cell = %grouped.cell, + resolution = ?grouped.resolution, + submitted = grouped.submissions.len(), + committed, + needs = grouped.needs.len(), + pending = ?grouped.pending, + "a coarse cell finished" + ); } + Ok(CellRun::Narrative(NarrativeRun::Pending(pending))) => { + tracing::debug!( + reason = ?pending.reason(), + "a detail narrative cell is pending" + ); + } + Ok(CellRun::Operational(OperationalRun::Pending(pending))) => { + tracing::debug!( + reason = ?pending.reason(), + "a detail operational cell is pending" + ); + } + Ok(CellRun::Narrative(_) | CellRun::Operational(_)) => {} Err(error) => { // A cell that faults does not abort the tick. Custody loss // does: the work journal is one lock and one custody claim, @@ -2596,10 +2629,10 @@ mod tests { /// captured argument is the `TickMinutes` `submit_clock_tick` was given, /// with no measured elapsed duration — no `Duration`, no `Instant` — ever /// constructed along the way. Driven through the narrow port rather than - /// `advance_world_clock` itself, so the assertion holds without waiting on - /// tokio's timer. + /// `drive_cover_tick` itself, so the assertion holds without waiting on + /// tokio's timer or on a cognition organ. #[tokio::test] - async fn advance_world_clock_tick_submits_the_configured_span_and_nothing_measured() { + async fn a_clock_tick_submits_the_configured_span_and_nothing_measured() { let minutes = TickMinutes::new(CLOCK_TICK_MINUTES).expect("a valid configured tick"); let captured: std::sync::Arc>> = std::sync::Arc::new(std::sync::Mutex::new(None)); diff --git a/crates/ghostlight-dungeon/src/world/controllers.rs b/crates/ghostlight-dungeon/src/world/controllers.rs index 8fdf30f..ff91af6 100644 --- a/crates/ghostlight-dungeon/src/world/controllers.rs +++ b/crates/ghostlight-dungeon/src/world/controllers.rs @@ -3988,7 +3988,6 @@ struct GroupedCapture { /// Handle to proposal. A handle absent here proposed nothing and declines. proposals: BTreeMap, needs: Vec, - inference_receipts: Vec, } enum GroupedLoopEvaluation { @@ -4007,7 +4006,6 @@ fn evaluate_grouped_loop( let mut proposals: BTreeMap = BTreeMap::new(); let mut terminal: BTreeSet = BTreeSet::new(); let mut needs = Vec::new(); - let mut receipts = Vec::new(); for (round, output) in completed.iter().enumerate() { if output.receipt_digest.is_empty() || output.receipt_digest.trim() != output.receipt_digest @@ -4017,7 +4015,6 @@ fn evaluate_grouped_loop( detail: "provider output has no canonical receipt digest".into(), }); } - receipts.push(output.receipt_digest.clone()); let mut called_tool = false; for event in &output.events { match event { @@ -4157,11 +4154,7 @@ fn evaluate_grouped_loop( }); } return Ok(GroupedLoopEvaluation::Complete { - capture: GroupedCapture { - proposals, - needs, - inference_receipts: receipts, - }, + capture: GroupedCapture { proposals, needs }, }); } } @@ -7322,7 +7315,6 @@ mod tests { .await; let cell = one_group(&mailbox).await; assert_eq!(cell.members().len(), 3); - assert_eq!(cell.resolution(), Resolution::Coarse { constituents: 3 }); let (runner, _store) = grouped_runner( &mailbox, @@ -7344,6 +7336,7 @@ mod tests { panic!("a coarse cell did not run the grouped lane") }; assert!(run.pending.is_none()); + assert_eq!(run.resolution, Resolution::Coarse { constituents: 3 }); assert_eq!(run.submissions.len(), 3, "every constituent finished"); let first = cell.members()[0].subject; assert!(matches!( @@ -7640,6 +7633,50 @@ mod tests { task.await.unwrap(); } + /// Adjacency is a scheduler projection, not a subject view. Two subjects in + /// one room are related through the kernel's own containment closure, which + /// no union of `SubjectSnapshot`s could produce for a channel, and the + /// result reaches `derive_cover` and nothing else: `run_cell` takes a + /// `&Cell`, which holds no graph, so a controller organ that read adjacency + /// would fail to compile. + #[tokio::test] + async fn soul_the_agency_graph_relates_co_located_subjects_and_reaches_no_prompt() { + let (_directory, mailbox, task) = active_cell_mailbox(vec![ + NewController::OperationalAgent, + NewController::OperationalAgent, + NewController::NarrativePersona, + ]) + .await; + let graph = mailbox.agency_graph().await.unwrap(); + assert_eq!(graph.subjects.len(), 3); + assert_eq!( + graph.edges.len(), + 3, + "three subjects in one room are a clique" + ); + for (one, other) in &graph.edges { + assert!(one < other, "an edge is not canonicalised"); + } + // Nothing about adjacency reaches a subject-facing surface: the typed + // view a constituent is shown carries its own state and no neighbour's. + let snapshot = mailbox.snapshot().await.unwrap(); + let selected = select_one(&snapshot, &snapshot.opportunities[0]).unwrap(); + let view = selected.typed_view().unwrap(); + for other in snapshot + .subjects + .iter() + .filter(|subject| subject.id != selected.subject.id) + { + assert!( + !view.contains(&other.label), + "a typed view named a neighbour" + ); + } + + drop(mailbox); + task.await.unwrap(); + } + /// A cell is not a transaction, and one inference does not buy N commits. /// /// Two co-located constituents both propose. The first commits; the second diff --git a/crates/ghostlight-dungeon/src/world/cover.rs b/crates/ghostlight-dungeon/src/world/cover.rs index 453b9f7..8b3d2bb 100644 --- a/crates/ghostlight-dungeon/src/world/cover.rs +++ b/crates/ghostlight-dungeon/src/world/cover.rs @@ -137,33 +137,12 @@ pub(crate) enum Cell { } impl Cell { - pub(crate) fn id(&self) -> CellId { - match self { - Self::Singleton { id, .. } | Self::Group { id, .. } => *id, - } - } - - pub(crate) fn tick(&self) -> TickIndex { - match self { - Self::Singleton { tick, .. } | Self::Group { tick, .. } => *tick, - } - } - pub(crate) fn members(&self) -> &[Constituent] { match self { Self::Singleton { member, .. } => std::slice::from_ref(member), Self::Group { members, .. } => members, } } - - pub(crate) fn resolution(&self) -> Resolution { - match self { - Self::Singleton { .. } => Resolution::Detail, - Self::Group { members, .. } => Resolution::Coarse { - constituents: members.len(), - }, - } - } } /// Derived, disposable, dropped at the end of a tick. diff --git a/crates/ghostlight-dungeon/src/world/mod.rs b/crates/ghostlight-dungeon/src/world/mod.rs index 322446f..658c44a 100644 --- a/crates/ghostlight-dungeon/src/world/mod.rs +++ b/crates/ghostlight-dungeon/src/world/mod.rs @@ -24,8 +24,7 @@ pub(crate) use controllers::{ SourceRange, SubmissionDisposition, TranslationGapSummary, }; pub(crate) use cover::{ - AgencyGraph, Cell, CellId, Constituent, Cover, CoverBudget, CoverBudgetError, Resolution, - TickIndex, derive_cover, + AgencyGraph, Cell, CellId, Constituent, Cover, CoverBudget, Resolution, TickIndex, derive_cover, }; pub(crate) use mailbox::{ControllerPort, ElaborationPort, MailboxError, WorldMailbox}; pub(crate) use patch::{