Repository navigation
Conversation
Phase 1 of tasks.md. Implements the splice marker and the rules that surround it; $super* pairing is phase 2. Arrays were replaced on inheritance not by decision but by omission: MergeObjects recursed when both sides were objects and let everything else fall through to child-replaces. This adds composition at that same seam. - internal/markers.go classifies a string in direct array element position. A defined marker is a marker; $super followed by an identifier character is a different word and stays data; $super followed by anything else is an undefined spelling in the reserved namespace and is an error, which is what keeps $super[1:] available to gain meaning later. - MergeObjects composes a marked array against the array it inherits, splicing the inherited elements at the marker's position. It now returns an error, so mergeObjects and resolveInheritances thread one. - Splicing builds a fresh slice. The node pool shares backing arrays between every document inheriting a file, so appending into one would corrupt them all. - Inherited elements are copied verbatim, markers included, so two splice deltas compose into a third that is still pending. - A marked array carries while the inherited array is absent, which is what lets an $includes fragment contribute to a document it knows nothing about. - Grounding walks the top-level object after composition and reports any marker that never resolved -- including one nested where nothing could ever bind it. It runs before value-side evaluation, so an eval: produced string is never classified as a marker. 18 autotest cases: 11 under inheritance/array-composition, 7 under negative/array-composition. Unit tests cover marker classification. Full suite 173/173, no regressions. Refs #91 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Owner
Author
|
Superseded by a stack, at the maintainer's request — this PR carried the engine, the tests, and the planning artifacts as one commit.
Nothing changed in the split: the tip of the stack is byte-identical to the commit on this branch, verified with Closing without merging. The branch |
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.
Phase 1 of
tasks.mdfor #91, following the planning merged in #96. Implements the$supersplice marker and the rules around it.$super*pairing is phase 2 — see the intermediate state note below.The change in one line
Arrays were replaced on inheritance not by decision but by omission:
MergeObjectsrecursed when both sides were objects and let everything else fall through to child-replaces. This adds composition at that same seam.What landed
internal/markers.goclassifies a string in direct array element position. A defined marker is a marker;$superfollowed by an identifier character is a different word and stays data ($supervisor);$superfollowed by anything else is an undefined spelling in the reserved namespace and is an error — which is what keeps$super[1:]and$super?available to gain meaning later.MergeObjectscomposes a marked array against the array it inherits, splicing the inherited elements at the marker's position. It now returns an error, somergeObjectsandresolveInheritancesthread one.$includesfragment contribute to a document it knows nothing about.eval:-produced string is never classified as a marker.Diagnostics
Task 1.1 settled the wording before any negative case was written, and recorded it in
design.md. Every message shares the prefixarray composition, so the family is greppable and the autotest cases match a stable string rather than each inventing their own.Tests
18 autotest cases — 11 under
inheritance/array-composition, 7 undernegative/array-composition— plus unit tests for marker classification.No regressions; the pre-existing inheritance cases pass unchanged, and
unmarked-replacesandnested-in-replaced-arraypin the unchanged default explicitly.Intermediate state, deliberate
Between this PR and phase 2,
$super*is reported as an unresolved marker rather than pairing. It errors instead of silently mis-composing, which is the safe half of the eventual behaviour, but the spec delta is not satisfied for that marker until phase 2 lands.One consequence worth flagging for review:
negative/array-composition/nested-in-queue-elementpasses today for the wrong reason. It asserts that{"m": ["$super*", ["$super", 5]]}is rejected as an unresolved marker, and it is — but right now the outer$super*is the unresolved one. After phase 2, pairing will take the queue element whole and the inner$superwill be the unresolved one, at path.m[0]. Same verdict, different cause. I left the assertion loose rather than pinning a path that is about to change.Notes
tasks.mdis shared state, so phase 2 has to follow this rather than run alongside. Tasks 1.1–1.10 are ticked.