Commit graph

1,344 commits

Author SHA1 Message Date
Meta Vens
c47a0785c9 Play surface: an untouched Play box submits an empty continue; seeding is offered only where a vault is configured (PA.f214, PA.f213)
world.play.text carries an authored value "" so the lowering sends text "" for a box left untouched. seed_vault_root() is the one reader of GHOSTLIGHT_SEED_VAULT_ROOT; the surface offers the seed controls, card and descriptor only when it answers, and seed_once reads its root through it. The committed bridge fixture drops its world.seed step, which the real client can no longer produce on an unconfigured server.

Not yet compiled when committed; verification follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 01:02:25 +02:00
Meta Vens
d79a96ede4 Merge remote-tracking branch 'origin/main' into ghostlight-verse/play-faults 2026-10-10 00:53:47 +02:00
Meta Vens
82a500eedb play-faults fix: every faulted-turn test pins the class on the warn line
The shared faulted-turn assertion now takes the expected class and checks the
warn line carries it (Connect, Timeout, BadReply, Status(404), Status(502)),
with the endpoint and reply canaries still absent. Not yet built or tested at
this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 00:35:24 +02:00
Meta Vens
b64b61c345 play-faults fix: the warn line carries the fault's typed class, HTTP status included
close_with_fault now takes a TurnFault (detail plus InferenceFaultClass) and
logs the class beside the fixed detail, so a 404 and a 502 read differently
again. absorb_or_close hands the fault's class through; every non-inference
caller is Unclassified. The &'static str comment now says what it does and
does not guarantee (Box::leak defeats it; the per-port canary tests are the
backstop). Not yet built or tested at this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 00:34:59 +02:00
Meta Vens
189d1d3c2b play-faults fix: the sidecar link errors carry no text
SidecarLinkError::Spawn and Codec held error text that the fault type now
refuses, leaving two never-read payloads; they are unit variants.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-09 23:40:12 +02:00
Meta Vens
97e39f48fd play-faults fix: bound the stalled-body test so a client that ignores its timeout fails it
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-09 23:36:51 +02:00
Meta Vens
3ee4ab8e88 play-faults fix: repair the malformed-reply test literal; the unroutable-model test no longer expects the model name in the fault
The previous commit (29efabe) does not build: a string literal in the new
malformed-reply test was mis-escaped.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-09 23:30:12 +02:00
Meta Vens
29efabe4d8 play-faults fix: a fault's detail is fixed text by type; one timeout owner; pin the malformed-body and default-timeout legs
InferenceFault.detail is a &'static str, so no inference port (local,
connector, SDK) can put an endpoint, request or reply text into a fault. The
connector and SDK details that were built from error text are now fixed per
kind or reason. LocalBinding loses its public response_timeout field; the
short timeout the PlayTable canary needs comes from open_local_port_with_timeout,
which exists only under the ghostlight test-support feature (a dungeon
dev-dependency feature), so a release has one timeout, RESPONSE_TIMEOUT.
Canary tests on the malformed-body path (port and PlayTable), on the SDK and
connector ports, and on the default timeout at both resolving sites.

Not yet built or tested at this commit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-09 23:26:21 +02:00
Meta Vens
5a876bf615 play-faults fix: read the body as bytes so a cut body is a transport failure
reqwest's json() reports a body cut mid-stream as a decode error, so the
is_decode branch in send_fault misclassed it BadReply. The body is now read
with bytes() through send_fault (timeout / connect / no complete reply), and
only a whole body that fails serde_json is classed by bad_reply().

Not yet built at this commit; verified by the following job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 22:35:13 +02:00
Meta Vens
6db5d0873e play-faults fix: one send classifier, timeout canary, composed retry test, honest comments
- send_fault now classifies the reply-body read too: a body-read timeout is
  Timeout, a body cut mid-stream is NoResponse (retryable), a whole body that
  does not decode stays BadReply. The response.json() map_err is gone.
- LocalBinding.response_timeout (None = RESPONSE_TIMEOUT) lets a test reach the
  timeout path through the full PlayTable path.
- Tests: stalled, cut and malformed bodies against loopback listeners; a
  timeout canary at the port and through PlayTable (stored fault, warn line,
  card row, Debug); a PlayTable turn that survives N empty replies and faults
  past ROUND_RETRY_BUDGET.
