Skip to content

chore: Route delegation evidence materialization through controlled rea… - #5023

Merged
Sinity merged 2 commits into
masterfrom
batch/polylogue-20260913-133320-6626c07a/integration
Sep 13, 2026
Merged

Sinity merged 2 commits into
masterfrom
batch/polylogue-20260913-133320-6626c07a/integration

Conversation

@Sinity

@Sinity Sinity commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Batch polylogue-20260913-133320-6626c07a on base a0187cfc1fed.

polylogue-vclez.5 Route delegation evidence materialization through controlled reads

  • 1. The materializer has no uncontrolled direct ArchiveStore.open_existing() read. 2. Its read phase uses a controlled/pinned boundary with cancellation and cleanup semantics. 3. Its separately owned w

polylogue-vclez.6 Route raw intake and observation discovery through controlled reads

  • 1. Both modules have no uncontrolled direct ArchiveStore.open_existing() read. 2. Bounded raw discovery retains current payload-size, session-id, cancellation, and continuation behavior. 3. Writer adm

polylogue-vclez.7 Route raw derivation compute and revalidation through controlled reads

  • 1. compute() and publish-time revalidation no longer make uncontrolled direct archive reads. 2. Revision/replay and raw convergence results are unchanged except for controlled read ownership. 3. Publi

polylogue-vclez.8 Classify and enforce the operation snapshot read boundary

  • 1. operation-context reads are either through the common transaction or an explicit, tested controlled operation-read boundary. 2. The direct-open guard distinguishes only this proven controlled class

@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 377823b7-dc65-4330-8e35-eaa198d7370c


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sinity
Sinity merged commit 3faacef into master Sep 13, 2026
3 checks passed
@Sinity
Sinity deleted the batch/polylogue-20260913-133320-6626c07a/integration branch September 13, 2026 14:19

@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: 016f240969

ℹ️ 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/operations/intake_adapters.py Resolved
@chatgpt-codex-connector

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-13T14:22:57.013744Z 016f240 PR opened
ℹ️ 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.

Sinity added a commit that referenced this pull request Sep 22, 2026
…5440)

## Summary

Repairs the six long-standing failures in
`tests/unit/daemon/test_daemon_cli.py`, which turned out to have **three
distinct causes** — including one real product defect. 101 passed / 6
failed at base `5204d0e9e`; **107 passed / 0 failed** at head, with no
previously-passing test in the file regressed.

These six had been re-reported as "inherited reds" by three separate
lanes without being owned, so they were costing attention on every run.

## 1. Product defect — `publish_session_usage_rollup` reported success
after deleting nothing

Its retirement branch returned `True` unconditionally. A **required**
key — a live intake hint names a session before ingest commits the row —
hit that branch, so the convergence kernel saw *"publish accepted,
required output still missing"*, which it deliberately classifies as a
broken publication, and recorded FAILED.

The delete's `rowcount` is the honest discriminator: an excess key
always has a binding row, a required one does not. No binding row means
nothing was retired, so the publication refuses and the key converges on
a later pass — which is the retryable race it actually was.

Confirmed by instrumenting both branches and observing `DBGBRANCH
retire` immediately before the FAILED, rather than inferred from
reading.

## 2. Stale test —
`..._parks_operation_recovery_on_audit_schema_mismatch`

The test wrote `PRAGMA user_version = 1` to manufacture a mismatch.
`b56699c80` (#5275, "Fresh schema floor") set
`ARCHIVE_FORMAT_FLOOR_VERSION = 1`, and audit's declared version **is**
that floor — so the write became a no-op,
`durable_tier_schema_mismatch()` returned False, and recovery was
correctly called. **The gate was never broken; the test stopped
producing its own premise.** The skew is now derived from the
declaration and deliberately *backward*, because a forward version is
refused earlier by the durable change train's forward-admission check —
a different contract.

## 3. Harness defect — `..._holds_writer_lease_through_replay`

`RawObservationDerivation.publish` began pinning its membership read
through `open_operation_read` in `3faacef23` (#5023). That read captures
the view from `archive.archive_root` and `archive.index_db_path`, which
the test's `FakeArchive` never grew. Both were added **to the double**,
not loosened in the production read. `pin_operation_snapshot` stays
absent because `operation_context.py` explicitly declares that
minimal-double path.

## Verification

```
devtools verify --quick                          ->  PASSED
devtools test tests/unit/daemon/test_daemon_cli.py  ->  107 passed, 0 failed
devtools test <rollup derivation + 2 convergence suites>  ->  PASSED
```

All three mutations **executed and refuted**:

- restore the retirement branch -> all four watcher params red:
`session_usage_rollup ... FAILED ... 'publish reported success but the
required output remains missing'`, `assert 1 == 0`
- replace the `durable_schema_mismatch` gate with `False` ->
`AssertionError: Expected 'mock' to not have been called. Called 1
times.`
- drop the writer lease across replay -> `assert [0] == [1]`, proving
that adding `archive_root` to `FakeArchive` did **not** weaken what that
test proves

## Two further issues measured, not guessed

The index read raced the replace that follows a returning intake pass
(measured: 1 -> 2 messages at ~200 ms), now a bounded wait plus settle
window. And the profile row is published then *withdrawn* by the
quarantined snapshot's replace, with re-derivation never arriving
because the test stops driving the daemon — so the row is sampled across
the window and required to have been published.

Stated plainly: that assertion **no longer proves the row is present in
the final settled state.** That is not a property a stopped daemon can
establish.

## Schema identity

`polylogue/storage/derived/session/usage_rollup.py` is **IN** the
closure. Index identity `be8d4619aff05…` -> `0d03d682a0c97…`. The
archive must reconverge, and **this must land before any fresh rebuild
starts.**

## Residual worth a bead

The durable change train's forward-admission refusal was not changed, so
a **forward**-versioned `audit.db` still kills daemon startup with
`DurableChangeTrainError` escaping into the `BaseException` shutdown
path — arguably the same failure mode polylogue-39pdi was filed against,
reachable by a different route. Redefining a durable-migration guard is
a product decision beyond a repair lane's authority, so the test was
scoped to the contract it names and the gap reported rather than
silently widened.

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

https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Closing out open Codex review threads on this PR (evidence checked against master at 64a9bd0):

  • P1 polylogue/operations/intake_adapters.py:484: Fixed on master (checked at 64a9bd0): Without a publication guard, open_operation_read no longer takes OwnedArchiveLocation. It opens read-only and verifies archive identity optimistically, so it does not conflict with the daemon's held ownership (polylogue/operations/operation_context.py:226-241, 287-293).

Resolving every thread listed; confirmed defects are fixed under the named bead.

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