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

Answer prose round 1: 0 🔴, 4 🟡; fold item 102 into the decision's sentence and tighten the comments

This commit is contained in:
2026-10-22 19:15:15 +02:00
committed by Lillem4n
parent 41ccdcb76e
commit 5278f68262
4 changed files with 8 additions and 8 deletions
+3 -3
View File
@@ -713,10 +713,10 @@ also shipped after three rounds: a definitions-only paragraph leaves no block, s
follows takes state carried across lines, and every design read worse on Locality while the overall
held; the scores at 6182ba6 were Junior 5.5, Mid 5.5, Senior 6 and Architect 5.5, mean 5.63. Item
56, still open, is to give that state one owner. Items 85 and 86, 2026-10-11, shipped after three
rounds under a fall the seats laid on item 93's `splitPath` and `splitPlace`, which place a refused
block's path by replaying `splitTaskList` on stand-in nodes; both seats read the chunk's own image
rounds under a fall the seats laid on item 93's `splitPath` and `splitPlace`, which placed a refused
block's path by replaying `splitTaskList` on stand-in nodes until item 102, 2026-10-22, removed them; both seats read the chunk's own image
builder as a gain. The scores at be23835 were Junior 6.5, Mid 6, Senior 6 and Architect 6, mean
6.13. Item 102, 2026-10-22, placed that path in the blocks the one split built. Item 106, 2026-10-13, shipped
6.13. Item 106, 2026-10-13, shipped
after three rounds under a worse ruling, the maintainer's call: both paired seats read the overall
as the same, but Locality fell to a mean of 5.13, laid on the spelling memo the chunk splits between
the CommonMark ask, which fills it, and the walk, which drops each entry as it reads it. The overall
+3 -3
View File
@@ -219,13 +219,13 @@ function bulletBlocks(items: readonly Block[][], reading: Reading, path: Convert
const { nodes: blocks, refusal } = tasks.value
if (refusal === undefined) return success(blocks)
const place = pathTo(blocks, refusal.marker)
// Failures are values, so a marker the split ever copied out of sight leaves the error at its pre-split path rather than asserting; task-list.test.ts pins that the split keeps it.
// task-list.test.ts pins that the split keeps the marker; were it lost, the error keeps its pre-split path, since nothing here throws.
if (place === undefined) return { error: refusal.error, ok: false }
const [blockIndex, ...steps] = place
return { error: { ...refusal.error, path: [...path.slice(0, -1), listIndex + blockIndex, ...steps.slice(0, -2), ...refusal.within] }, ok: false }
}
// A block a task list refused. A placeholder holding `marker` as its one child stands where the block's node would, so the split that builds the list places the refusal too, and `within` is the error's path below that node.
// A block a task list refused. Its placeholder holds `marker` as its one child and stands where the block's node would, so the one split that builds the list places it; `within` is the error's path below that node.
type Refusal = { error: ConvertError; marker: AdfNode; within: ConvertErrorPath }
// Nodes read from task blocks and the first refusal among them; a list is read up to the task holding its refusal.
@@ -252,7 +252,7 @@ function taskBlocks(items: readonly Block[][], reading: Reading, path: ConvertEr
return success({ nodes: splitTaskList({ content: tasks, type: 'taskList' }), refusal })
}
// The nodes a block of a task reads to. A refused one is a placeholder, typed as the split tells paragraphs and task lists from other blocks, so a paragraph that failed to read stays a paragraph.
// A refused block reads to a placeholder. The split tells only paragraphs and task lists from other blocks, so a paragraph that failed to read stays a paragraph.
function readTaskBlock(block: ReadBlock, reading: Reading, path: ConvertErrorPath, depth: number): TaskNodes {
const nodePath = [...path, 'content', 0]
const nested = block.kind === 'bulletList' ? taskBlocks(block.items, reading, nodePath, depth) : undefined
@@ -205,7 +205,7 @@ test('names where a refused block stands after the task list splits', () => {
assert.equal(refused('- [ ] a\n\n <div>x</div>\n\n tail <b>y</b>\n'), '/content/1')
})
test('holds task lists to the 500 levels the parser carries, refusing one level deeper where it stands', () => {
test('refuses a task list nested one level past the 500 the parser carries, at its deepest item', () => {
const nested = (levels: number): string => Array.from({ length: levels }, (_, level) => `${' '.repeat(level)}- [ ] a\n`).join('')
assert.ok(portableMarkdownToAdf(nested(largestNesting)).ok)
const refused = portableMarkdownToAdf(nested(largestNesting + 1))
+1 -1
View File
@@ -19,7 +19,7 @@ export function splitTaskList(list: AdfNode): AdfNode[] {
return blocks
}
// Where `target` stands among `blocks`: its block's index, then the steps down to it. Every node the split moves keeps its identity, but a lone paragraph, which becomes a taskItem holding its inline nodes.
// Where `target` stands among `blocks`: its block's index, then the steps down to it. The split rebuilds lists and items but never an inline node, so an inline marker stays findable.
export function pathTo(blocks: readonly AdfNode[], target: AdfNode): [number, ...ConvertErrorPath] | undefined {
const pending: Visit[] = blocks.map((node, step) => ({ node, parent: undefined, step }))
for (let visit = pending.pop(); visit !== undefined; visit = pending.pop()) {