Skip to content

fix: Separate unmeasured from measured zero across four red surfaces - #5367

Merged
Sinity merged 4 commits into
masterfrom
fix/inherited-red-cluster
Sep 21, 2026
Merged

Sinity merged 4 commits into
masterfrom
fix/inherited-red-cluster

Conversation

@Sinity

@Sinity Sinity commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Summary

Clears four inherited-red defects that every lane has had to prove "not mine".
14 failed / 408 passed → 0 failed / 419 passed, proven at the rebase base by
reverting all eight changed files in place rather than inferred from bead text.

Two were product defects, two were stale tests. No test was relaxed to make it
green.

polylogue-w4hfb — product defect, and the tempting fix is provably wrong

analysis/orchestration_evidence.py built positive_tokens with
if (value := getattr(message, key)) > 0 over four lanes that became
int | None = None in #5300. Guarded rather than coerced: positive is
value is not None and value > 0, and value is None gets its own bucket
plus a message_token_lanes_unmeasured gap token. A measured 0 is excluded from
the unmeasured bucket, because it is a measurement.

The forbidden fix was executed to prove it is caught: getattr(message, key) or 0
leaves 6 of 7 green and reddens exactly the distinction test —
assert usage['messages_with_unmeasured_token_lanes'] == 1 → assert 0 == 1.

Sibling sweep found no other consumer applying an ordering operator to these four
columns: cost_compute.py tests is not None, material_adapter.py guards the
same way, pricing.py orders a coerced payload carrying a separate
unmeasured_lanes tuple, and storage readers use IS NOT NULL/COALESCE.

polylogue-njcms — the test's intent survives the census-ledger retirement

Ruling: the retired frontier census row carried two separable questions —
"is there unresolved frontier debt?", which durable blocker rows now answer
directly and which was correctly retired, and "was this domain measured at all?",
which nothing answered afterwards. Retiring the ledger retired the row, not the
second question.

The defect is in the product, not a revert. raw_materialization_ready returns
True when all twelve blocking counters are zero — so on an archive with zero raw
artifacts every counter is trivially zero and the projection certifies convergence
off an inspection that examined no rows.
Probed live on the fixture:
classification='not_run', raw_artifact_count=0, yet
claim_guard.converged = {value: true, determinate: true, reason: 'ready'}.

The successor precondition is a zero denominator — exactly the shape
search_unmeasured_reason already refuses for FTS coverage ("fts coverage is
undefined at a zero denominator, not complete"
). Unlike the old census-row
condition, which a code comment says "marked every production archive permanently
indeterminate"
, this leaves every populated archive determinate. Only an explicit
integer zero is classified; an absent count keeps its own verdict, so a real
refutation is never masked into "unknown" — a mutation widening it to
if not raw_artifact_count: reddens that assertion.

Routed through readiness/claim_guard.py (closure out); readiness/capability.py
(closure IN) untouched. Both status producers already share the one function.

