Repository navigation
Description
Found while verifying cache-consistency invariants around the commit path (Claude traced it during review remediation of #1718; pasting the mechanism essentially as-is, spot-checked against the tree). Pre-existing — not introduced or worsened by any open PR — and worth its own small fix because the failure mode is serving an aborted transaction's configuration to later, unrelated writes.
Mechanism. Cypher interactive transactions resolve write-path policy against the transaction's private state — a base snapshot plus its own unpublished pending commits (cypher_txn.rs:219, :280 → build_transact_policy_context). resolve_ledger_config_cached (policy_view.rs:473-499) computes its cache key from that private state's novelty: the to_t == head_t freshness check passes against the private head, so the key is the private config_write_t. It then looks up the shared handle via mgr.get_loaded_handle and writes the resolution into the shared handle's config_cache (config_cache_put, ledger_manager.rs:232-236).
So a transaction that (1) stages a config-graph write landing at private t=N, then (2) resolves policy for a later statement, has published a (key=N, private-config) entry into the cache every other writer consults. If the transaction commits, no harm — shared state converges to the same key and content. If it aborts, the entry lingers with a key the shared ledger hasn't reached yet; when a later real commit writes the config graph at the same t=N — entirely plausible, e.g. retrying the same operation via autocommit — the shared marker becomes N, the poisoned entry hits, and every subsequent write-path policy resolution serves the aborted transaction's config until the next config write or handle eviction. Since ledger config can carry policy classes and defaults, that's a correctness/policy problem, not just staleness.
Fix shape. Gate the cache put (and arguably the get) on the resolving state actually being the shared handle's — e.g. a caller flag threaded from the two cypher_txn call sites so private-state resolutions compute but never publish into the shared cache. Small, local, and testable: stage a config write in an interactive txn, resolve policy, abort, land a real config write at the same t, and assert the resolution reflects the committed config rather than the aborted one — a test that should fail today.
Activity