fix(jobdanmark-search): drop a malformed closing tag the parser left as text (#526)

A live page wrote its Jobtype item as "Fuldtid </ li >". node-html-parser
consumes well-formed markup but does not recognise a closing tag with a
space after the "<" or the slash, so the fragment became a text node and
overviewValue kept it: employmentType: ["Fuldtid </ li >"], matching none
of the documented job-type vocabulary. The same cleanText feeds every
text field on both branches.

Strip only the closing-tag shape in cleanText before collapsing
whitespace. The parser decodes entities before cleanText runs, so author
text the page encoded as &lt;div&gt; or &lt;T&gt; arrives as a literal
<div> / <T> and must stay; a probe of what the parser leaks shows only
malformed closing shapes (</ li >, </ li>, < /li>). Two fixtures: the
stray tag in both the Jobtype item and a description paragraph (fails on
master), and an entity-encoded <div> that survives.

Observed by the maintainer in the #516 merge note.
This commit is contained in:
Ayobami Adegoke authored and GitHub committed 2026-10-15 11:53:54 +02:00
1 parent e475d355ae
commit a644df0625
3 files changed
+68 -1

No files matched your search

+13
View File
@@ -29,6 +29,19 @@ per-file diff commands.
### Fixed
- **`jobdanmark-search detail` no longer keeps a malformed closing tag as text on the
rendered-HTML branch** (#525, `detail.ts`, `tests/detail-parsing.test.ts`) - a live page wrote
its Jobtype item as `Fuldtid </ li >`, and because `node-html-parser` does not recognise a
closing tag with a space after the slash, the fragment reached the output verbatim:
`employmentType: ["Fuldtid </ li >"]`, a value that matches none of the documented job-type
vocabulary. The same `cleanText` feeds every text field on both branches, so any of them
could carry it. `cleanText` now drops the closing-tag shape (`</ li >`, `</ li>`, `< /li>`)
before collapsing whitespace - and only that shape, because the parser decodes entities
before `cleanText` runs, so author text the page encoded as `&lt;div&gt;` or `&lt;T&gt;`
arrives as a literal `<div>` / `<T>` and must survive. Two fixtures: the stray tag in both
the Jobtype item and a description paragraph (fails on master), and an entity-encoded
`<div>` in a description that stays in the text.
- **`/add-portal` includes the `.agents` prefix in generated `allowed-tools`** (#545,
`.claude/commands/add-portal.md`, `tests/test_add_portal_command.py`) - the specification template
for the new portal's `SKILL.md` frontmatter wrote `allowed-tools: Bash(bun run skills/<name>/cli/src/cli.ts *)`