docs(proposal): add targeted ALTER for message definitions, and the nesting measurement that requires it - #375
Merged
Merged
Conversation
…requires it The first draft had only collection-level CREATE/DROP/DESCRIBE/SHOW, on an unstated assumption that a definition is a flat field list. Measuring the corpus shows it is not: definitions nest to depth 7, with most elements at depths 5-7 (2,208 at depth 7 alone), a mean of 4.7 members per object element and a tail out to 22. So a whole-document CREATE OR MODIFY is a poor tool for "expose one more attribute" — restating a seven-level document to add a leaf is exactly the diff-unfriendliness ADR-0003 argues against, and is why ALTER ENTITY ADD ATTRIBUTE exists rather than only CREATE OR MODIFY ENTITY. Adds two statement families: alter message definition collection M.MD_Order add|drop|rename definition ... alter message definition M.MD_Order.Order add|drop|set member ... Three choices worth reviewing. The definition is addressed as Module.Collection.Definition, the three-part reference WITH MESSAGE DEFINITION already takes, so the two cannot drift apart. It is SET member ... AS, not RENAME ... TO, because ALTER ENTITY's RENAME changes the model and rewrites every reference while this changes only the element's ExposedName — borrowing the verb would promise something far larger. And a nested member is reached with `in <exposed-name path>` rather than a /-joined name, because / already means "association to entity" inside a member. Also raises a wildcard member (`( * )`) as an open question rather than designing it: the checkbox-tree UI makes it a natural thing to want, but nothing in the corpus says anyone does, and proposing it would be designing for a shape with no document behind it. Verification plan gains the control that separates a targeted edit from a rebuild: add one member and assert every other element is byte-identical. 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-up to #371, which merged the first draft of this proposal. Docs only.
What changed and why
The first draft had only collection-level
CREATE/DROP/DESCRIBE/SHOW, resting on an unstated assumption that a message definition is a flatfield list. Measuring the corpus shows it is not. Definitions nest to
depth 7:
Most elements sit at depths 5–7. Object elements carry a mean of 4.7 members,
with a tail out to 22.
So a whole-document
CREATE OR MODIFYis a poor tool for "expose one moreattribute": restating a seven-level document to add a leaf is exactly the
diff-unfriendliness ADR-0003
argues against, and is why
ALTER ENTITY ADD ATTRIBUTEexists rather than onlyCREATE OR MODIFY ENTITY.Added
Collection-level ALTER matters for the 8 collections holding more than one
definition; member-level ALTER applies to all 36.
Three choices a reviewer should push on
Module.Collection.Definitionas the address — the same three-partreference
WITH MESSAGE DEFINITIONalready takes, so the two cannot driftapart.
SET member … AS, notRENAME … TO.ALTER ENTITY RENAME ATTRIBUTErenames in the model and rewrites every reference to it; this changes only the
element's
ExposedNameand touches nothing else. Borrowing the verb wouldpromise something far larger than it delivers.
in <path>for a nested member, written in exposed names, rather than a/-joined name —/already means "association to entity" inside a member(
Sales.Order_Line/Sales.Line), and overloading it in the same clause would beambiguous to a reader even where the grammar could tell them apart.
Deliberately not designed
A wildcard member (
( * )for "expose every attribute"). Studio Pro's UI is acheckbox tree, so it is a natural thing to want, and with a tail out to 22
members it would save real typing — but
*appears nowhere else in MDL andnothing in the corpus says anyone wants it. Raised as an open question instead
of proposed, on the same principle that killed the import
group =node.Also
The verification plan gains the control that matters for ALTER specifically: add
one member and assert every other element is byte-identical — that is what
separates a targeted edit from a rebuild that happened to produce the same
result.
🤖 Generated with Claude Code