Skip to content

test(storage): Stop inserting the retired session_events.summary column - #5458

Merged
Sinity merged 1 commit into
masterfrom
fix/session-events-summary-fixture
Sep 23, 2026
Merged

Sinity merged 1 commit into
masterfrom
fix/session-events-summary-fixture

Conversation

@Sinity

@Sinity Sinity commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Summary

Repairs a regression introduced by #5446, which I landed earlier today.

Problem

#5446 retired session_events.summary — a derived column that reproduced from payload_json in 7,403,923 of 7,403,923 live rows, costing 178.9 MB. One test fixture still wrote it:

sqlite3.OperationalError: table session_events has no column named summary

tests/unit/storage/test_session_profile_derivation.py:462 inserted (session_id, source_message_id, position, event_type, summary, payload_json).

Solution

The event's summary rides in payload_json — which is where the retired column was reproducing it from in the first place, so the fixture now writes the shape production actually stores.

Verification

devtools test tests/unit/storage/test_session_profile_derivation.py  ->  PASSED (32/32)
devtools verify --quick                                              ->  PASSED exit=0

Before: 31 passed / 1 failed.

How it was found

A gpt-5.6-luna worker on an unrelated bead (polylogue-bp12n.1) reported it as an inherited baseline failure rather than absorbing it or working around it. That is the reporting discipline paying off — the worker had no stake in this file and still surfaced it with the receipt.

It also shows the gap in my own landing of #5446: devtools verify --quick was green on that branch because the quick set does not run this suite, and the branch's own focused selection did not include it. A retired column needs a grep for its writers across tests/ as well as polylogue/.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy

PR #5446 retired session_events.summary as a derived column that
reproduced from payload_json in 7,403,923 of 7,403,923 live rows. One
fixture still wrote it, so the test failed at insert with
"table session_events has no column named summary".

The event's summary now rides in payload_json, which is where the
column was reproducing from in the first place.

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

coderabbitai Bot commented Sep 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 33 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: 490cdbe7-ddae-45b2-9110-a03f78af3002

📥 Commits

Reviewing files that changed from the base of the PR and between a3c21cb and 3a994dc.

📒 Files selected for processing (1)
  • tests/unit/storage/test_session_profile_derivation.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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 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-23T04:18:07.184911Z 3a994dc PR opened
🔒 Security Review ✅ Completed 2026-09-23T04:20:45.349186Z 3a994dc 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 enabled auto-merge (squash) September 23, 2026 04:21
@Sinity
Sinity merged commit d72c70f into master Sep 23, 2026
3 checks passed
@Sinity
Sinity deleted the fix/session-events-summary-fixture branch September 23, 2026 04:26
Sinity added a commit that referenced this pull request Sep 23, 2026
## Summary

Completes the cleanup of **#5446** (retiring `session_events.summary`).
My first repair, **#5458**, fixed one file; three more were still
referencing the dropped column.

## What was still broken on master

| file | how |
|---|---|
| `tests/unit/pipeline/test_ingest_batch.py` | `SELECT event_type,
summary` + two assertions on `event["summary"]` |
| `tests/unit/storage/test_archive_tiers_archive.py` | `SELECT
event_type, summary` at two sites + two assertions |
| `tests/unit/storage/test_archive_tiers_write.py` | `SELECT … summary
…` plus **three** stale `"summary"` keys in its expected rows |

All now read `payload_json` — which is exactly what the retired column
reproduced from, in **7,403,923 of 7,403,923** live rows.

## Verification

```
devtools test test_ingest_batch.py test_archive_tiers_archive.py test_archive_tiers_write.py
    ->  265 passed / 265, exit 0
devtools verify --quick
    ->  PASSED exit=0
```

The write-path file needed three separate passes: each stale `"summary"`
key in the expected-row list surfaced only after the previous one was
removed, because the assertion compares whole dicts and reports the
first differing index.

## How this was found, and what it says about my own process

A `gpt-5.6-luna` worker on an unrelated bead (polylogue-3szyi) reported
it as an *inherited* baseline failure. That is the second time today a
worker with no stake in the file surfaced this regression — the first
led to #5458.

My #5458 fix was incomplete because I grepped for **writers** (`INSERT`)
and stopped. Retiring a column needs a search for **every** reference —
reads, expected-row fixtures and assertions included. `devtools verify
--quick` cannot catch this: none of these suites are in the quick set.

🤖 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 added a commit that referenced this pull request Sep 23, 2026
## Summary

Three tests were red on master and the MCP session-timeline route raised
at runtime. Found by a wave-2 worker whose own bead was unrelated.

## Problem

`polylogue-kc8eq` retired `session_events.summary` — correctly: it was a
write-time render of `payload_json["summary"] or payload_json["text"]`,
derivable in 7,403,923 of 7,403,923 live rows, and 178.9 MB of index
restating the payload.

But the timeline UNION in `polylogue/operations/session_reads.py:245`
still selected `e.summary`. Any session timeline read raised.

The spec comment justifying the removal asserted the column was **"never
selected by the read path."** That was false. The audit behind the
retirement grepped writers.

This is the third time this retirement has broken something: `#5458`
fixed one fixture, `#5465` fixed three more, and this is the first that
is a production route rather than a test fixture.

## Solution

Move the render read-side with identical semantics —
`COALESCE(json_extract(payload_json,'$.summary'),
json_extract(payload_json,'$.text'), '')`. Timeline text for a
session-event is byte-identical to what the stored column produced.

The false comment is corrected in place, naming what actually happened,
so the next column retirement doesn't repeat the writers-only audit.

## Verification

```
devtools test tests/unit/mcp/test_session_owner_operations.py \
              tests/unit/mcp/test_server_surfaces.py \
              tests/unit/archive/query/test_continuation_surface_parity.py
-> PASSED exit=0
```

Red before this change (32 passed / 3 failed), green after.

## Residual

Worth stating plainly: master's quick-gate was **green** throughout,
because `verify --quick` is static gates only. The affected-test lane
that would have caught this had been sitting in a paused pueue group
since a `verify_all` failure on 2026-09-22, so no pytest ran on master
for over a day. The group is resumed.

🤖 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**
* Fixed an issue that could prevent the session timeline from loading.
Session events now display text from their saved details, checking the
summary first and falling back to the event text when needed. Existing
timeline text remains unchanged.

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