Repository navigation
Ship record version history to production (staging port of #135) - #136
Conversation
Ports the opt-in record version history from main (#135) onto staging without the unreleased record validation gate: migration 015 record_version, RecordVersionsRepository, the RECORD_HISTORY_COLLECTIONS config, Tap handler writes (version before the current-state insert, tombstone before delete), baseline seeding at startup, and the recordHistory GraphQL query. The migration keeps number 015 so main and staging agree; the runner applies any unapplied migration, so 012-014 still apply when main is promoted.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: GainForest/hyperindex/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a06ec1b511
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| CREATE TABLE IF NOT EXISTS record_version ( | ||
| id BIGSERIAL PRIMARY KEY, | ||
| uri TEXT NOT NULL, | ||
| cid TEXT NOT NULL, |
There was a problem hiding this comment.
Remove version rows when purging an actor
When an admin invokes PurgeActor or Tap receives a deleted, deactivated, suspended, or taken-down identity, RecordsRepository.PurgeActorData deletes only record and actor; this independent table has no cascade and neither purge path removes its rows. Because the new public recordHistory resolver reads this table directly, tracked record bodies remain publicly retrievable after an operation documented as removing all indexed data for the DID. Include these rows in the same purge transaction.
Useful? React with 👍 / 👎.
| -- A version is recorded once, however often Tap redelivers or resyncs it. | ||
| CREATE UNIQUE INDEX IF NOT EXISTS idx_record_version_uri_key | ||
| ON record_version(uri, version_key); |
There was a problem hiding this comment.
Preserve recreated versions after a deletion
When a URI is deleted and later recreated with the same content, ATProto produces the same content-addressed CID, but this URI/CID uniqueness constraint discards both the later create and its subsequent delete:<cid> tombstone. CID-less records have the same problem because identical bodies and all empty-CID tombstones reuse their keys. The resulting history ends at the first delete even while the record exists again, so deduplication needs an event or lifecycle identity that distinguishes redelivery from a legitimate recreate.
AGENTS.md reference: AGENTS.md:L94-L94
Useful? React with 👍 / 👎.
Ports #135 (opt-in record version history, merged to
main) ontostagingso it reaches production without the unreleasedmainwork (#123 record validation gate, #133).record_version,RecordVersionsRepository,RECORD_HISTORY_COLLECTIONS,recordHistory(uri, first, after), baseline seeding at startup, and docs.records.Insert/records.Deletepath. The version is written before the insert; the tombstone is written before the delete.schema_migrations, so 012–014 still apply at the next main → staging promotion. Expect a small conflict ininternal/tap/handler.gothen: keep main's version, which already contains this feature.Rollout: set
RECORD_HISTORY_COLLECTIONS=app.gainforest.dwc.occurrenceon the productionhyperindexservice. The first boot seeds about 34.5k baseline rows.Verified on this branch:
go build,golangci-lint(0 issues),go test -race ./...on SQLite and PostgreSQL 17, and integration tests. A new migration test covers 015 up/down; the Postgres rollback test now rolls back 015 before 011.