Repository navigation
Conversation
…n-gate # Conflicts: # internal/database/migrations/migrations_test.go
Reject duplicate filesystem Lexicon IDs, return reliable Lexicon timestamps, and cover existing-row migration upgrades. Bound CAR error details and apply the remaining focused test, formatting, and operator-documentation fixes.
Filter endorsement closure inputs to valid records and align local API smoke checks with raw validation metadata and typed visibility.
…n-gate # Conflicts: # .agents/skills/hyperindex/references/schema-reference.md # cmd/hyperindex/main.go # internal/graphql/schema/builder.go # internal/graphql/schema/builder_test.go # internal/graphql/subscription/handler.go # internal/graphql/subscription/handler_test.go # internal/graphql/subscription/pubsub.go
validation: add record validation gate
|
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
|
|
| svc.validator, err = validation.NewValidatorFromLexiconBytes(savedLexicons) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to build startup Lexicon snapshot: %w", err) | ||
| } |
There was a problem hiding this comment.
Startup guidance remains stale
The fixed startup Lexicon snapshot and validation-refresh workflow change configuration and migration behavior, but AGENTS.md still omits the restart-only application model and startup refresh requirements, leaving future operational and maintenance work based on stale repository guidance.
Context Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Bundle the workscope CEL Lexicon dependency
Collections listed in RECORD_HISTORY_COLLECTIONS (exact NSIDs or prefix.* patterns, Tap mode) now keep every observed version in a new record_version table: one row per distinct CID plus delete tombstones, written before the current-state upsert so Tap redelivery keeps both consistent and repeats are no-ops. Startup seeds a baseline row per existing record without history. The root recordHistory(uri, first) GraphQL query returns versions oldest first. Off by default. Motivation: GainForest needs the label edit history of observations (app.gainforest.dwc.occurrence), meaning who changed a species name and when. Public Jetstream misses most certified.one events, so the indexer's Tap stream is the only reliable source.
- Dedupe on a version key: the CID, a sha256 of the body when Tap sends no CID, or delete:<cid> for tombstones. CID-less edits no longer collapse into one version and redelivered deletes are no-ops. - Write the delete tombstone before removing the record and fail the event if it cannot be written, so Tap retries instead of losing the tombstone. - recordHistory pages with an `after` version id; `first` must be 1-500. - Switch history on only after baseline seeding succeeds, so a failed seed never leaves records whose baseline the next seed would skip. - Docs: deletes have a null value, paging, history stays queryable after a collection is removed.
Opt-in record version history (recordHistory query)
Deleting a record now removes its stored versions (instead of adding a tombstone), and PurgeActorData removes an account's versions together with its records, so deleted, deactivated or taken-down accounts leave no queryable past versions. The purge runs on every delete delivery and even for collections no longer tracked, so history recorded earlier is never stranded. Migration 016 indexes record_version(did) for account purges.
Prod stores app.gainforest.organization.getIndexedOrganizations (main type query). The startup Lexicon gate rejected it with 'unsupported main definition type: query' and refused to boot. Query/procedure/subscription/permission-set lexicons never describe stored records, so skip them with a warning. Unknown types still fail closed.
…artup validation: skip non-record lexicons when building startup snapshot
Validated typed queries sorted or filtered by createdAt compiled to ORDER BY json->>'createdAt', which bitmap-scanned and sorted every valid row in the collection. On app.gainforest.ac.audio this took 2-6s under load and pushed www feed requests past their timeouts. For collections whose Lexicon makes top-level createdAt a required datetime, map the sort and full-datetime filters to record_created_at so Postgres walks idx_record_timeline_valid and stops at LIMIT. The write path keeps first-seen createdAt, matching recordTimeline.
Lexicon allows const on boolean, integer, and string fields. The parser decoded const as a string, so saved lexicons such as app.bsky.embed.record (viewBlocked.blocked: true) failed to parse and now abort startup while building the startup Lexicon snapshot.
pgx caches prepared statements. Once PostgreSQL switches one to a generic plan it cannot tell that the validation_status bind parameter equals 'valid', so it falls back to idx_record_timeline_collection_created and filters out invalid rows one by one instead of using idx_record_timeline_valid. Inline the constant on the sorted and reversed connection queries and add a forced-generic-plan regression test.
graphql, records: sort createdAt by indexed record_created_at
lexicon: accept boolean and integer const values
RECORD_VALIDATION_ENABLED turns write-time Lexicon validation off; records are stored as unvalidated with a NULL lexicon_hash so the startup refresh reclassifies them once validation is re-enabled. TYPED_GRAPHQL_VALID_ONLY turns off the typed GraphQL validity filter for queries, subscriptions, profile hydration, and endorsement closure. Typed record objects now expose validationStatus and validationError so clients can tell rows apart. Disabling validation requires disabling the filter.
validation: add env toggles for record validation and typed filter
No description provided.