JITSU-182: canonical row hashing — breaker survives serializer key reorder - #1480
Merged
Conversation
…key reorder Raw-byte row hashing made any console serialization change (jitsu#1478's zod key reorder, 2026-08-24) read as a 100% mass change and trip every guarded repo fleet-wide. Rows now hash canonically: object keys sorted, strings length-prefixed, values type-tagged, numbers by literal via json.Number. Baseline cache needs no migration — seeding re-hashes the cached payload with the same function. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…e; pin escape/literal semantics in tests Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Reviewed bulker/config-keeper/breaker.go and bulker/config-keeper/breaker_test.go for breaker correctness, regression risk, and failure-mode handling around canonical row hashing.
I did not find actionable bugs or security/correctness regressions in this change set. The canonical hashing approach appears deterministic and the added tests cover the key-order false-positive incident plus important value-distinction cases.
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.
Follow-up to the config-keeper circuit breaker (#1476), from today's prod field experience. Linear:
JITSU-182.Why
Within hours of the breaker going live, #1478's deploy reordered JSON keys in every export row (zod
parseemits schema keys first). Content was byte-for-byte identical after key normalization — but the breaker hashes raw row bytes, so it read 100% mass change and tripped fleet-wide on both replicas (correctly per its design, but the "serializer changes are rare" trade-off documented in the code did not survive day one). The breaker is currently disabled in prod pending this fix — all repos must survive field reorders.What
hashRowsnow hashes each row canonically: object keys sorted, ',' separator + length-prefixed keys (uniquely decodable — an encoding-collision construction from review is closed), type-tagged values, numbers by literal viajson.Number(no float64 precision loss), decoder-normalized string escapes.1vs1.0) still trip by design — single stable producer, and that failure mode is a confirmation, not a miss.lastRejectedshort-circuit deliberately stays byte-based (it only suppresses re-parsing of a byte-identical rejected generation).Tests: reorder-immunity end-to-end (incl. clearing a held state with a reordered good payload), collision-resistance of the encoding (string/number/boundary/precision cases), escape normalization, literal sensitivity. 25 config-keeper tests green.
After deploy, re-enable with
CFGKPR_BREAKER_ENABLED=truein jitsu-cloud-infra.🤖 Generated with Claude Code