Diff record flags per record and field, not as a truncated blob - #40
Merged
Conversation
A record flag's default-vs-config diff was two `.string(json)` values, truncated to
forty characters and unreadable. It is now a structured breakdown:
payment-methods:
~ Apple Pay: enabled true → false, minimumSpend 5.0 → 10.0
- Bank transfer
+ PayPal
Records are paired by their @FlagRecordKey when they have one — so a reordered list
is not a wall of false changes — and by position ([0], [1]) when they do not. For a
paired record, only the fields that differ are shown; a record present on one side
only is added or removed. The structured form is public as FlagRecordDiff /
FlagFieldDiff on each comparison's `records`, for inspecting rather than reading.
Field values render with a generous cap rather than the forty-character one the whole
blob used to hit, since the point of a diff is to see the values.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NnwCqKNm8rZ63Au6bpYdaD
A record with several changed fields ran them together on one line. Each is now on
its own line, nested under the record:
~ Apple Pay:
enabled true → false
minimumSpend 5.0 → 10.0
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NnwCqKNm8rZ63Au6bpYdaD
`enabled: true → false`, not `enabled true → false`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NnwCqKNm8rZ63Au6bpYdaD
A config that sends the same keyed records in a different order differs in its stored value — so it is a change — but no record was added, removed, or edited. The per-record breakdown is therefore empty, and the description fell straight back to the two truncated JSON strings the breakdown exists to replace. It now says the list was reordered. Only reachable for a keyed list: an index-paired reorder shows as field changes. Found reviewing the record diff. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NnwCqKNm8rZ63Au6bpYdaD
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.
A record flag's default-vs-config diff was two
.string(json)values, truncated toforty characters and unreadable. It is now a structured, per-record, per-field
breakdown:
~a changed record, each changed field on its own line,field: old → new. Onlythe fields that differ are shown; an unchanged record does not appear.
-/+a record present on only one side.Records are paired by their
@FlagRecordKeywhen they have one — so a reordered listis not a wall of false changes — and by position (
[0],[1]) when they do not.The structured form is public: each comparison's
recordsis[FlagRecordDiff], with.identifierand.change(.added/.removed/.changed([FlagFieldDiff])), soyou can inspect a specific record's specific field rather than read the text. Field
values render with a generous cap, not the forty-character one the whole blob hit.
Adversarial review
One defect, and it was the exact thing this feature removes. A config that sends the
same keyed records in a different order differs in its stored value, so it is a
change — but no record was added, removed, or edited, so the per-record breakdown is
empty, and the description fell straight back to the two truncated JSON strings. It now
says the list was reordered. Only reachable for a keyed list; an index-paired reorder
shows as field changes.
Also confirmed clean under review: a duplicate-key config is refused by the mapper and
never reaches the diff, and an emptied list reports every record removed.
Verified
760 tests on a clean build. DocC clean with
--warnings-as-errors, both example appsand the iOS package scheme build. Additive only — no breaking changes.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NnwCqKNm8rZ63Au6bpYdaD