Repository navigation
fix(storage): skip redundant v2 message backfill - #743
Conversation
Problem: the v2-to-v3 upgrade added by PR #742 still planned the message-type backfill when a database already had messages.message_type but only carried the old user_version marker. That is the exact live workstation shape, so applying the fix would still scan the archive unnecessarily.\n\nWhat changed: only append the message-type backfill when the message_type column is absent. Already-extended v2 archives repair only missing version/index state.\n\nVerification: PYTHONPATH=. /realm/project/polylogue-schema-v2-upgrade/.venv/bin/python -m pytest -q tests/unit/storage/test_backend.py tests/unit/storage/test_schema_safety.py; ruff check/format on changed Python files; git diff --check.\n\nRef #618
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Review rate limit: 0/1 reviews remaining, refill in 54 minutes and 10 seconds.Comment |
Summary Avoids an unnecessary archive-wide message-type backfill when a schema v2 archive already has the v3 `messages.message_type` column. Problem PR #742 added the right v2-to-v3 upgrade path, but the upgrade plan still appended the message-type backfill whenever `messages` existed. That is wasteful for the live failure shape: a physically v3-shaped DB whose `PRAGMA user_version` was rewritten to 2 by an older binary. Running the backfill there would scan the archive even though the column already exists. Solution Only append the message-type backfill when `messages.message_type` is absent. Already-extended v2 archives now repair missing version/index state without rereading all messages/content blocks. Verification - `PYTHONPATH=. /realm/project/polylogue-schema-v2-upgrade/.venv/bin/python -m pytest -q tests/unit/storage/test_backend.py tests/unit/storage/test_schema_safety.py` -> `61 passed in 8.72s` - `PYTHONPATH=. /realm/project/polylogue-schema-v2-upgrade/.venv/bin/ruff check polylogue/storage/backends/schema_bootstrap.py tests/unit/storage/test_backend.py` -> `All checks passed!` - `PYTHONPATH=. /realm/project/polylogue-schema-v2-upgrade/.venv/bin/ruff format --check polylogue/storage/backends/schema_bootstrap.py tests/unit/storage/test_backend.py` -> `2 files already formatted` - `git diff --check` - Pre-push hook under the Polylogue devshell -> `verify: all checks passed` Ref #618
Summary
Avoids an unnecessary archive-wide message-type backfill when a schema v2 archive already has the v3
messages.message_typecolumn.Problem
PR #742 added the right v2-to-v3 upgrade path, but the upgrade plan still appended the message-type backfill whenever
messagesexisted. That is wasteful for the live failure shape: a physically v3-shaped DB whosePRAGMA user_versionwas rewritten to 2 by an older binary. Running the backfill there would scan the archive even though the column already exists.Solution
Only append the message-type backfill when
messages.message_typeis absent. Already-extended v2 archives now repair missing version/index state without rereading all messages/content blocks.Verification
PYTHONPATH=. /realm/project/polylogue-schema-v2-upgrade/.venv/bin/python -m pytest -q tests/unit/storage/test_backend.py tests/unit/storage/test_schema_safety.py->61 passed in 8.72sPYTHONPATH=. /realm/project/polylogue-schema-v2-upgrade/.venv/bin/ruff check polylogue/storage/backends/schema_bootstrap.py tests/unit/storage/test_backend.py->All checks passed!PYTHONPATH=. /realm/project/polylogue-schema-v2-upgrade/.venv/bin/ruff format --check polylogue/storage/backends/schema_bootstrap.py tests/unit/storage/test_backend.py->2 files already formattedgit diff --checkverify: all checks passedRef #618