Skip to content

fix(storage): stop promising an actuator the executability gate can't select - #3466

Merged
Sinity merged 3 commits into
masterfrom
fix/raw-authority-quarantine-absorbing-state
Jul 31, 2026
Merged

Sinity merged 3 commits into
masterfrom
fix/raw-authority-quarantine-absorbing-state

Conversation

@Sinity

@Sinity Sinity commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the raw-authority-quarantine absorbing state (polylogue-u19l) by making
its root cause (polylogue-w32w) structurally unrepresentable: a frontier
item's actuator must have a real apply() handler only if its state is in the
executability gate's admitted set.

Problem

Audit 2026-07-31 (live source.db, read-only) found: 4,147 open
raw_authority_blockers rows all reading "accepted raw authority remains
quarantined pending exact refinement proof"; 15,205/17,384 frontier plans
residual (87%); fixed_point=0 on all 256 retained censuses; total gap count
that only ever grew (16,874 -> 17,384, never shrinking).

Root cause: a quarantined raw whose refinement proof came back "ineligible"
got no strategy override, so _classify_frontier's default fallback assigned
it state=UNRESOLVED_PROVENANCE, actuator=REFINE_QUARANTINE. But
REFINE_QUARANTINE has a real apply() dispatch branch that only ever runs
for _EXECUTABLE_STATES = {SAFELY_REKEYABLE, DUPLICATE_ALIAS} — both the
daemon and the operator break-glass path (apply_raw_authority_frontier,
which raises RuntimeError on any non-executable selected item) select only
executable items. The handler at raw_reconciler.py:1297 was unreachable
through every path that exists.

Two corrections from the audit preserved unchanged:

  • unresolved_raw_replay_blockers() already deliberately excludes frontier
    plan blockers from starving unrelated work.
  • REFINE_QUARANTINE is not entirely dead — the strategy override for
    eligible/already_repaired quarantined raws (promoting to
    SAFELY_REKEYABLE) is the real, executable 2,179-plan lane draining at
    8/pass. Only the ineligible complement was absorbing.

Solution

  • _strategy_overrides now records an override for "ineligible" quarantine
    proofs too: state stays UNRESOLVED_PROVENANCE (still tracked in
    state_counts and raw_authority_blockers — still an operator-visible
    obligation), actuator becomes NONE with the real ineligibility reason
    folded into the item's reason text. The ineligibility reasons enumerated
    in _inspect_quarantined_accepted_raw (missing rows, mismatched hashes,
    competing authority, incompatible typed envelopes) are permanent
    structural facts about a raw's own data, not transient states — matching
    the existing apply()-time code comment ("not transiently"). This is the
    "record a terminal, countable, operator-visible state" branch of the two
    legitimate options the bead named, chosen over building a refinement-proof
    actuator that cannot exist for permanently mismatched bytes.
  • Same fix applied to two more classify_frontier call sites with the
    identical shape: the no-logical_source_key REFINE_QUARANTINE fallback,
    and REPLAY on a logical-source-key mismatch (confirmed 0 live rows today
    via the raw_authority_blockers reason distribution; REPLAY has no
    apply() handler at all, fixed pre-emptively).
  • polylogue-w32w's invariant, made structurally enforceable:
    RawAuthorityFrontierItem.__post_init__ now rejects constructing an item
    whose actuator has a real apply() dispatch branch
    (_APPLY_DISPATCHED_ACTUATORS) paired with a non-executable state. Fires
    on every construction path (_item(), dataclasses.replace() in
    _apply_judgment_dispositions). REACQUIRE/REQUEST_JUDGMENT are
    deliberately exempt — both resolve out-of-band (ordinary re-acquisition;
    an operator judgment assertion promoted by _apply_judgment_dispositions).
  • test_apply_dispatched_actuators_match_apply_branches regex-parses the
    actual apply() dispatch branches out of the module source and asserts they
    equal _APPLY_DISPATCHED_ACTUATORS, so the allowlist can't silently drift.
  • test_quarantine_refinement_fanout_scopes_by_logical_source_key previously
    asserted the now-fixed sibling's actuator as REFINE_QUARANTINE — it was
    the direct reproduction case for this defect, encoded as expected
    behavior. Updated to assert NONE.
  • Also restores polylogue/storage/sqlite/archive_tiers/common.py's
    literal_check() helper, deleted by refactor: collapse duplicate implementations, dead shims, and split vocabularies #3458 on stale "uncalled" evidence
    after feat(storage): wire literal_check into DDL, fix a drift CHECK gap #3451 had already wired it into archive_tiers/index.py — broke
    every import of polylogue.storage on origin/master HEAD. Discovered
    while setting up verification for this fix; restored as a prerequisite
    since nothing here (or in the wider suite) can import without it.

