test: pin the two keyed-path boundaries that prose got wrong - #15
Merged
Conversation
Both claims corrected in #14 were ones I first stated backwards while reading the code, and neither had a test that would have caught it. A keyBy policy engages only when the delta at that path is an array. I had written that a non-array replaces the list; it does not. It follows ordinary merge semantics, so a plain object folds onto a plain-object base and returns it by reference when nothing changes, and replaces only when the base is something else. An `items[]` replacement is verbatim only after reconciliation has decided which item it applies to. I had written that the value goes in without inspection; a missing identity, a duplicate, or a malformed tombstone all throw first, and a tombstone still removes its item rather than being swapped in. The existing tests varied the base shape at a keyed path and covered the happy path for item replacement, so neither boundary was pinned from the delta side. Co-Authored-By: Claude Opus 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.
Follow-on from #14. Tests only — no source, no docs.
Why these two and nothing else
Of the ten claims corrected in the doc sweep, most were already covered by tests, and the rest aren't usefully testable: the cost figures would need brittle perf assertions, and "does not validate your application schema" is a negative claim with nothing to assert.
Two were uncovered — and they are precisely the two I stated backwards while reading the source, before a probe corrected me:
keyBypath "replaces it silently"{items:{a:1}}+{items:{b:2}}→{items:{a:1,b:2}}replace: ["items[]"]value is swapped in "without inspecting it"The argument isn't coverage for its own sake. It's that these two sentences have already demonstrated they drift, and a test is the only thing that would have caught it. Nothing else was added.
What is pinned
keyByengages only for an array delta — a non-array bypasses reconciliation and takes ordinary merge semantics: folds onto a plain-object base (returning it by reference when nothing changes), folds against an empty object otherwise, and a scalar replaces.items[]is verbatim only after reconciliation decides which item it applies to — missing identity, duplicate identity and malformed tombstone each throw, and a tombstone still removes its item rather than being swapped in.Existing coverage varied the base shape at a keyed path and covered only the happy path for item replacement, so neither boundary was pinned from the delta side.
Review
GPT-5.6-sol, no blocking defects. It mutation-tested rather than eyeballing: introducing a replacement-specific bypass of identity, uniqueness and tombstone validation produced exactly the four new cases failing while the other 120 passed, confirming they protect a real boundary rather than restating existing coverage.
Its three nits are applied — the
keyBytest was misfiled under "ambiguity and failure safety" and now sits in "keyed-list reconciliation" beside the wrong-shaped-base case; the table name now covers all three of its rows; and one commit-message phrase was imprecise about non-plain bases.124 tests,
vp run checkgreen.Summary by cubic
Pins two keyed-path reconciliation boundaries in tests to prevent doc drift; runtime behavior is unchanged.
keyByengages only when the delta at that path is an array; non-array deltas use ordinary merge semantics (merge into a plain-object base and return it by reference when unchanged, or replace otherwise).items[]replacement is verbatim only after reconciliation chooses the target item; missing identity, duplicate identity, and malformed tombstones throwKeyfoldMergeError, and a tombstone still removes its item rather than being inserted.Written for commit 709c748. Summary will update on new commits.