3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-20 23:25:43 +01:00

Answer architecture round 1: every container joining several walks sums their projections before it joins, the portable reduction refuses a list whose spelling is refused, and heldTextLength moves beside textLength

This commit is contained in:
2026-10-12 17:10:56 +02:00
committed by Lillem4n
parent e3aa790ec8
commit 2b5d22cbc6
10 changed files with 101 additions and 41 deletions
@@ -76,6 +76,12 @@ test('refuses a paragraph whose text would pass V8\'s longest string, joining no
assert.equal(portableDocument(document(merged)), 'unsupported-node-shape at /content/0')
})
test('refuses an expand whose title and body together would pass V8\'s longest string', () => {
let quote: AdfNode = node('expand', { title: 'a'.repeat(1_000_000) }, { attrs: {}, content: [text('a\n'.repeat(1_108_000))], type: 'codeBlock' })
for (let level = 0; level < 240; level += 1) quote = { content: [quote], type: 'blockquote' }
assert.equal(portableDocument(document(quote)), `unsupported-node-shape at /${Array.from({ length: 241 }, () => 'content/0').join('/')}`)
})
test('refuses nesting past 500 levels wherever the reduction walks', () => {
const lowest = (bottom: AdfNode): string => {
let deep = bottom