Order repo work maps by Mind admission

This commit is contained in:
Meta Vens 2026-07-13 00:43:27 +01:00
commit c300b4ca91
5 changed files with 94 additions and 2 deletions

View file

@ -5527,7 +5527,14 @@ pub fn write_epiphany_cultmesh_repo_work_map_entry(
validate_repo_work_map_entry(&map_entry)?;
let mut node = open_epiphany_cultmesh_node(&store_path, map_entry.runtime_id.clone())?;
let written = node.put(map_entry.map_entry_id.clone(), &map_entry)?;
node.put(EPIPHANY_CULTMESH_REPO_WORK_MAP_ENTRY_LATEST_KEY, &written)?;
let current_latest = node.get::<EpiphanyCultMeshRepoWorkMapEntry>(
EPIPHANY_CULTMESH_REPO_WORK_MAP_ENTRY_LATEST_KEY,
)?;
if current_latest.as_ref().is_none_or(|current| {
repo_work_map_admission_key(&written) >= repo_work_map_admission_key(current)
}) {
node.put(EPIPHANY_CULTMESH_REPO_WORK_MAP_ENTRY_LATEST_KEY, &written)?;
}
node.flush()?;
Ok(written)
}
@ -5711,6 +5718,15 @@ fn validate_repo_work_map_entry(entry: &EpiphanyCultMeshRepoWorkMapEntry) -> Res
"repo work map entry projection requires admitted durable state"
));
}
let admitted_at = DateTime::parse_from_rfc3339(&entry.admitted_at)
.map_err(|error| anyhow!("repo work map entry has invalid admitted_at: {error}"))?;
let mirrored_at = DateTime::parse_from_rfc3339(&entry.mirrored_at)
.map_err(|error| anyhow!("repo work map entry has invalid mirrored_at: {error}"))?;
if mirrored_at < admitted_at {
return Err(anyhow!(
"repo work map entry was mirrored before Mind admission"
));
}
if entry.tui_rows.is_empty() {
return Err(anyhow!("repo work map entry requires compact TUI rows"));
}
@ -5726,6 +5742,16 @@ fn validate_repo_work_map_entry(entry: &EpiphanyCultMeshRepoWorkMapEntry) -> Res
Ok(())
}
fn repo_work_map_admission_key(
entry: &EpiphanyCultMeshRepoWorkMapEntry,
) -> (DateTime<FixedOffset>, &str) {
(
DateTime::parse_from_rfc3339(&entry.admitted_at)
.expect("validated repo work map admission timestamp"),
entry.map_entry_id.as_str(),
)
}
fn validate_repo_work_public_proof(proof: &EpiphanyCultMeshRepoWorkPublicProofEntry) -> Result<()> {
if proof.private_state_exposed {
return Err(anyhow!(
@ -7374,6 +7400,60 @@ mod tests {
Ok(())
}
#[test]
fn repo_work_map_latest_follows_mind_admission_not_mirror_arrival() -> Result<()> {
let temp = tempfile::tempdir()?;
let store = temp.path().join("repo-work-map-order.ccmp");
let older = EpiphanyCultMeshRepoWorkMapEntry {
schema_version: EPIPHANY_CULTMESH_REPO_WORK_MAP_ENTRY_SCHEMA_VERSION.to_string(),
runtime_id: "repo-work-test".to_string(),
verse_id: EPIPHANY_CULTMESH_LOCAL_AREA_VERSE_ID.to_string(),
map_entry_id: "repo-work-map-older".to_string(),
admitted_at: "2026-07-13T01:00:00Z".to_string(),
mirrored_at: "2026-07-13T01:00:01Z".to_string(),
workspace: "E:/Projects/test".to_string(),
item: "test-item".to_string(),
branch: "main".to_string(),
changed_paths: vec!["src/lib.rs".to_string()],
commit_sha: "older".to_string(),
safe_action_family: "planning-note".to_string(),
modeling_summary: "Older admitted map.".to_string(),
soul_verdict_receipt_id: "soul-older".to_string(),
mind_gateway_review_id: "mind-review-older".to_string(),
mind_state_commit_receipt_id: "mind-commit-older".to_string(),
publication_gate: "bifrost".to_string(),
durable_state_admitted: true,
source_store_path: "state/runtime.cc".to_string(),
tui_rows: vec!["MAP test-item older".to_string()],
private_state_exposed: false,
notes: Vec::new(),
modeling_finding_receipt_id: "modeling-finding-older".to_string(),
modeling_route_id: "modeling-route-older".to_string(),
modeling_generation: 1,
};
let mut newer = older.clone();
newer.map_entry_id = "repo-work-map-newer".to_string();
newer.admitted_at = "2026-07-13T02:00:00Z".to_string();
newer.mirrored_at = "2026-07-13T02:00:01Z".to_string();
newer.commit_sha = "newer".to_string();
newer.modeling_generation = 2;
write_epiphany_cultmesh_repo_work_map_entry(&store, newer.clone())?;
write_epiphany_cultmesh_repo_work_map_entry(&store, older.clone())?;
assert_eq!(
load_latest_epiphany_cultmesh_repo_work_map_entry(&store, "repo-work-test")?,
Some(newer)
);
let mut impossible = older;
impossible.map_entry_id = "repo-work-map-impossible".to_string();
impossible.mirrored_at = "2026-07-13T00:59:59Z".to_string();
let err = write_epiphany_cultmesh_repo_work_map_entry(&store, impossible)
.expect_err("map projection before Mind admission must be refused");
assert!(err.to_string().contains("before Mind admission"));
Ok(())
}
#[test]
fn scheduler_latest_mirror_refuses_delayed_replay() -> Result<()> {
let temp = tempfile::tempdir()?;

View file

@ -562,3 +562,13 @@ production/lower-bound times with the accepted-verification lower bound no
later than packet production. `latest` advances by `(production time,
telemetry ID)`. The old fixture's future lower bound was corrected rather than
blessed as prophecy.
## Mirror arrival presented as latest Mind-admitted repo map
The repo-work map is a projection of Mind-admitted durable state and drives
queue visibility, but its `latest` mirror was overwritten by arrival order and
its admission/mirror timestamps were unchecked strings. A delayed projection
of an older admission could therefore become the queue's current map. Map
entries now require valid RFC3339 admission/mirror times, reject projection
before Mind admission, and advance `latest` by `(admission time, map entry ID)`.
Mirror latency is metadata; it does not own state progression.

View file

@ -143,6 +143,8 @@ The confirmed conceptual substitutions have been cut:
- Work-loop telemetry is now validated internal evidence and production-time
ordered. Delayed or wrong-Verse packets cannot replace Soul/Modeling's
current Hands consequence chain; future receipt lower bounds are refused.
- Repo-work map `latest` is Mind-admission-time-owned. Delayed older projections
cannot rewind the queue map, and mirroring before admission is refused.
The presentation boundary is now plain: `swarm overview` is a generic compact read-only projection. Gjallar is a downstream TUI application on Nightwing and is not an Epiphany organ, provider, owner, runtime, or architectural dependency. Eve/CultUI graphs may be lowered or composited downstream without Epiphany caring which presentation client does it.

Binary file not shown.

View file

@ -660,4 +660,4 @@ current_status:
- Service lifecycle receipt history is now event-only: `load_epiphany_cultmesh_daemon_service_lifecycle_receipts` filters out the `epiphany-local/daemon-service-lifecycle-receipt/latest` mirror, while `load_latest_epiphany_cultmesh_daemon_service_lifecycle_receipt` remains the latest-state reader. Focused unit test `service_lifecycle_receipt_history_excludes_latest_mirror` proves two per-receipt writes return exactly two history records and latest points at the second. Fresh smoke `verse-query-lifecycle-history-filter-smoke` and live overview/triage `local-20260618-145632-497-efac6f0d` / `local-20260618-145632-321-867947af` prove compact swarm sights still expose service lifecycle attention plus the present elevated runbook artifact without daemon pokes or service mutation. Do not use a broad unscoped cargo test filter for this check on Windows; it fans out across bin harnesses and hit a broken pipe during this pass.
- `epiphany-verse-query seed-compact` is the compact seed receipt for wrappers and read-only rites. The older `seed` command still prints the full local Verse context for explicit debugging, but compact wrapper modes now avoid full `seed`/final `query` readback after the combined overview proof exposed Windows debug stack overflow from full-context serialization pressure.
last_completed_repo_swarm_cut: Huginn live-fire has crossed the first real repo Body from Persona pressure to branch-local Hands commit and Soul/Mind closure, and now has repeatable closure and redacted-public-proof mouths. On `E:\Projects\Huginn` branch `epiphany/huginn/first-awakening`, `tools/epiphany_local_run.ps1 -Mode repo-persona-intake` accepted item `huginn-inspection-readback-livefire`, Weksa/Persona intake remained sealed, and `epiphany-work derive-plan` lowered it to model-authored safe family `repo.status_section` for `README.md` only. `tools/epiphany_local_run.ps1 -Mode repo-swarm-run` advanced four bounded pulses: run-from-plan, adopt-from-plan, execute-from-plan, and close-from-execute. Huginn commit `e9b07c38fceabbdc89ea35c2156326c80c0393a2` updated only `README.md`; closure receipt `.epiphany\work\work-close-huginn-inspection-readback-livefire.json` records status `closed`, Soul verdict `passed`, Mind state commit `repo-work-close-huginn-inspection-readback-livefire-mind-commit`, safe family `repo.status_section`, path scope `README.md`, Bifrost publication gate, and `privateStateExposed=false`. Verification also ran Huginn's TypeScript compiler through concrete Node path: `C:\Program Files\nodejs\node.exe E:\Projects\Huginn\node_modules\typescript\bin\tsc -p tsconfig.json` passed. Native verifier `epiphany-repo-livefire-closure-smoke --workspace E:\Projects\Huginn --item huginn-inspection-readback-livefire --expected-path README.md --expected-family repo.status_section --expected-gate awaiting-publication --expected-blocker bifrost-publication-missing` checks closure receipt, Mind map entry, overview gate/blocker, authority seals, and `git show` changed paths, returning `status=ok`, `soulVerdict=passed`, `publicationGate=Bifrost`, and `privateStateExposed=false`. Wrapper `tools/epiphany_local_run.ps1 -Mode repo-livefire-closure -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exposes the same read-only proof through the local operator mouth; artifact `local-20260621-190156-803-2f85ba15` printed commit, path, gate, blocker, Soul verdict, Mind commit receipt, and `privateStateExposed=False` without push, merge, publication, or target mutation. New wrapper `tools/epiphany_local_run.ps1 -Mode repo-work-public-proof -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exports the redacted proof bundle and repo-local Verse index without publishing; artifact `local-20260621-190645-345-4555b1dc` wrote `.epiphany\public\proof-bundles\repo-work-public-proof-huginn-inspection-readback-livefire.json`, proof id `repo-work-public-proof-huginn-inspection-readback-livefire`, SHA-256 `857545b199f3e37eb06c2e757e5cfc201958e46667bb1f8403fd333a22620f63`, nine artifact rows, zero publication rows, and `privateStateExposed=False`. swarm overview readback `local-20260621-190701-140-b9519ec6` sees the `REPO-WORK-PUBLIC-PROOF` row and action row from Huginn's repo-local Verse with the same SHA-256 while Bifrost publication remains missing. Launcher compact modes are now named compact operator-context modes instead of read-only modes, and `bifrost-public-proof` summaries print item, target public Verse, room, proof SHA-256, review receipts, and credit receipts so publication receipts are auditable without claiming upstream sync.
next_action: Continue the conceptual-substitution modeling pass beyond receipt writers. Publication/closure/Hands authority is single-sourced; Idunn lifecycle, scheduler, Hands gate, role-review, coordinator-run, and internal work-loop latest mirrors are validated event-time projections rather than arrival-owned state. Continue auditing other evidence-, security-, or coordination-relevant latest mirrors, service configuration claims, adapters, and destructive path consumers for borrowed authority.
next_action: Continue the conceptual-substitution modeling pass beyond receipt writers. Publication/closure/Hands authority is single-sourced; operational/evidence latest mirrors are validated event-time projections; repo-work map latest is owned by Mind admission time rather than mirror arrival. Continue auditing repo-work overview/readiness projections, other evidence/security mirrors, service configuration claims, adapters, and destructive path consumers for borrowed authority.