Repository navigation
Description
Problem
In the id web editor, the task_list node's parseDOM rule for <ol> reads the list start from the DOM's own el.start reflection instead of the validated parseOrderedListStart helper that #2005 / PR #4078 added for the sibling ordered_list rule in the same file — so ordered task lists still admit every start value that fix was created to reject:
pkgs/id/web/src/editor.ts:210-218— both branches of the task_list<ol>rule return{ order: el.start }.el.startis whatever the DOM implementation makes of the raw attribute; nothing checks it is a plain non-negative decimal integer.pkgs/id/web/src/editor.ts:46-57,118—parseOrderedListStart(plain\d+, safe-integer, fallback 1) is applied only toordered_list. Thetask_listattrs (editor.ts:203) declareorder: { default: null }with no validation.pkgs/id/src/web/markdown.rs:4378— on save, the codec reads task_listattrs.orderviaas_u64(): a negative or fractional order reads asNone, and the list is rebuilt as a bullet task list (markdown.rs:4379-4390). A pasted ordered task list silently loses its ordering on save.pkgs/id/web/src/editor.ts:220-227— the task_listtoDOMemitsstart="<order>"for any order ≠ 1, so a stored-3or2.5round-trips into the rendered HTML verbatim until the save drops the ordering entirely.
Verified this run (2026-11-01, main ceba688a; laptop clone at 7a0da2fc, editor.ts md5 82283862fb30369b0bc9864a49c2568d identical on both)
Probe on the laptop (~/git/fleet/probe-2026-11-01-laneA-tasklist-start/, happy-dom — the DOM implementation of the repo's own test suite, pkgs/id/web/vitest.config.ts — reading el.start exactly as editor.ts:214/216 does, against parseOrderedListStart, the helper copied verbatim):
| start attr | task_list el.start → saves as |
ordered_list parseOrderedListStart |
|---|---|---|
| (absent) | 1 → ordered from 1 | 1 |
5 / 0 / 42 |
5 / 0 / 42 → preserved | 5 / 0 / 42 |
2.5 |
2.5 → bullet (as_u64 None) | 1 |
-3 |
-3 → bullet (as_u64 None) | 1 |
"" |
0 → ordered from 0 | 1 |
0x10 |
16 → saved as 16 (reinterpreted) | 1 |
1e3 |
1000 → saved as 1000 (reinterpreted) | 1 |
9007199254740993 |
9007199254740992 → saved rounded | 1 |
In a spec-compliant browser el.start is the IDL signed-long reflection, whose details differ (it truncates 2.5 to 2, parses 0x10 as 0, clamps huge values to 2147483647) — but it still bypasses the fallback-to-1 rule, still truncates instead of rejecting, and still admits negatives that the u64 codec cannot represent. Neither reflection is the validated read #2005 established.
Why it matters
This is the residual half of #2005 in the same schema: the plain ordered list was hardened, the ordered task list — which shares the <ol start> surface and the same u64 save codec — was not. Pasted web content is the realistic source (task lists copied from rendered HTML carry whatever start the source page had), and the failure shapes are the two #2005/#2010 classics: silent reinterpretation (0x10 → 16) and silent loss on save (negative/fractional → bullet list). Distinct from #2010 (image width/height Number() in the same file) — different node, different expression, different downstream failure.
Acceptance criteria
- The task_list
<ol>parseDOM rule derivesorderfromparseOrderedListStart(el.getAttribute("start"))(or an equivalent validated read): only a plain non-negative decimal integer within safe range is preserved (0 included); malformed, fractional, negative, hex/scientific, empty, or unsafe values fall back to 1, exactly asordered_list— in both branches (class-matched and checkbox-detected). - Tests mirroring the id(web/editor): ordered_list parseDOM bare Number() lets NaN/fractional start through — pasted lists silently renumber from 1 on save #2005
ordered_list start parsingblock cover the task_list rule's getAttrs for the same value set (5,0,42preserved;abc,2.5,0x10,1e3, empty,-3,9007199254740993→ 1; absent → 1). - The editor test suite passes (
bun run testinpkgs/id/webor CI equivalent).
Activity
dezren39 commentedon Nov 2, 2026
🤖 Agent note · state: self-assigned
Merge pull request #4101 from developing-today/creator-a/4100-tasklis…
dezren39 commentedon Nov 2, 2026
🤖 Agent note · state: done
parseOrderedListStart(el.getAttribute("start")); tests mirror the id(web/editor): ordered_list parseDOM bare Number() lets NaN/fractional start through — pasted lists silently renumber from 1 on save #2005 block.