fix(sync): emit sortAt ops by TARGET name in seconds (source-name ops silently dropped) - #334
Merged
Merged
Conversation
…s are silently dropped The W1-1/W2-1 design emitted the Image trigger's sort value as field 'sortAtUnix' in milliseconds, assuming the data_schema sortAtUnix->sortAt (ms_to_seconds) mapping applied at op ingestion. It does not: data_schema source->target renames apply to DOCUMENT keys (dump/insert path) only. Op Set/Remove fields resolve raw against filter/sort TARGET names (ops_processor process_set_op) and unknown fields are silently ignored — so every steady-state sortAt op was dropped in prod (~5h, 2026-07-17/18) while publishedAt (target-name) ops in the same batches applied fine. Proven by a single-op experiment against prod; every other field always emitted target names. Fix: the shared expression + shared_ops_fields emit field 'sortAt' in SECONDS (no *1000). Function name bitdex_image_sortat_ops is unchanged (re-emitter parity preserved). The dormant sortAtUnix->sortAt doc mapping stays for the dump path. Tests updated to pin target-name + seconds and to reject source-name emission; trigger-sql-review.sql regenerated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prod bug found 2026-07-18 during W4: steady-state sortAt ops emitted as
sortAtUnix(ms) were silently ignored — the data_schema rename layer is doc-path only; op fields resolve against TARGET names (ops_processor process_set_op) and unknown fields drop without error. publishedAt worked because it always emitted the target name.Evidence: single-op experiment against prod (correct-value
sortAtUnixset applied, doc + layers unchanged); same-batch publishedAt applied. Full writeup in the session; heal re-run follows trigger regeneration.Emission now: field
sortAt, SECONDS, same COALESCE belt, same shared function name (re-emitter parity intact). Suite 1250 green; review SQL regenerated.🤖 Generated with Claude Code