docs: harden RollPart spec from design review #114#115
Merged
Conversation
Spec corrections to STAGE3.md §5 (RollPart shape): `literal` / `variable` carry `total: number` `grouped` variant added — preserves user-typed `(...)` distinct in the part tree `modifier` redesigned with `ModifierSpec[]` mirroring `flattenModifierChain` Conditions on threshold modifiers preserved — `condition` on `reroll`, `threshold?` on `explode`, `threshold` + `failThreshold?` on `successCount`, `successThresholds[]` + `failThresholds[]` on `critThreshold` `dice` carries `count: number` — symmetric with `fateDice` `successCount.total = successes - failures` invariant pinned `group.keptIndices` semantics pinned — 0-based, pre-sort, omitted on bare groups, dropped sub-rolls retain full RollPart `DieResult` reference sharing documented — no deep-clone `RollPartType = RollPart['type']` alias added Per-branch construction notes for `evalVersus`, `evalSuccessCount`, `evalGroupModifier` Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Landed the 10 spec corrections to
.claude/docs/STAGE3.md§5 from the design review of #84. Docs-only — no source or test changes. On merge, #84 is unblocked.total: numbertoliteralandvariablesoresult.parts.total === result.totalholds for trivial expressions.groupedvariant — keeps user-typed(...)distinct in the part tree and preserves the 1:1 AST↔RollPart mapping (16 variants).modifier: stringwithModifierSpec[]mirroringflattenModifierChain; chains like4d6kh3kl1round-trip per-spec.reroll(condition),explode(threshold?),successCount(threshold+failThreshold?), andcritThreshold(successThresholds[]+failThresholds[]).count: numbertodice— symmetric withfateDice, eliminates the "derive fromrolls.length" footgun under keep/drop.successCount.total = successes − failuresas an invariant regardless of empty-pool or wrapping arithmetic.group.keptIndicessemantics — 0-based, indexesparts[]in author-written order, pre-sort, omitted on bare groups, written byevalGroupModifieronto the innergrouppart; dropped sub-rolls retain their full RollPart includingversus.degree.DieResultreference sharing between part-treerolls[]andresult.rolls[]— no deep-clone.RollPartType = RollPart['type']alias for exhaustive switches.evalDice,evalModifier,evalGroupModifier,evalGroup,evalVersus,evalSuccessCount, andevalCritThreshold; rejected thepartsStackalternative and the optionalparts?field in prose.Closes #114
Drafted with AI assistance