3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-18 22:25:44 +01:00

Answer architecture round 5: the builders keep main's spelling, each writer's result and the CommonMark ask's spelling are held to the bound once built, and the engines' own overflows refuse alike

This commit is contained in:
2026-10-12 21:36:11 +02:00
committed by Lillem4n
parent a0bb09b80d
commit 6f518dab93
16 changed files with 165 additions and 228 deletions
+25
View File
@@ -602,3 +602,28 @@ Inherited architect, decided by:
- Navigation, Shape: `src/markdown/length-bound.ts:41` `withinEngineLimits`: a too-long symptom leads straight to the module named for it
- Shape: `src/markdown/directive-syntax.ts:133` `spellDirectiveOpener`: each spelling is a string function and a pieces generator
- Shape: `src/markdown/opaque-carry.ts:64` `carriedJson`: the lambda parameter `spelled` shadows the function's own
## 2026-10-12T16:40:52Z, PR #36 at acd22aa, against 7a27f6b
Ruling: worse
| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall |
|---|---|---|---|---|---|
| Mid A | better | worse | worse | same | worse |
| Inherited architect | better | worse | worse | same | worse |
Mid A, decided by:
- Locality, Shape: `src/markdown/emit/adf-to-markdown.ts:374` `spelledList`: a builder's `undefined` now means either no list spelling or past the length bound, and every caller of `joinBlocks` must remember which it holds
- Shape: `src/markdown/emit/adf-to-markdown.ts:383` `listLines`: split, map and join became generators yielding pieces into `separatedBy` and `joinedWithin`, so a reader rebuilds the string in their head
- Locality: `src/markdown/emit/adf-to-markdown.ts:125` `readableBlock`: the memo is filled in `commonMarkSpelling` and deleted on read, a one-shot cache whose hits depend on which walk came first
- Navigation: `src/markdown/length-bound.ts:41` `withinEngineLimits`: a too-long refusal leads to a module named for it
Inherited architect, decided by:
- Locality, Shape: `src/markdown/emit/adf-to-markdown.ts:374` `spelledList`: `undefined` means two things a few lines apart, told apart only by the side of a nested `boundedThen` callback
- Locality: `src/markdown/emit/adf-to-markdown.ts:125` `readableBlock`: reading the memo is a mutation, and a second read spells again
- Shape: `src/markdown/pipe-table-syntax.ts:43` `pipeRowPieces`: one-line templates became generators whose output cannot be read off one line
- Locality, Shape: `src/markdown/emit/block-directive-spelling.ts:27` `spellBlockDirectiveOpener`: the opener's layout is known here and in `spellDirectiveOpener`
- Shape: `src/markdown/portable/adf-to-portable-markdown.ts:231` `reduceCodeBlock`: an ADF-to-ADF reducer carries a markdown length bound through a callback
- Navigation: `src/markdown/length-bound.ts:41` `withinEngineLimits`: a too-long refusal leads straight to one small, well-named module
+13 -11
View File
@@ -666,18 +666,20 @@ is the shortest of the engines the library claims.
Every writer, and the reader's CommonMark ask, refuses markdown longer than 2^29 − 24 characters
(`longestMarkdown`) as `unsupported-node-shape` at the document's path, so the same document
converts alike everywhere. Each builder joins its pieces — blocks, quoted and list lines, directive
pairs and openers, fences, pipe rows, the carry's JSON — through `joinedWithin`, which stops once
they pass the bound, so none builds a string no engine was asked for. A writer first refuses a
document whose text alone passes the bound, since every character of it is spelled at least once. A
deep list or quote re-indents its whole text at each level until the level that passes the bound
refuses (`todo.md` item 109).
converts alike everywhere. A writer first refuses a document whose text alone passes the bound: the
lossless writer spells every character of it, and the portable reduction refuses on the caller's
text, edge whitespace and all, since merging that text first could build past the bound. The
builders join as they always did, and the writer's result and the CommonMark ask's spelling are held
to the bound once built. V8 stops at the bound itself and SpiderMonkey at its own longest string,
and `withinEngineLimits` refuses both throws as the same `tooLong`, so every engine answers alike.
The carry's two-space JSON, which indents every value its depth over, stops at the bound unbuilt
(`joinedWithin`). A deep list or quote re-indents its whole text at each level before the bound
refuses it (`todo.md` item 109).
A line is held to its text's length alone; what its spelling adds — escapes, link targets,
attributes — passes V8's longest string only by throwing, and `withinEngineLimits` refuses that
throw, and SpiderMonkey's, as the same refusal: both mean a string past the bound. `todo.md` item
108 bounds the line itself. The engines' throws past their own longest array, and JavaScriptCore's
`Out of memory`, which also reports a heap running short, stay refused with the engine's message.
JavaScriptCore builds up to its own longest string, 2^31 − 1, before the check. A throw past that,
past any engine's longest array, or JavaScriptCore's `Out of memory`, which also reports a heap
running short, is refused with the engine's message. `todo.md` item 108 bounds the line's own
memory.
## Nothing recurses unbounded