Index instance retention lookups - #52
Conversation
Find expired actor instances through actor type and update time instead of scanning retained instances. Install the index in migration 10 before the existing polling-migration early return, and update doctor checks. Verify actual pruning plans on SQLite, PostgreSQL, and MySQL, including version-nine upgrades, interrupted installs, and multiple policies. See cardmagic/solid-objects-ruby#69
|
@greptileai please review the current head bc7f764. |
Older SQLite versions may choose a primary-key scan for an OR across multiple actor policies even with the retention index. Keep explicit index-selection regressions for fresh and upgraded single-policy data. Verify distinct cutoffs and unconfigured actors in a separate behavior test without requiring an optimizer choice for that different workload. The full Node 24.4 suite and all new MySQL and PostgreSQL cases pass.
|
@greptileai please review the current head a324551, including the Node 24.4 compatibility correction. |
Greptile SummaryThe PR adds schema migration 10, creating an index over
Confidence Score: 5/5The PR appears safe to merge with no outstanding correctness, security, release-consistency, or repository-rule issues. The current code consistently applies and records migration 10, exercises fresh and interrupted upgrade paths, and keeps package, runtime, and changelog versions aligned at 0.15.1. All five earlier findings were manually resolved without explanatory replies and therefore are not outstanding. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
Install[runtime.install] --> Check{Migration 10 recorded?}
Check -->|Yes| Existing[Continue schema installation]
Check -->|No| Index[Create instances retention index]
Index --> Record[Record migration 10]
Record --> Existing
Existing --> Retention[Preview or prune instances]
Retention --> Lookup[Filter by actor_type and updated_at_ms]
Lookup --> Pending[Check pending-work protections]
Reviews (5): Last reviewed commit: "chore: prepare version 0.15.1" | Re-trigger Greptile |
Name the query-plan fields emitted by each supported database and infer forwarded query arguments from DatabaseConnection. Flatten the upgrade setup so index removal and migration reset are explicit sequential steps.
Forward get directly and derive the all argument tuple from DatabaseConnection so generic callbacks keep their explicit native contract.
|
@greptileai please review the current head 3254be7. The query-plan rows now have explicit per-database fields, forwarded query arguments use DatabaseConnection parameter types, and upgrade setup uses sequential conditions. Type checks and Node 24.4 retention tests pass. |
Capture connection reads as well as transactional candidate queries and independently require the preview and pruning plans to use the retention index.
|
@greptileai please review current head 9804e56. The preview-plan feedback is now covered independently: the tests assert one preview plan and two pruning plans, all using the retention index. Prior typing and nested-condition feedback remains addressed. pnpm run check and the Node 24.4 retention regressions pass. |
Align the package and runtime versions and date the retention index release notes for the patch release.
|
@greptileai please review current head b6cac4b. This prepares patch version 0.15.1: package and runtime versions match the dated changelog. Version/release-note tests and the packaged-install smoke test pass. |
Opt-in instance pruning filters by actor type and
updated_at_ms, but the SQL schema had no index supporting that lookup. Finding one expired instance among 2,000 retained/recent records scanned an unrelated index. Migration 10 adds(actor_type, updated_at_ms, id)so the database can narrow expired candidates before checking pending work.The migration runs before the existing polling-migration early return, covering installed version-nine databases as well as fresh installs. Index creation can be retried after interruption. Doctor now expects migration 10, and the changelog and parity ledger describe the optimization. Retention predicates, timestamps, pending-work protections, batch sizes, and deletion order remain unchanged.
This is the JavaScript companion to Ruby #69. JavaScript already compares its timestamp directly, so its fix adds a supporting index. Run
runtime.install()as part of upgrading to a release containing this change; older runtimes reject the newer schema version.Prepare patch release 0.15.1 with matching runtime and package metadata and dated release notes. The packaged-install smoke test and version/release-note tests pass for 0.15.1.
Validation:
b6cac4be71d1eaef4c93d33c9cb95d9350a3c6a4: PR CI and branch CI passed. Greptile reports 5/5 on this commit, with no unresolved review threads.pnpm run check,pnpm run format:check, andpnpm run buildpassed.Query-plan limit: older SQLite versions can still choose a primary-key scan for the combined OR predicate across actor policies. This migration supplies the missing index and fixes the measured single-policy workload; it does not force planner choices or rewrite multi-policy SQL. That behavior is documented rather than asserting a universal index-selection guarantee in the tests.