What this fix does NOT do: it does not reduce the 4,147 existing blocker
rows or shrink raw_authority_census_plans' ~709K carried_forward rows
(polylogue-f4z9, tracked separately) — those are pre-existing durable rows
from the old misclassification and need their own migration/backfill,
out of scope here. Going forward, every new census records these raws with
the honest NONE actuator instead of reproducing the false promise. No
index rebuild is required
(polylogue ops reset --index && polylogued run) — source.db's revision_authority column is unaffected; only the
derived frontier classification (an index-tier read model) changes on the
next census.

Verification

  • devtools test tests/unit/storage/test_raw_authority_ledger.py tests/unit/storage/test_quarantined_accepted_raw_repair.py tests/unit/storage/test_duplicate_raw_identity_repair.py tests/unit/storage/test_browser_capture_origin_repair.py tests/unit/storage/test_archive_tiers_common.py — 81 passed
  • devtools verify --quick — exit 0 (ruff format, ruff check, mypy --strict, render all --check, layering, closure-matrix, schema-versioning policy, and the rest of the quick-tier gates)
  • Not run: full suite / testmon (fresh unseeded worktree); per-PR CI skips the heavy test suite by design.
  • Pre-existing, unrelated failure found and left alone (filed as polylogue-jsxj):
    tests/unit/daemon/test_daemon_cli.py::test_maybe_run_raw_materialization_whale_pass_*
    (TypeError: lambda got unexpected keyword '_bootstrap') — introduced by
    refactor(config): delete two inert config keys and the whale off-switch #3455's load_polylogue_config() signature change, touches neither
    raw_reconciler.py nor common.py; reproduces identically on
    origin/master HEAD before this branch's changes.

Ref polylogue-u19l
Ref polylogue-w32w

Sinity and others added 2 commits July 31, 2026 16:25
…ill called

Problem: #3458 ("collapse duplicate implementations, dead shims") deleted
literal_check() from archive_tiers/common.py as "uncalled", but #3451 had
already wired three real call sites into archive_tiers/index.py
(delegation_facts.mapping_state/.result_status CHECK generation) before
#3458 merged. #3458's removal claim was never re-checked against that
landed change, so origin/master HEAD breaks on
`ImportError: cannot import name 'literal_check' from
'polylogue.storage.sqlite.archive_tiers.common'` for every import of the
storage package. Found while setting up verification for the
polylogue-u19l/polylogue-w32w raw-authority fix.

Solution: restore literal_check() and its sql_string_literal import exactly
as they existed before #3458's deletion, add it back to __all__, and fix
the order_check() docstring cross-reference #3458 also broke.

Verification: `python -c "import polylogue.storage.raw_reconciler"` now
succeeds (previously ImportError). Full verification for this commit rides
the same devtools verify/test run as the raw-authority fix in this branch.
… select

Problem (polylogue-u19l, polylogue-w32w): a quarantined accepted raw whose
refinement proof came back "ineligible" got no strategy override, so
_classify_frontier's default fallback assigned it
state=UNRESOLVED_PROVENANCE, actuator=REFINE_QUARANTINE. But
REFINE_QUARANTINE has a real apply() dispatch handler that only ever runs
for _EXECUTABLE_STATES = {SAFELY_REKEYABLE, DUPLICATE_ALIAS} -- both the
daemon (daemon/cli.py) and the operator break-glass path
(apply_raw_authority_frontier) select only executable items. So this
handler was unreachable through every path that exists.

