Skip to content

fix(storage): bound live frontier admission with journals - #5657

Merged
Sinity merged 5 commits into
masterfrom
claude/irddg
Sep 27, 2026
Merged

Sinity merged 5 commits into
masterfrom
claude/irddg

Conversation

@Sinity

@Sinity Sinity commented Sep 27, 2026

Copy link
Copy Markdown
Owner

Summary

Live intake page admission no longer scans every indexed raw seed on each page. A process-local certificate proves once that every active index raw reference exists in source, then consumes transactional changed-key journals (source deletes/key changes, index session/head re-pointing) on later pages. Predecessor and cursor authority are read afresh for the selected path only.

Problem

require_cursor_authority (file intake adapter, live watcher, live batch) called the global raw-frontier projection, which enumerates all index seeds, predecessor chains and cursors. Its cost grows with the archive, so a fresh build paid O(archive) per intake page. A selected-only check is not sufficient on its own: an unrelated indexed session whose raw row is missing from source.db must still refuse admission.

Solution

  • polylogue/storage/frontier_existence.py: the certificate (full bootstrap, then journal reconciliation; refuses on journal truncation, watermark regression, trigger loss, tier or schema change; discarded after fork).
  • Source/index DDL: raw_existence_changes journals and triggers, so external writers are covered in the same transaction.
  • raw_retention.py / batch.py: selected-path chain and cursor proof; a raw or cursor lacking its canonical path refuses rather than guessing aliases.
  • The journal DDL changes the fresh v1 source schema, so the archive-format lineage moves to v4 (the existing route that fences earlier roots). The earlier draft's separate preparation-marker exemption is not carried.

Verification

  • devtools test over frontier admission, dispatcher intake measurement, reviewed acquisition defects, live watcher, schema manifest, revision replay and format-lineage tests: 243 passed, 2 failed. One was a test whose re-pointing UPDATE was a no-op (fixed so it journals a real change); one is test_live_full_ingest_offloads_sync_work_to_keep_loop_responsive, which fails identically on master. A fork-safety subprocess test timed out at 15s under host load; its guard is now 120s (the inner 3s check still detects a blocked child).
  • devtools verify --quick: PASSED.

Residuals

  • The index journal gains one row per session insert/re-point and has no pruning owner yet (the prune trigger advances retained_floor); growth is bounded by session writes on a rebuildable tier.
  • Schema closure: all changed production files are IN; this must land before the fresh build.

🤖 Generated with Claude Code

https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-27T21:43:08.772071Z 260dc79 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 00ff4936aa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread polylogue/storage/raw_retention.py Resolved
Sinity and others added 4 commits September 27, 2026 23:03
The source-tier journal tables and triggers change the fresh v1 DDL. Bump
the archive-format lineage to v4, the existing route that fences every
earlier root, instead of a second preparation-marker authority. Also make
the pruning test journal a real re-pointing, and give the fork-safety
subprocess room to import under host load.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
…e consumed journals

Selected-path cursor authority re-resolved the stored alias against the
current filesystem, so a removed or retargeted symlink named the refusal
under an obsolete spelling and the watcher admitted the real path. Compare
and refuse through the canonical paths stored at acquisition instead.

Journal rows were never deleted. A daemon convergence stage now deletes the
rows this process's certificate has consumed; a lagging certificate whose
rows were pruned re-proves from scratch instead of refusing.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
…perations

