Skip to content

test: pin the two keyed-path boundaries that prose got wrong - #15

Merged
b2m9 merged 1 commit into
mainfrom
test/pin-keyed-path-boundaries
Aug 13, 2026
Merged

test: pin the two keyed-path boundaries that prose got wrong#15
b2m9 merged 1 commit into
mainfrom
test/pin-keyed-path-boundaries

Conversation

@b2m9

@b2m9 b2m9 commented Aug 13, 2026

Copy link
Copy Markdown
Owner

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:

I wrote Actual
a non-array delta at a keyBy path "replaces it silently" it merges: {items:{a:1}} + {items:{b:2}}{items:{a:1,b:2}}
a replace: ["items[]"] value is swapped in "without inspecting it" a missing identity, duplicate, or malformed tombstone all throw first

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

keyBy engages 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 keyBy test 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 check green.


Summary by cubic

Pins two keyed-path reconciliation boundaries in tests to prevent doc drift; runtime behavior is unchanged.

  • keyBy engages 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 throw KeyfoldMergeError, and a tombstone still removes its item rather than being inserted.

Written for commit 709c748. Summary will update on new commits.

Review in cubic

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>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

@b2m9
b2m9 merged commit 4e38e5b into main Aug 13, 2026
3 checks passed
@b2m9
b2m9 deleted the test/pin-keyed-path-boundaries branch August 13, 2026 13:52
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