Live evidence (source.db, read-only, 2026-07-31, before this fix):
- 4,147 open raw_authority_blockers rows, all "accepted raw authority
  remains quarantined pending exact refinement proof"
- 15,205/17,384 frontier plans residual (87%)
- fixed_point=0 on all 256 retained censuses
- gap count only ever grew: 16,874 (seq 691) -> 17,384 (seq 931)

Two corrections from the audit that this fix preserves:
- unresolved_raw_replay_blockers() already deliberately excludes frontier
  plan blockers from starving unrelated work -- untouched here.
- REFINE_QUARANTINE is NOT entirely dead: the strategy override for
  eligible/already_repaired quarantined raws (promoting them to
  SAFELY_REKEYABLE) is the real, executable 2,179-plan lane draining at
  8/pass -- untouched here. Only the ineligible complement was absorbing.

Solution: the ineligibility reasons enumerated in
_inspect_quarantined_accepted_raw (missing rows, mismatched hashes,
competing authority, incompatible typed envelopes) are permanent
structural facts about a raw's own data, not transient states awaiting a
retry -- the existing apply()-time comment already said as much ("not
transiently"). Chose the "record a terminal, countable, operator-visible
state" branch of the two legitimate options in polylogue-u19l, over
building a refinement-proof actuator that cannot exist for permanently
mismatched bytes:

- _strategy_overrides now also records an override for "ineligible"
  quarantine proofs: state stays UNRESOLVED_PROVENANCE (still tracked in
  state_counts and raw_authority_blockers -- still an operator-visible
  obligation), but actuator becomes NONE with the real ineligibility
  reason folded into the item's reason text, instead of the false
  REFINE_QUARANTINE promise. Same fix applied to the two remaining
  classify_frontier call sites that had the identical shape (quarantined
  row with no logical_source_key to override under; REPLAY assigned to a
  logical-source-key mismatch that likewise has no apply() handler --
  confirmed empirically at 0 live rows today, fixed pre-emptively so the
  same defect can't silently recur there).

- polylogue-w32w's invariant, made structurally enforceable rather than
  documented: RawAuthorityFrontierItem.__post_init__ now rejects
  constructing an item whose actuator has a real apply() dispatch branch
  (_APPLY_DISPATCHED_ACTUATORS) paired with a non-executable state. This
  fires on every construction path (_item(), dataclasses.replace() in
  _apply_judgment_dispositions), so the exact u19l shape can no longer be
  constructed even by a future call site, not merely avoided by
  convention. REACQUIRE and REQUEST_JUDGMENT are deliberately excluded --
  both resolve out-of-band (ordinary re-acquisition; an operator judgment
  assertion promoted by _apply_judgment_dispositions), not through this
  apply dispatcher, so pairing them with a non-executable state is not the
  defect class this guards against.

- test_apply_dispatched_actuators_match_apply_branches parses the actual
  apply() dispatch branches out of the module source and asserts they
  match _APPLY_DISPATCHED_ACTUATORS exactly, so the guard's own allowlist
  can't silently drift out of sync with the code it's meant to police.

- test_quarantine_refinement_fanout_scopes_by_logical_source_key
  (test_quarantined_accepted_raw_repair.py) previously asserted the
  now-fixed session_b sibling's actuator as REFINE_QUARANTINE -- i.e. it
  was the direct reproduction case for this defect, encoded as expected
  behavior. Updated to assert NONE.

What this fix does NOT do: it does not reduce the 4,147 existing blocker
rows or shrink raw_authority_census_plans' ~709K carried_forward rows
(polylogue-f4z9) -- those are pre-existing durable rows from the old
(mis-)classification and need their own migration/backfill pass, out of
scope here. What changes going forward: every future census will record
these raws with the honest NONE actuator, so the same population stops
generating a false "REFINE_QUARANTINE will fix this" signal on every
subsequent cycle. A rebuild (polylogue ops reset --index && polylogued
run) is not required -- source.db's revision_authority column is
unaffected; only the derived frontier classification (index-tier read
model) changes on the next census.

Also restores polylogue/storage/sqlite/archive_tiers/common.py's
literal_check() helper, deleted by #3458 on stale "uncalled" evidence
after #3451 had already wired it into archive_tiers/index.py -- broke
every import of polylogue.storage on origin/master HEAD. Discovered while
setting up verification for this fix; fixed as a prerequisite since
nothing here (or in the wider test suite) can import without it. See the
prior commit on this branch for full detail.

Verification:
- devtools test tests/unit/storage/test_raw_authority_ledger.py
  tests/unit/storage/test_quarantined_accepted_raw_repair.py
  tests/unit/storage/test_duplicate_raw_identity_repair.py
  tests/unit/storage/test_browser_capture_origin_repair.py
  tests/unit/storage/test_archive_tiers_common.py -- 81 passed
- devtools verify --quick -- exit 0 (ruff format, ruff check, mypy
  --strict, render all --check, layering, closure-matrix, schema policy,
  and the rest of the quick-tier gates)
- Not run: full suite / testmon (fresh worktree, unseeded). Pre-existing,
  unrelated failure found and left alone:
  tests/unit/daemon/test_daemon_cli.py::test_maybe_run_raw_materialization_whale_pass_*
  (TypeError: lambda got unexpected keyword '_bootstrap') -- introduced by
  #3455's load_polylogue_config() signature change, touches neither
  raw_reconciler.py nor common.py; reproduces identically on origin/master
  HEAD before this branch's changes.

Ref polylogue-u19l
Ref polylogue-w32w

Co-Authored-By: Claude <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 17 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5fbe65e3-d558-4665-8e3c-7bdb1f68b4d2

📥 Commits

Reviewing files that changed from the base of the PR and between d740074 and 49e5a57.

📒 Files selected for processing (3)
  • polylogue/storage/raw_reconciler.py
  • tests/unit/storage/test_quarantined_accepted_raw_repair.py
  • tests/unit/storage/test_raw_authority_ledger.py

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.

Resolves the common.py conflict by taking master's literal_check restoration
(#3464), which superseded this branch's own prerequisite fix for the same
breakage.
@Sinity
Sinity merged commit 5118541 into master Jul 31, 2026
2 of 3 checks passed
@Sinity
Sinity deleted the fix/raw-authority-quarantine-absorbing-state branch July 31, 2026 15:19
Sinity added a commit that referenced this pull request Aug 2, 2026
…story (#3559)

## Summary

Fixes the census/plan-ledger side of the raw-authority obligation-guard
defect: `prune_raw_authority_census_history`'s per-census plan-row
window (`RAW_AUTHORITY_CENSUS_PLAN_RETENTION`) no longer stays
permanently pinned by a structurally-unresolvable blocker. Census
headers keep their guard (a real FK), plan-row detail now prunes on the
ordinary retention window regardless of blocker state.

## Problem

`polylogue-z7ko` and `polylogue-f4z9` describe the same mechanism from
two angles:
`raw_authority_census_plans`/`raw_authority_census_post_plans` (a
durable `source.db` tier) grew ~100k rows/hour, reaching 709,264 rows
and ~870 MiB, with only 41 of the ~112 most recent censuses (sequence
820-932) holding plan rows at all — far more than
`RAW_AUTHORITY_CENSUS_PLAN_RETENTION=8` should allow. `fixed_point`
never reached 1 on any of 256 censuses ever measured.

Root cause: `prune_raw_authority_census_history`'s plan-row window
required every blocker attached to a census to be resolved before that
census's `raw_authority_census_plans`/`_post_plans` rows could be
dropped. The dominant blocker reason ("accepted raw authority remains
quarantined pending exact refinement proof", ~4,400 rows) is a
structurally permanent fact about a raw's own data — nothing about it
changes between census passes, so it never resolves. Continuous live
ingestion keeps producing new instances of this same permanent
obligation; each one anchors whichever census first observed it, and
that census's entire plan-row snapshot stays pinned forever. Over time
more and more censuses accumulate this pin, which is why the guard
eventually stopped bounding growth at all despite existing.

I verified this is a genuinely separate exception from `polylogue-wkc6`
(PR #3530, already merged): that PR fixed pruning of *orphaned*
`raw_authority_plans` rows (plans no census references at all). This
PR's guard is a different code path in the same function — the
*per-census plan-row retention window itself* refusing to advance while
any attached blocker is open, which `wkc6` did not touch.

I also checked `polylogue-u19l` (PR #3539, merged,
`live_source_reconciliation.py`): that module is a read-only classifier
over `raw_sessions.revision_authority='quarantined'`, entirely separate
from the `raw_authority_blockers`/census obligation mechanism this bug
lives in — it never marks a blocker resolved and isn't wired to this
guard. It is not usable to unblock this issue's plans, because the
underlying obligation here is not "unproven," it's provably permanent
(see `_strategy_overrides`' ineligible branch in `raw_reconciler.py`,
from the already-merged PR #3466).

## Solution

`polylogue/storage/raw_authority.py`,
`prune_raw_authority_census_history`:

- The plan-row window (`raw_authority_census_plans`/`_post_plans`) now
deletes purely by the `sequence_no` retention floor, unconditionally. A
blocker's own `expected_json`/`observed_json` columns already carry a
complete, self-contained snapshot of the plan and its evidence (written
by `_reconcile_frontier_obligations`), and
`resolve_raw_authority_blocker` reads that plus the census-independent
`raw_authority_plans` table — never
`raw_authority_census_plans`/`_post_plans`. So gating this window on
blocker resolution bought nothing but the unbounded pin.
- Already-*resolved* blockers tied to a pruned census are deleted in the
same pass (nothing needs them once their census ages out);
still-*unresolved* ones are left alone — deleting those would be the
actual "silently report the obligation as cleared" failure mode the old
guard existed to avoid.
- The header window (`raw_authority_censuses`) keeps its existing guard
unchanged: `raw_authority_blockers` has a real foreign key on
`census_id`, so a header can only be dropped once nothing references it.

No schema/DDL change: `source.db`'s table definitions are untouched,
this is a behavior-only fix to an existing maintenance routine that
already runs inside every census-recording transaction.

## What's intentionally out of scope

- The underlying quarantine pile itself (why ~4,400 raws are permanently
ineligible) is `polylogue-u19l`'s territory, already addressed there.
- A full `RawAuthorityReconciler` rewrite
(`polylogue-lkrc`/`hjpx`/`yla8`) remains explicitly gated on separate
operator authorization.
- I don't touch `_reconcile_frontier_obligations`'s blocker-insert path
at all: I initially suspected `blocker_id` being keyed on `(census_id,
plan_id)` caused duplicate unresolved rows per pass, but a pre-existing
partial unique index (`idx_raw_authority_blockers_open_plan` on `plan_id
WHERE resolved_at_ms IS NULL`) already prevents that — there is exactly
one unresolved blocker row per `plan_id`, always. That hypothesis was
wrong; I reverted the speculative change once I found the index and
re-diagnosed against the actual mechanism above.

## Verification

```
devtools test tests/unit/storage/test_raw_authority_ledger.py tests/unit/storage/test_raw_retention.py
devtools verify --quick
```

New test
`test_census_plan_rows_prune_past_retention_even_with_an_unresolved_blocker`
plants a durable, permanently-unresolved blocker on the first of nine
census passes and asserts: the blocker itself is never silently marked
resolved; its census header survives (the real FK); its plan-row detail
prunes to the retention window like any other census's. Confirmed this
test fails against the pre-fix code (`assert 'census:1:...' not in
{...}` — the first census's rows were still present after 8 more passes)
and passes after.

10 pre-existing failures in `test_raw_authority_ledger.py` are unchanged
before and after this diff (verified against both the pre-fix and
post-fix tree) — an unrelated `_write_codex_raw` test-fixture regression
where an empty-text message is now rejected by dispatch ("no messages,
no positive conversational evidence"). Not touched by this PR; filing a
follow-up bead is worth doing separately.

Ref polylogue-z7ko
Ref polylogue-f4z9

Co-authored-by: Claude <[email protected]>
Sinity added a commit that referenced this pull request Aug 2, 2026
Problem: polylogue-w32w found RawAuthorityFrontierState.UNRESOLVED_PROVENANCE
paired with the dispatched RawAuthorityActuator.REFINE_QUARANTINE -- an
actuator no path (daemon or operator break-glass) could ever select, since
only states in _EXECUTABLE_STATES are ever chosen. 4,174 blockers
accumulated behind this unreachable actuator for weeks before anyone
noticed. PR #3466 fixed the specific defect and added a constructor-level
invariant (RawAuthorityFrontierItem.__post_init__ raises for this exact
shape) plus a drift-guard test tying _APPLY_DISPATCHED_ACTUATORS to
apply()'s real dispatch branches. That closed polylogue-w32w, but its
close note explicitly left this bead's broader ask open: a devtools
lab-policy check, not just a constructor guard, so a FUTURE unreachable
pairing fails at review time even for a branch no test happens to
exercise (a runtime constructor guard only fires when something actually
constructs the bad combination).

Solution: devtools/verify_raw_authority_frontier_executability.py
statically parses polylogue/storage/raw_reconciler.py and enumerates
every literal (state, actuator) pair constructible via _item(...) and
_StrategyOverride(...) call sites (17 pairs found on the current source;
1 dynamic forwarding site correctly reported as informational-only,
since its underlying literal source is already covered by its
_StrategyOverride construction site). Each pair is re-checked against
the real _EXECUTABLE_STATES / _APPLY_DISPATCHED_ACTUATORS imported
directly from raw_reconciler.py (never re-declared), so this lint can
never drift out of sync with the actual executability gate. Wired as
`devtools lab policy raw-authority-frontier-executability`.

Verification: devtools test tests/unit/devtools/test_verify_raw_authority_frontier_executability.py
-- 6 passed, including an anti-vacuity test reproducing the exact
pre-#3466 UNRESOLVED_PROVENANCE+REFINE_QUARANTINE shape in a synthetic
fixture module and proving the lint flags it, plus controls proving a
safe pairing, a RawAuthorityActuator.NONE pairing, a dynamic-site
pairing, and an unknown-enum-member typo all behave correctly.
devtools lab policy raw-authority-frontier-executability against the
live repo: 0 violations. devtools verify --quick clean (ruff
format/check, mypy --strict, render all --check, topology projection
regenerated for the new module).

Ref polylogue-lb39z (Phase 1, item 4) / polylogue-w32w

Co-Authored-By: Claude <[email protected]>
Sinity added a commit that referenced this pull request Aug 2, 2026
…y lint (#3588)

## Summary

Lands items 3 and 4 of polylogue-lb39z's five-item raw-authority Phase 1
program (items 1-2 already merged via PR #3574 and #3577). Both items
are low-risk (read-only classifier + dry-run actuator; static AST lint)
and share the same investigation session, so they land in one PR with
two focused commits rather than two separate PRs.

## Problem

**Item 3**: 2,712 `raw_sessions` rows are `revision_kind='append'`,
`revision_authority='quarantined'`, and have zero
`raw_session_memberships` rows at all -- a genuine fixed point. The only
mechanism that ever promotes an append raw
(`_promote_contiguous_append_evidence`) requires its byte-contiguous
predecessor to already be `byte_proven`; when the predecessor is itself
stuck quarantined, no amount of re-running that cascade reaches the
child.

**Item 4**: polylogue-w32w found
`RawAuthorityFrontierState.UNRESOLVED_PROVENANCE` paired with the
dispatched `RawAuthorityActuator.REFINE_QUARANTINE` -- an actuator no
path (daemon or operator) could ever select. 4,174 blockers accumulated
behind this for weeks undetected. PR #3466 added a runtime constructor
guard (`RawAuthorityFrontierItem.__post_init__`) for the exact shape,
but a constructor guard only fires when something actually constructs
the bad pairing -- w32w's own close note explicitly left this bead's
broader ask (a static lab-policy check) open.

## Solution

**Item 3** (`polylogue/storage/raw_append_chain_backfill.py` +
`polylogue/maintenance/raw_append_chain_backfill_apply.py`): a new
read-only classifier proves each membershipless append row's own claimed
`[append_start_offset:append_end_offset)` byte range directly against
its live source file's current bytes, reusing the exact byte-window
comparison polylogue-u19l's `live_source_reconciliation` module already
validated -- a proof independent of any ancestor's authority. The
actuator follows the identical dry-run-default /
verified-backup-required-to-apply / immutable-receipt pattern as the
merged u19l and lb39z-item-2 actuators, promoting exact matches to
`byte_proven` (reusing the existing `live_source_verification_v1`
evidence value -- the mechanism is identical, only the target population
differs). It deliberately never touches
`predecessor_raw_id`/`baseline_raw_id`/`acquisition_generation`; once a
row is proven, the existing cascade picks it up for free on the next
convergence pass. Adds migration 020 (source schema v19->v20, new
`raw_append_chain_backfill_receipts` table) and `devtools workspace
raw-append-chain-backfill-apply`.

**Item 4** (`devtools/verify_raw_authority_frontier_executability.py`):
statically parses `polylogue/storage/raw_reconciler.py` and enumerates
every literal `(state, actuator)` pair constructible via `_item(...)`
and `_StrategyOverride(...)` call sites (17 pairs on current source; 1
dynamic forwarding site correctly reported informational-only, since its
literal source is separately covered). Each pair is re-checked against
the real `_EXECUTABLE_STATES`/`_APPLY_DISPATCHED_ACTUATORS` imported
directly from `raw_reconciler.py`, so this lint can never drift out of
sync with the actual gate. Wired as `devtools lab policy
raw-authority-frontier-executability`.

## Not in scope / explicitly deferred

Item 5 of polylogue-lb39z (re-classify the ambiguous cohort + wire
`_maximal_evidence_fallback`) is intentionally NOT in this PR -- flagged
in the bead as the highest-risk item, directly touching the
never-retire-an-accepted-head invariant. See the bead notes for a
detailed account of what's needed and why it needs its own dedicated,
unhurried session.

No live archive mutation was performed or attempted. Both actuators are
proven only against synthetic fixtures; live application is a separate,
later, operator-supervised step.

## Verification

- `devtools test tests/unit/storage/test_raw_append_chain_backfill.py
tests/unit/maintenance/test_raw_append_chain_backfill_apply.py` -- 5
passed
- `devtools test tests/unit/storage/test_durable_migrations.py` -- 40
passed (hardcoded v19->v20 migration-chain assertions updated)
- `devtools test
tests/unit/devtools/test_verify_raw_authority_frontier_executability.py`
-- 6 passed, including an anti-vacuity test reproducing the exact
pre-#3466 defect shape in a synthetic fixture and proving the lint
catches it
- `devtools test -k raw_authority` -- 90 passed, 6 failed (confirmed
pre-existing/unrelated: `test_raw_authority_scale_proof.py` /
`test_raw_authority_daemon_health_proof.py`, identical to the prior
lb39z session's findings)
- `devtools test -k raw_materialization` -- 118 passed
- `devtools verify --quick` -- clean (format, lint, mypy --strict,
render all --check, topology projection regenerated)

Ref polylogue-lb39z (Phase 1, items 3 and 4) / polylogue-w32w

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[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