The collateral was repaired, not accommodated. Nine daemon-status tests asserted
converged=True on a mocked empty archive. Their subject is debt-ledger isolation
from the convergence claim — their helper is literally named
_complete_raw_materialization_readiness ("the complete source evidence required to
isolate claim signals") while supplying only available=True and a census stub. The
helper was made actually complete, preserving their subject exactly.

polylogue-2i96t — both causes were the test

input_tokens: MessageRenderEnvelope is generated from the canonical Message
model, so its lanes are int | None with default None — verified at runtime, and
models.py:61-70 states the ruling: defaulting to 0 on a public output model
"reintroduced, on the public output model, exactly the false measured-zero the
storage/read path stopped writing."
The assertions pinned the pre-#5300 default.
Repaired to pin None for an omitted lane and 0 for an explicitly measured
one — including on the wire, where unmeasured drops under exclude_none and a
measured zero does not.

total_unit: the field is legitimate and the roster was stale. Established by
git log -S: it entered in #5224 for polylogue-1c6j precisely so the emitted
document could satisfy the published additionalProperties: false schema, and that
PR regenerated the OpenAPI and CLI-output schemas without touching this test.

The roster was extended, not derived — deliberately: a field-set contract is
meant to force a human decision when the envelope grows. That is its
anti-vacuity property
, unlike pxzms below where the roster mirrored a derived
fact.

polylogue-pxzms — derived, plus a stronger property

Confirmed: write_coordinator.py measures out and is absent from the baseline, so
the hand-written roster was the stale side. Three property tests replace two
parametrized rosters and a pinned directional test — including one that proves the
anti-prefix property over all 1296 files under polylogue/ rather than one
hand-picked sibling pair (57 directories currently hold members beside non-members),
and one deriving real members and real non-members and requiring the command's JSON
verdict to equal the library predicate in both directions.

Both anti-vacuity directions executed. Stubbing the command to report True for
everything reddens it; stubbing False reddens it. And the must-not-redden
direction was measured too: a real closure change 555 → 933 that pulled
write_coordinator.py back IN left all three replacement tests green — the exact
class of change that broke the old roster. (The two tests that did redden are the
ones that should: the baseline ratchet and CLI identity-neutrality.)

One rejected mutation is reported for honesty: emptying
_REPLAY_ROUTING_FINGERPRINT_PATHS did not change the closure — the graph is too
connected for any single entry-path removal to matter — so the import-edge mutation
was used instead.

Verification

devtools verify --quick exit 0 (26 gates) · render all --check exit 0,
zero out of sync · focused 9-file selection 419/419 passed, git_dirty false
· the same selection with all eight files reverted in place → 14 failed.

Closure: all eight touched files out; the identity does not move — proven by
computing derived_schema_identity with both production files replaced by their
base content (index and ops identical). This branch can land during a rebuild.

Both candidate fix sites that are closure IN — surfaces/payloads.py for
2i96t and readiness/capability.py for njcms — were left untouched, because in
each case the defect was on the other side.

Residuals

  • raw_materialization_ready() still returns True at a zero denominator. Only
    the claim layer was fixed, because storage/archive_readiness.py is closure IN
    and claim_guard.py exists precisely so claim classification stays outside it.
    Non-claim consumers (convergence_feedback.py:31, commands/paths.py:76,
    readiness/__init__.py:97, daemon/status.py:3067) still read a pristine archive
    as materialization-ready. That is a rebuild-boundary edit, deliberately not taken.
  • orchestration_evidence.py:311 still appends a
    message_usage_missing_and_zero_indistinguishable gap whenever message_tokens is
    non-empty. Now that the lanes are nullable end to end and this projection separates
    them, that claim is stale prose — it over-reports uncertainty rather than
    over-claiming measurement, so it is safe, but it should be re-derived by whoever
    owns that vocabulary.
  • Still red and not cleared here, proven inherited:
    test_runtime_operations_are_well_formed on the missing explicit_dry_run_evidence
    guard.
  • Evidence boundary: focused selections plus the static quick gate, not an affected or
    full corpus run.

The shared known-red file was updated — four rows removed, with the 14 → 0
measurement and the per-defect ruling recorded in their place.

Closes polylogue-w4hfb, polylogue-njcms, polylogue-2i96t, polylogue-pxzms.

🤖 Generated with Claude Code

https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq

Sinity and others added 4 commits September 21, 2026 21:09
polylogue-w4hfb. ``build_session_orchestration`` built ``positive_tokens``
with a walrus comparison over the four per-message token lanes, which became
nullable on the canonical ``Message`` model in #5300 (polylogue-qgyuj). Six
MCP tests raised ``TypeError: '>' not supported between instances of
'NoneType' and 'int'`` at origin/master.

The lanes are guarded rather than coerced: ``None`` means the provider
reported no counter at this grain and ``0`` means it reported a measured
zero, so folding one into the other would republish the false measured-zero
the storage/read path stopped writing (#5353's defect class). Unmeasured
lanes now occupy their own bucket beside the positive tally, which is what
keeps ``message_tokens_lower_bound`` readable as a lower bound over a stated
denominator, and they raise the ``message_token_lanes_unmeasured`` gap.

Sweep for siblings: no other consumer applies an ordering operator to these
four columns off the ``Message`` model. ``cost_compute._get_message_token_counts``
already tests ``is not None``; ``sinex/material_adapter`` guards ``ParsedMessage``
lanes the same way; ``semantic/pricing`` orders a coerced ``CostUsagePayload``
with a separate ``unmeasured_lanes`` tuple; the SQL readers use
``IS NOT NULL``/``COALESCE``.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq
polylogue-njcms. ``claim_guard.converged.value`` read ``True`` on a pristine
archive that had never ingested anything, because
``raw_materialization_ready`` is the invariant "every raw artifact is
materialized" and reads every blocking counter as zero when there are no raw
artifacts at all. A status surface was certifying convergence off an
inspection that examined no rows.

The polylogue-6kur ruling retired the per-pass census ledger, and with it the
frontier census row this predicate used to require. That row carried two
separable questions, though: "is there unresolved frontier debt?", which
durable blocker rows now answer directly, and "was this domain measured at
all?", which nothing answered afterwards. The second question survives the
ruling; its successor precondition is the zero denominator, which -- unlike
the census row -- leaves every populated archive determinate.

This is the shape ``search_unmeasured_reason`` already refuses for FTS
coverage (polylogue-o6oct), and it lands in ``readiness/claim_guard.py``,
which is outside the derived-schema identity closure. ``readiness/capability.py``
is inside it and is untouched.

``_complete_raw_materialization_readiness`` in the daemon status tests now
carries a measured denominator, which is what "complete" was always meant to
mean there: those tests isolate the debt ledger from the convergence claim,
so the raw projection they hand it has to be one that inspected something.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq
polylogue-2i96t. Three reds in tests/unit/surfaces, two distinct causes, and
in both the test was the side that had gone stale.

``MessageRenderEnvelope`` is generated from the canonical ``Message`` model,
whose four token lanes became ``int | None = None`` in #5300
(polylogue-qgyuj) precisely so a public output model stops reporting an
unmeasured lane as a measured empty one. The two ``input_tokens == 0``
assertions were pinning the pre-qgyuj default. They now pin ``None`` for an
omitted lane and ``0`` for an explicitly measured one, so the distinction the
model exists to carry is what the contract holds -- on the wire too, where
the unmeasured lane drops under ``exclude_none`` and the measured zero does
not.

``SearchEnvelope.total_unit`` is legitimate: polylogue-1c6j declared it so
the emitted document could satisfy the published ``additionalProperties:
false`` schema this model generates, and #5224 regenerated both
docs/openapi/search.yaml and docs/schemas/cli-output/search-envelope.schema.json
for it. What #5224 did not update was ``REQUIRED_ENVELOPE_FIELDS``, so the
roster -- not the field -- was the defect. The roster stays hand-written
here on purpose: a field-set contract is meant to force a decision when the
envelope grows.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq
polylogue-pxzms. ``test_schema_closure`` pinned a hand-written ``IN_CLOSURE``
roster. The closure legitimately shrank in #5350 (558 -> 555 members) and
``polylogue/daemon/write_coordinator.py`` left it, so three tests went red
with nothing wrong: the file is absent from the origin/master
docs/plans/schema-closure-baseline.json.

A roster that a legitimate closure change turns red will go stale again on
the next one, and it erodes trust in the one check every lane must consult
before it knows its landing window. Every sample is now derived at run time:

* ``test_no_path_prefix_rule_reproduces_membership`` proves the anti-prefix
  property over every file under ``polylogue/`` instead of over one
  hand-picked sibling pair -- 57 directories currently hold members beside
  non-members.
* ``test_the_command_agrees_with_the_library_in_both_directions`` samples real
  members and real non-members, one per directory, and requires the command's
  verdict to equal the library predicate's for each. A command stubbed to
  answer IN (or out) for everything is red in either direction.

Measured: the replacements stay green across a 555 -> 933 closure shape
change that pulls ``write_coordinator.py`` back in, and go red when the
command misreports membership.

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

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 28af860f-8b1b-4640-b49c-20f8542c6e32

📥 Commits

Reviewing files that changed from the base of the PR and between a29cd05 and e2a702d.

📒 Files selected for processing (8)
  • polylogue/analysis/orchestration_evidence.py
  • polylogue/readiness/claim_guard.py
  • tests/unit/core/test_claim_guard.py
  • tests/unit/daemon/test_daemon_status.py
  • tests/unit/devtools/test_schema_closure.py
  • tests/unit/mcp/test_session_orchestration.py
  • tests/unit/surfaces/test_message_render_envelope.py
  • tests/unit/surfaces/test_search_envelope_contract.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.

@Sinity
Sinity enabled auto-merge (squash) September 21, 2026 19:27
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 21, 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-21T19:31:32.793445Z e2a702d PR opened
🔒 Security Review ✅ Completed 2026-09-21T19:34:21.980436Z e2a702d 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
Sinity merged commit 3e926b0 into master Sep 21, 2026
3 checks passed
@Sinity
Sinity deleted the fix/inherited-red-cluster branch September 21, 2026 19:38
Sinity added a commit that referenced this pull request Sep 21, 2026
…urface (#5370)

## Summary

Moves ref resolution into `operations/` as a single implementation,
makes the
`around` window expressible on **all four surfaces**, and moves three
more read
views onto the daemon.

**One hypothesis in the bead set is refuted below**, and `r3cuz` is
delivered
partially with the reasons stated rather than narrowed silently.

## polylogue-j5u2b — one implementation, reachable from both sides

`operations/ref_resolution.py` holds the whole resolution **as a plan**:
`plan_ref_resolution()` classifies the ref **archive-free** and either
decides the
payload or names the one archive read it needs (operation, arguments,
projection,
stable order). `Polylogue.resolve_ref` frames that read with
`run_archive_read`;
`daemon/http.py::_handle_ref_resolve` frames it against the reader it
already pins.

**962 lines deleted from `api/archive.py`**, and no copy remains — grep
for the
three private resolvers outside the new module returns only two test
docstrings.

Anti-vacuity executed: adding a handler-side block-anchor branch that
drops the
resolved object ref →
`{'object_refs': []} != {'object_refs':
['message:claude-code-session:c1:n:m-c1']}`.

### It does **not** unblock decision D2 — my premise was wrong

I filed `j5u2b` partly on the hypothesis that one move would unblock
D2's
`_resolve_user_state_target`. **Verified false at head**: that resolver
never calls
`resolve_ref`. It is independent, over `api/user_state_resolver.py` plus
three facade
helpers. The two blockers are *structurally* identical but **share no
code**, so
`r29bv` AC3 is unblocked and D2 is not.

Cheap lead for whoever takes D2: `api/user_state_resolver.py` measures
closure `out`
and its **only** surface import is a re-export of a storage function —
so it is an
operations-layer resolver mis-filed under `polylogue/api/`, and moving
it is
mechanical.

## polylogue-idrej — `around` on all four surfaces, plus a typed refusal
that was missing

`read_contracts.py` declares `ANCHORED_SESSION_READ_KINDS` and
`SessionReadRequest.around`, refusing `around` on a non-anchored kind,
`around` +
`continuation`, and `around` + `offset`. The anchor is resolved
**before** the window
is framed, so the minted continuation carries the resolved coordinate
and **nothing
about the anchor**. Wired through the CLI (`--around`, new Click param
placed last),
`Polylogue.read_transcript_window`, and MCP `read`. `raw` keeps its own
option set
rather than inheriting an `--around` it could only ignore.

**A refusal that would have reached the operator as a traceback is now
typed.**
`MessageNotInSessionError` was a bare `LookupError`, which the declared
read
operation's error map does not classify — so on the CLI route it was
unclassified. It
now subclasses `(LookupError, ValueError)`, so one class with one
`code="message_not_found"` reaches HTTP 404, a CLI non-zero exit, the
MCP
`error_json` and a Python raise. Asserted on all four.

The parity test compares row ids, resolved offset and total across all
four surfaces,
asserts the anchor is **inside** the window, that the offset is the
page-aligned `2`
(**neither the first nor the last window** — so a trivial implementation
cannot pass),
and that the anchored window equals the window fetched by the offset it
reports. Both
mutations executed: dropping the plumbing from the CLI route puts it on
page zero;
dropping it from the API route does the same in the other direction plus
`DID NOT RAISE MessageNotInSessionError`.

## polylogue-r3cuz — 3 of 11 moved, and **two are held back for contract
reasons, not effort**

`file-edits`, `agent-policies` and `web-content` now lower onto
`session.read`
evidence kinds; the ratchet drops 11 → 8. `hooks` moved to the same
shared adapter and
**gained the `served-by:` marker it never printed**.

- **`events` is not movable as it stands.** It accepts `--limit` and its
payload
reports the **truncated** row count as `total`. An evidence kind is
answered whole,
so lowering it would make `session.read` report `complete=true` for a
truncated body
— which `SessionReadResult`'s validator refuses outright. It needs a
windowed-evidence
contract, or an explicit decision to change that payload's `total`
semantics.
- **`raw` is genuinely windowed**, with a real limit/offset and a real
total — but
`transcript_window.py` owns the **message** window vocabulary, and
minting artifact
continuations into that family is exactly the mixing the family exists
to prevent. It
  needs a third body vocabulary and its own projection token.
- `dialogue`, `temporal` and `chronicle` accept **query sets** rather
than one exact
reference, so they are not `session.read` projections at all;
`effective_context` is a
compaction-aware replay; `neighbors` and `correlation` reach different
subsystems.
  Each needs its own operation declaration, not a kind.

### The row-vocabulary test is load-bearing for a non-obvious reason

`test_session_evidence_readers.py` compares the operation's evidence
body against the
facade reader it replaced, field for field — **because after the move
both CLI legs run
the same operation, so a daemon-vs-direct parity test would drop a field
on both legs
together and stay green.** Mutation: renaming `structured_patch` → red.

Both served-by directions executed on the new parity tests: forcing
`daemon_disabled`
→ `assert 'served-by: daemon (uds,' in 'served-by: direct (21ms)'`;
hard-coding the
identity → the same assertion in reverse.

## Landing window

**All 30 changed files measure `out`. The derived identity does not
move** — this can
land during a rebuild.

That was deliberate, not luck: `surfaces/payloads.py` is **IN** and was
untouched
because `read_contracts.py` exists so a new declaration stays off the
boundary, and
that held for the new `around` field **and** the three new kinds.
`archive_tiers/archive.py`,
`write.py` and `queries/session_events.py` are IN and were avoided — the
evidence
reader table now holds **callables into
`operations/session_evidence.py`** instead of
`ArchiveStore` method names, and the three new sync readers went into
query modules
that measure `out`.

## Verification

`devtools verify --quick` exit 0, 25/25 gates · `render all --check`
exit 0, zero
`out of sync` · 14-selection focused run **1037 passed / 1 failed**, the
one failure
reproduced identically at `origin/master` in a clean detached worktree.
**Zero new
failures.**

Broad `tests/unit/cli tests/unit/operations` before the final rebase:
3662 passed / 46
failed against 3657 / 46 at base — node-id sets identical, none new,
none fixed. Most
were cleared upstream by #5367, which is why the final run shows one.

## Residuals

- **8 of 11 `IN_PROCESS_READ_VIEWS` remain**, each with its blocker
named above.
- **`r29bv` AC3 is unblocked but not executed** — that is its own bead's
work, and
  lowering `annotations import` touches the mutation-authority baseline.
- Inherited red, unrelated and unfixed here:

`test_seed_ontology.py::test_seed_catalog_is_registered_and_replayed_without_user_schema_bump`
asserts `target_ref_kinds` still contains `'phase'`, which #5314 deleted
with
`session_phases`. Reproduced at `origin/master`. The correct fix — drop
`'phase'` or
restore the kind — is a judgement about the seed ontology, not the read
route.

Closes polylogue-j5u2b, polylogue-idrej. Advances polylogue-r3cuz (3 of
11).

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

https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 22, 2026
… unchecked claims (#5378)

## Summary

Two coverage reads over `source_attachments` disagreed.
`corpus-attachment-fidelity` already partitioned the `acquired` bucket
correctly; `scan_attachment_coverage` and the `attachment-coverage` gate
collapsed it into a boolean and certified rows they had not checked.
This partitions the second read the same way and stops one write route
from re-asserting acquisition on trust.

## Problem (evidence)

Measured at `158d1363e` on a synthetic `index.db` with three
`acquisition_status='acquired'` rows — one with bytes in the store, one
naming a hash the store does not hold, one with `blob_hash` NULL:

- `scan_attachment_coverage` returned `{acquired_count: 3,
acquired_reachable_count: 3, acquired_missing_blob_count: 1}` — **no
term at all** for the NULL-hash row, because of `if blob_hash is None:
continue`.
- On a lone hashless acquired row the `attachment-coverage` gate printed
`OutcomeStatus.OK` with the summary `all 1 acquired attachment(s) have
bytes and a live attachment reference` — a false sentence about an
archive where it had checked nothing.
- `_surviving_blob_ref` gated the re-bind on `blob_store.exists()` ("a
file sits at that path") and then wrote `acquisition_status='acquired'`.
A published blob corrupted in place produced `{recorded_hash: 664656fb…,
actual_hash_of_file: 4ca8451f…, byte_count_claimed: 32, actual_size: 31,
downloads_attempted: []}` — acquisition re-asserted with no provider
request and no signal.

The bead's other cited defect (`DriveNotFoundError` recorded as
`acquired`) does **not** reproduce at head; it terminates `unavailable`
and has since #4873/#4908. That citation is stale.

## Solution

- `AttachmentCoverageReport` partitions `acquired` into
`acquired_with_bytes_count` (corroborated),
`acquired_missing_blob_count` (contradicted) and
`acquired_unverifiable_count` (nothing to check), published side by side
in `to_dict()`. Following #5367's
`raw_materialization_unmeasured_reason`, an unmeasured claim gets its
own term rather than folding into the nearest boolean.
- `ok` is false for either non-corroborated term, so an unmeasured claim
blocks exactly as a false one does — without the report ever asserting
bytes are absent.
- The survivor probe uses `blob_store.verify()`, not `exists()`. A
contradicted survivor is not evidence: it falls through to the provider,
and emits `operations.attachment_convergence.survivor_contradicted` at
WARNING/`outcome=degraded` so a decayed published blob is not silently
erased by a re-download.

## Verification

```
devtools verify --quick                    exit 0   25 gates ok (schema-closure, atlas, layering, test-collection)
devtools render all --check                exit 0   8 "sync OK", 0 "out of sync" (grep -c on captured log)
devtools test <8 attachment selections>    exit 0   198 passed in 75.25s
```
Receipt
`.cache/verify/runs/20260922T003420Z-focused-test-183221-b5c5388c/run.json`.

Inherited-red baseline at `158d1363e` in this worktree: `177 passed`,
exit 0 — no inherited reds in the touched scope.

Anti-vacuity conditions were **executed**, not asserted. Restoring `if
blob_hash is None: continue` → 3 failed, including `assert
<OutcomeStatus.OK> is <OutcomeStatus.ERROR>` with summary `all 1
acquired attachme…`. Reverting `debt_count` to `missing + unreachable` →
1 failed, whose evidence dict reads `'unverifiable_count': 1` beside
that same summary — the exact claim/measurement split. Reverting
`verify()` to `exists()` → `assert [] == ['drive-file-1']`, the
corrupted survivor re-binding with no provider request.

## Schema identity

Does not move. `derived_schema_identity` at `158d1363e` equals that at
this head for both derived tiers (index `d5e285b3…`, ops `86866235…`).
All six changed files report `out`; `storage/blob_liveness.py` is the
one IN-closure file in the area and was deliberately not touched. No
DDL, no vocabulary member — `acquisition_status` keeps its existing
three-value durable CHECK. Safe to land at any point relative to the
build boundary.

## Residuals

- **Criterion 5 of polylogue-o0uw5 is not discharged by this branch.**
Which route removed the 1242 blobs is still unnamed; the evidence is
`gc_generations` in `source.db` and the daemon event log, neither read
here. The bead's own design marks it not dispatchable to a code worker.
- Live census (read-only, reflink copy, deleted after): 1933 `acquired`
rows, 1446 distinct acquired hashes, 204 with bytes, **1242
contradicted** — the bead's 1240/1446 still reproduces. **0** acquired
rows with NULL `blob_hash`, so the unverifiable term guards a latent
shape the live archive does not currently contain.
- Oversize attachments and explicit 404s both terminate `unavailable`,
but for an oversize file the provider still has the bytes — the same
overstated claim in the opposite direction. Out of scope; wants its own
bead.
- `demo/constructs.py:104` claims stored bytes but its SQL never
consults the store.
- `daemon/webui_data.py` collapses six attachment states into
`missing-blob`.

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

https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Attachment coverage now flags acquired attachments without verifiable
blob identity as blocking issues.
* Coverage reports distinguish attachments with bytes, missing blobs,
and unverifiable blobs, including counts and sample details.
* Corrupted retained blobs are rejected and re-fetched when possible,
preventing invalid attachments from being rebound as acquired.
* When recovery fails, affected attachments are correctly marked
unavailable without retaining invalid blob data.

* **Tests**
* Added coverage for unverifiable attachments, corrupted blobs, and
recovery failures.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

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