Skip to content

Move record id preparation into the JSON ingestion adapter - #1393

Merged
myronmarston merged 1 commit into
mainfrom
myron/move-record-id-preparation-to-json-adapter
Sep 20, 2026
Merged

myronmarston merged 1 commit into
mainfrom
myron/move-record-id-preparation-to-json-adapter

Conversation

@myronmarston

Copy link
Copy Markdown
Collaborator

The indexer copied the envelope `id` into the record for every ingestion format. Only the JSON adapter knows `record` is a Hash, so the copy moves there — this drops the last format-specific `is_a?` check from the operation factory and prepares for a typed `Event` whose `record` type is a per-format generic parameter.

  • `ValidationResult` now carries the event to build operations from, so an adapter can return a prepared copy of the event.
  • `Operation::Factory` 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 never fire — this states the invariant to Steep rather than guarding against an unreachable case at runtime.

🤖 Generated with Claude Code

@myronmarston
myronmarston marked this pull request as ready for review September 18, 2026 01:34
@myronmarston
myronmarston added this pull request to stack #1399 September 18, 2026 18:43
@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 removed this pull request from stack #1399 September 18, 2026 19:44
@myronmarston
myronmarston changed the base branch from main to myron/test-settings-ipv4-loopback September 18, 2026 19:44
@myronmarston
myronmarston added this pull request to stack #1401 September 18, 2026 19:49
@myronmarston
myronmarston force-pushed the myron/move-record-id-preparation-to-json-adapter branch from bdf3b01 to d880756 Compare September 18, 2026 20:06
Base automatically changed from myron/test-settings-ipv4-loopback to main September 18, 2026 21:19
@myronmarston
myronmarston force-pushed the myron/move-record-id-preparation-to-json-adapter branch 2 times, most recently from d8c76ec to f8d2c6b Compare September 18, 2026 23:46
- 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
@myronmarston
myronmarston force-pushed the myron/move-record-id-preparation-to-json-adapter branch from f8d2c6b to 2d4edee Compare September 20, 2026 01:03
@myronmarston
myronmarston merged commit 897388e into main Sep 20, 2026
24 checks passed
@myronmarston
myronmarston deleted the myron/move-record-id-preparation-to-json-adapter branch September 20, 2026 04:57
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.

2 participants