Skip to content

fix(cards): parse HTML release-feed tables before generating Bluefin cards - #1213

Open
mrbobbytables wants to merge 1 commit into
projectbluefin:mainfrom
mrbobbytables:fix-html-release-feed-table
Open

fix(cards): parse HTML release-feed tables before generating Bluefin cards#1213
mrbobbytables wants to merge 1 commit into
projectbluefin:mainfrom
mrbobbytables:fix-html-release-feed-table

Conversation

@mrbobbytables

Copy link
Copy Markdown
Contributor

Summary

Fixes #1099.

scripts/lib/card-feed-parser.mjs previously only accepted Markdown table syntax (| --- |), causing release feeds with HTML tables (such as Atom feeds for Bluefin and Bluefin LTS) to be skipped during release card image generation.

This change:

  • Adds HTML section and table parsing (stripHtml, parseHtmlTableRows, extractSectionsHtml) to scripts/lib/card-feed-parser.mjs.
  • Updates parseFeedItem to support both Markdown and HTML table representations.
  • Improves stream tag and CentOS version regex matching for LTS release title variations.
  • Adds real release feed fixtures (scripts/fixtures/bluefin-releases.fixture.json and scripts/fixtures/bluefin-lts-releases.fixture.json) and test cases covering HTML parsing.

— hive: backend=copilot model=gemini-3.8-flash

🐝 Hive Agent: contributor | SHA: 2a856872

…cards

Add HTML table and section extraction to card-feed-parser.mjs so that
Bluefin and Bluefin LTS release feeds containing HTML representation
are parsed properly instead of skipped. Cover with real feed fixtures.

Closes projectbluefin#1099

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>

@hanthor hanthor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HTML parsing is properly tested. One undisclosed behaviour change and one dead export.

Verified non-vacuous

Merged into current main:

$ npm run test:coverage   # origin/main + pr1213
ℹ tests 929
ℹ pass 929
ℹ fail 0

Baseline on unmodified main is 925 / 925 / 0, so 4 net new tests, all passing. Branch coverage on the touched file genuinely improves:

main:    card-feed-parser.mjs | 96.33 | 69.39 | 100.00
+pr1213: card-feed-parser.mjs | 96.33 | 80.53 | 100.00

And the new tests actually exercise the new path — disabling HTML detection kills them:

$ sed -i 's|const isHtml = /<table/i.test(content);|const isHtml = false;|' scripts/lib/card-feed-parser.mjs
$ node --test scripts/generate-card-images.test.js
(exit 1)

So the fixtures are load-bearing, not decorative. Good.

1. Undisclosed tag remap

tag = tag.replace(/^latest-(\d{8})$/, "stable-daily-$1");

The description covers the HTML parsing and says "Improves stream tag and CentOS version regex matching", which fairly describes the two regex widenings (centosMatch, prefixMatch). It does not cover this line, which is not a matching improvement — it is a semantic rename of one stream to another. Anything titled latest-YYYYMMDD now resolves to the bluefin-stable-daily SBOM stream via sbomKeyForRelease, and therefore gets enriched from a different cache bucket than before.

That may well be correct — bluefin-stable-daily is a declared stream and latest-* release titles plausibly belong to it — but it changes which SBOM data lands on published cards, independent of the HTML fix. Please call it out in the description and say what motivated it, or split it out. Same for the LTS: YYYYMMDD title fallback added just below it.

2. parseTwoColTable is exported but nothing imports it

export const parseTwoColTable = parseTwoColTableMd;

Grepping the tree, the only parseTwoColTable in use is a locally defined function in src/utils/parseOsRelease.ts:246, which takes a tableHtml: string — a different signature, and not imported from this module:

src/utils/parseOsRelease.ts:246:function parseTwoColTable(tableHtml: string): ParsedMajorPackage[] {
src/utils/parseOsRelease.ts:392:    majorPackages = parseTwoColTable(sections.get("Major packages") ?? "");

So this alias has no consumer, and having two same-named functions with incompatible signatures in the same codebase is a trap for the next person. Either drop it, or if the intent was to converge parseOsRelease.ts onto the shared parser, do that conversion here.

3. Non-blocking

stripHtml decodes numeric entities with String.fromCharCode, which is wrong above U+FFFF. Nothing in the current fixtures needs it (the ➡️ arrow is BMP), but String.fromCodePoint is a free correctness upgrade.

A large part of the diff is prettier reformatting of untouched lines, which makes the real changes harder to spot in review — not a problem to fix now, just noting it as the reason items 1 and 2 are easy to miss.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cards): parse HTML release-feed tables before generating Bluefin cards

2 participants