Skip to content

Diff record flags per record and field, not as a truncated blob - #40

Merged
andyyhope merged 4 commits into
mainfrom
feature/record-default-diff
Aug 25, 2026
Merged

Diff record flags per record and field, not as a truncated blob#40
andyyhope merged 4 commits into
mainfrom
feature/record-default-diff

Conversation

@andyyhope

Copy link
Copy Markdown
Owner

A record flag's default-vs-config diff was two .string(json) values, truncated to
forty characters and unreadable. It is now a structured, per-record, per-field
breakdown:

Default vs config:
  changes (2):
    • page-size: 10 → 25
    • payment-methods:
        ~ Apple Pay:
            enabled: true → false
            minimumSpend: 5.0 → 10.0
        - Bank transfer
        + PayPal
  • ~ a changed record, each changed field on its own line, field: old → new. Only
    the fields that differ are shown; an unchanged record does not appear.
  • - / + a record present on only one side.

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.

The structured form is public: each comparison's records is [FlagRecordDiff], with
.identifier and .change (.added / .removed / .changed([FlagFieldDiff])), so
you 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 apps
and the iOS package scheme build. Additive only — no breaking changes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NnwCqKNm8rZ63Au6bpYdaD

andyyhope and others added 4 commits August 25, 2026 15:39
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
@andyyhope
andyyhope merged commit 109231d into main Aug 25, 2026
6 checks passed
@andyyhope
andyyhope deleted the feature/record-default-diff branch August 25, 2026 05:58
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