Repository navigation
Commit 8494572
committed
http-transport: a link's label is decoded once with the page, wherever the link stands
What changed: `inline()` in lib/http-transport.mjs no longer decodes a link's label inside
the link pass; the label is kept as written and decoded once at the end with everything
else, and its emptiness is judged on the decoded text, so a ` `-only link is dropped in
a list item as it was in a paragraph. `decodeEntities` decodes hex, decimal and named
references in one pass instead of three in turn. The regex oracle in
test/fixtures/regex-extract.mjs carries both rules.
Why: the review of the G3 fix (output-reliability audit) found the page-level pass still
decoding a link label on its own before the tag-stripping pass that follows it, so
`<p>See <a href="/x">limit < 10 and burst > 2</a> now.</p>` came out
`See [limit 2](/x) now.` and `<a>a &lt; b</a>` came out `[a < b]` - the G3 defect,
alive in the one place its test did not look (a paragraph or a div). Two smaller findings
from the same review are folded in because they are the same rule: the emptiness test ran
on the undecoded label, so `<li><a> </a></li>` kept a `[ ](/x)`; and `&lt;` was
decoded to `<` and then to `<`, since the numeric passes ran before the named one.
Alternative set aside: decoding the label and escaping its `<` for the stripping pass, which
would make the converter's output depend on which pass a character came through.
What it touched: research-kit/lib/http-transport.mjs (`decodeEntities`, `inline`),
research-kit/test/fixtures/regex-extract.mjs (the oracle, same two rules),
research-kit/test/transport.test.mjs (one test: paragraph and div links, the double-encoded
label, the blank link, the numeric ampersand), docs/ARCHITECTURE.md (http-transport row),
CHANGELOG.md, research-kit/README.md (1548 tests). No new term.
What you verified:
- the new test red before the fix: `See [limit 2](/x) now.` - verified.
- `node research-kit/bin/selftest.mjs transport http-linear`: 106 passed, 0 failed, so
the 3,000-page oracle equivalence still holds with the extended rules - verified.
- the full suite runs in the commit gate on this commit - verified by the gate before this
commit is accepted.
- staged diff scanned for keys and the pasted token: 0 - verified.
What you got wrong and fixed:
- mistake: the new test expected `- item\n\npara` for a paragraph whose first child is a
dropped blank link, but the converter leaves the space that followed the link, ` para`.
- where: research-kit/test/transport.test.mjs, the blank-link assertion.
- impact: a red assertion about behaviour this commit does not change; nothing delivered.
- cause: I wrote the expectation from the fix's intent, not from the converter's output.
- fix: the assertion matches the list item, the paragraph with an optional leading space,
and the absence of any empty link.
- verified: `selftest transport http-linear` 106 passed, 0 failed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1fT6wSqD2LwRjsUuRvDau1 parent ad2f5ef commit 8494572
6 files changed
Lines changed: 52 additions & 16 deletions
File tree
- docs
- research-kit
- lib
- test
- fixtures
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
456 | | - | |
| 456 | + | |
457 | 457 | | |
458 | 458 | | |
459 | 459 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
200 | 204 | | |
201 | 205 | | |
202 | 206 | | |
| |||
334 | 338 | | |
335 | 339 | | |
336 | 340 | | |
337 | | - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
338 | 345 | | |
339 | 346 | | |
340 | 347 | | |
341 | 348 | | |
342 | | - | |
343 | | - | |
| 349 | + | |
| 350 | + | |
344 | 351 | | |
345 | 352 | | |
346 | 353 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
149 | 151 | | |
150 | 152 | | |
151 | 153 | | |
152 | | - | |
153 | | - | |
| 154 | + | |
| 155 | + | |
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
313 | 336 | | |
314 | 337 | | |
315 | 338 | | |
| |||
0 commit comments