- Comments: CREATE_BINDINGS doc reattached, backoff comments state the curve,
  close_with_fault no longer claims "endpoint-free by construction".

Not yet built or tested at this commit; verified by the following job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 22:31:35 +02:00
Meta Vens
1e6da32ad3 Merge origin/main into ghostlight-verse/session-refresh 2026-10-09 21:41:25 +02:00
Meta Vens
f0adcc61c5 play-faults test: read the fault-closed turn's id off the view
The table mints the turn id, so the log assertion must read it from the stored turn, not the id the caller passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 20:41:38 +02:00
Meta Vens
e1c2632f03 play-faults: classify send failures, show the fault on the card, log it, lengthen the retry window
R3: every local send that fails before a status arrives is Retryable except a timeout; the fault carries a typed InferenceFaultClass (Connect, NoResponse, Timeout, Status, BadReply) and a detail without the request URL.
R1: PlayTurnView.fault and a fixed world.play.fault card row.
R2: close_with_fault logs the turn id and the (endpoint-free) detail at warn.
R4: backoff cap 20 s, shift clamp 8: the retry budget now spans about 105 s.

Not yet built or run when committed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 20:31:55 +02:00
Meta Vens
aa18e28925 docs: FactStanding, Eve logout and inference transports match their types
ontology:103 lists all three FactStanding variants (patch.rs:298); the Eve
table gains app.auth.logout (eve.rs operation_schema, 9 ids); mvp:466 names
the three RoutedInferencePort routes (sdk_inference.rs:700).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 20:18:05 +02:00
Meta Vens
26f533e8f4 Refresh tests pin the production edges: key-fetch typing, cache wiring, algorithm gate, cadence
VerificationUnavailable now carries an error class and never the fetch error,
whose text named the key-set URL. fetch_jwks returns the reqwest error so the
class is read from it, not from a string. run_refresh_loop loses its period
parameter: SESSION_REFRESH_PERIOD is decided in one place and a paused-clock
test observes it exactly and over twelve ticks.

Tests drive HeimdallClient::verify_access against a loopback issuer that
counts fetches (cache stored, read, ttl 299 s fresh and 301 s stale), a closed
port and a 503 (kept session and receipt, no URL in the error or the log line),
and nine wrong-algorithm tokens. The moved-session test also pins that the
newer claim is the one spent next.