The daemon may not import storage directly, and the prune is a tier write
that belongs to the certificate's module. Storage owns the consumed-row
query and delete (censused as a source/index writer); an operations stage
schedules it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
@Sinity
Sinity enabled auto-merge (squash) September 27, 2026 21:03

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ed8ada8129

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread polylogue/storage/raw_retention.py Resolved
Comment thread polylogue/storage/frontier_existence.py Resolved
A page that journals thousands of keys checked each with two statements,
and a selected path with more retained raws than SQLite binds at once
failed membership expansion with too many SQL variables, refusing a valid
source. Both now run in bounded IN batches.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 260dc79c7d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread polylogue/storage/raw_retention.py Resolved
@Sinity
Sinity merged commit 8b04bae into master Sep 27, 2026
3 checks passed
@Sinity
Sinity deleted the claude/irddg branch September 27, 2026 21:45
Sinity added a commit that referenced this pull request Sep 28, 2026
- expect an unavailable snapshot when no rich observation exists (#5621);
- let the converger test double accept derivation_barrier (#5664);
- expect the request model's normalized mark payload;
- measure a steady-state chunk: the first chunk after seeding also
  prunes the seeding's raw-existence journal, one trigger per row (#5657);
- inject the thread-insight failure at the ArchiveStore the route reads.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
Sinity added a commit that referenced this pull request Sep 28, 2026
## Summary

Fixes one product defect and realigns daemon and MCP tests that fail on
master because they encode superseded contracts.

## Problem

A per-directory run of `tests/unit/daemon` and `tests/unit/mcp` on clean
master (`03c543dfe`) failed 28 and 11 tests. This PR covers the clusters
below. Other failures belong to named owners or need a decision; see
Residuals.

- **Product defect: MCP hides daemon rejections.** When the resident
daemon refused a write before durable acceptance, MCP callers saw
`write: internal error (DaemonOperationRejectedError)`. The daemon's
typed code and detail were lost, for example why a saved view cannot be
watched.
- **MCP tests that write with no daemon.** Public archive writes are
daemon-owned since #5550. Nine MCP tests plus three standing-query tests
still wrote with no daemon and got `FacadeDaemonRequiredError`.
- **Stale daemon expectations:**
- Since #5621 a snapshot with no rich observation is `unavailable`, not
`stale`.
- #5664 passes `derivation_barrier` to the converger, which the test
double did not accept.
- The mark-delete route test compared against the raw payload rather
than the request model's normalized one.
- The chunk-cost test measured the first chunk after seeding. Since
#5657, that chunk also prunes the seeding's raw-existence journal, one
trigger firing per row, so its cost grew with archive size once.
- The insights failure injection patched the facade the route no longer
reads.

## Solution

- `_exception_to_error_json` relays `DaemonOperationRejectedError` with
the daemon's code and detail, as the CLI does.
- New `tests/infra/mcp.py::daemon_served_runtime_services` runs the real
operation stack on the archive's socket for MCP write tests. The
load-evidence test seeds its deliveries under the daemon and measures
reads without it.
- Each stale expectation is realigned; the chunk-cost test converges one
warm-up chunk and measures a steady-state chunk.

## Verification

`devtools test` over the affected daemon and MCP tests plus the MCP
error-translation tests: `165 passed, 1 failed` (receipt
`20260928T000820Z-focused-test-736375-35660df1`, pre-rebase). The one
failure is `test_working_dir_demand_withholds_profile_readiness`,
tracked in polylogue-6remh. The rebase kept master's own fix to
`test_convergence_debt_alert.py` and dropped this branch's change to
that file. No other conflicts.

Review follow-up (`f189af7`): `WatchDefinitionError` declares
`invalid_watch_definition`. MCP reports an undeclared (prose) rejection
code as `rejected`. `DaemonClient` keeps a pre-dispatch refusal's public
detail. `devtools test tests/unit/mcp/test_tool_error_isolation.py
…::test_skewed_write_refusal_is_pre_dispatch_not_an_indeterminate_mutation
tests/unit/daemon/test_standing_queries_default_evaluator.py` passed
(receipt `20260928T003051Z-focused-test-966381-9c978486`). `devtools
schema closure`: `archive/query/watch_definition.py` is IN, so this
lands before a rebuild.

## Residuals

- polylogue-6remh (filed): since #5570, periodic profile ticks run the
startup audit before demanded work. This starves demand and contradicts
#5540's idle-tick contract. It leaves
`test_two_accepted_revisions_survive_one_periodic_profile_pass`,
`test_working_dir_demand_withholds_profile_readiness` and likely
`test_real_factory_defers_hot_target_without_losing_the_no_hint_cursor`
red.
- Not covered here:
- master-fix-owned clusters: the read-authorizer `not authorized`
regression, `selected_session_parts` and `raw_observation_derivation`;
- daemon failures still to diagnose: schema preflight behind the #5657
frontier gate, status baseline `ok`, evidence-summary lineage authority,
stale archive storage, Drive asserted-authority growth, the watcher-hint
timeout, and status component metadata.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 28, 2026
- fail the evidence-summary lineage read where the route imports
  archive_read_context now (#5550);
- keep the structural-error preflight test's stub cursor outside the
  archive root, which the #5657 source-selection gate would block;
- give the healthy raw-materialization fixture a denominator, since an
  empty archive is unmeasured, never ready (#5491);
- expect the component metadata's completed_at and
  collection_duration_s fields.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
Sinity added a commit that referenced this pull request Sep 28, 2026
## Summary
Fixes a batch of defects that fail on master and would affect the fresh
build.

## Problem (evidence, reproduced on origin/master)
- **Read authorizer regression:** `open_read_connection` re-applied read
pragmas after `open_readonly_connection` installed the read authorizer,
so every call failed with `sqlite3.DatabaseError: not authorized`
(search, status, all of `tests/integration/test_workflows.py`). Plain
parameterized sibling ATTACHes on profiled readers were denied the same
way.
- **Grok exports never ingested (polylogue-5yig1):** the streamed Grok
export route wrote its shard to the preparation directory instead of the
worker's attempt directory; the ownership check deferred the path, and
canonical ingest refused with `deferred=1` forever. The deferral named
no cause.
- **Selected session profiles never published (polylogue-bh8v1):**
`converge_selected` computed a profile whose prerequisites (summary,
usage rollup) had never been converged, so the publisher refused it and
the outcome was misreported as `binding_moved`.
- **Retained raw replay refused:** retained JSON preparation bound a
null enrichment digest when no enrichment ran, while the publisher
always recomputes it, so publication failed with "enrichment evidence
changed"; `SchemaSkewError` could not be unpickled across the worker
pool, surfacing as a dead worker.
- Import cycle `embedding_write -> embeddings -> derivation ->
embedding_write`.
- `raw_existence_changes` (from #5657) had no excision-carrier
declaration, so session excision refused.
- Stale or incomplete tests: otel-genai had no unknown-outcome routes,
schema drift used the v1 floor, the converger fake lacked
`derivation_barrier`, the judged-memory loop mutated without a daemon,
and the deadline test froze the process-wide monotonic clock (hanging
the worker pool).

## Solution
- Readers apply pragmas only inside the factory, before the authorizer;
`attach_database` routes a query-only reader through
`attach_readonly_database` (read-only URI) and is used by
sibling/embedding/source-tier attaches.
- The Grok shard uses the attempt directory; an artifact outside its
attempt directory now fails the path visibly (only an OS error while
checking stays retryable).
- `converge_selected` converges the exact `prerequisite_keys` first and
names a refused publication `publication_refused`.
- The JSON worker binds the same evidence value the publisher
recomputes; `SchemaSkewError` defines `__reduce__`.
- `polylogue.storage.embeddings` re-exports nothing; the one consumer
imports the submodule.
- `raw_existence_changes` is a tombstone carrier (content-free, and
excision's own delete appends to it).
- The pass deadline reads a dedicated `_pass_clock`.

## Verification
Focused `devtools test` selections in this worktree; results in the
review thread once the final run completes. `devtools schema closure`
noted below.

## Residuals
None known beyond those listed in follow-up comments.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 28, 2026
## Summary

Bounds three read/queue paths from the read-bounds bug family: yooge,
buuxr, 1gxyu.

## Problem

- **yooge:** `DeferredEffectQueue` stored a receipt per
`effect:staleness_key` for the process lifetime. The key embeds the
batch's session ids, so it grew with every distinct ingest batch in a
long-running daemon. No production code reads those receipts.
- **buuxr:** a full-scope insight rebuild ran
`list_summaries(limit=1_000_000)` and built four archive-sized
collections (manifest JSON, targets, target refs) per `prepare`, twice
per mutation. `apply` ignores them for the full scope. On an archive
past the plan's target ceiling, `build_plan` refused to plan the rebuild
at all.
- **1gxyu:** attachment availability on every session read called
`BlobStore.verify`, which streams and SHA-256s the whole blob, so
reading a session with large attachments cost their full size every
time.

## Solution

- **yooge:** the queue keeps only the in-flight key set (for
de-duplication) and drops settled deliveries; failures are still
reported by `archive.write_effect.failed`. The unused receipt API is
removed.
- **buuxr:** a full-scope plan carries no per-session targets; its
manifest digest is the scope identity (scope, index path, materializer
version). Explicit scopes still name their sessions.
- **1gxyu:** read paths use `BlobStore.verify_for_read`, which
hash-verifies once and then trusts the result while the blob file keeps
the same device, inode, size and nanosecond mtime; any change forces a
full re-hash. The memo is a pacing bound (eviction only re-hashes).
`verify`/`verify_all` stay uncached integrity checks.

Already fixed on master, recorded on the beads: fvsjn (per-session
bounds, #5381) and 0bn4p (facet scope bound with a named
`facet_scope_truncated` gap and shared cancellation).

## Verification

- `devtools test` over the three new test files plus
`test_mutation_actuators.py` and `test_blob_store.py`: all passed except
`TestSessionExcisionActuator::test_prepare_and_apply_expose_marker_carrier_terminal_evidence`,
which fails with `UnclassifiedSessionCarrierError:
raw_existence_changes` — a table added on master by #5657 without an
excision carrier declaration, not touched here.
- `devtools schema closure`: all five production files are IN; this must
land before the fresh build.

## Residuals

- 2fguj (per-row text materialized before truncation) and gzmd4 (several
unbounded storage reads) need a query-contract change and stay open.
- `verify_for_read` does not detect an in-place rewrite that restores
the same size and nanosecond mtime.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 28, 2026
## Summary

A degraded live batch now returns before it touches the archive, and
five stale daemon test expectations match current contracts.

## Problem

These failures are from a clean-master run of `tests/unit/daemon` (base
`03c543dfe`), outside the clusters that PR #5705 and the master-fix
owner cover.

- **Product: degraded ingest still hit the archive.** `_ingest_files`
ran `require_cursor_authority()` before its `is_fully_degraded()`
short-circuit. That gate reads the archive's existence journals on every
call. Under an event burst, a degraded daemon therefore did the per-file
archive access the short-circuit exists to prevent (#1003). On
unreadable tiers it raised `CursorAuthorityBlockedError` instead of
skipping
(`test_ingest_files_short_circuits_under_burst_after_degraded`).
- **Stale tests:**
- The evidence-summary test patched `http.archive_read_context`, but the
route (moved in #5550) imports it from `archive.query.transaction` at
call time, so the injected lineage failure never fired.
- The structural-error preflight test placed a stub `index.db` in the
archive root without a source tier. The #5657 source-selection gate
correctly blocks that archive before the full parse the test drives.
- The "healthy" raw-materialization fixture had zero raw artifacts,
which #5491 classifies as unmeasured, never ready.
- The component-metadata test predates the `completed_at` and
`collection_duration_s` fields.

## Solution

- The degraded check now runs first. The authority gate and refused-path
filtering follow in their original order, so a non-degraded batch
behaves as before.
- Each stale test is realigned as described in the commit messages.

## Verification

- `devtools test tests/unit/daemon/test_status_unmeasured.py
tests/unit/daemon/test_status_observations.py
tests/unit/daemon/test_schema_preflight.py
tests/unit/daemon/test_daemon_http.py`: `64 passed, 1 failed` (receipt
`20260928T002626Z-focused-test-923898-aafe19be`). The one failure,
`test_daemon_status_names_every_halted_unit_and_is_not_ok`, is left as
it is on master; see Residuals.
- `devtools schema closure polylogue/sources/live/batch.py`: IN, so this
must land before a rebuild.

## Residuals

Still red on master, and not addressed here:
- `test_daemon_status_names_every_halted_unit_and_is_not_ok`: an
initialized empty archive has never had a green `ok` baseline since
#5491. Pinning collectors healthy was not enough, so this needs its own
diagnosis.
- `test_drive_phased_matches_ordinary_document_growth`: no
asserted-authority revision with a predecessor.
- `test_daemon_watcher_hints_wake_fair_intake_and_canonical_derivation`:
intake discovers no source carrier.
- polylogue-6remh: periodic profile ticks starve demand.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 28, 2026
…t prefixes (#5747)

## Summary

Two marker-carrier lifecycle defects that change what a fresh build
stores (polylogue-1tyq5.139, polylogue-1tyq5.135):

- A raw whose index transaction rolled back now retries through the
ordinary session writer. Its uncommitted pending carrier is replaced by
the retry's interpretation. Before this change, a hash-only shortcut
skipped the writer.
- When a child session is ingested before its parent and the parent then
arrives, the child's already-accepted prefix marker candidates are
superseded when the parent's carrier is delivered. Before this change
they stayed live next to the parent's copies.

## Problem

**Pending-carrier shortcut (1tyq5.139, seven Codex findings on #5507).**
If a raw's index transaction rolled back and another raw then published
an identical session hash, `_reuse_current_accepted_marker_carrier`
returned early and skipped `_drain_ready_session_entries`. The retry
then:

- left `sessions.raw_id` on the intervening raw;
- skipped stale-session deletion, ingest-flag convergence and FTS repair
detection;
- recorded no skipped session;
- accepted the stale pending bytes. For a prefix-sharing child those
bytes held candidates for rows the committed index does not contain.

A related liveness defect: a pending carrier from a replaced index
incarnation was refused on every retry. A cold build that restarts after
its generation is reclaimed would therefore strand those raws
permanently.

**Child-before-parent markers (1tyq5.135, #5493).** A child written
before its parent is stored whole, so
`marker_candidates_for_prepared_write` sealed candidates for the
replayed prefix under the child's message ids. When the parent arrived,
`_reextract_prefix_tail_db` deleted those rows and the parent's carrier
sealed the same markers under the parent's ids. Assertion ids include
the evidence refs, so delivery kept two candidate assertions for each
inherited marker.

## Solution

- `_reuse_current_accepted_marker_carrier` now reuses a carrier only
when a witness proves it committed in the current incarnation.
- A pending carrier is the prepare half of a two-tier commit: its
witness is inserted in the same index transaction as the writes it
describes. When the open index transaction has no witness for the
request, `_publish_marker_witnesses_before_index_commit` replaces the
pending carrier through `replace_uncommitted_pending_marker_input_sync`.
The replacement is compare-and-swap on the retained digest and is
declared in the durable-write census as `two_phase_recovery`. Accepted
carriers are never replaced.
- Re-extraction streams each removed prefix text block of the child to a
sink (`report_reextracted_prefix_blocks`), which keeps only the derived
ids. The writing raw's carrier records the child assertion ids those
blocks produced, as `retired_assertions`, computed with the same
extraction the child's carrier used (`retired_marker_assertion_ids`).
Delivery records each retired id in the new user-tier table
`retired_marker_assertions`, marks an existing untouched candidate
`superseded`, and `lower_markers` skips any retired id, so delivery
order between the child's and parent's carriers does not matter. Only
untouched agent `candidate` rows are changed; human assertions and
existing judgments are preserved. The marker recipe format moves from 3
to 4.

Derived-identity closure: `storage/sqlite/archive_tiers/write.py`,
`storage/accepted_marker_inputs.py` and
`pipeline/services/ingest_batch/_models.py` are members, so this must
land before the fresh build starts. Schema classification:
additive-durable, meaning one new `user.db` table in `USER_DDL`, written
through `user_write.record_retired_marker_assertion`. No v1 archive has
been built, so the change follows the repository's fresh-floor route
(the same one #5657 used): `ARCHIVE_FORMAT_LINEAGE` moves from
`polylogue.archive-format.v4` to `v5`, and every tier stays at
`user_version=1`. Any v4 development root is therefore fenced at open
rather than opened without the table. `devtools gate schema-manifest`
reports `durable-schema-evolution: PASS` and `devtools gate layering`
reports `violations: []`.

## Verification

- `agentctl job start polylogue pytest_focused -- tests/unit/markers
tests/unit/storage/test_accepted_marker_consumer.py
tests/unit/storage/test_bulk_fts_prefix_reextract.py
tests/unit/storage/test_fresh_archive_format.py
tests/unit/storage/test_durable_tier_version_authority.py
tests/unit/devtools/test_verify_schema_manifest.py` on head 50d7a48
(job 1194): `Success`.
- An earlier run on 1b8c464 (job 869) also covered
`tests/unit/security/test_excision_carrier_reach.py`. Its one failure is
inherited and unrelated: `raw_existence_changes` is declared TOMBSTONE,
and the test expects RETIRED.
- `mypy` on the changed files: no issues.

Anti-vacuity:
- Restoring the hash-only shortcut leaves `sessions.raw_id` on the
intervening raw, records zero skipped sessions, and accepts the stale
pending bytes.
`test_public_marker_retry_replaces_uncommitted_pending_carrier` asserts
all three.
- Removing retirements leaves two live candidates for the inherited
marker, which fails
`test_late_parent_supersedes_the_childs_prefix_markers`.
- If a retirement only supersedes rows that already exist, delivering
the parent's carrier first leaves a live candidate, which fails
`test_retirement_delivered_before_the_child_carrier_still_holds`.

## Residuals

- Accepted carriers encode lineage state at ingest time: a tail-only
child and a whole child produce different bytes. A later rebuild that
ingests in a different order than the original run would be refused on
byte equality. The fresh v1 build starts with no accepted carriers, so
it is not affected. Filed as polylogue-gubtm.
- If a person already judged a child prefix assertion (accepted or
rejected, for example) before the parent arrived, that judgment is kept,
and the parent's copy remains alongside it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 29, 2026
## Summary

Four intake tests failed on master at 1beb2e5. Each encoded a route
or contract that an earlier PR had changed. None is a production bug, so
this PR changes tests only. One sibling guard that could never fire is
tightened too.

## Problem (evidence)

I reproduced the failures in one focused job over the four files
(agentctl job 2555) and diagnosed them with probe tests that were not
committed (including jobs 2635 and 2660). All four failures are
deterministic, not load-related.

- `test_page_admission_runs_lease_free_owners_outside_the_writer_gate`:
`admit_page` returned `RETRYABLE` with `CursorAuthorityBlockedError: ...
global raw existence is unproven: required source or index tier is
unavailable`. The fixture created only `index.db`. The cursor-authority
gate added in #5657 fails closed when one tier exists without the other,
which is the intended behavior.
- `test_watcher_queues_behind_daemon_maintenance_writer`: the test
paused `LiveParseStage.warm`. The batch has called only `warm_paths`
since #5550, so the pause never happened and `parser_started.wait(5.0)`
timed out.
-
`test_dispatcher_page_compaction_cost_is_one_scoped_hold_at_archive_scale`:
each page traced 4 SELECTs instead of 3. The fourth is `SELECT identity
FROM schema_identity WHERE tier = 'index'`, which every validated
read-only open has run since #5727. The three authority reads are
unchanged.
-
`test_flag_on_prefetch_and_flag_off_produce_identical_archive_content`:
the snapshots differ in `raw_sessions`, `raw_revision_heads` and
`raw_authority_parser_census`.
  - The prefetch arm writes `full`/`byte_proven` raws with byte heads.
- The production arm (`converge_raw_observations`, which uses the
retained preparation from #5643) writes `unknown`/`quarantined` raws
with semantic heads.
- The prefetch arm drives `DaemonParseStage` and
`backfill(prefetch_cache=...)`. No production module has constructed
`DaemonParseStage` since #5002, and `RawObservationDerivation.compute`
always builds `RawObservationReplacement(payload=None)`. So production
archive content never goes through the route that differs.

## Solution

- Lease-free owners test: bootstrap a whole archive with
`initialize_active_archive_root`, and put the source under its own root.
- Maintenance-queueing test: pause `warm_paths`, the method the batch
calls in `_ingest_full_paths`. Replace the 5 s and 1 s wall-clock waits
with waits on the events themselves: an `asyncio.Event` set with
`call_soon_threadsafe`, plus the maintenance-entered event. A `finally`
releases the parked thread. pytest-timeout bounds a hang.
- Compaction-cost test: separate the per-open identity read. Assert
there is exactly one, which means the page used one connection, then
keep the three-authority-read assertions. Raise the hang guard to 600 s,
the same as its sibling measurement test: in one probe run under host
load (average about 22), the 120 s default fired during seeding.
- Delete the prefetch equivalence test and the helpers only it used.
polylogue-fhlo1 tracks deleting or rewiring the dead `DaemonParseStage`
and `LiveParseStage.warm` routes.
- Sibling:
`test_page_admission_acquires_source_without_reading_unavailable_index`
forbade `warm`, which production never calls. The batch also swallows
prewarm exceptions, so a raising stub would have passed anyway. The test
now records calls to `warm_paths` and asserts there were none.

No production file changes, so the derived-identity closure is
untouched.

## Verification

- `agentctl job start polylogue pytest_focused --workspace
/realm/worktrees/polylogue-mh-intake --wait --
tests/unit/sources/test_live_batch_convergence.py
tests/unit/sources/test_live_watcher_locking.py
tests/unit/daemon/test_dispatcher_intake_measurement.py
tests/unit/daemon/test_raw_materialization_parse_stage_equivalence.py
tests/unit/sources/test_live_watcher.py::test_page_admission_acquires_source_without_reading_unavailable_index`
(job 2688, head d81534d): `devtools test: PASSED exit=0
diagnosis=pytest_passed`, 21/21.
- `agentctl job start polylogue verify_quick --workspace
/realm/worktrees/polylogue-mh-intake --wait` (job 2696, head
d81534d): `verify: PASSED exit=0`.

## Self-review

- **Siblings.** I searched `tests/` for patches of the unused `warm`.
One other guard patched it; it is fixed here. The remaining
`stage.warm(...)` calls in `test_parse_prefetch.py` and
`test_live_watcher_parse_stage_equivalence.py` test the dead classes
directly and belong to polylogue-fhlo1.
- **Fix itself.** The identity filter matches only `from
schema_identity`, and it asserts exactly one match, so an extra
connection per page still fails the test. The authority-read assertions
are unchanged.
- **Anti-vacuity.**
- Maintenance queueing: wrapping the page in `coordinator.run` blocks
maintenance, so `maintenance_entered` never sets and pytest-timeout
fails the test.
  - Lease-free owners: the owner-outside-gate assertions are unchanged.
- Derived-only guard: removing the `_source_tier_acquisition_required()`
gate records a call.
- **Interruption.** The parked parse thread is released on every exit
from the wait block, so a failing run does not leave a thread blocking
executor shutdown.
- **Waits.** The only wall-clock bounds left in the changed tests are
`coordinator.shutdown(timeout=1.0)` after all tasks finish, which was
already there, and the pytest-timeout marks.
- **Public boundary.** Synthetic fixtures only.
- **Docs.** `docs/design/convergence-simplification-inventory.md` still
cites the deleted equivalence test. That design note describes the dead
route as a whole, so it is left to polylogue-fhlo1.

## Residuals

- In one repro job under load, the deleted test's seeding hung for 120 s
in `BlobPublicationReservationStore.reserve_many` at `conn.close()`.
Sibling tests in that file use the same seeding and passed. I did not
reproduce it again.
- `tests/unit/daemon/test_daemon_cli.py` load-sensitivity did not show
up in my runs, so it is not addressed here.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant