Skip to content

Route indexing events through a typed Event value end to end - #1394

Closed
myronmarston wants to merge 2 commits into
myron/move-record-id-preparation-to-json-adapterfrom
myron/route-events-through-typed-event
Closed

myronmarston wants to merge 2 commits into
myron/move-record-id-preparation-to-json-adapterfrom
myron/route-events-through-typed-event

Conversation

@myronmarston

Copy link
Copy Markdown
Collaborator
  • Replaces raw event Hashes with Indexer::Event across FailedEventError, IndexingFailuresError, Operation::Factory/Update, the JSON ingestion adapter, and the indexer_lambda/warehouse_lambda consumers.
  • IngestionAdapter#events_from validates each event's envelope up front and builds a MalformedEventError per malformed one, before an Event exists.
  • FailedEventError/MalformedEventError include IndexingFailuresError::_IndexingFailure so Steep enforces the interface they already satisfy; FailedEventError delegates to event via Forwardable instead of manual wrapper methods.

🤖 Generated with Claude Code

- The indexer copied the envelope `id` into the record for every format.
  Only the JSON adapter knows that `record` is a Hash, so the copy belongs
  there. This removes the last format-specific `is_a?` check from the
  operation factory.
- `ValidationResult` now carries the event to build operations from, so an
  adapter can return a prepared copy of the event.
- Prepares for a typed `Event` whose `record` type is a per-format
  generic parameter.
- Narrows `validation_result.record_preparer`/`.event` with `# : ...` type
  comments instead of `or raise`: both are always present together by
  construction once `failure` is nil, so the assertion can't fire.

Generated with Claude Code
- Introduces Indexer::Event, a Data value object with a validated envelope
  (op, type, id, version, record, schema_version, ingestion_format,
  message_id, latency_timestamps), and MalformedEventError for payloads
  whose envelope an ingestion adapter can't turn into an Event.
- Replaces raw event Hashes with Event across FailedEventError,
  IndexingFailuresError, Operation::Factory/Update, the JSON ingestion
  adapter, and the indexer_lambda/warehouse_lambda consumers.
- IngestionAdapter#events_from validates each event's envelope up front and
  builds a MalformedEventError per malformed one, before an Event exists.
- Fix _RecordPreparer[untyped] annotation in Operation::Factory to match the
  interface's new generic param (was left bare, which Steep now rejects).
- FailedEventError delegates id/op/type/version/record/message_id to its
  event via Forwardable instead of manual wrapper methods.
- FailedEventError and MalformedEventError include IndexingFailuresError::
  _IndexingFailure so Steep enforces the interface they already satisfy.

Generated with Claude Code
@myronmarston

Copy link
Copy Markdown
Collaborator Author

@myronmarston
myronmarston force-pushed the myron/move-record-id-preparation-to-json-adapter branch from 7f9f74b to bdf3b01 Compare September 18, 2026 19:31
@myronmarston
myronmarston force-pushed the myron/move-record-id-preparation-to-json-adapter branch from bdf3b01 to d880756 Compare September 18, 2026 20:06
@myronmarston
myronmarston force-pushed the myron/move-record-id-preparation-to-json-adapter branch 3 times, most recently from f8d2c6b to 2d4edee Compare September 20, 2026 01:03
@myronmarston
myronmarston deleted the myron/route-events-through-typed-event branch September 20, 2026 01:15
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