Builds and passes under ygg-verify (28 of 28 in heimdall:: and refresh_loop_tests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 20:13:25 +02:00
Meta Vens
5cb2ecbb31 ontology, consumer API, smoke note: enumerated sets match their Rust types
ComponentOp has 34 variants (table rewritten), Precondition 9, ActionMismatch
26, FactStanding 3, EdgeKind 1; CausalBoundary field shapes, PatchAnswer,
and the live state/commit/controller-work schema generations follow the
code. The consumer page lists the ops a confined consumer is refused. The
smoke note points at the Idunn acceptance step instead of the historical
play-agent page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 20:11:29 +02:00
Meta Vens
64071de685 mvp: enumerated sets name the Rust type that decides them
CommandBody has seven variants, WorldPhase two, EdgeKind one, WorldState
a fixed field set; the page now lists those and marks membership, contract,
archive and general relations as unbuilt. Persistence rows and WorldCommit
fields match journal.rs and lib.rs. The play-agent gate citation points at
the Idunn recipe's acceptance step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 20:09:50 +02:00
Meta Vens
d3f8975d3d Current-labelled pages cite only live files and state unbuilt features as unbuilt
ontology: drop the two citations of deleted pre-rebuild pages; Session Zero is
named as an unbuilt consumer. mvp: bounded co-op and the archived phase are
marked design intent, since crates/ has neither.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 20:02:09 +02:00
Meta Vens
424a20e64b README labels linked design pages honestly; drop dangling system-map citation
The README no longer calls unbuilt or historical pages current design records:
play-agent is historical, session-zero is unbuilt, public-architecture and
articles are unbuilt design and essays, extraction and stock-lenses are closed
records. The authority architecture page loses its citation of a deleted file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 19:58:09 +02:00
Meta Vens
9de9e53a5f Docs describe the machine on main: README, AGENTS, handoff pointer, live architecture pages
README and AGENTS.md state what exists (sealed kernel, Dungeon, persona
projection, sidecar, browser host) and what does not (the verse, storylets,
cast, episodes). The handoff becomes a pointer to the Eureka mind. The Eve
interface page matches eve.rs (world.create v4, Draft/Active cards, play
card). Live pages cite crates/ghostlight/src/<file> instead of world/*.rs.
The implementation plan gains a historical status line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 19:50:28 +02:00
Meta Vens
57b16df286 Refresh tests: pin the refresh owner's endurance and the signing-algorithm check
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 17:32:28 +02:00
Meta Vens
72a98d8468 Refresh: keep a receipt whose keys were unavailable, and pin the loop and the branch rules
The refresh pass keeps a spent-upstream receipt when verification could not
fetch the signing keys and verifies it on the next pass instead of refreshing
again; only a positive verification failure revokes. The loop body is
run_refresh_loop, tested for calling the pass; tests pin that a moved session
is not revoked and a higher revision is applied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 17:21:23 +02:00
Meta Vens
2b6e8c7826 Heimdall: type the unavailable-keys failure and cache the signing keys for a bounded time
A JWKS fetch failure is now VerificationUnavailable, distinct from a receipt that
positively fails verification. The fetched key set is cached for five minutes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 17:21:18 +02:00
Meta Vens
447471825b Drop the dead npm scripts and ignore lines of the parked tree
Removes state:*, prestate:*, *:validate, schema:validate, images:count and
coverage:status (they called the deleted Python tools); keeps dungeon:* and
sdk:*. Description now names the Rust kernel and Dungeon. Drops .gitignore
lines for __pycache__, *.pyc, .venv, state scratch and experiments/images.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 17:05:45 +02:00
Meta Vens
86977e51f7 Cut six pre-rebuild notes pages
Parked at tag parked/ghostlight-pre-rebuild (ruling ghostlight-verse:ruling:park-pre-rebuild-tree).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 17:05:13 +02:00
Meta Vens
1f85d1c4d7 Cut 27 pre-rebuild architecture pages and the Aetheria brainstorm
Parked at tag parked/ghostlight-pre-rebuild (ruling ghostlight-verse:ruling:park-pre-rebuild-tree).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 17:05:13 +02:00
Meta Vens
ea91b33946 Cut the Python store's state/
Parked at tag parked/ghostlight-pre-rebuild (ruling ghostlight-verse:ruling:park-pre-rebuild-tree).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 17:05:02 +02:00
Meta Vens
a7ed853fcd Cut newspaper output and woodcut assets
Parked at tag parked/ghostlight-pre-rebuild (ruling ghostlight-verse:ruling:park-pre-rebuild-tree).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 17:05:01 +02:00
Meta Vens
90ec569d53 Cut acceptance, prompts and scripts of the pre-rebuild tree
Parked at tag parked/ghostlight-pre-rebuild (ruling ghostlight-verse:ruling:park-pre-rebuild-tree).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 17:05:01 +02:00
Meta Vens
62dcc6c5b3 Cut experiments
Parked at tag parked/ghostlight-pre-rebuild (ruling ghostlight-verse:ruling:park-pre-rebuild-tree).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 17:05:01 +02:00
Meta Vens
058c070a42 Cut pre-rebuild example fixtures
Parked at tag parked/ghostlight-pre-rebuild (ruling ghostlight-verse:ruling:park-pre-rebuild-tree).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 17:05:01 +02:00
Meta Vens
26623d6d2f Cut the pre-rebuild JSON schemas
Parked at tag parked/ghostlight-pre-rebuild (ruling ghostlight-verse:ruling:park-pre-rebuild-tree).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 17:05:00 +02:00
Meta Vens
ece28506e6 Cut the Python state store, validators and newspaper typesetter (tools/ except the Eve bridge)
Parked at tag parked/ghostlight-pre-rebuild (ruling ghostlight-verse:ruling:park-pre-rebuild-tree).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 17:05:00 +02:00
Meta Vens
1b31bfc399 Refresh tests: pin the denied-status split and the session and account custody checks
Mutation survivors of the first cut: the status comparison inside invoke (now
refuse_denied, tested directly) and the session-or-account custody check
(a receipt for another session, or another account, revokes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:49:22 +02:00
Meta Vens
af7e544830 Refresh: apply an equal-revision receipt, key each refresh by its claim, revoke what cannot succeed
Heimdall's access_revision is a revocation epoch, so a refresh receipt at the
session's revision is the normal case (ruling refresh-revision-is-revocation-epoch).
The loop pass moves behind a SessionRefresher port; a typed HeimdallDenied
revokes the session, a backwards receipt revokes it, every local refusal
names its clause, and the idempotency key derives from the claim being spent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:37:52 +02:00
Meta Vens
c4bc865573 Map: name the clause that refuses an executed Heimdall refresh
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:32:55 +02:00
Meta Vens
46df4070a8 Map: Ghostlight verse phase 1, body facts and model page parked/ghostlight-pre-rebuild
Why the 2026-09-30 deploy died (Odin's route), what main's build and
tests say, the play-session findings against main, the live refresh
loop, the host's retired v1 body, and where phase 2's verb sets plug in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:22:47 +02:00
Meta Vens
1e5761d9e0 Target: every event the kernel admits has exactly one render path
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:19:26 +02:00
Meta Vens
4441381987 Target: Ghostlight verse campaign (honest and running, factions and cast, the verse loaded)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:02:54 +02:00
Meta Vens
4fee97f089 Map and handoff: Ghostlight deploys from main
Operator ruling 2026-09-30: "Nope, I'd rather be on main". main was
fast-forwarded to the codex/ghostlight-dungeon-mvp tip (eeb3a68) and the
Yggdrasil ghostlight binding now admits refs/heads/main (gamecult-ops
45eb584). Historical cut records keep the branch they landed on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 12:33:54 +02:00
Meta Vens
eeb3a68042 Steer map and handoff to the live deploy and the fix list
Dungeon is live on Yggdrasil under Idunn v2 (454fc33); the operator ruled
"Stop here, we have shit to fix". Next action is PA.f211-f216 in order,
then the owed Soul pass; legacy-served and deploy-next text retired.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 22:21:30 +02:00
Meta Vens
f23adbbf49 Record the first deploy and play session: PA.f198-PA.f216
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 22:18:40 +02:00
Meta Vens
454fc33b8e Check Heimdall's session expiry against its refresh expiry, not access
Heimdall's session record lives as long as its refresh token: issueAccessClaim
reports session.expiresAt and refresh.expiresAt as the record's expiry, and
only the signed access claim carries the shorter access expiry. Dungeon
required the session expiry to equal the access claim's exp, so every
completion Heimdall redeemed was refused ("session expiry disagrees with
its signed claim") and no session was ever adopted.

The session expiry must now equal the refresh expiry, and refresh must
outlive the signed access claim. The new test builds the completion in the
shape Heimdall issues; restoring the old comparison fails it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 21:37:01 +02:00
Meta Vens
9457410365 Log every refused Eve command with its operation and message
A sign-in completion that Heimdall redeemed was refused by Ghostlight with
no trace outside the browser that received it. The command-result builder
now logs every refusal (not accepted, completed or pending) at warn, with
the operation and the refusal message, never the payload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 21:35:06 +02:00
Meta Vens
4c83d54964 Send the advertised route transport with the sign-in completion
The page builds heimdall.auth.complete itself rather than through the
vendored client, and its routeHint carried only sourceVersion. Ghostlight
refuses any invocation without the route transport ("invocation metadata
is incomplete"), so every completion was denied before it reached
Heimdall. The page now takes the transport the provider advertises for
ghostlight.eve.commands, as the vendored client takes it from a command
descriptor. Verified on Yggdrasil: the corrected shape reaches Heimdall's
private plane and gets Heimdall's own answer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 21:12:14 +02:00
Meta Vens
e42e1c1b31 Finish browser sign-in by attempt id, and on returning to the tab
Heimdall's Discord callback issues a random completion code distinct from
the attempt id, but the vendored adapter required the two to be equal and
rejected every real return as a malformed witness, so no player could sign
in. Re-vendored from Heimdall e8e2832, which completes by attempt id and
never reads the completion code; the test fixture issues a distinct code as
the server does.

A player who finishes Discord elsewhere and switches back to this tab never
reloads it, so the load-time resume never ran. The page now reruns the same
resume when it becomes visible with an attempt in flight.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 20:51:20 +02:00
Meta Vens
c5bf090d62 Stop declaring Heimdall as an Idunn dependency
Odin (96a55ec) now computes Ready with an external-operator-binding
dependency not ready, but CultLib's shared contract
(runtime_authority_contracts.rs:797-805) refuses any correlation claiming
Ready while a non-optional dependency is not ready, so Odin rejected every
Ghostlight Active presence (30/30 in the last deploy). The external kind
existed only because Heimdall isn't v2-managed; that reason doesn't survive
contact with Odin's own Ready computation.

Ghostlight's deploy stops declaring Heimdall as an Idunn dependency. The
daemon discovers it through Odin at use instead: HeimdallClient already took
Option<HeimdallDependencyBinding> with None as the non-managed path, so
runtime.rs now passes None directly rather than computing it from a
dependency_bindings field that no longer exists, and the loopback-only,
non-secret-bearing, app-bound HMAC+AES envelope enforcement is unchanged.
When Heimdall becomes a v2 target the dependency returns as `required`
managed.

- deployment/idunn/recipe.toml: deleted the heimdall.command-boundary
  [[dependencies]] block. Ghostlight's own required_environment for
  GHOSTLIGHT_HEIMDALL_APP_SECRET_FILE/GHOSTLIGHT_HEIMDALL_BASE_URL is
  unrelated (Heimdall's HTTP app integration, not the Idunn dependency) and
  stays.
- idunn_health.rs: runtime_dependency_bindings now requires exactly the Odin
  dependency (one, not two). Deleted HEIMDALL_CAPABILITY,
  required_external_dependency and its doc comment, the `heimdall` field on
  RuntimeDependencyBindings, the fixture's external_dependency helper and
  its Heimdall entry, and the recipe-drift test's Heimdall block/assertion
  (now asserts exactly one [[dependencies]] block and fails if a Heimdall
  dependency reappears without the daemon changing to expect it again).
  HeimdallDependencyBinding itself moved to heimdall.rs (see below) rather
  than being deleted outright: it's still the shape
  require_expected_heimdall_boundary checks a discovered boundary against
  when Idunn does supply one, which stays true the moment Heimdall returns
  as a managed dependency.
- heimdall.rs: now owns HeimdallDependencyBinding (moved from
  idunn_health.rs, which no longer has any use for it). No behavior change:
  HeimdallBoundaryLocator::Odin's `expected: Option<HeimdallDependencyBinding>`
  and its None-tolerant checking logic were already exactly the
  "discover through Odin, verify against a managed binding when one exists"
  shape this ruling asks for.
- runtime.rs: expected_heimdall is gone; `HeimdallClient::from_env` now
  takes `None` directly instead of a value computed from a
  dependency_bindings field that no longer exists, with a comment on why.

Mutation: re-added the heimdall.command-boundary [[dependencies]] block to
the recipe -> recipe_matches_the_daemon_it_deploys fails (asserts exactly
one dependency block). Restored; deployment/idunn/recipe.toml is
git-diff-clean after, one clean 7-line deletion.

Verification: cargo test -p ghostlight-dungeon --bin ghostlight-dungeon ->
192 passed, 0 failed, 4 ignored (unchanged count: removed a test helper, not
a test).

Structural delta: 4 files changed, 42 insertions(+), 138 deletions(-) in
Ghostlight (net -96 lines) — a genuine subtraction, not a relocation with
padding; the only addition of substance is the doc comment on the relocated
HeimdallDependencyBinding explaining why it still exists.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-23 20:29:00 +02:00
Meta Vens
203dc3658e Retry the initial Active presence through Odin's correlation gap
Odin refuses Active until it has correlated the lease Idunn just granted
("Ready topology state is not supported by correlated evidence"); the
first v2 candidate to get past Warming and the lease died on that single
refusal. Retry it with the helper and window the Warming publish already
uses; the periodic republish already only logs. The cadence constant now
names both presences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 20:11:26 +02:00
Meta Vens
140445dda8 Let the publisher carry its own custody choice, so the lease-retry tests run on Linux
aca5686's fix was right but its two new tests always called acquire_recent
(custody enforced), and a test lease necessarily lives under a tempdir —
never root-controlled. On the pinned Linux image that failed with "process
write-lease ancestor contains a non-root-controlled directory" instead of
exercising the retry logic; on Windows it passed only because
require_process_write_lease_custody is a deliberate no-op there, which is
exactly the platform gap this whole fix is about. The deploy platform is
Linux, so the tests have to run there for real, not slip through on a
Windows-only no-op.

RuntimePresencePublisher now carries the same enforce_custody choice
ProcessWriteLeaseGuard::acquire_inner already had: true from
from_environment (every production construction path), false from the test
fixture constructor. wait_for_write_lease calls acquire_recent or
acquire_recent_fixture to match. acquire_recent_fixture is no longer
#[cfg(test)]-gated, since production's own wait_for_write_lease source must
reference it (unreachable there, since production publishers always carry
enforce_custody: true, but the symbol has to exist in a release build). No
trait, no env flag — a plain bool threaded through the existing constructor.

Added production_custody_choice_rejects_a_lease_under_a_non_root_tempdir:
builds a publisher the way from_environment does (enforce_custody: true)
via a new fixture_with_state_contract_and_custody helper (the existing
fixture() stays enforce_custody: false, unchanged), points it at the same
empty-revoked-store shape the other two tests use, and asserts
wait_for_write_lease still refuses it with a custody-rejection error rather
than acquiring it. This one is #[cfg(target_os = "linux")]-gated —
correctly, not as a workaround: custody enforcement is architecturally a
root-ownership concept that idunn_health.rs's own code makes a no-op on
every other OS, so there is nothing for the assertion to observe on Windows
regardless of this fix. The two tests from aca5686
(an_empty_revoked_lease_store_times_out_not_not_admitted,
a_lease_written_after_an_empty_revoked_store_still_wins) needed no changes
beyond inheriting enforce_custody: false through fixture() as before — they
were already testing the retry logic, not custody, and now do so honestly on
both platforms since custody enforcement is out of their path entirely.

cargo test -p ghostlight-dungeon --bin ghostlight-dungeon (Windows): 192
passed, 0 failed, 4 ignored, unchanged from aca5686 — the new Linux-gated
test does not compile into this binary here, so it does not appear even as
ignored. Awaiting the Linux run for its count and the custody-rejection
assertion.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-23 20:01:54 +02:00
Meta Vens
aca5686f01 Retry write-lease acquisition, not just its existence check
Live failure under Idunn v2 (deploy up-180cf07f): the candidate died in ~2s
with "process write lease was not admitted: ... zero records". Idunn's own
revocation of a prior candidate's lease leaves the store and its .lock
present but empty (a 22-byte zero-record CultCache file), which
`path.exists() && lock.exists()` cannot distinguish from a real lease.
wait_for_write_lease called acquire_recent exactly once on that signal and
let its failure propagate.

wait_for_write_lease's job is "wait until the exact lease for this
incarnation is admitted", not "wait until something exists at the path". On
each poll where the store exists, it now attempts acquire_recent; on failure
it remembers the error and keeps polling (heartbeats unaffected); only the
outer deadline bails, and that bail carries the last acquisition error as
context for diagnosis. acquire_recent's own exact-match checks are untouched
and stay the authority — nothing here special-cases empty stores by size or
by matching error text, so the same retry covers empty, stale-incarnation,
and not-yet-written stores alike, exactly as asked.

Tests (idunn_health.rs, all run on Windows — decode_write_lease and
acquire_inner's enforce_custody path have a Linux-only branch inside
require_process_write_lease_custody, but that function no-ops on non-Linux,
so this whole path is exercised here too, not gated):
- an_empty_revoked_lease_store_times_out_not_not_admitted: builds a
  present-but-zero-record store via push-then-delete of a throwaway envelope
  (the crate's own public store API, not hand-encoded bytes) — the same
  shape Idunn's revocation leaves. Asserts the wait runs its own full 600ms
  timeout (not an instant "not admitted") and that the timeout error still
  carries "not admitted" in its chain.
- a_lease_written_after_an_empty_revoked_store_still_wins: same empty start,
  but a valid lease for the fixture's own incarnation is written 300ms in
  from a spawned task. Proves the retry re-attempts acquisition on every
  poll, not just the first: the wait returns the written lease.

Mutation: reverted to a single-shot acquire (return on first attempt
regardless of outcome) -> the empty-store test fails in ~1ms with the
pre-fix symptom instead of running its 600ms timeout. Restored; diff-clean
after.

cargo test -p ghostlight-dungeon --bin ghostlight-dungeon: 192 passed, 0
failed, 4 ignored (was 190 before this pass; +2 new tests).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-23 19:57:01 +02:00