Skip to content

fix: Make export-element content identity authoritative and demote sour… - #5284

Merged
Sinity merged 2 commits into
masterfrom
batch/polylogue-20260920-100341-e18862be/integration
Sep 20, 2026
Merged

Sinity merged 2 commits into
masterfrom
batch/polylogue-20260920-100341-e18862be/integration

Conversation

@Sinity

@Sinity Sinity commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

Batch polylogue-20260920-100341-e18862be on base 36de4728c4b5.

polylogue-wzgpf Make export-element content identity authoritative and demote source_index to a hint

  • 1. All 11,803 raw records and 6,966 distinct blobs are reclassified into element-of-container or whole-member addressing with zero unknown records.
  1. Reacquisition never accepts an element because `s

Summary by CodeRabbit

  • Bug Fixes
    • ZIP member replay now prioritizes valid structural identities when matching content.
    • Prevents mismatched content from being accepted when a structural identity conflicts with a legacy byte hash.
    • Preserves legacy byte-hash compatibility when no valid structural identity is recorded.
  • Tests
    • Added coverage for structural identity mismatches, including collisions with retained byte hashes.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 20, 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-20T10:24:18.528584Z ed1cbfc PR opened
🔒 Security Review ✅ Completed 2026-09-20T10:26:25.404435Z ed1cbfc 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.

@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: cbd19e6e-3495-45b6-aca8-3fb2cfe43e94

📥 Commits

Reviewing files that changed from the base of the PR and between 36de472 and ed1cbfc.

📒 Files selected for processing (2)
  • polylogue/operations/zip_acquisition_replay.py
  • tests/unit/sources/test_export_member_addressing.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
🔇 Additional comments (2)
polylogue/operations/zip_acquisition_replay.py (1)

80-80: LGTM!

Also applies to: 101-108, 122-133, 233-239, 268-275

tests/unit/sources/test_export_member_addressing.py (1)

373-396: LGTM!


📝 Walkthrough

Walkthrough

ZIP member replay now distinguishes structural content identities from legacy byte hashes. Valid structural digests disable byte-hash fallback during candidate matching. A unit test verifies that a colliding byte hash does not satisfy a structural identity.

Changes

ZIP structural identity matching

Layer / File(s) Summary
Authoritative candidate matching
polylogue/operations/zip_acquisition_replay.py
resolve_member_candidate accepts expected_is_structural. Structural matching compares only candidate.content_identity; legacy matching retains the byte-hash fallback.
Replay detection and collision validation
polylogue/operations/zip_acquisition_replay.py, tests/unit/sources/test_export_member_addressing.py
zip_reacquisition_payload detects valid 64-character hexadecimal structural digests. The test verifies that a colliding byte hash returns None with content_identity:unmatched.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description states the intended change and key objective, but it is largely incomplete. It omits the required Problem, Solution, Verification, Changelog, and Risks and Follow-ups sections, and the… Complete the description using the repository template. Add the Problem, Solution, Verification, Changelog, and Risks and Follow-ups sections. Include exact test commands and manual validation results. State whether a changelog entry is req…
Docstring Coverage ⚠️ Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: making export-element content identity authoritative and demoting source_index. It is concise and related to the implementation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description states the intended change and key objective, but it is largely incomplete. It omits the required Problem, Solution, Verification, Changelog, and Risks and Follow-ups sections, and the existing objective is truncated.

Resolution

Complete the description using the repository template. Add the Problem, Solution, Verification, Changelog, and Risks and Follow-ups sections. Include exact test commands and manual validation results. State whether a changelog entry is required. Complete the truncated reacquisition requirement and explain any remaining risks or follow-ups.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

A rabbit checks the ZIP at night
Structural names must match just right
Byte hashes cannot sneak through
The replay path now knows what’s true
A test guards the identity light

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

@Sinity
Sinity merged commit 2aecd38 into master Sep 20, 2026
3 checks passed
@Sinity
Sinity deleted the batch/polylogue-20260920-100341-e18862be/integration branch September 20, 2026 10:30
Sinity added a commit that referenced this pull request Sep 22, 2026
## Summary

Retires a derived-tier column that reproduces from its own input in
**7,403,923 of 7,403,923 live rows, zero exceptions**, costing **178.9
MB**. Bead: polylogue-kc8eq (all five criteria); polylogue-wzgpf not
attempted, premise corrected.

## Premise correction

Both beads recorded that live-archive measurement is blocked by
`SchemaSkewError`. **That is wrong for read-only measurement** — the
wall applies to archive-*opening* maintenance routes; a plain read-only
`sqlite3` URI connection bypasses it. The census the kc8eq addendum
declared impossible was run.

## Measurement (frozen live index, 7,403,923 rows)

| carrier | rows | text bytes | share |
|---|---|---|---|
| `claude_queue_operation` | 57,396 (0.8%) | 519 MB | **20.8%** |
| `function_call` | 1,614,517 | 299 MB | 12.0% |
| `function_call_output` | 1,614,209 | 263 MB | 10.6% |

Exactly one carrier clears the 20% rule, and it is **kept**: it is not a
derived projection — it carries queued prompt content that exists
nowhere else.

Decomposing by *field* ownership found the real redundancy.
`session_events.summary` is a write-time render of
`payload_json["summary"] or payload_json["text"]`, stored next to its
own input. Three independent declarations already said it was not
load-bearing: absent from `SESSION_EVENT_PROJECTION_COLUMNS`; listed in
`SESSION_EVENT_EXCLUDED_COLUMNS` as *"not read by
sync_session_events_batch"*; never selected by
`storage/sqlite/queries/session_events.py`; absent from the
`SessionEvent` read model.

## A hazard found and fixed before deleting

`record_capture_gap` was the **single writer using the column as primary
storage** — a prose summary with an empty payload. Deleting the column
blind would have silently destroyed that evidence. Its four values now
persist as named payload fields, queryable by field rather than by
substring.

## Verification

```
devtools verify --quick  ->  PASSED exit=0
devtools test <8 changed test files>  ->  122 passed, 1 failed
devtools render all --check  ->  no "out of sync"
```

The single failure is
`tests/unit/demo/test_demo_seed_verify.py::test_seed_demo_embedding_session_is_classified_fresh_not_pending`,
which is **pre-existing** — I confirmed it at `cba0480d7`, before any of
today's merges, and it is untouched by this branch.

Anti-vacuity **executed** through the real production route
(`demo/seed.py` -> `record_capture_gap_event`), not a fixture:
withholding the summary from the capture_gap payload gives

```
assert "DOM browser-capture fallback" in capture_gap_events[0][1]
E   TypeError: argument of type 'NoneType' is not a container or iterable
```

## Schema

**Additive-derived** (a derived-tier column removal); `index` carries no
version chain, so no migration. Five changed files are **IN** the
closure (`archive_tiers_specs.py`, `write.py`, `revision_governance.py`,
`ingest_precedence.py`, `input_binding.py`); `demo/constructs.py` is
out. Index identity moves `015a941a75ea6903…` -> `01317a7dccde0d6f…`.
**Must land before a fresh rebuild starts, never during one.**

## polylogue-wzgpf — not attempted, with a corrected premise

AC2 is satisfied pre-existing (#5284), verified at head:
`zip_acquisition_replay.py:3` states the hint contract, `:236` passes
`source_index` as a hint into structural resolution,
`decoder_zip.py:326` emits `source_index=None` on the whole-member path.

AC1/AC3/AC4/AC5/AC6 not attempted — corpus reclassification plus a
durable migration, and the bead is `write_scope: NONE`.

One finding the bead does not record: **the durable side is entirely
unmigrated.** Live `raw_sessions` has `source_index` and **no**
`addressing_mode` and **no** `content_identity` column, and all 11,803
rows have non-null `source_index` — so **zero of the 43 whole-member
blobs have been reclassified**. At head `addressing_mode` exists only on
`source_generations`/`source_items`, not per-raw. AC6 is therefore
unsatisfied **by schema**, not merely by missing receipts, and its
successor is a durable additive migration.

No operator data is committed; the measurement was read-only.

🤖 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

- **Data Storage**
- Session event summaries are now stored within event payloads rather
than a separate database field.
- Event details and summaries remain available through payload-based
queries.

- **Bug Fixes**
- Compaction validation now reads summaries from event payloads while
continuing to reject failed or errored attempts.

- **Tests**
- Updated archive, event-processing, replay, and benchmark coverage to
reflect payload-based summary storage.
- Preserved existing validation, idempotency, and event behavior checks.

<!-- 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