diff --git a/crates/ghostlight-dungeon/src/bin/ghostlight-strategic-smoke.rs b/crates/ghostlight-dungeon/src/bin/ghostlight-strategic-smoke.rs index b21f151..85beb82 100644 --- a/crates/ghostlight-dungeon/src/bin/ghostlight-strategic-smoke.rs +++ b/crates/ghostlight-dungeon/src/bin/ghostlight-strategic-smoke.rs @@ -79,8 +79,12 @@ fn validate_completed_newspaper_recomposition_receipt( .ok_or_else(|| { anyhow::anyhow!("completed wave newspaper recomposition has no recovery boundary") })?; - if recomposition["schema"] != "ghostlight.newspaper_wave_recomposition.v1" - || recomposition["wave_index"].as_u64() != Some(wave_index) + let recomposition_schema = recomposition["schema"].as_str(); + if !matches!( + recomposition_schema, + Some("ghostlight.newspaper_wave_recomposition.v1") + | Some("ghostlight.newspaper_wave_recomposition.v2") + ) || recomposition["wave_index"].as_u64() != Some(wave_index) || wave_index < current_recovery_start_wave as u64 || recorded_recovery_start_wave == 0 || recorded_recovery_start_wave > wave_index @@ -89,6 +93,8 @@ fn validate_completed_newspaper_recomposition_receipt( || recomposition["editorial_contract_digest"] != editorial_contract_digest || recomposition["issue"].is_null() || recomposition["newspaper_grounding"]["accepted"] != true + || recomposition_schema == Some("ghostlight.newspaper_wave_recomposition.v2") + && recomposition["newspaper_editorial"]["accepted"] != true || recomposition["issue_file"] != format!("newspaper-wave-{wave_index:02}.md") || recomposition["issue_audit_file"] != format!("newspaper-wave-{wave_index:02}.audit.md") { @@ -154,6 +160,21 @@ fn validate_completed_newspaper_recomposition_receipt( "completed wave newspaper recomposition grounding differs from its receipt" ) } + if recomposition_schema == Some("ghostlight.newspaper_wave_recomposition.v2") { + let editorial: ghostlight_dungeon::newspaper::WorldNewspaperEditorialVerdict = + serde_json::from_value(recomposition["newspaper_editorial"].clone()).map_err( + |error| { + anyhow::anyhow!( + "completed wave newspaper recomposition has an invalid editorial verdict: {error}" + ) + }, + )?; + if recomposition["editorial_digest"] != strategic_smoke_digest(&editorial)? { + anyhow::bail!( + "completed wave newspaper recomposition editorial verdict differs from its receipt" + ) + } + } } Ok(()) } @@ -1844,6 +1865,7 @@ async fn main() -> anyhow::Result<()> { let ( issue, newspaper_grounding, + newspaper_editorial, newspaper_model_receipts, issue_path, issue_audit_path, @@ -1869,6 +1891,7 @@ async fn main() -> anyhow::Result<()> { ( Some(composition.issue), Some(composition.grounding), + Some(composition.editorial), composition.model_receipts, Some(issue_path), Some(issue_audit_path), @@ -1880,6 +1903,7 @@ async fn main() -> anyhow::Result<()> { checkpoint, model_receipts, }) => ( + None, None, None, model_receipts, @@ -1895,6 +1919,7 @@ async fn main() -> anyhow::Result<()> { return Err(error); }; ( + None, None, None, failure.model_receipts.clone(), @@ -1917,6 +1942,7 @@ async fn main() -> anyhow::Result<()> { "commit":committed, "issue":issue, "newspaper_grounding":newspaper_grounding, + "newspaper_editorial":newspaper_editorial, "newspaper_model_receipts":newspaper_model_receipts, "newspaper_error":newspaper_error, "newspaper_reconciliation_checkpoint":newspaper_reconciliation_checkpoint, @@ -2068,7 +2094,7 @@ async fn main() -> anyhow::Result<()> { std::fs::write(&issue_path, &reader_copy)?; std::fs::write(&issue_audit_path, &audit_copy)?; let checkpoint = serde_json::json!({ - "schema":"ghostlight.newspaper_wave_recomposition.v1", + "schema":"ghostlight.newspaper_wave_recomposition.v2", "wave_index":wave_index, "recovery_start_wave":newspaper_recovery_start_wave, "world_revision":issue_campaign.revision, @@ -2076,11 +2102,13 @@ async fn main() -> anyhow::Result<()> { "editorial_contract_digest":editorial_contract_digest, "issue_digest":strategic_smoke_digest(&composition.issue)?, "grounding_digest":strategic_smoke_digest(&composition.grounding)?, + "editorial_digest":strategic_smoke_digest(&composition.editorial)?, "model_receipt_set_digest":strategic_smoke_digest(&composition.model_receipts)?, "reader_copy_digest":strategic_smoke_bytes_digest(reader_copy.as_bytes()), "audit_copy_digest":strategic_smoke_bytes_digest(audit_copy.as_bytes()), "issue":composition.issue, "newspaper_grounding":composition.grounding, + "newspaper_editorial":composition.editorial, "newspaper_model_receipts":composition.model_receipts, "issue_file":format!("newspaper-wave-{wave_index:02}.md"), "issue_audit_file":format!("newspaper-wave-{wave_index:02}.audit.md"), @@ -2112,7 +2140,12 @@ async fn main() -> anyhow::Result<()> { let report = wave_reports[report_index] .as_object_mut() .ok_or_else(|| anyhow::anyhow!("completed wave report is not an object"))?; - for field in ["issue", "newspaper_grounding", "newspaper_model_receipts"] { + for field in [ + "issue", + "newspaper_grounding", + "newspaper_editorial", + "newspaper_model_receipts", + ] { report.insert(field.into(), recomposition[field].clone()); } report.insert("issue_path".into(), serde_json::to_value(issue_path)?); @@ -2284,6 +2317,7 @@ async fn main() -> anyhow::Result<()> { "news_count":campaign.news.len(), "newspaper":newspaper_composition.issue, "newspaper_grounding":newspaper_composition.grounding, + "newspaper_editorial":newspaper_composition.editorial, "newspaper_model_receipts":newspaper_composition.model_receipts, "newspaper_path":newspaper_path, "newspaper_audit_path":newspaper_audit_path, @@ -2911,7 +2945,7 @@ mod tests { } #[test] - fn current_recomposition_is_still_typed_and_rerendered() { + fn current_recomposition_requires_both_review_verdicts_and_rerenders() { let issue = ghostlight_dungeon::newspaper::WorldNewspaperIssue { schema: "ghostlight.world_newspaper_issue.v3".into(), id: "issue:current".into(), @@ -2935,8 +2969,13 @@ mod tests { assessment: "Exact current grounding".into(), findings: Vec::new(), }; + let editorial = ghostlight_dungeon::newspaper::WorldNewspaperEditorialVerdict { + accepted: true, + assessment: "Exact current editorial acceptance".into(), + findings: Vec::new(), + }; let recomposition = serde_json::json!({ - "schema":"ghostlight.newspaper_wave_recomposition.v1", + "schema":"ghostlight.newspaper_wave_recomposition.v2", "wave_index":18, "recovery_start_wave":18, "world_revision":27, @@ -2944,11 +2983,13 @@ mod tests { "editorial_contract_digest":"sha256:contract", "issue_digest":strategic_smoke_digest(&issue).unwrap(), "grounding_digest":strategic_smoke_digest(&grounding).unwrap(), + "editorial_digest":strategic_smoke_digest(&editorial).unwrap(), "model_receipt_set_digest":strategic_smoke_digest(&receipts).unwrap(), "reader_copy_digest":strategic_smoke_bytes_digest(reader_copy.as_bytes()), "audit_copy_digest":strategic_smoke_bytes_digest(audit_copy.as_bytes()), "issue":issue, "newspaper_grounding":grounding, + "newspaper_editorial":editorial, "newspaper_model_receipts":receipts, "issue_file":"newspaper-wave-18.md", "issue_audit_file":"newspaper-wave-18.audit.md", @@ -2965,6 +3006,27 @@ mod tests { &audit_copy, ) .unwrap(); + let mut legacy_current = recomposition.clone(); + legacy_current["schema"] = serde_json::json!("ghostlight.newspaper_wave_recomposition.v1"); + legacy_current + .as_object_mut() + .unwrap() + .remove("editorial_digest"); + legacy_current + .as_object_mut() + .unwrap() + .remove("newspaper_editorial"); + validate_completed_newspaper_recomposition_receipt( + &legacy_current, + 18, + 18, + 27, + "sha256:campaign", + "sha256:contract", + &reader_copy, + &audit_copy, + ) + .unwrap(); assert!( validate_completed_newspaper_recomposition_receipt( &recomposition, @@ -2978,6 +3040,22 @@ mod tests { ) .is_err() ); + let mut changed_editorial = recomposition.clone(); + changed_editorial["newspaper_editorial"]["assessment"] = + serde_json::json!("Changed after admission"); + assert!( + validate_completed_newspaper_recomposition_receipt( + &changed_editorial, + 18, + 18, + 27, + "sha256:campaign", + "sha256:contract", + &reader_copy, + &audit_copy, + ) + .is_err() + ); let mut changed_grounding = recomposition.clone(); changed_grounding["newspaper_grounding"]["assessment"] = serde_json::json!("Changed after admission"); diff --git a/crates/ghostlight-dungeon/src/newspaper.rs b/crates/ghostlight-dungeon/src/newspaper.rs index 1422dac..e415e8f 100644 --- a/crates/ghostlight-dungeon/src/newspaper.rs +++ b/crates/ghostlight-dungeon/src/newspaper.rs @@ -28,7 +28,7 @@ const MAX_FRONT_PAGE_ARTICLES: usize = 6; const MAX_PUBLIC_RECORD_QUERY_RESULTS: usize = 24; const MAX_NARRATIVE_SELECTION_STEPS: usize = 12; const REWRITE_DESK_ACTIONS_PER_ADVANCE: usize = 3; -const NEWSROOM_CONTRACT_VERSION: &str = "canopy-ledger-publication-rewrite-desk.v6"; +const NEWSROOM_CONTRACT_VERSION: &str = "canopy-ledger-night-editor.v7"; const EDITION_LABEL: &str = "Current Edition"; const ALLOWED_SECTIONS: [&str; 6] = [ "Front Page", @@ -151,9 +151,42 @@ pub struct WorldNewspaperComposition { pub schema: String, pub issue: WorldNewspaperIssue, pub grounding: WorldNewspaperGroundingVerdict, + pub editorial: WorldNewspaperEditorialVerdict, pub model_receipts: Vec, } +#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)] +pub struct WorldNewspaperEditorialFinding { + pub article_index: u16, + pub category: WorldNewspaperEditorialCategory, + #[schemars(length(min = 1, max = 500))] + pub passage: String, + #[schemars(length(min = 1, max = 500))] + pub reason: String, + #[schemars(length(min = 1, max = 500))] + pub rewrite_goal: String, +} + +#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)] +#[serde(rename_all = "snake_case")] +pub enum WorldNewspaperEditorialCategory { + BuriedLede, + ProceduralForeground, + ThroughlineDropped, + StakesAbstracted, + TensionFlattened, + RepetitiveUpdate, +} + +#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)] +pub struct WorldNewspaperEditorialVerdict { + pub accepted: bool, + #[schemars(length(min = 1, max = 500))] + pub assessment: String, + #[schemars(length(max = 24))] + pub findings: Vec, +} + #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[serde(tag = "state", rename_all = "snake_case")] pub enum WorldNewspaperAdvance { @@ -185,11 +218,48 @@ impl WorldNewspaperAdvance { #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "snake_case")] pub enum WorldNewspaperCheckpointOrigin { - InitialCopyDesk, + InitialReview, Reconciliation, LegacyTerminalImport, } +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[serde(tag = "owner", rename_all = "snake_case")] +enum WorldNewspaperDeskRejection { + CopyDesk { + verdict: WorldNewspaperGroundingVerdict, + }, + NightEditor { + verdict: WorldNewspaperEditorialVerdict, + }, +} + +impl WorldNewspaperDeskRejection { + fn affected_article_indices(&self) -> BTreeSet { + match self { + Self::CopyDesk { verdict } => verdict + .findings + .iter() + .map(|finding| usize::from(finding.article_index)) + .collect(), + Self::NightEditor { verdict } => verdict + .findings + .iter() + .map(|finding| usize::from(finding.article_index)) + .collect(), + } + } + + fn with_assessment(&self, assessment: String) -> Self { + let mut rejection = self.clone(); + match &mut rejection { + Self::CopyDesk { verdict } => verdict.assessment = assessment, + Self::NightEditor { verdict } => verdict.assessment = assessment, + } + rejection + } +} + #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[serde(deny_unknown_fields)] pub struct WorldNewspaperReconciliationCheckpoint { @@ -204,7 +274,7 @@ pub struct WorldNewspaperReconciliationCheckpoint { #[serde(default)] editorial_agenda: Option, draft: EditorialPageDraft, - verdict: WorldNewspaperGroundingVerdict, + rejection: WorldNewspaperDeskRejection, model_receipt_ids: Vec, receipt_chain_digest: String, } @@ -1016,22 +1086,31 @@ struct NewsroomArticleRewrite { #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] #[serde(tag = "kind", rename_all = "snake_case")] enum NewsroomRewriteDeskFinding { - CopyDeskRejected { + DeskRejected { draft: EditorialPageDraft, - verdict: WorldNewspaperGroundingVerdict, + rejection: WorldNewspaperDeskRejection, }, } fn newsroom_rewrite_desk_finding( draft: EditorialPageDraft, - verdict: WorldNewspaperGroundingVerdict, + rejection: WorldNewspaperDeskRejection, ) -> NewsroomRewriteDeskFinding { - NewsroomRewriteDeskFinding::CopyDeskRejected { draft, verdict } + NewsroomRewriteDeskFinding::DeskRejected { draft, rejection } } struct NewsroomRewriteDeskOutput { draft: EditorialPageDraft, - verdict: WorldNewspaperGroundingVerdict, + grounding: WorldNewspaperGroundingVerdict, + editorial: WorldNewspaperEditorialVerdict, +} + +enum WorldNewspaperPublicationReview { + Accepted { + grounding: WorldNewspaperGroundingVerdict, + editorial: WorldNewspaperEditorialVerdict, + }, + Rejected(WorldNewspaperDeskRejection), } struct PreparedNewspaper { @@ -1137,7 +1216,7 @@ fn checkpoint_identity( source_witness_digest: Option<&str>, editorial_agenda: Option<&WorldNewspaperEditorialAgenda>, draft: &EditorialPageDraft, - verdict: &WorldNewspaperGroundingVerdict, + rejection: &WorldNewspaperDeskRejection, model_receipt_ids: &[String], receipt_chain_digest: &str, ) -> Result { @@ -1152,7 +1231,7 @@ fn checkpoint_identity( source_witness_digest, editorial_agenda, draft, - verdict, + rejection, model_receipt_ids, receipt_chain_digest, ))?) @@ -1169,7 +1248,7 @@ fn new_reconciliation_checkpoint( source_witness_digest: Option, editorial_agenda: Option, draft: EditorialPageDraft, - verdict: WorldNewspaperGroundingVerdict, + rejection: WorldNewspaperDeskRejection, receipts: &[ModelStageReceipt], ) -> Result { let model_receipt_ids = receipts @@ -1186,12 +1265,12 @@ fn new_reconciliation_checkpoint( source_witness_digest.as_deref(), editorial_agenda.as_ref(), &draft, - &verdict, + &rejection, &model_receipt_ids, &receipt_chain_digest, )?; Ok(WorldNewspaperReconciliationCheckpoint { - schema: "ghostlight.world_newspaper_reconciliation_checkpoint.v2".into(), + schema: "ghostlight.world_newspaper_reconciliation_checkpoint.v3".into(), id, publication_task_binding: publication_task_binding.into(), editorial_binding: binding.into(), @@ -1201,7 +1280,7 @@ fn new_reconciliation_checkpoint( source_witness_digest, editorial_agenda, draft, - verdict, + rejection, model_receipt_ids, receipt_chain_digest, }) @@ -1211,7 +1290,7 @@ fn persist_reconciliation_checkpoint( store: &CampaignStore, checkpoint: &WorldNewspaperReconciliationCheckpoint, ) -> Result<()> { - let kind = "world_newspaper_reconciliation_checkpoint.v2"; + let kind = "world_newspaper_reconciliation_checkpoint.v3"; if let Some((_, existing)) = store.load::(kind, checkpoint.id())? { @@ -1225,7 +1304,7 @@ fn persist_reconciliation_checkpoint( } store.insert( kind, - "ghostlight.world_newspaper_reconciliation_checkpoint.v2", + "ghostlight.world_newspaper_reconciliation_checkpoint.v3", checkpoint.id(), checkpoint, )?; @@ -1239,9 +1318,9 @@ fn persist_newspaper_completion( source_checkpoint_id: Option, composition: &WorldNewspaperComposition, ) -> Result<()> { - let kind = "world_newspaper_composition.v1"; + let kind = "world_newspaper_composition.v2"; let record = PersistedWorldNewspaperComposition { - schema: "ghostlight.persisted_world_newspaper_composition.v1".into(), + schema: "ghostlight.persisted_world_newspaper_composition.v2".into(), publication_task_binding: publication_task_binding.into(), editorial_binding: binding.into(), source_checkpoint_id, @@ -1259,7 +1338,7 @@ fn persist_newspaper_completion( } store.insert( kind, - "ghostlight.persisted_world_newspaper_composition.v1", + "ghostlight.persisted_world_newspaper_composition.v2", publication_task_binding, &record, )?; @@ -1288,11 +1367,10 @@ fn validate_reconciliation_checkpoint( max_articles: usize, receipts: &[ModelStageReceipt], ) -> Result<()> { - if checkpoint.schema != "ghostlight.world_newspaper_reconciliation_checkpoint.v2" + if checkpoint.schema != "ghostlight.world_newspaper_reconciliation_checkpoint.v3" || checkpoint.publication_task_binding != prepared.publication_task_binding || checkpoint.editorial_binding != prepared.binding - || checkpoint.verdict.accepted - || checkpoint.verdict.findings.is_empty() + || checkpoint.editorial_agenda.is_none() || receipts.len() != checkpoint.model_receipt_ids.len() { return Err(anyhow!("newspaper reconciliation checkpoint is invalid")); @@ -1320,7 +1398,7 @@ fn validate_reconciliation_checkpoint( checkpoint.source_witness_digest.as_deref(), checkpoint.editorial_agenda.as_ref(), &checkpoint.draft, - &checkpoint.verdict, + &checkpoint.rejection, &checkpoint.model_receipt_ids, &checkpoint.receipt_chain_digest, )? != checkpoint.id @@ -1351,7 +1429,7 @@ fn validate_reconciliation_checkpoint( == Some("newspaper_copy_desk") } } - WorldNewspaperCheckpointOrigin::InitialCopyDesk + WorldNewspaperCheckpointOrigin::InitialReview | WorldNewspaperCheckpointOrigin::Reconciliation => { let editor_index = receipts .iter() @@ -1384,12 +1462,26 @@ fn validate_reconciliation_checkpoint( validate_editorial_agenda(&prepared.records, agenda, max_articles)?; validate_editorial_alignment(&checkpoint.draft, agenda)?; } - let verdict = GroundingVerdictDraft { - accepted: checkpoint.verdict.accepted, - assessment: checkpoint.verdict.assessment.clone(), - findings: checkpoint.verdict.findings.clone(), + validate_desk_rejection(&checkpoint.draft, &checkpoint.rejection)?; + let latest_review_stage = receipts + .iter() + .rev() + .find(|receipt| { + matches!( + receipt.stage.as_str(), + "newspaper_copy_desk" | "newspaper_night_editor" + ) + }) + .map(|receipt| receipt.stage.as_str()); + let expected_review_stage = match &checkpoint.rejection { + WorldNewspaperDeskRejection::CopyDesk { .. } => "newspaper_copy_desk", + WorldNewspaperDeskRejection::NightEditor { .. } => "newspaper_night_editor", }; - validate_grounding_verdict(&checkpoint.draft, &verdict)?; + if latest_review_stage != Some(expected_review_stage) { + return Err(anyhow!( + "newspaper reconciliation checkpoint lost its rejecting desk receipt" + )); + } Ok(()) } @@ -1405,7 +1497,7 @@ fn load_reconciliation_tip( > { let checkpoints = store .load_all::( - "world_newspaper_reconciliation_checkpoint.v2", + "world_newspaper_reconciliation_checkpoint.v3", )? .into_iter() .filter(|checkpoint| { @@ -1466,13 +1558,14 @@ pub async fn advance_world_newspaper( ) -> Result { let prepared = prepare_newspaper(campaign, title, editorial_voice, max_articles)?; if let Some((_, persisted)) = store.load::( - "world_newspaper_composition.v1", + "world_newspaper_composition.v2", &prepared.publication_task_binding, )? { - if persisted.schema != "ghostlight.persisted_world_newspaper_composition.v1" + if persisted.schema != "ghostlight.persisted_world_newspaper_composition.v2" || persisted.publication_task_binding != prepared.publication_task_binding || persisted.editorial_binding != prepared.binding || !persisted.composition.grounding.accepted + || !persisted.composition.editorial.accepted || persisted.composition.issue.source_world_revision != campaign.revision || persisted.composition.issue.title != prepared.title { @@ -1508,7 +1601,7 @@ pub async fn advance_world_newspaper( editorial_receipt_ids: Vec::new(), }; let composition = WorldNewspaperComposition { - schema: "ghostlight.world_newspaper_composition.v1".into(), + schema: "ghostlight.world_newspaper_composition.v2".into(), issue, grounding: WorldNewspaperGroundingVerdict { accepted: true, @@ -1516,6 +1609,12 @@ pub async fn advance_world_newspaper( .into(), findings: Vec::new(), }, + editorial: WorldNewspaperEditorialVerdict { + accepted: true, + assessment: "No edition was issued, so there is no page to assess editorially." + .into(), + findings: Vec::new(), + }, model_receipts: Vec::new(), }; persist_newspaper_completion( @@ -1596,9 +1695,12 @@ pub async fn advance_world_newspaper( store.persist_model_stage_receipts(&receipts)?; let editor_receipt_id = receipts[editor_receipt_index].storage_key().to_owned(); let editor_output_hash = receipts[editor_receipt_index].output_hash.clone(); - let verdict = match run_copy_desk( + let review = match run_publication_review( model, format!("{}:draft:{editor_output_hash}", prepared.binding), + &prepared.title, + &prepared.editorial_voice, + &agenda, &selected_source_json, &prepared.source_receipt_ids, std::slice::from_ref(&editor_receipt_id), @@ -1607,47 +1709,54 @@ pub async fn advance_world_newspaper( ) .await { - Ok(verdict) => verdict, + Ok(review) => review, Err(error) => { store.persist_model_stage_receipts(&receipts)?; return Err(composition_failure(error.to_string(), receipts)); } }; store.persist_model_stage_receipts(&receipts)?; - if verdict.accepted { - let issue = lower_editorial_page( - campaign, - prepared.title.clone(), - &prepared.records, - Some(agenda.clone()), - draft, - &receipts, - )?; - let composition = WorldNewspaperComposition { - schema: "ghostlight.world_newspaper_composition.v1".into(), - issue, - grounding: verdict, - model_receipts: receipts, - }; - persist_newspaper_completion( - store, - &prepared.publication_task_binding, - &prepared.binding, - None, - &composition, - )?; - return Ok(WorldNewspaperAdvance::Accepted { composition }); - } + let rejection = match review { + WorldNewspaperPublicationReview::Accepted { + grounding, + editorial, + } => { + let issue = lower_editorial_page( + campaign, + prepared.title.clone(), + &prepared.records, + Some(agenda.clone()), + draft, + &receipts, + )?; + let composition = WorldNewspaperComposition { + schema: "ghostlight.world_newspaper_composition.v2".into(), + issue, + grounding, + editorial, + model_receipts: receipts, + }; + persist_newspaper_completion( + store, + &prepared.publication_task_binding, + &prepared.binding, + None, + &composition, + )?; + return Ok(WorldNewspaperAdvance::Accepted { composition }); + } + WorldNewspaperPublicationReview::Rejected(rejection) => rejection, + }; let checkpoint = new_reconciliation_checkpoint( &prepared.publication_task_binding, &prepared.binding, 0, None, - WorldNewspaperCheckpointOrigin::InitialCopyDesk, + WorldNewspaperCheckpointOrigin::InitialReview, None, Some(agenda), draft, - verdict, + rejection, &receipts, )?; persist_reconciliation_checkpoint(store, &checkpoint)?; @@ -1709,7 +1818,7 @@ pub fn admit_world_newspaper_reconciliation_import( || import.source_witness_digest.len() != 71 || store .load::( - "world_newspaper_composition.v1", + "world_newspaper_composition.v2", &prepared.publication_task_binding, )? .is_some() @@ -1727,7 +1836,9 @@ pub fn admit_world_newspaper_reconciliation_import( Some(import.source_witness_digest), import.editorial_agenda, import.draft, - import.verdict, + WorldNewspaperDeskRejection::CopyDesk { + verdict: import.verdict, + }, &import.model_receipts, )?; validate_reconciliation_checkpoint( @@ -1760,9 +1871,12 @@ async fn advance_reconciliation( mut receipts: Vec, ) -> Result { validate_reconciliation_checkpoint(&checkpoint, prepared, max_articles, &receipts)?; + let agenda = checkpoint + .editorial_agenda + .clone() + .ok_or_else(|| anyhow!("newspaper reconciliation checkpoint lost its editorial agenda"))?; for _ in 0..REWRITE_DESK_ACTIONS_PER_ADVANCE { - let selected_source_json = - source_json_for_agenda(&prepared.records, checkpoint.editorial_agenda.as_ref())?; + let selected_source_json = source_json_for_agenda(&prepared.records, Some(&agenda))?; let progress = run_newsroom_rewrite_desk_step( model, &prepared.records, @@ -1770,13 +1884,13 @@ async fn advance_reconciliation( &prepared.binding, &prepared.title, &prepared.editorial_voice, - checkpoint.editorial_agenda.as_ref(), + &agenda, &selected_source_json, &prepared.source_receipt_ids, &receipts, checkpoint.id(), checkpoint.draft.clone(), - checkpoint.verdict.clone(), + checkpoint.rejection.clone(), ) .await; match progress { @@ -1792,9 +1906,10 @@ async fn advance_reconciliation( &receipts, )?; let composition = WorldNewspaperComposition { - schema: "ghostlight.world_newspaper_composition.v1".into(), + schema: "ghostlight.world_newspaper_composition.v2".into(), issue, - grounding: run.output.verdict, + grounding: run.output.grounding, + editorial: run.output.editorial, model_receipts: receipts, }; persist_newspaper_completion( @@ -1806,7 +1921,7 @@ async fn advance_reconciliation( )?; return Ok(WorldNewspaperAdvance::Accepted { composition }); } - Ok((ModelAgentProgress::Exhausted(exhausted), draft, verdict)) => { + Ok((ModelAgentProgress::Exhausted(exhausted), draft, rejection)) => { store.persist_model_stage_receipts(&exhausted.receipts)?; receipts.extend(exhausted.receipts); let next = new_reconciliation_checkpoint( @@ -1818,7 +1933,7 @@ async fn advance_reconciliation( None, checkpoint.editorial_agenda.clone(), draft, - verdict, + rejection, &receipts, )?; persist_reconciliation_checkpoint(store, &next)?; @@ -1844,8 +1959,11 @@ struct NewsroomRewriteDeskWorkbench<'a> { binding: &'a str, source_json: &'a str, source_receipt_ids: &'a [String], + title: &'a str, + editorial_voice: &'a str, + agenda: &'a WorldNewspaperEditorialAgenda, draft: EditorialPageDraft, - verdict: WorldNewspaperGroundingVerdict, + rejection: WorldNewspaperDeskRejection, } #[async_trait] @@ -1865,13 +1983,10 @@ impl ModelAgentTool for NewsroomRewriteDeskWorkbench<'_> { schema.remove("$schema"); } let affected_article_indices = self - .verdict - .findings - .iter() - .map(|finding| finding.article_index) - .collect::>() + .rejection + .affected_article_indices() .into_iter() - .map(serde_json::Value::from) + .map(|index| serde_json::Value::from(index as u64)) .collect::>(); rewrite_schema["properties"]["article_index"] = serde_json::json!({ "type":"integer", @@ -1901,36 +2016,32 @@ impl ModelAgentTool for NewsroomRewriteDeskWorkbench<'_> { action: Self::Action, context: &ModelAgentToolContext, ) -> ModelAgentToolOutcome { - let draft = match apply_newsroom_article_rewrites(&self.draft, &self.verdict, action) { + let draft = match apply_newsroom_article_rewrites(&self.draft, &self.rejection, action) { Ok(draft) => draft, Err(error) => { - let verdict = WorldNewspaperGroundingVerdict { - accepted: false, - assessment: format!("The proposed article rewrite was not admitted: {error}") + let rejection = self.rejection.with_assessment( + format!("The proposed article rewrite was not admitted: {error}") .chars() .take(500) .collect(), - findings: self.verdict.findings.clone(), - }; - self.verdict = verdict.clone(); + ); + self.rejection = rejection.clone(); return ModelAgentToolOutcome::Rejected { - finding: newsroom_rewrite_desk_finding(self.draft.clone(), verdict), + finding: newsroom_rewrite_desk_finding(self.draft.clone(), rejection), receipts: Vec::new(), }; } }; if let Err(error) = validate_editorial_draft(self.records, &draft, self.max_articles) { - let verdict = WorldNewspaperGroundingVerdict { - accepted: false, - assessment: format!("The article rewrite produced invalid copy: {error}") + let rejection = self.rejection.with_assessment( + format!("The article rewrite produced invalid copy: {error}") .chars() .take(500) .collect(), - findings: self.verdict.findings.clone(), - }; - self.verdict = verdict.clone(); + ); + self.rejection = rejection.clone(); return ModelAgentToolOutcome::Rejected { - finding: newsroom_rewrite_desk_finding(self.draft.clone(), verdict), + finding: newsroom_rewrite_desk_finding(self.draft.clone(), rejection), receipts: Vec::new(), }; } @@ -1949,37 +2060,48 @@ impl ModelAgentTool for NewsroomRewriteDeskWorkbench<'_> { .filter(|receipt_id| !self.source_receipt_ids.contains(receipt_id)) .cloned() .collect::>(); - let mut copy_desk_receipts = Vec::new(); - let verdict = match run_copy_desk( + let mut review_receipts = Vec::new(); + let review = match run_publication_review( self.model, format!("{}:newsroom-rewrite:{draft_digest}", self.binding), + self.title, + self.editorial_voice, + self.agenda, self.source_json, self.source_receipt_ids, &editorial_receipt_ids, &draft, - &mut copy_desk_receipts, + &mut review_receipts, ) .await { - Ok(verdict) => verdict, + Ok(review) => review, Err(error) => { return ModelAgentToolOutcome::Failed { message: error.to_string(), - receipts: copy_desk_receipts, + receipts: review_receipts, }; } }; - if verdict.accepted { - ModelAgentToolOutcome::Accepted { - output: NewsroomRewriteDeskOutput { draft, verdict }, - receipts: copy_desk_receipts, - } - } else { - self.draft = draft.clone(); - self.verdict = verdict.clone(); - ModelAgentToolOutcome::Rejected { - finding: newsroom_rewrite_desk_finding(draft, verdict), - receipts: copy_desk_receipts, + match review { + WorldNewspaperPublicationReview::Accepted { + grounding, + editorial, + } => ModelAgentToolOutcome::Accepted { + output: NewsroomRewriteDeskOutput { + draft, + grounding, + editorial, + }, + receipts: review_receipts, + }, + WorldNewspaperPublicationReview::Rejected(rejection) => { + self.draft = draft.clone(); + self.rejection = rejection.clone(); + ModelAgentToolOutcome::Rejected { + finding: newsroom_rewrite_desk_finding(draft, rejection), + receipts: review_receipts, + } } } } @@ -1987,28 +2109,24 @@ impl ModelAgentTool for NewsroomRewriteDeskWorkbench<'_> { fn apply_newsroom_article_rewrites( original: &EditorialPageDraft, - verdict: &WorldNewspaperGroundingVerdict, + rejection: &WorldNewspaperDeskRejection, action: NewsroomRewriteDeskAction, ) -> Result { let NewsroomRewriteDeskAction::SubmitRewrites { rewrites } = action; - if verdict.findings.is_empty() { - return Err(anyhow!("the copy desk supplied no rejected articles")); + let affected = rejection.affected_article_indices(); + if affected.is_empty() { + return Err(anyhow!("the rejecting desk supplied no affected articles")); } if rewrites.is_empty() { return Err(anyhow!( "a newsroom rewrite must address every rejected article" )); } - let affected = verdict - .findings - .iter() - .map(|finding| usize::from(finding.article_index)) - .collect::>(); if affected .iter() .any(|article_index| *article_index >= original.articles.len()) { - return Err(anyhow!("copy desk named an invalid article")); + return Err(anyhow!("rejecting desk named an invalid article")); } let mut draft = original.clone(); let mut rewritten = BTreeSet::new(); @@ -2044,29 +2162,29 @@ async fn run_newsroom_rewrite_desk_step( binding: &str, title: &str, editorial_voice: &str, - agenda: Option<&WorldNewspaperEditorialAgenda>, + agenda: &WorldNewspaperEditorialAgenda, source_json: &str, source_receipt_ids: &[String], reconciliation_receipts: &[ModelStageReceipt], checkpoint_id: &str, draft: EditorialPageDraft, - verdict: WorldNewspaperGroundingVerdict, + rejection: WorldNewspaperDeskRejection, ) -> std::result::Result< ( ModelAgentProgress, EditorialPageDraft, - WorldNewspaperGroundingVerdict, + WorldNewspaperDeskRejection, ), crate::agent::ModelAgentFailure, > { let instructions = format!( - "You are `{title}`'s rewrite desk: the publication's night editor, not a compliance patcher. Rewrite the complete reader-facing prose of every article rejected by the factual copy desk while preserving the admitted edition's argument, urgency, and house voice. Submit headline, deck, dateline, and all paragraphs for each rejected article_index. The deterministic workbench freezes article selection, order, sections, bylines, citations, and every unaffected article; it rejects partial coverage, source widening, or structural mutation, then reruns the same whole-page copy desk. If the admitted sources cannot support an honest version of an article, the edition must remain rejected rather than changing its agenda.\n\nThe copy desk findings identify factual boundaries, not the desired prose. Rebuild each affected article as journalism. Lead with the consequential fact, name the pressure or opposing act when the cited material supplies it, and make the stakes legible to readers. Preserve the admitted narrative claim as interpretation rather than flattening the page into verification notes. You may create meaning through selection, ordering, contrast, metaphor, political characterization, and source-safe juxtaposition. Keep distinct reports grammatically distinct when their causal relationship is not established: proximity can invite the reader's inference, but your prose must not silently turn chronology or juxtaposition into a concrete causal claim. Attribute disputes naturally to their supplied speaker or institution. Do not mention the fact desk, citations, findings, verification, support boundaries, or phrases such as `the record does not establish` in reader-facing copy. Do not invent events, entities, motives, outcomes, chronology, identity attributes, or private knowledge.\n\nPUBLICATION VOICE:\n{editorial_voice}\n\nADMITTED NARRATIVE AGENDA:\n{agenda_json}\n\nFROZEN NEWSROOM FACT DESK:\n{source_json}\n\nCURRENT CHECKPOINTED PAGE:\n{draft_json}\n\nCOPY DESK VERDICT AND COMPLETE FINDINGS:\n{verdict_json}", + "You are `{title}`'s rewrite editor, not a compliance patcher. Rewrite the complete reader-facing prose of every article rejected by either the factual copy desk or the independent editorial-quality desk while preserving the admitted edition's argument, urgency, and house voice. Submit headline, deck, dateline, and all paragraphs for each rejected article_index. The deterministic workbench freezes article selection, order, sections, bylines, citations, and every unaffected article; it rejects partial coverage, source widening, or structural mutation, then reruns the factual copy desk followed by editorial review. If the admitted sources cannot support an honest version of an article, the edition must remain rejected rather than changing its agenda.\n\nThe rejecting desk's findings identify boundaries and editorial failures, not the desired prose. Rebuild each affected article as journalism. Lead with the consequential fact, name the pressure or opposing act when the cited material supplies it, and make the stakes legible to readers. Preserve the admitted narrative claim as interpretation rather than flattening the page into verification notes. You may create meaning through selection, ordering, contrast, metaphor, political characterization, pointed questions, and source-safe juxtaposition. Keep distinct reports grammatically distinct when their causal relationship is not established: proximity can invite the reader's inference, but your prose must not silently turn chronology or juxtaposition into a concrete causal claim. Attribute disputes naturally to their supplied speaker or institution. When editorial findings ask for stronger stakes or conflict, use the admitted agenda and selected facts more sharply; do not answer by inventing a missing fact. Do not mention the fact desk, citations, findings, verification, support boundaries, or phrases such as `the record does not establish` in reader-facing copy. Do not invent events, entities, motives, outcomes, chronology, spatial relationships, affiliations, identity attributes, or private knowledge.\n\nPUBLICATION VOICE:\n{editorial_voice}\n\nADMITTED NARRATIVE AGENDA:\n{agenda_json}\n\nFROZEN NEWSROOM FACT DESK:\n{source_json}\n\nCURRENT CHECKPOINTED PAGE:\n{draft_json}\n\nREJECTING DESK VERDICT AND COMPLETE FINDINGS:\n{rejection_json}", title = title, editorial_voice = editorial_voice, agenda_json = serde_json::to_string_pretty(&agenda).unwrap_or_default(), source_json = source_json, draft_json = serde_json::to_string_pretty(&draft).unwrap_or_default(), - verdict_json = serde_json::to_string_pretty(&verdict).unwrap_or_default(), + rejection_json = serde_json::to_string_pretty(&rejection).unwrap_or_default(), ); let mut causal_sources = source_receipt_ids .iter() @@ -2098,11 +2216,140 @@ async fn run_newsroom_rewrite_desk_step( binding, source_json, source_receipt_ids, + title, + editorial_voice, + agenda, draft, - verdict, + rejection, }; let progress = crate::agent::run_model_agent_progress(model, &spec, &mut tool).await?; - Ok((progress, tool.draft, tool.verdict)) + Ok((progress, tool.draft, tool.rejection)) +} + +#[allow(clippy::too_many_arguments)] +async fn run_publication_review( + model: &dyn ModelPort, + snapshot_binding: String, + title: &str, + editorial_voice: &str, + agenda: &WorldNewspaperEditorialAgenda, + source_json: &str, + source_receipt_ids: &[String], + editorial_source_receipt_ids: &[String], + draft: &EditorialPageDraft, + receipts: &mut Vec, +) -> Result { + let grounding = run_copy_desk( + model, + snapshot_binding.clone(), + source_json, + source_receipt_ids, + editorial_source_receipt_ids, + draft, + receipts, + ) + .await?; + if !grounding.accepted { + return Ok(WorldNewspaperPublicationReview::Rejected( + WorldNewspaperDeskRejection::CopyDesk { verdict: grounding }, + )); + } + let copy_desk_receipt_id = receipts + .last() + .map(|receipt| receipt.storage_key().to_owned()) + .ok_or_else(|| anyhow!("accepted copy-desk review produced no receipt"))?; + let editorial_receipt_ids = editorial_source_receipt_ids + .iter() + .cloned() + .chain(std::iter::once(copy_desk_receipt_id)) + .collect::>(); + let editorial = run_night_editor( + model, + format!("{snapshot_binding}:night-editor"), + title, + editorial_voice, + agenda, + source_json, + source_receipt_ids, + &editorial_receipt_ids, + draft, + receipts, + ) + .await?; + if !editorial.accepted { + return Ok(WorldNewspaperPublicationReview::Rejected( + WorldNewspaperDeskRejection::NightEditor { verdict: editorial }, + )); + } + Ok(WorldNewspaperPublicationReview::Accepted { + grounding, + editorial, + }) +} + +#[allow(clippy::too_many_arguments)] +async fn run_night_editor( + model: &dyn ModelPort, + snapshot_binding: String, + title: &str, + editorial_voice: &str, + agenda: &WorldNewspaperEditorialAgenda, + source_json: &str, + source_receipt_ids: &[String], + editorial_source_receipt_ids: &[String], + draft: &EditorialPageDraft, + receipts: &mut Vec, +) -> Result { + let schema = serde_json::to_value(schema_for!(WorldNewspaperEditorialVerdict))?; + let request = ModelStageRequest { + stage: "newspaper_night_editor".into(), + model: MODEL_CAPABLE.into(), + snapshot_binding, + lived_stream: format!( + "OUTPUT JSON SCHEMA (follow exactly):\n{}\n\nYou are the independent night editor of `{title}`. The factual copy desk has already cleared this exact page. Decide whether it is publishable journalism for the stated audience, not merely accurate prose. Judge the rendered page against the publication voice and the admitted narrative agenda using only the selected fact desk. Acceptance requires the page to make the agenda's throughline legible; put each story's consequential incident before routine handling; use available tension, opposition, reaction, scandal, bodily danger, or material cost; make the lead feel like the lead; and avoid repetitive administrative minutes. Strong rhetoric, pointed questions, political judgment, metaphor, and source-safe juxtaposition are assets.\n\nDo not relitigate factual grounding and do not demand a person, motive, reaction, consequence, or scene detail absent from the selected facts. Judge whether the copy makes the strongest honest case available from this exact selection. A finding must identify one article_index and one exact contiguous passage occurring exactly once in that article, explain the editorial failure, and state a rewrite_goal achievable with the admitted agenda and selected facts. Categories are buried_lede, procedural_foreground, throughline_dropped, stakes_abstracted, tension_flattened, and repetitive_update. Return the complete bounded finding set. `accepted` is true exactly when findings is empty. Do not rewrite the page.\n\nPUBLICATION VOICE:\n{}\n\nADMITTED NARRATIVE AGENDA:\n{}\n\nSELECTED FACT DESK:\n{}\n\nPROPOSED PAGE:\n{}", + serde_json::to_string(&schema)?, + editorial_voice, + serde_json::to_string_pretty(agenda)?, + source_json, + serde_json::to_string_pretty(draft)?, + ), + output_schema: Some(schema), + source_receipt_ids: source_receipt_ids + .iter() + .cloned() + .chain(editorial_source_receipt_ids.iter().cloned()) + .collect(), + temperature: Some(0.0), + max_output_tokens: Some(1_500), + }; + let output = run_validated_stage(model, &request) + .await + .map_err(|error| anyhow!("newspaper night-editor inference failed: {error}"))?; + receipts.push(output.receipt); + let receipt_index = receipts.len() - 1; + let structured = output + .structured + .ok_or_else(|| anyhow!("newspaper night editor returned no structured output")); + let structured = match structured { + Ok(structured) => structured, + Err(error) => { + mark_semantic_invalid(&mut receipts[receipt_index], &error); + return Err(error); + } + }; + let verdict: WorldNewspaperEditorialVerdict = match serde_json::from_value(structured) { + Ok(verdict) => verdict, + Err(error) => { + let error = anyhow!("newspaper night editor returned an invalid verdict: {error}"); + mark_semantic_invalid(&mut receipts[receipt_index], &error); + return Err(error); + } + }; + if let Err(error) = validate_editorial_verdict(draft, &verdict) { + mark_semantic_invalid(&mut receipts[receipt_index], &error); + return Err(error); + } + Ok(verdict) } async fn run_copy_desk( @@ -2120,7 +2367,7 @@ async fn run_copy_desk( model: MODEL_CAPABLE.into(), snapshot_binding, lived_stream: format!( - "OUTPUT JSON SCHEMA (follow exactly):\n{}\n\nAct as a strict copy desk, not a rewriting model. Compare every reader-facing factual claim in the proposed fantasy newspaper page with only its cited notes in the bounded newsroom fact desk. Reject invented or overconfident facts, quotations, identities, offices, places, numbers, motives, outcomes, chronology, or private knowledge. Treat each fact's assertion_status as an exhaustive boundary: attempt_committed_outcome_unknown never supports completion; course_committed_embedded_actions_not_completed supports the adopted course but not completion of acts named inside it; public_declaration supports only the declaration; material_change_committed supports the stated material change. Treat each named person's supported_identity_attributes as exhaustive. If it is empty, reject pronouns, gender, title, kinship, or office not independently stated in that fact, and require the name or identity-neutral wording. When cited notes dispute a document, accusation, identity, outcome, or authority, require explicit attribution or qualified language; one public claim does not silently settle another note's dispute. Distinguish an institution publishing a notice about evidence from displaying, releasing, or publishing the physical objects themselves. Reject copy that exposes the fact desk, citations, verification work, or state transitions instead of reporting news.\n\nThe five allowed generic bylines are publication role labels supplied by the newspaper contract, not claims about new people, witnesses, or reporting acts; never reject an allowed byline for lacking source evidence. Metaphor, dry wit, rhetorical contrast, plainly signalled opinion, and political characterization are editorial language rather than world facts when they introduce no concrete entity, occurrence, status, motive, quotation, number, or private knowledge. Do not demand a source sentence for such language. Still reject a rhetorical phrase when it smuggles in a concrete outcome, such as treating a proposed kiln closure as completed, or turns missing evidence into proof that something did not happen. Return the complete bounded finding set in one verdict rather than revealing one defect per pass. Every claim_or_phrase must copy one exact contiguous reader-facing substring that occurs exactly once in its named article; never paraphrase the defect in that field. A neutral contract-owned edition label is not part of the proposed model copy. `accepted` may be true only when findings is empty. Return findings only; never propose replacement copy.\n\nNEWSROOM FACT DESK:\n{}\n\nPROPOSED PAGE:\n{}", + "OUTPUT JSON SCHEMA (follow exactly):\n{}\n\nAct as a strict copy desk, not a rewriting model. Compare every reader-facing factual claim in the proposed fantasy newspaper page with only its cited notes in the bounded newsroom fact desk. Reject invented or overconfident facts, quotations, identities, offices, places, numbers, motives, outcomes, chronology, spatial relationships, or private knowledge. Treat each fact's assertion_status as an exhaustive boundary: attempt_committed_outcome_unknown never supports completion; course_committed_embedded_actions_not_completed supports the adopted course but not completion of acts named inside it; public_declaration supports only the declaration; material_change_committed supports the stated material change. Treat each named person's supported_identity_attributes as exhaustive. If it is empty, reject pronouns, gender, title, kinship, office, membership, or affiliation not independently stated in that fact, and require the name or identity-neutral wording. A person acting within, at, beside, or through a named population or institution does not by itself belong to it. Shared location, a cordon, a route, barriers, and nearby evidence do not establish unstated containment, adjacency, or surrounding geometry. When cited notes dispute a document, accusation, identity, outcome, or authority, require explicit attribution or qualified language; one public claim does not silently settle another note's dispute. Distinguish an institution publishing a notice about evidence from displaying, releasing, or publishing the physical objects themselves. Reject copy that exposes the fact desk, citations, verification work, or state transitions instead of reporting news.\n\nThe five allowed generic bylines are publication role labels supplied by the newspaper contract, not claims about new people, witnesses, or reporting acts; never reject an allowed byline for lacking source evidence. Metaphor, dry wit, rhetorical contrast, plainly signalled opinion, and political characterization are editorial language rather than world facts when they introduce no concrete entity, occurrence, status, motive, quotation, number, spatial relationship, or private knowledge. Do not demand a source sentence for such language. Still reject a rhetorical phrase when it smuggles in a concrete outcome, such as treating a proposed kiln closure as completed, or turns missing evidence into proof that something did not happen. Return the complete bounded finding set in one verdict rather than revealing one defect per pass. Every claim_or_phrase must copy one exact contiguous reader-facing substring that occurs exactly once in its named article; never paraphrase the defect in that field. A neutral contract-owned edition label is not part of the proposed model copy. `accepted` may be true only when findings is empty. Return findings only; never propose replacement copy.\n\nNEWSROOM FACT DESK:\n{}\n\nPROPOSED PAGE:\n{}", serde_json::to_string(&verifier_schema)?, source_json, serde_json::to_string_pretty(draft)?, @@ -2719,19 +2966,9 @@ fn validate_grounding_finding_target( draft: &EditorialPageDraft, finding: &WorldNewspaperGroundingFinding, ) -> Result<()> { - let article = draft - .articles - .get(usize::from(finding.article_index)) - .ok_or_else(|| anyhow!("copy desk returned an invalid article index"))?; - let occurrence_count = [ - article.headline.as_str(), - article.deck.as_str(), - article.dateline.as_str(), - ] - .into_iter() - .chain(article.paragraphs.iter().map(String::as_str)) - .map(|text| text.match_indices(&finding.claim_or_phrase).count()) - .sum::(); + let occurrence_count = + article_passage_occurrence_count(draft, finding.article_index, &finding.claim_or_phrase) + .ok_or_else(|| anyhow!("copy desk returned an invalid article index"))?; if occurrence_count != 1 { return Err(anyhow!( "copy-desk claim_or_phrase must be one exact contiguous phrase occurring once in the named article" @@ -2740,6 +2977,25 @@ fn validate_grounding_finding_target( Ok(()) } +fn article_passage_occurrence_count( + draft: &EditorialPageDraft, + article_index: u16, + passage: &str, +) -> Option { + let article = draft.articles.get(usize::from(article_index))?; + Some( + [ + article.headline.as_str(), + article.deck.as_str(), + article.dateline.as_str(), + ] + .into_iter() + .chain(article.paragraphs.iter().map(String::as_str)) + .map(|text| text.match_indices(passage).count()) + .sum::(), + ) +} + fn validate_grounding_verdict( draft: &EditorialPageDraft, verdict: &GroundingVerdictDraft, @@ -2763,6 +3019,63 @@ fn validate_grounding_verdict( Ok(()) } +fn validate_editorial_verdict( + draft: &EditorialPageDraft, + verdict: &WorldNewspaperEditorialVerdict, +) -> Result<()> { + validate_single_line(&verdict.assessment, 500, "night-editor assessment")?; + if verdict.accepted != verdict.findings.is_empty() { + return Err(anyhow!( + "night-editor acceptance must be true exactly when findings are empty" + )); + } + let mut exact_passages = BTreeSet::new(); + for finding in &verdict.findings { + validate_single_line(&finding.passage, 500, "night-editor passage")?; + validate_single_line(&finding.reason, 500, "night-editor reason")?; + validate_single_line(&finding.rewrite_goal, 500, "night-editor rewrite goal")?; + let article_index = usize::from(finding.article_index); + if !exact_passages.insert((article_index, finding.passage.as_str())) { + return Err(anyhow!("night editor repeated one exact finding passage")); + } + let occurrence_count = + article_passage_occurrence_count(draft, finding.article_index, &finding.passage) + .ok_or_else(|| anyhow!("night editor returned an invalid article index"))?; + if occurrence_count != 1 { + return Err(anyhow!( + "night-editor passage must occur exactly once in the named article" + )); + } + } + Ok(()) +} + +fn validate_desk_rejection( + draft: &EditorialPageDraft, + rejection: &WorldNewspaperDeskRejection, +) -> Result<()> { + match rejection { + WorldNewspaperDeskRejection::CopyDesk { verdict } => { + let draft_verdict = GroundingVerdictDraft { + accepted: verdict.accepted, + assessment: verdict.assessment.clone(), + findings: verdict.findings.clone(), + }; + validate_grounding_verdict(draft, &draft_verdict)?; + if verdict.accepted { + return Err(anyhow!("copy-desk rejection cannot contain acceptance")); + } + } + WorldNewspaperDeskRejection::NightEditor { verdict } => { + validate_editorial_verdict(draft, verdict)?; + if verdict.accepted { + return Err(anyhow!("night-editor rejection cannot contain acceptance")); + } + } + } + Ok(()) +} + fn lower_editorial_page( campaign: &Campaign, title: String, @@ -3202,6 +3515,8 @@ mod tests { const FINAL_REPAIR_DECK_ACTION: &str = r#"{"tool":"submit_rewrites","rewrites":[{"article_index":0,"headline":"Court Sells the Crown's Seal, Then the Treasurer","deck":"The court's admission leaves the dismissed treasurer.","dateline":"Room","paragraphs":["The Thorn Court has admitted that its royal seal was pawned to cover a dragon's gambling debt, a confession that turns private embarrassment into a public question of custody.","The treasurer who delivered that admission in open court was dismissed soon afterward. The court has explained the firing; it has not made the seal any less pawned."]}]}"#; const REWRITE_SECOND_ARTICLE_ACTION: &str = r#"{"tool":"submit_rewrites","rewrites":[{"article_index":1,"headline":"Cracked Hinge Closes West Gate at Moonrise","deck":"Masons will replace the hinge after the announced closure.","dateline":"Yard","paragraphs":["Officials say the west gate will close at moonrise while masons replace its cracked hinge.","Travellers have a closing hour but no announced reopening time."]}]}"#; const ACCEPTING_COPY_DESK: &str = r#"{"accepted":true,"assessment":"The copy is fully supported by its cited public source and reads as attributed court reporting.","findings":[]}"#; + const ACCEPTING_NIGHT_EDITOR: &str = r#"{"accepted":true,"assessment":"The page fulfills its admitted agenda with a clear lead, concrete stakes and pointed narrative framing.","findings":[]}"#; + const REJECTING_NIGHT_EDITOR: &str = r#"{"accepted":false,"assessment":"The page buries the court's scandal beneath an abstract deck.","findings":[{"article_index":0,"category":"procedural_foreground","passage":"A gambling debt reaches the throne room and leaves one official carrying the blame.","reason":"The deck summarizes blame instead of leading with the pawned royal seal and the court's retaliation against its messenger.","rewrite_goal":"Lead with the pawned seal, then juxtapose the court's admission with the treasurer's dismissal."}]}"#; async fn pending_local_rejection_fixture() -> ( Campaign, @@ -3250,6 +3565,34 @@ mod tests { } } + #[test] + fn night_editor_schema_and_validation_own_article_specific_quality_findings() { + let schema = serde_json::to_string(&schema_for!(WorldNewspaperEditorialVerdict)).unwrap(); + for category in [ + "buried_lede", + "procedural_foreground", + "throughline_dropped", + "stakes_abstracted", + "tension_flattened", + "repetitive_update", + ] { + assert!(schema.contains(category)); + } + let draft: EditorialPageDraft = serde_json::from_str(ACCEPTED_PAGE).unwrap(); + let verdict: WorldNewspaperEditorialVerdict = + serde_json::from_str(REJECTING_NIGHT_EDITOR).unwrap(); + validate_editorial_verdict(&draft, &verdict).unwrap(); + + let mut invalid = verdict; + invalid.findings[0].passage = "a phrase absent from the page".into(); + assert!( + validate_editorial_verdict(&draft, &invalid) + .unwrap_err() + .to_string() + .contains("must occur exactly once") + ); + } + #[test] fn narrative_workbench_owns_lead_and_allows_shared_foundational_records() { let records = public_news_records(&campaign_with_two_news()).unwrap(); @@ -3672,7 +4015,9 @@ mod tests { }; let repaired = apply_newsroom_article_rewrites( &draft, - &verdict, + &WorldNewspaperDeskRejection::CopyDesk { + verdict: verdict.clone(), + }, NewsroomRewriteDeskAction::SubmitRewrites { rewrites: vec![NewsroomArticleRewrite { article_index: 0, @@ -3722,7 +4067,9 @@ mod tests { }; let incomplete = apply_newsroom_article_rewrites( &draft, - &verdict, + &WorldNewspaperDeskRejection::CopyDesk { + verdict: verdict.clone(), + }, NewsroomRewriteDeskAction::SubmitRewrites { rewrites: vec![NewsroomArticleRewrite { article_index: 0, @@ -3764,7 +4111,9 @@ mod tests { }; let unaffected = apply_newsroom_article_rewrites( &draft, - &verdict, + &WorldNewspaperDeskRejection::CopyDesk { + verdict: verdict.clone(), + }, NewsroomRewriteDeskAction::SubmitRewrites { rewrites: vec![rewrite], }, @@ -3781,7 +4130,9 @@ mod tests { }; let duplicate = apply_newsroom_article_rewrites( &draft, - &verdict, + &WorldNewspaperDeskRejection::CopyDesk { + verdict: verdict.clone(), + }, NewsroomRewriteDeskAction::SubmitRewrites { rewrites: vec![rewrite.clone(), rewrite], }, @@ -3795,15 +4146,17 @@ mod tests { let draft: EditorialPageDraft = serde_json::from_str(ACCEPTED_PAGE).unwrap(); let invalid = apply_newsroom_article_rewrites( &draft, - &WorldNewspaperGroundingVerdict { - accepted: false, - assessment: "Invalid article index.".into(), - findings: vec![WorldNewspaperGroundingFinding { - article_index: 1, - category: WorldNewspaperGroundingCategory::UnsupportedFact, - claim_or_phrase: "missing phrase".into(), - reason: "Fixture error.".into(), - }], + &WorldNewspaperDeskRejection::CopyDesk { + verdict: WorldNewspaperGroundingVerdict { + accepted: false, + assessment: "Invalid article index.".into(), + findings: vec![WorldNewspaperGroundingFinding { + article_index: 1, + category: WorldNewspaperGroundingCategory::UnsupportedFact, + claim_or_phrase: "missing phrase".into(), + reason: "Fixture error.".into(), + }], + }, }, NewsroomRewriteDeskAction::SubmitRewrites { rewrites: vec![NewsroomArticleRewrite { @@ -3819,7 +4172,7 @@ mod tests { assert!( invalid .to_string() - .contains("copy desk named an invalid article") + .contains("rejecting desk named an invalid article") ); } @@ -3831,6 +4184,7 @@ mod tests { ONE_STORY_AGENDA, ACCEPTED_PAGE, ACCEPTING_COPY_DESK, + ACCEPTING_NIGHT_EDITOR, ]); let composition = compose_world_newspaper( &model, @@ -3879,7 +4233,9 @@ mod tests { render_world_newspaper_audit_markdown(&boundary_issue) .contains("audit shows the complete stored account and asserts nothing beyond it") ); - assert_eq!(composition.model_receipts.len(), 5); + assert_eq!(composition.model_receipts.len(), 6); + assert!(composition.grounding.accepted); + assert!(composition.editorial.accepted); let requests = model.requests(); assert_eq!( requests[0].stage, @@ -3895,6 +4251,8 @@ mod tests { "newspaper_narrative_selection_agent_action" ); assert_eq!(requests[3].stage, "newspaper_editor"); + assert_eq!(requests[4].stage, "newspaper_copy_desk"); + assert_eq!(requests[5].stage, "newspaper_night_editor"); assert!( requests[3] .lived_stream @@ -4078,6 +4436,7 @@ mod tests { REJECTED, REPAIR_DECK_ACTION, ACCEPTING_COPY_DESK, + ACCEPTING_NIGHT_EDITOR, ]); let composition = compose_world_newspaper( &model, @@ -4089,7 +4448,7 @@ mod tests { .await .unwrap(); - assert_eq!(composition.model_receipts.len(), 7); + assert_eq!(composition.model_receipts.len(), 8); let requests = model.requests(); assert_eq!(requests[0].temperature, Some(0.8)); assert_eq!(requests[1].temperature, Some(0.8)); @@ -4135,9 +4494,71 @@ mod tests { ); assert!(requests[4].lived_stream.contains("publication role labels")); assert!(requests[4].lived_stream.contains("Metaphor, dry wit")); + assert!( + requests[4] + .lived_stream + .contains("does not by itself belong to it") + ); + assert!( + requests[4] + .lived_stream + .contains("do not establish unstated containment") + ); assert!(composition.grounding.accepted); } + #[tokio::test] + async fn night_editor_rejection_reuses_the_same_rewrite_and_review_loop() { + let campaign = campaign_with_news(); + let model = ScriptedNewspaperModel::new([ + QUERY_ALL_RECORDS, + ONE_STORY_AGENDA, + ACCEPTED_PAGE, + ACCEPTING_COPY_DESK, + REJECTING_NIGHT_EDITOR, + REPAIR_DECK_ACTION, + ACCEPTING_COPY_DESK, + ACCEPTING_NIGHT_EDITOR, + ]); + + let composition = compose_world_newspaper( + &model, + &campaign, + "The Underdeep Clarion", + "A skeptical court broadsheet with dry restraint.", + 4, + ) + .await + .unwrap(); + + assert_eq!(composition.model_receipts.len(), 9); + assert!(composition.grounding.accepted); + assert!(composition.editorial.accepted); + assert_eq!( + composition.issue.articles[0].source_news_ids(), + ["news:seal-scandal"] + ); + let requests = model.requests(); + assert_eq!(requests[4].stage, "newspaper_copy_desk"); + assert_eq!(requests[5].stage, "newspaper_night_editor"); + assert_eq!(requests[6].stage, "newspaper_rewrite_desk_agent_action"); + assert_eq!(requests[7].stage, "newspaper_copy_desk"); + assert_eq!(requests[8].stage, "newspaper_night_editor"); + assert!( + requests[6] + .lived_stream + .contains("buries the court's scandal") + ); + assert_eq!( + requests[6] + .output_schema + .as_ref() + .unwrap() + .pointer("/properties/rewrites/items/properties/article_index/enum"), + Some(&serde_json::json!([0])) + ); + } + #[tokio::test] async fn rewrite_desk_preserves_admitted_article_selection_and_rechecks_the_page() { const REJECTED_SECOND: &str = r#"{"accepted":false,"assessment":"The dispatch adds a claim absent from its source.","findings":[{"article_index":1,"category":"unsupported_fact","claim_or_phrase":"the west gate is unsafe","reason":"The cited source records a cracked hinge and closure, not a safety finding."}]}"#; @@ -4149,6 +4570,7 @@ mod tests { REJECTED_SECOND, REWRITE_SECOND_ARTICLE_ACTION, ACCEPTING_COPY_DESK, + ACCEPTING_NIGHT_EDITOR, ]); let composition = compose_world_newspaper( &model, @@ -4176,9 +4598,13 @@ mod tests { assert!( !render_world_newspaper_markdown(&composition.issue).contains("west gate is unsafe") ); - assert_eq!(composition.model_receipts.len(), 7); - let final_copy_desk = composition.model_receipts.last().unwrap(); + assert_eq!(composition.model_receipts.len(), 8); + let final_copy_desk = &composition.model_receipts[composition.model_receipts.len() - 2]; assert_eq!(final_copy_desk.stage, "newspaper_copy_desk"); + assert_eq!( + composition.model_receipts.last().unwrap().stage, + "newspaper_night_editor" + ); assert!( final_copy_desk .snapshot_binding @@ -4197,6 +4623,7 @@ mod tests { .contains(&receipt.storage_key().to_owned()) })); assert!(composition.grounding.accepted); + assert!(composition.editorial.accepted); } #[tokio::test] @@ -4213,6 +4640,7 @@ mod tests { REJECTED_AFTER_REPAIR, SECOND_REPAIR_DECK_ACTION, ACCEPTING_COPY_DESK, + ACCEPTING_NIGHT_EDITOR, ]); let composition = compose_world_newspaper( &model, @@ -4223,8 +4651,9 @@ mod tests { ) .await .unwrap(); - assert_eq!(composition.model_receipts.len(), 9); + assert_eq!(composition.model_receipts.len(), 10); assert!(composition.grounding.accepted); + assert!(composition.editorial.accepted); let requests = model.requests(); assert_eq!( requests @@ -4263,6 +4692,7 @@ mod tests { REJECTED_AFTER_REPAIR, SECOND_REPAIR_DECK_ACTION, ACCEPTING_COPY_DESK, + ACCEPTING_NIGHT_EDITOR, ]); let composition = compose_world_newspaper( &model, @@ -4274,8 +4704,9 @@ mod tests { .await .unwrap(); - assert_eq!(composition.model_receipts.len(), 10); + assert_eq!(composition.model_receipts.len(), 11); assert!(composition.grounding.accepted); + assert!(composition.editorial.accepted); let requests = model.requests(); assert_eq!( requests @@ -4308,7 +4739,7 @@ mod tests { .lived_stream .contains("revised deck still overstates blame") ); - let final_copy_desk = composition.model_receipts.last().unwrap(); + let final_copy_desk = &composition.model_receipts[composition.model_receipts.len() - 2]; assert_eq!(final_copy_desk.stage, "newspaper_copy_desk"); assert_eq!(final_copy_desk.validation_result, "valid"); assert!(composition.model_receipts[..9].iter().all(|receipt| { @@ -4370,7 +4801,7 @@ mod tests { rejected .local_validation_error .as_deref() - .is_some_and(|finding| finding.contains("copy_desk_rejected")) + .is_some_and(|finding| finding.contains("desk_rejected")) ); } } @@ -4418,7 +4849,7 @@ mod tests { assert_eq!(prior_receipts.len(), 11); assert_eq!( store - .keys("world_newspaper_reconciliation_checkpoint.v2") + .keys("world_newspaper_reconciliation_checkpoint.v3") .unwrap() .len(), 4 @@ -4430,8 +4861,11 @@ mod tests { .is_some() })); - let resume_model = - ScriptedNewspaperModel::new([FINAL_REPAIR_DECK_ACTION, ACCEPTING_COPY_DESK]); + let resume_model = ScriptedNewspaperModel::new([ + FINAL_REPAIR_DECK_ACTION, + ACCEPTING_COPY_DESK, + ACCEPTING_NIGHT_EDITOR, + ]); let accepted = advance_world_newspaper( &resume_model, &campaign, @@ -4445,7 +4879,7 @@ mod tests { .into_accepted() .unwrap(); let resumed_requests = resume_model.requests(); - assert_eq!(resumed_requests.len(), 2); + assert_eq!(resumed_requests.len(), 3); assert!( resumed_requests .iter() @@ -4461,12 +4895,17 @@ mod tests { .source_receipt_ids .contains(&checkpoint.id().to_owned()) ); - assert_eq!(accepted.model_receipts.len(), 13); + assert_eq!(accepted.model_receipts.len(), 14); assert_eq!( &accepted.model_receipts[..prior_receipts.len()], prior_receipts.as_slice() ); - let final_copy_desk = accepted.model_receipts.last().unwrap(); + let final_copy_desk = &accepted.model_receipts[accepted.model_receipts.len() - 2]; + assert_eq!(final_copy_desk.stage, "newspaper_copy_desk"); + assert_eq!( + accepted.model_receipts.last().unwrap().stage, + "newspaper_night_editor" + ); assert!(accepted.model_receipts[..12].iter().all(|receipt| { final_copy_desk .source_receipt_ids @@ -4533,7 +4972,12 @@ mod tests { source_witness_digest: format!("sha256:{}", "a".repeat(64)), editorial_agenda: checkpoint.editorial_agenda.clone(), draft: checkpoint.draft.clone(), - verdict: checkpoint.verdict.clone(), + verdict: match &checkpoint.rejection { + WorldNewspaperDeskRejection::CopyDesk { verdict } => verdict.clone(), + WorldNewspaperDeskRejection::NightEditor { .. } => { + panic!("fixture must stop on copy-desk rejection") + } + }, model_receipts: model_receipts.clone(), }; let imported_directory = tempfile::tempdir().unwrap(); @@ -4554,8 +4998,11 @@ mod tests { WorldNewspaperCheckpointOrigin::LegacyTerminalImport ); - let resume_model = - ScriptedNewspaperModel::new([FINAL_REPAIR_DECK_ACTION, ACCEPTING_COPY_DESK]); + let resume_model = ScriptedNewspaperModel::new([ + FINAL_REPAIR_DECK_ACTION, + ACCEPTING_COPY_DESK, + ACCEPTING_NIGHT_EDITOR, + ]); let accepted = advance_world_newspaper( &resume_model, &campaign, @@ -4568,7 +5015,7 @@ mod tests { .unwrap() .into_accepted() .unwrap(); - assert_eq!(accepted.model_receipts.len(), model_receipts.len() + 2); + assert_eq!(accepted.model_receipts.len(), model_receipts.len() + 3); assert!( resume_model .requests() @@ -4614,7 +5061,7 @@ mod tests { sibling.source_witness_digest.as_deref(), sibling.editorial_agenda.as_ref(), &sibling.draft, - &sibling.verdict, + &sibling.rejection, &sibling.model_receipt_ids, &sibling.receipt_chain_digest, ) @@ -4646,6 +5093,7 @@ mod tests { ONE_STORY_AGENDA, MARKDOWN_PAGE, ACCEPTING_COPY_DESK, + ACCEPTING_NIGHT_EDITOR, ]); let composition = compose_world_newspaper( &model, @@ -4704,6 +5152,7 @@ mod tests { ONE_STORY_AGENDA, ACCEPTED_PAGE, ACCEPTING_COPY_DESK, + ACCEPTING_NIGHT_EDITOR, ]), &campaign, "The Underdeep Clarion", @@ -4718,6 +5167,7 @@ mod tests { ONE_STORY_AGENDA, ALTERNATE_PAGE, ACCEPTING_COPY_DESK, + ACCEPTING_NIGHT_EDITOR, ]), &campaign, "The Underdeep Clarion", diff --git a/crates/ghostlight-dungeon/src/registry.rs b/crates/ghostlight-dungeon/src/registry.rs index bef85a4..6929593 100644 --- a/crates/ghostlight-dungeon/src/registry.rs +++ b/crates/ghostlight-dungeon/src/registry.rs @@ -819,6 +819,14 @@ mod tests { }) .to_string()); } + if request.stage == "newspaper_night_editor" { + return Ok(serde_json::json!({ + "accepted":true, + "assessment":"The page makes its admitted accusation legible and consequential.", + "findings":[] + }) + .to_string()); + } registry_newspaper_editor_response(request) } diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 10bd337..2b61131 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -1310,6 +1310,36 @@ The audit discloses when an immutable source account reaches the shared account and asserts nothing beyond it. Reviewers must treat that as the owned world-source boundary, not as newsroom truncation or omitted provenance. +Exact-source run 57 at +`0c1400985c061c0db44969288846eff79eeed69a`, using rewrite-desk contract v6, +is an immutable mechanically complete newspaper-only run over frozen world +revision 27 with 18 waves, 363 events, and 853 news rows. SHA-256: newspaper +`d90758f411193aa6e86ae2e8cb390650d9b8a58eac77ef87018bd61e9a668c57`; +audit `895268bc22aa3e4176b1da31388e85327f0fe11e4ea4ea4ee600b4e3270a8eed`; +archive `241354b669ee2357c9bb7a06e10e0b93378637621ff2b8b27ab7cf35c2e44e28`. +Mechanical grounding accepts. + +Independent blind editorial review fails. The lead and other stories remain +administrative, lived stakes are abstract, no named accountable Greathold +opposition appears, severed hands are buried without court responses or +suspects, and the seed-vault story repeats procedure. The admitted editorial +agenda is materially sharper than the rendered copy. World simulation, ledger +access, and lead selection are therefore not the active blocker; the live +hypothesis is missing editorial-quality acceptance and feedback between agenda +and publication. + +The completed local Night Editor cut owns contract +`canopy-ledger-night-editor.v7` and is verified but not yet committed or +provider-accepted. The independent copy-desk agent remains the sole factual +judge. After factual clearance, the publication-owned Night Editor judges the +page against the admitted agenda and selected facts. A rejection names exact +article passages and achievable editorial goals, then enters the same +publication-owned full-article rewrite path used for factual rejection. Every +revision returns through copy-desk judgment and Night Editor judgment before +acceptance. The Night Editor gains no fact, world, event, selection, or +persistence authority. Gates pass 30/30 focused newspaper tests, 485/485 +library tests, and 15/15 strategic-smoke tests. + Run 54 exposed one separate upstream publicity defect: a public strategic activity propagates its channel to private `MemberMemory` outcomes, which is how Orin Pell retaining a memory became a public news row. The newsroom should @@ -1317,15 +1347,18 @@ ignore that bookkeeping, but revision 27 remains immutable. Future kernel work must require an outcome's own observable or communicated public scope before materializing a `NewsIssue`. -1. Preserve immutable runs 55 and 56 and the exact live services. Stage pushed - commit `0c1400985c061c0db44969288846eff79eeed69a` against run 56's frozen - revision-27 campaign and accepted per-wave publications. -2. Run one immutable final-newspaper-only acceptance with no world or per-wave - replay. Retain and resume typed rewrite checkpoints rather than rerunning - the publication writer. -3. Require exact newspaper, audit, result, archive, manifest, provenance, and - service-isolation proof, then obtain independent blind editorial and - grounding reviews. Deliver the actual copy only if both accept. +1. Commit the exact verified Night Editor v7 worktree and push the resulting + commit. Do not name a commit hash until that exact body exists remotely. +2. Preserve immutable runs 55 through 57 and the exact live services. Stage the + exact pushed commit for immutable Run 58 as a newsroom-only continuation + from run 57's frozen revision-27 campaign and accepted per-wave + publications. Replay no world mechanic or wave; retain and resume typed + rewrite checkpoints. +3. Require internal copy-desk factual acceptance and Night Editor + editorial-quality acceptance, exact newspaper, audit, result, archive, + manifest, provenance, and service-isolation proof, then independent blind + editorial and grounding acceptance. Deliver the actual copy only if both + independent reviews accept. 4. Defer multiple publication Personas, TeX layout, and engraved cuts until the single Canopy Ledger passes. 5. Per-wave issues may use daily-like reporting windows, while a final diff --git a/notes/ghostlight-current-system-map.md b/notes/ghostlight-current-system-map.md index 37b80c2..1db6c16 100644 --- a/notes/ghostlight-current-system-map.md +++ b/notes/ghostlight-current-system-map.md @@ -1297,8 +1297,13 @@ The deliberative newsroom boundary is live under this authority map: candidate agenda, its exact digest, and commit admission. The initial publication editor owns the first prose proposal. The admitted agenda remains the sole owner of article selection, order, focus, citation grouping, and - framing. The copy desk owns factual judgment. `WorldKernel` remains the only - world-event writer. Query results and editorial proofs own nothing. + framing. The copy desk owns factual judgment. The Night Editor owns + editorial-quality acceptance and article-specific findings after factual + clearance. The publication rewrite desk owns prose repair for either desk's + rejection, and the shared publication-review primitive owns the fixed review + order: copy desk first, Night Editor second. `WorldKernel` remains the only + world-event writer. Query results, editorial proofs, and both review verdicts + own no world facts. - **Inputs:** one exact campaign revision, publication title and voice, article budget, source-receipt ancestry, and newsroom contract version. Through the existing generic agent harness, the selector issues deterministic bounded @@ -1343,28 +1348,36 @@ The deliberative newsroom boundary is live under this authority map: each article on its focus record's consequential fact, and may not widen or regroup the selection. Record bookkeeping, memory retention, maintained warnings, and procedure are not automatically the lede merely because they - are recent. The copy desk and rejected-copy rewrite desk see the same - selected-record projection. -- **Grounding path:** accepted stable IDs lower once into the existing + are recent. The copy desk, Night Editor, and publication rewrite desk see the + same selected-record projection. +- **Review and grounding path:** accepted stable IDs lower once into the existing self-contained semantic audit with source news IDs, channels, reliability, exact account text, assertion status, event IDs, supported identity attributes, institutions, populations, and places. Reader-facing numeric - labels are assigned only during lowering. Rejected copy enters one - publication-owned rewrite desk. That agent receives - the exact copy-desk findings, frozen selected-record projection, publication - title and house voice, admitted agenda, and current frozen page. It may + labels are assigned only during lowering. The copy desk first judges every + concrete reader-facing claim against those exact cited records. Only a + factually accepted page reaches the Night Editor, which judges whether the + page makes the admitted throughline and strongest honest case legible from + the same selected records. Either desk may reject through one tagged desk + verdict. Rejected copy enters one publication-owned rewrite desk. That agent + receives the rejecting desk's exact findings, frozen selected-record + projection, publication title and house voice, admitted agenda, and current + frozen page. It may rewrite all reader-facing prose of only the articles named by the findings: headline, deck, dateline, and paragraphs. Its deterministic workbench merges only those complete article rewrites into the page, preserves article selection, order, section, byline, citations, every unaffected article, and - all world state, then invokes the same copy desk on the whole resulting page. + all world state, then invokes the same shared publication review on the whole + resulting page. Acceptance requires both an accepted factual verdict and an + accepted editorial-quality verdict. - **Invariants:** private events do not enter the query surface; every selected stable ID resolves at the bound revision; article facts remain constrained to selected records; story order, selection, citation grouping, and focus remain agenda-owned; no proposal can become editor input without one intervening deterministic proof observation and an exact-current-digest commit; omitted public facts remain true; query, - proof, editing, copy review, and rewrite cannot mutate the world; the rewrite + proof, editing, factual review, editorial-quality review, and rewrite cannot + mutate the world; the rewrite desk cannot change an unaffected article or retain a rejected article by editing around one phrase; resume does not rerun selection or initial editing. If the admitted selection and citations cannot support an honest @@ -1379,34 +1392,42 @@ The deliberative newsroom boundary is live under this authority map: set. The copy desk cannot rewrite prose. The rewrite desk cannot select or delete articles; reorder them; change section, byline, citation membership, agenda, findings, facts, title, or house voice; rewrite an article absent from - the rejected verdict; persist checkpoints; or accept its own copy. Caches and - renderers cannot decide record equivalence, assertion status, story + the rejected verdict; persist checkpoints; or accept its own copy. The copy + desk cannot decide whether accurate prose is compelling journalism. The + Night Editor cannot relitigate factual grounding, demand facts absent from + the selection, select stories, rewrite prose, or accept its own requested + repair. Caches and renderers cannot decide record equivalence, assertion + status, story relevance, or fact completion. The newspaper module has no second event-kind status switch. - **Shared paths:** fresh composition queries stable records, proposes one or more agendas, observes the deterministic front-page proof for each proposal, and commits exactly one current candidate before invoking the editor. Editor, - copy desk, lowering, audit, and rejected-copy rewrite all dereference that - committed agenda's same stable IDs. On rejection, both fresh and resumed - paths derive the affected article set from the exact verdict, invoke the same - rewrite desk with the same frozen facts, title, house voice, and agenda, - merge the complete rewrites through the same deterministic workbench, and - rerun the same copy desk. Resume reconstructs the selected projection from + copy desk, Night Editor, lowering, audit, and rewrite desk all dereference + that committed agenda's same stable IDs. Initial editor output and every + merged rewrite call the same `run_publication_review` primitive: the copy + desk runs first, and only factual acceptance reaches the Night Editor. On + either rejection, both fresh and resumed paths derive the affected article + set from the exact tagged verdict, invoke the same rewrite desk with the same + frozen facts, title, house voice, and agenda, merge the complete rewrites + through the same deterministic workbench, and return through that same + two-desk review primitive. Resume reconstructs the selected projection from the checkpointed committed agenda and bound ledger without replaying selection, proof, commit, or initial editing. Accepted-composition idempotence returns the stored issue. -- **Persistence and compatibility:** reconciliation checkpoint v2 binds the - agenda, draft, verdict, task and exact editorial bindings, immutable receipt +- **Persistence and compatibility:** reconciliation checkpoint v3 binds the + agenda, draft, tagged rejecting-desk verdict, task and exact editorial + bindings, immutable receipt chain, generation, and parent. The internal contract is - `canopy-ledger-publication-rewrite-desk.v6`; it prevents pre-cut compositions - and checkpoints from winning current idempotence, so phrase-repair - checkpoints cannot resume as rewrite-desk authority. Candidate + `canopy-ledger-night-editor.v7`; it prevents pre-cut compositions and + checkpoints from winning current idempotence. Candidate agendas and proofs are ephemeral within one bounded selector run; only the committed agenda and its ordered model-receipt ancestry cross into editor and - reconciliation persistence. Public issue schema v3 and the accepted - composition envelope remain structurally unchanged. The read-only `angle` + reconciliation persistence. Public issue schema v3 remains unchanged. + Accepted composition envelope v2 stores both factual and editorial verdicts, + and current idempotence requires both to be accepted. The read-only `angle` alias and empty legacy `focus_citation` default can decode historical rows - but cannot authorize a fresh v6 compose. + but cannot authorize a fresh v7 compose. - **Cut line:** `NewsroomSource`, transient ordinal selection IDs, fact-bundle deduplication, fixed newest-32/preceding-12/foundational-12 windows, per-story and total citation ceilings, global record uniqueness across @@ -1416,7 +1437,9 @@ The deliberative newsroom boundary is live under this authority map: Phrase replacements, finding references, target-field and paragraph addressing, byte-span resolution, overlap ordering, empty-phrase deletion, and article deletion are deleted. No compatibility path may retain - any of those operations as an alternate writer. Complete rejected-article + any of those operations as an alternate writer. The copy-desk-only + acceptance path is deleted: no initial draft or rewritten page can lower into + an accepted composition without both desk verdicts. Complete rejected-article prose is the rewrite unit, and the admitted agenda plus deterministic merge remains the owner of everything around it. Query projection and front-page proof reuse the generic agent harness and @@ -1436,12 +1459,15 @@ The deliberative newsroom boundary is live under this authority map: citations, agenda, and unaffected article bytes survive unchanged; old finding-ref/span/delete commands are absent from schemas and code; malformed, partial, duplicate, unknown, or unaffected-article rewrites are rejected; - the same whole-page copy desk judges every merged draft; exact-chain resume + the same whole-page two-desk review judges every initial and merged draft; + Night Editor findings target one exact unique passage and an achievable + rewrite goal without widening the selected facts; exact-chain resume reaches that same workbench without the initial editor; and no world event or - campaign revision changes. The bounded package, strategic-smoke, formatting, - state, and system-map gates pass at 28/28 focused newspaper tests, 483/483 - library tests, and 15/15 strategic-smoke tests. The cut adds no service, - crate, dependency, event authority, or simulation pass. + campaign revision changes. Verification remains bounded to the existing + newspaper library and strategic-smoke targets plus formatting, state, and + system-map gates; the current focused gates pass at 30/30 newspaper tests, + 485/485 library tests, and 15/15 strategic-smoke tests. The cut adds no + service, crate, dependency, event authority, or simulation pass. Run 54 is immutable mechanically complete evidence at exact source `01581b8576774f370884e331558605e7ef5e1b9b`, implementation @@ -1465,7 +1491,7 @@ or communicated public scope before `NewsIssue` materialization. Revision 27 remains immutable evidence and is not rewritten for this newsroom-only acceptance. -The resumable composition and rejected-copy rewrite boundary is live: +The resumable composition and publication-review rewrite boundary is live: - **Owner:** `newspaper::advance_world_newspaper` is the single composition, checkpoint-advance, resume, and accepted-composition owner. `CampaignStore` @@ -1475,17 +1501,21 @@ The resumable composition and rejected-copy rewrite boundary is live: rewrite desk proposes complete reader-facing prose for rejected articles only. Its deterministic workbench owns affected-article membership, frozen field preservation, merge, local structural validation, and reinvocation of - the copy desk. The copy desk alone accepts or rejects factual grounding. + the shared publication review. The copy desk alone accepts or rejects factual + grounding; the Night Editor alone accepts or rejects editorial quality after + grounding passes. The same rewrite desk handles the tagged rejection from + either owner and cannot accept its own result. - **Inputs:** one exact `Campaign` snapshot, title, editorial voice, article budget, model port, and `CampaignStore`. A publication-task binding covers campaign id and revision plus title, voice, and budget. The editorial binding additionally covers the exact ordered public-record projections derived from the bound `NewsIssue` and `Event` ledger. Each rewrite action receives the - admitted agenda, current frozen page, complete exact copy-desk verdict, + admitted agenda, current frozen page, complete exact rejecting-desk verdict, selected frozen facts, publication title, and house voice. This lets the owner find the task's checkpoint chain while still rejecting same-task source drift before inference. -- **Outputs:** acceptance is one immutable persisted composition. A still +- **Outputs:** acceptance is one immutable persisted composition containing an + accepted factual verdict and an accepted editorial-quality verdict. A still rejected page is typed `Pending`, carrying the current immutable checkpoint and complete ordered receipt chain; pending is not a `WorldNewspaperCompositionFailure`. Fatal model, schema, local-validation, @@ -1494,33 +1524,41 @@ The resumable composition and rejected-copy rewrite boundary is live: complete reader-facing prose replacement for every rejected article and none for any other article. The workbench emits a merged full-page draft only after preserving the frozen fields and unaffected articles. -- **Persistent and derived state:** the initial copy-desk rejection persists its - narrative-selection, editor, and copy-desk receipts, then publishes - generation zero before any rewrite action. Each later rejected action persists - its new receipts before +- **Persistent and derived state:** the initial review rejection persists its + narrative-selection, editor, copy-desk, and, when factual review passed, + Night Editor receipts, then publishes generation zero before any rewrite + action. Each later rejected action persists its new receipts before appending one checkpoint with task and editorial bindings, generation, parent id, typed origin, admitted editorial agenda, current private draft, - rejected verdict, ordered receipt ids, and receipt-chain digest. The rejected - article-index set, per-article rewrite schema, immutable-field comparison, - selected fact projection, and chain tip are derived and validated; they are - not parallel state owners. Three actions per call remain only the current + tagged rejecting-desk verdict, ordered receipt ids, and receipt-chain digest. + Checkpoint v3 verifies that the latest review receipt matches the desk named + by that rejection. The rejected article-index set, per-article rewrite schema, + immutable-field comparison, selected fact projection, and chain tip are + derived and validated; they are not parallel state owners. Each persisted + verdict is also validated so acceptance is true exactly when its finding set + is empty. + Three actions per call remain only the current advance cadence. Reaching that boundary returns `Pending` and does not make rejection terminal. - **Resume and idempotence:** every call checks the accepted composition marker before checkpoint discovery. Otherwise it loads the unique checkpoint tip, reloads every typed receipt, validates checkpoint identity, task and exact editorial bindings, generation and parent links, strict receipt-prefix - growth, agenda admission and editor alignment, draft, rejected verdict and - rejected article membership, then reconstructs the same rewrite workbench. A + growth, agenda admission and editor alignment, draft, tagged rejecting-desk + verdict, rejecting-desk receipt, and rejected article membership, then + reconstructs the same rewrite workbench. A resumed action includes the checkpoint id and every prior receipt in its causal ancestry and - never invokes the initial editor. Acceptance - persists its receipts and a composition linked to the source checkpoint; + never invokes the initial editor. Acceptance persists its receipts and a + composition-v2 envelope linked to the source checkpoint only when both + review verdicts accept; later calls return that composition without model work even though the historical pending chain remains immutable. -- **Forbidden writers:** the initial editor, rewrite desk, and copy desk may - propose, rewrite, and judge within their named seams but cannot persist or - resume reconciliation state. The rewrite desk cannot alter article count, +- **Forbidden writers:** the initial editor, rewrite desk, copy desk, and Night + Editor may propose, rewrite, or judge only within their named seams and cannot + persist or resume reconciliation state. The copy desk cannot own editorial + quality; the Night Editor cannot own factual admission or prose; neither may + bypass the other. The rewrite desk cannot alter article count, selection, order, section, byline, citations, agenda, unaffected articles, findings, facts, world state, or acceptance. Registry, strategic smoke, renderers, JSON result/checkpoint projections, world cells, Nemesis, clocks, @@ -1529,7 +1567,9 @@ The resumable composition and rejected-copy rewrite boundary is live: already accepted issue to repair editorial copy. - **Shared paths:** Registry calls `advance_world_newspaper` directly. Strategic live per-wave, missing-issue recovery, and final-combined composition use a - thin `compose_persisted_newspaper` delegate to that same owner and store. A + thin `compose_persisted_newspaper` delegate to that same owner and store. All + entry paths use the same initial-or-resumed rewrite workbench and the same + ordered copy-desk-then-Night-Editor review primitive. A pending interim issue is recorded in its immutable wave report and does not stop later strategic waves; recovery resumes it from `CampaignStore`. A pending final combined issue writes pending result/status projections and @@ -1553,12 +1593,14 @@ The resumable composition and rejected-copy rewrite boundary is live: phrase-edit command algebra, finding reference catalog, field and paragraph target resolution, byte ranges, overlap ordering, whitespace seam, and article-delete branch before adding the rejected-article rewrite command. - None remains as a compatibility writer. + None remains as a compatibility writer. Copy-desk acceptance is no longer + publication acceptance, and no second rewrite mechanism was added for Night + Editor findings. - **Verification layer:** focused tests prove typed harness exhaustion, generation zero plus one append per rejected rewrite, typed pending after three `REWRITE_DESK_ACTIONS_PER_ADVANCE`, exact-chain resume without the initial editor, cumulative - receipt and copy-desk ancestry, accepted-composition idempotence without + receipt and review ancestry, accepted-composition idempotence without inference, same-task source-drift rejection and fork rejection before inference, typed legacy import through the common validator, and Registry preservation of pending state. Implemented negative tests require the exact @@ -1568,12 +1610,16 @@ The resumable composition and rejected-copy rewrite boundary is live: exposes only the rejected article-index enum and complete headline, deck, dateline, and paragraph fields; it exposes no section, byline, citations, or finding reference. Focused path tests prove the same selected records, title, - house voice, agenda, and exact findings reach the desk; the same whole-page - copy desk judges the merge; repeated rejection may invoke another whole + house voice, agenda, and exact findings reach the desk; initial drafts and + merged rewrites use the same ordered publication review; a copy-desk + rejection skips the Night Editor, while factual acceptance must still obtain + Night Editor acceptance; a Night Editor rejection returns through the same + full-article rewrite path; repeated rejection may invoke another whole rewrite without another initial editor; exact-chain resume preserves receipt - ancestry; and accepted output retains the admitted source IDs. The current - verified gates are 28/28 focused newspaper tests, 483/483 library tests, and - 15/15 strategic-smoke binary tests. + ancestry; and accepted output retains the admitted source IDs plus both + verdicts. Strategic recomposition receipt v2 binds and validates both verdict + digests while historical receipt v1 remains readable evidence. No event, + world-simulation, selector, agenda, or source-provenance authority moved. The typed issue retains exact event IDs, channels, reliability, source revision, and model receipts as audit data. Its internal issue time is derived @@ -1585,8 +1631,9 @@ commit always project the final completed wave, matching the top-level counts and persisted campaign head; per-wave history remains under `waves`. The reader renderer has no path to provenance fields and escapes all model- and consumer-supplied plain text before Markdown emission; the provenance renderer -applies the same plain-text boundary to its audit data. Neither editor, copy -desk, renderer, nor receipt persistence can write world state. +applies the same plain-text boundary to its audit data. Neither editor, rewrite +desk, copy desk, Night Editor, renderer, nor receipt persistence can write +world state. #### Acceptance-driver per-wave newspaper recovery @@ -1605,12 +1652,14 @@ desk, renderer, nor receipt persistence can write world state. already exists, its immutable receipt and exact named reader/audit files are additional inputs. - **Output:** acceptance writes one separately named immutable recomposition - checkpoint containing the issue, grounding verdict, and newspaper model - receipts, plus the rendered reader and audit files. Its receipt binds the + checkpoint containing the issue, grounding verdict, editorial verdict, and + newspaper model receipts, plus the rendered reader and audit files. Its + receipt binds the narrowed source campaign, recovery boundary, title/voice/article-budget contract, issue, model-receipt collection, expected filenames, and both - rendered byte streams by digest. Current v3 receipts additionally bind the - complete typed grounding verdict by digest. The configured boundary is also + rendered byte streams by digest. Current recomposition v2 receipts bind the + complete typed grounding and editorial verdicts by digest. The configured + boundary is also projected through run status and success or failure result artifacts. The driver fills only the missing newspaper fields in its in-memory result projection. Pending reconciliation @@ -1637,8 +1686,9 @@ desk, renderer, nor receipt persistence can write world state. consumer recovery and cannot repair mechanics. - **Shared paths:** live per-wave composition, recovery composition, and final combined composition all call the thin `compose_persisted_newspaper` delegate - into `advance_world_newspaper`, including the same grounding/copy-desk, - checkpoint-resume, and receipt-persistence owner. A later resume advances a + into `advance_world_newspaper`, including the same ordered factual and + editorial review, checkpoint-resume, and receipt-persistence owner. A later + resume advances a pending library checkpoint without rerunning the editor. Once accepted, it consumes the successful recomposition artifact instead of paying for the newspaper again. The driver recomputes its wave, source-campaign, and @@ -1646,11 +1696,13 @@ desk, renderer, nor receipt persistence can write world state. boundary, and checks the exact issue value, typed model-receipt set, reader bytes, and audit bytes against their immutable digests. A current-schema issue and grounding verdict are additionally deserialized, their grounding digest - is required, and the issue is rendered again. A historical v2 accepted issue + is required, and the issue is rendered again. Current recomposition v2 also + deserializes the accepted editorial verdict and requires its exact digest. A + historical v2 accepted issue is structurally deserialized only as v2 and is not reinterpreted through the current issue type or renderer; its original receipt owns those historical bytes, and the driver carries its JSON only as an inert result projection. - Historical v2 predates `grounding_digest`, so this local validator requires + Historical issue v2 predates `grounding_digest`, so this local validator requires accepted status but does not claim a retroactive digest for its complete grounding verdict. Whole-checkpoint integrity instead remains anchored by the unchanged Run 51 source-root/archive hash and Run 52 before/after artifact @@ -1659,9 +1711,10 @@ desk, renderer, nor receipt persistence can write world state. renderer output are no longer authorities over a historical accepted issue. Raw digest verification is not a migration path and cannot create, repair, or reaccept a paper: all applicable original source, contract, filename, issue, - receipt-set, and byte bindings must already be present and exact. Current v3 - also requires its exact grounding digest; historical v2 keeps the explicitly - bounded accepted-status plus archive/manifest proof described above. + receipt-set, and byte bindings must already be present and exact. Current + issue v3 requires its exact grounding digest, and recomposition v2 additionally + requires exact editorial acceptance and digest; historical issue v2 keeps the + explicitly bounded accepted-status plus archive/manifest proof described above. Strategic state and per-wave artifacts remain forbidden writers. - **Verification layer:** the focused boundary regression proves that a second wave is recomposed from only its newly appended news row while retaining the @@ -1676,8 +1729,9 @@ desk, renderer, nor receipt persistence can write world state. skipped while later missing issues are selected. Dedicated regressions prove that historical v2 preserves its recorded original recovery boundary and accepts exact historical bytes without current rendering while rejecting byte - drift, and that current v3 still requires typed deserialization, exact - rendering, and an exact grounding digest. The strategic binary gate is 15/15. + drift, that current issue v3 still requires typed deserialization, exact + rendering, and an exact grounding digest, and that current recomposition v2 + rejects editorial-verdict drift. The strategic binary gate is 15/15. The first-wave limit is now an explicit closed boundary rather than inferred recovery: when wave one is selected, the driver refuses to compose without a diff --git a/state/map.yaml b/state/map.yaml index 39f79c6..ba76934 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -326,7 +326,7 @@ data_flow: current_status: summary: Ghostlight's generic consumer boundary admits sparse WorldSeeds, runs the hundreds-class parallel cell machinery used by Dungeon, and projects grounded newspapers from committed public events. Local acceptance proves 1,000 subjects across 200 cells and two-wave durable named-person emergence. Exact-source provider run 38 at `596e50679244b5d42b4cfdf70d723f815751b8ff` resumed the preserved world at revision 8 without replaying compilation or four committed locality elaborations, recovered 51 of 52 strategic-wave cells on pulse three and the final cell on pulse four, then committed all six waves through revision 14. Pushed commit `3a69306f3004e4af2cd57bba612a6ad8d1b8132f` implements the mapped clock-consequence owner and is verified locally: world clocks own declared consequence text and exact observable scope; a bounded agent may propose legacy scope binding, while `WorldKernel` alone admits it and materializes stable threshold-crossing events and public news through the common mutation path. Binding, emitted-event ancestry, mutation receipts, and the next newspaper boundary persist atomically. Exact-source run 39 resumed run 38 without replaying its six committed waves, bound clock consequences, committed six new waves through revision 21, and emitted Issues 7 through 12 plus a final digest. This completes the mechanical provider acceptance path; all inherited wave 1-6 checkpoint hashes match run 38 exactly and live services were unchanged. Independent blind editorial review returns FAIL: only Issue 7 approaches spicy, while Issues 8-12 are dominated by plans, filings, inspections, warnings, and abstract relationship deltas without betrayal, scandal, public reaction, sustained reversal, or material lived cost. That run-39 diagnosis is superseded for the current phase: run 51 closes the world and reconciliation mechanics, and the active defect belongs to newsroom narrative selection and self-contained semantic provenance over immutable facts. Independent grounding review also returns FAIL: Issue 9 inflates a planned expedited agenda into completion, while Issue 8 assigns unsupported feminine pronouns to Sela Venn and Eryn Tal. Other grounding mechanics pass: 208/208 citations resolve, no future events appear, no replay occurred, the player remained unchanged, all 116/116 manifest entries verify, the archive is exact, and root independently confirmed the live service PIDs and invocation IDs remained unchanged. Editorial and grounding acceptance are terminally failed for run 39. Eight titled elaborators use the generic agent harness under deterministic weighted scheduling, bounded parallelism, and Luna/Terra/Sol routing. Workers remain proposal-only; deterministic admission binds exact frozen schedules, dispatch, receipts, conflicts, and semantic verification, and `WorldKernel` alone owns atomic CultCache persistence. Destination reconciliation is a private transactional workbench, provider schema compatibility is lowered once at the shared model-connector boundary, and durable elaboration and strategic-pulse checkpoints bind to their canonical mutation proofs. The generic ModelAgent harness remains consumer-neutral transport. Provider run 23 remains stopped; earlier failed runs and checkpoint archives remain immutable provenance. The live daemons remain outside the acceptance body. Dungeon play remains regression pressure, the Delvehold game-side adapter remains unimplemented, and unpublished Mars and Kalsa destination previews remain unapproved. - provider_acceptance_checkpoint: Exact-source run 56 at `c34c4b1f94706661cdc35d5314ea23347bda6fd7` is an immutable mechanically complete newspaper-only run over the frozen revision-27 simulation. Independent grounding and blind editorial reviews both fail. The query-backed selector and deliberative lead challenge worked: the newsroom chose the consequential lead. The remaining repair path then reduced rejected copy through phrase-level grounding reconciliation, producing compliance prose rather than a source-safe journalistic structure. Run 55 and its exact hashes remain immutable prior evidence. - implementation_checkpoint: Pushed exact commit `0c1400985c061c0db44969288846eff79eeed69a` owns contract `canopy-ledger-publication-rewrite-desk.v6` over the deliberative selector. Phrase-level repair is replaced by a publication-owned full-article rewrite desk over the admitted selection, exact canonical public records, rejected articles, and complete copy-desk findings. The deterministic workbench freezes article selection, order, sections, bylines, citations, and unaffected articles; the rewrite desk may reconstruct all reader-facing prose for every rejected article, then the same independent copy-desk agent rechecks the whole page as factual judge. Typed rewrite checkpoints preserve the exact draft, verdict, selected records, and receipt chain for resume without editor or simulation replay. Verification passes 28/28 focused newspaper tests, 483/483 library tests, and 15/15 strategic-smoke tests. The audit explicitly discloses when an immutable source account reaches the shared 240-character public-event summary boundary: it shows the complete stored account and asserts nothing beyond it, so reviewers must not mistake that owned world boundary for newsroom truncation. No fact, world, or event authority moves into the rewrite desk. The separate kernel publicity defect remains recorded and revision 27 remains immutable. - next_action: Preserve immutable runs 55 and 56 and the exact live services; stage pushed commit `0c1400985c061c0db44969288846eff79eeed69a` against run 56's frozen revision-27 campaign and accepted per-wave publications. Run one immutable final-newspaper-only acceptance with no world or per-wave replay, retaining and resuming typed rewrite checkpoints rather than rerunning the publication writer. Require exact newspaper, audit, result, archive, manifest, provenance, and service-isolation proof, then obtain independent blind editorial and grounding reviews. Deliver the actual copy only if both accept. Keep the weekly-style current-issue model; defer multi-publication Personas, TeX layout, and engraved cuts. + provider_acceptance_checkpoint: Exact-source run 57 at `0c1400985c061c0db44969288846eff79eeed69a`, using rewrite-desk contract v6, is an immutable mechanically complete newspaper-only run over frozen world revision 27 with 18 waves, 363 events, and 853 news rows. Newspaper SHA-256 is `d90758f411193aa6e86ae2e8cb390650d9b8a58eac77ef87018bd61e9a668c57`, audit is `895268bc22aa3e4176b1da31388e85327f0fe11e4ea4ea4ee600b4e3270a8eed`, and archive is `241354b669ee2357c9bb7a06e10e0b93378637621ff2b8b27ab7cf35c2e44e28`. Mechanical grounding accepts. Independent blind editorial review fails: the lead and other stories remain administrative, lived stakes stay abstract, no named accountable Greathold opposition appears, the severed hands are buried without court responses or suspects, and the seed-vault story repeats procedure. The admitted editorial agenda is materially sharper than the rendered copy, so world simulation, ledger access, and lead selection are not the active blocker. + implementation_checkpoint: The completed local Night Editor cut owns contract `canopy-ledger-night-editor.v7` and is verified but not yet committed or provider-accepted. The independent copy-desk agent remains the sole factual judge. After factual clearance, the publication-owned Night Editor judges editorial quality against the admitted agenda and selected facts; a rejection names exact article passages and achievable editorial goals, then enters the same publication-owned full-article rewrite path used for factual rejection. Every revision returns through copy-desk judgment and Night Editor judgment before acceptance. The Night Editor gains no fact, world, event, selection, or persistence authority. Verification passes 30/30 focused newspaper tests, 485/485 library tests, and 15/15 strategic-smoke tests. The shared 240-character public-event summary disclosure remains part of the audit. The separate kernel publicity defect remains recorded and revision 27 remains immutable. + next_action: Commit the exact verified Night Editor v7 worktree and push that resulting commit; do not claim a hash until it exists remotely. Preserve immutable runs 55 through 57 and the exact live services, then stage that exact pushed commit for immutable Run 58 as a newsroom-only continuation from run 57's frozen revision-27 campaign and accepted per-wave publications. Replay no world mechanic or wave. Retain and resume typed rewrite checkpoints, and require both internal verdicts—copy desk factual acceptance and Night Editor editorial-quality acceptance—plus exact newspaper, audit, result, archive, manifest, provenance, and service-isolation proof. Then obtain independent blind editorial and grounding acceptance and deliver the actual copy only if both accept. Defer multi-publication Personas, TeX layout, and engraved cuts. gestalt_population: Gestalt Personas own shared population baselines; persistent member deltas own named individuality; WorldKernel materialization and approval-gated fission preserve lineage and identity. Materialisation/folding changes only representation and the exact member delta, advances resolution epoch, and retires the old cover; it has no Gestalt-wide effect authority. Selected actionable member exceptions are mandatory Projector perspective owners, so aggregation cannot silently erase their decision. Presence projection is limited to nearby active leaves and exact-location dormant members, includes reciprocal player relationship evidence, and may propose an earned cast without committing it. Simulation cells are derived covers only.