GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — lab-ops-hub: Worker-fallback extractor diverges from container Extractor — bare <a> uncounted, script-string <a counted, title entities raw, style/title leak into text · Issue #569 · developing-today/code

lab-ops-hub: Worker-fallback extractor diverges from container Extractor — bare <a> uncounted, script-string <a counted, title entities raw, style/title leak into text #569

New issue
Copy link
New issue
Copy link
Closed
#3918
Closed
lab-ops-hub: Worker-fallback extractor diverges from container Extractor — bare <a> uncounted, script-string <a counted, title entities raw, style/title leak into text#569
#3918
Copy link
Assignees
dezren39
Labels
app/lab-ops-hubPackage/app: lab-ops-hub (pkgs/ or apps/ in this repo)effort/mMedium: expected under 1 day of workkind/bugSomething isn't working (prefixed form of the classic bug label)meta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)source/humanFiled directly by a human

Description

@dezren39
dezren39
opened on Oct 22, 2026
Issue body actions

Problem

POST /api/crawl returns the same JSON contract from two extractors — the container's Python Extractor (pkgs/lab-ops-hub/container/app.py:388-415) and the Worker fallback's regexes (crawlFallback, pkgs/lab-ops-hub/src/index.ts:196-205) — but on identical HTML the two produce different title, links and text/excerpt. Which values a crawl returns (and archives to R2 / D1) therefore depends on whether the container happened to be available, contrary to the README's "Worker-side fallback crawler with the same JSON contract" (pkgs/lab-ops-hub/README.md:14).

Verified this run by feeding identical HTML to the real Python Extractor and to the fallback's exact regex expressions:

  1. Bare <a> anchors are not counted by the fallback. The fallback counts html.match(/<a\s/gi) — an <a> with no attributes has no whitespace after the tag name. Sample <a>only bare anchor</a>: container links=1, fallback links=0.
  2. <a inside a <script> string is counted by the fallback. Sample <script>var s = "<a href='/fake'>x</a>";</script>: container links=0 (HTMLParser treats script content as data), fallback links=1 (the <script> removal only applies to the text extraction, not to the earlier links count on the raw HTML).
  3. Title entities are not decoded by the fallback. <title>Tom &amp; Jerry &#8212; Best</title>: container returns Tom & Jerry — Best (HTMLParser decodes character references), fallback returns the raw Tom &amp; Jerry &#8212; Best.
  4. Title and <style> content leak into the fallback's text/excerpt. The container keeps title text out of text and skips <script>/<style> content entirely (_skip counter). The fallback strips <script> blocks but not <style>, and its tag-stripping leaves the title's text in place. Sample with <title>T</title><style>.x { color: red; }</style>: container text='only bare anchor', fallback text='T .x { color: red; } only bare anchor'.

Why it matters

The crawl result is archived verbatim (crawls/<ts>.json in R2, row in D1 crawls), so the same URL crawled twice — once per path — yields inconsistent records, and the fallback path (used exactly when the container is unhealthy, i.e. when reliability matters most) returns visibly wrong excerpts (raw entities, CSS source) and link counts.

Suggested fix / acceptance criteria

  • Make the fallback extraction match the container's semantics for the cases above: count <a> start-tags regardless of attributes, never count markup inside <script>/<style>, decode HTML entities in the title (and text), and exclude title + script + style content from text.
  • The natural home is a pure helper in src/lib.ts (like crawlFetcher, lab-ops-hub: the #500 crawl-timeout fix has no regression test — crawlFallback's fetcher is inline in the untestable Worker entry #524) so it is unit-testable with plain Node; crawlFallback in src/index.ts cannot be imported by tests today because the module imports Cloudflare bindings.
  • Add paired fixtures: the same HTML samples run through both extractors (extend test/lib.test.ts and test/test_container_validate.py-style parity, or a shared fixture file both suites read), asserting identical title, links and text for: bare <a>, <a inside a script string, entity-bearing title, and a <style> block.
  • Existing suites still pass: npm test in pkgs/lab-ops-hub (TS + Python).

Acceptance criteria

  • The Worker fallback's extraction lives in a pure, unit-testable helper and matches the container Extractor's semantics for the filed cases: bare <a> anchors are counted; markup inside <script>/<style> is never counted; HTML entities are decoded in the title (and text); title, script and style content are excluded from text/excerpt.
  • Paired fixtures run the same HTML samples through both extractors and assert identical title, links and text for: a bare <a>, an <a inside a script string, an entity-bearing title, and a <style> block.
  • Existing lab-ops-hub suites still pass (npm test in pkgs/lab-ops-hub, TS + Python).

Activity

Next
  1. github-actions
    assigned
    dezren39
    on Oct 22, 2026
  2. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    source/humanFiled directly by a human
    status/needs-triageNot yet triaged; needs a first look
    priority/normalOrdinary priority (the default)
    effort/mMedium: expected under 1 day of work
    app/lab-ops-hubPackage/app: lab-ops-hub (pkgs/ or apps/ in this repo)
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Oct 26, 2026
  3. dezren39 commented on Oct 26, 2026

    @dezren39
    dezren39
    on Oct 26, 2026
    MemberAuthor
    More actions

    Intake review

    • Related: lab-ops-hub: the #500 crawl-timeout fix has no regression test — crawlFallback's fetcher is inline in the untestable Worker entry #524 (the crawlFetcher pure-helper precedent in the same package); container Extractor in pkgs/lab-ops-hub/container/app.py.
    • Notes: Verified still live on current main this run (2026-10-26, main 24261355): pkgs/lab-ops-hub/src/index.ts:203 still counts links with html.match(/<a\s/gi) inside crawlFallback (line 186), so all four filed divergences stand. The body's "Suggested fix / acceptance criteria" is formalized in the appended ## Acceptance criteria.
    • Risks: The fallback runs exactly when the container is unhealthy; changing its output shape carelessly could break the archived-crawl contract (crawls/<ts>.json in R2, D1 rows). Parity fixtures must pin both extractors to the same samples.
    • Suggested approach: Extract a pure helper in src/lib.ts (the lab-ops-hub: the #500 crawl-timeout fix has no regression test — crawlFallback's fetcher is inline in the untestable Worker entry #524 pattern), implement the container's semantics (count <a start-tags, skip script/style content, decode entities, exclude title/script/style from text), and add the paired fixtures before touching crawlFallback.
  4. dezren39 commented on Oct 27, 2026

    @dezren39
    dezren39
    on Oct 27, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator job (code lane A, new-issue-creator-code-a)
    • Session / ID: new-issue-creator-code-a cron run, 2026-10-27 10:35 CDT
    • Found via: filed this run
    • Task: Additional verified divergence samples for this issue's extractor pair (not a separate filing — same function pair, same fix direction).
    • Expectation: Fold the samples below into this issue's paired fixtures when the fallback helper is built.
    • Links: ci(cf-container-hello): no workflow runs the #955 hardening regression suite — 11 SSRF/gate tests execute only when a human remembers #1439 (this run's filing, different package)

    More container vs Worker-fallback divergences (verified this run, main 95cd41f0)

    Method: identical HTML fed to the real Python Extractor (container/app.py:1240) and to the fallback's exact expressions (src/index.ts:202-209: title regex, <a\s count, script-strip + tag-strip). Log: goal hidden_files/probe-2026-10-27-laneA-diff/extract_probe.py.

    Sample Container Fallback
    <p>real</p><!-- <a href='/x'>hidden</a> --> links=0, text=real links=1, text=real hidden --> (anchor inside an HTML comment is counted, and comment residue leaks into text)
    <p>real</p><script>var secret = 'leaked'; (unclosed) text=real text=real var secret = 'leaked'; (the <script[\s\S]*?</script> strip needs a closing tag; an unclosed script's body leaks)
    <title>a <b>c</b> d</title><p>body</p> title=a <b>c</b> d, text=body title=`` (empty — [^<]* cannot cross the ``), text=`a c d body`
    <title>First</title><title>Second</title><p>body</p> title=FirstSecond title=First, text=First Second body (second title's text also leaks into text)
    <textarea><a href='/x'>t</a></textarea><p>body</p> links=0, text=<a href='/x'>t</a> body (textarea content is data) links=1, text=t body

    The comment and textarea cases extend item 2's class (markup in non-markup contexts) beyond <script> strings; the unclosed-script and title cases are new shapes for items 3/4. All five are covered by this issue's suggested fix (a real parser-based pure helper matching the container's semantics) — they only widen the fixture list its acceptance criteria should pin.

  5. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    on Nov 1, 2026
  6. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    🤖 Agent note · picked up

    • Agent: openchamber scheduled lane (repo-worker-code)
    • Task: Triage queue task 2169; revalidate current main and route a scoped fix if still applicable.
  7. 65 remaining items

  8. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    agent-note:v1 — task 4868 picked up by OpenChamber scheduled lane (2026-11-01). Fresh verification: #569 is OPEN and assigned to Drew; PR #3918 is OPEN, authored by Drew, at head 741b85a. The task’s implementation and tests are already on that PR; I will not touch its worktree, review, CI, or merge disposition. Parking until the PR merges/closes or ownership changes; revalidate before any action.

  9. dezren39
    added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    on Nov 1, 2026
  10. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    agent-note:v1 — task 4868 parked by OpenChamber scheduled lane (2026-11-01). PR #3918 remains OPEN and Drew-authored at 741b85a; implementation/tests are already present. No PR/worktree, CI, review, or merge disposition was touched. Resume after the PR merges/closes or ownership changes, then revalidate. Labels reflect parked state; work/assigned remains set.

  11. dezren39
    added 4 commits that reference this issue on Nov 1, 2026

    fix(lab-ops-hub): address Codex round-2 P2s on extractor parity (#569)

    17347f0

    fix(lab-ops-hub): address Codex round-3 P2s on extractor parity (#569)

    a179aba

    fix(lab-ops-hub): bound end-tag match to avoid quadratic backtracking (…

    edf21a6

    Merge pull request #3918 from developing-today/queue/4868-569-extract…

    bdc66c7
  12. dezren39
    closed this as completedin #3918on Nov 1, 2026
  13. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done

    • Agent: queue worker (repo-worker-code), lane D shift
    • Session / ID: task 4868
    • Found via: queue claim (resume of the parked task; PR fix(lab-ops-hub): Worker-fallback extractor parity with container Extractor (#569) #3918 already existed on branch queue/4868-569-extractor-parity)
    • Task: Resumed PR fix(lab-ops-hub): Worker-fallback extractor parity with container Extractor (#569) #3918 and carried it to merge. Codex rounds 2–4 dispositioned in full: round 2 (quote-mode boundaries, entity own-property lookup, raw-text end tags) fixed in 17347f0; round 3 (self-closing slash must immediately precede >, tolerant end tags in the normal path) fixed in a179aba; round 4 P1 (quadratic backtracking in the tolerant end-tag pattern, introduced in round 3's fix) fixed in edf21a6 — pathological input now 0.72 ms. Every new fixture's expected values were verified against the container Extractor before pinning; suites green at merge: node 85/85, python 65 OK. PR fix(lab-ops-hub): Worker-fallback extractor parity with container Extractor (#569) #3918 merged as bdc66c7.
    • Expectation: lab-ops-hub: Worker-fallback extractor diverges from container Extractor — bare <a> uncounted, script-string <a counted, title entities raw, style/title leak into text #569 closed by the merge. Two broader parity gaps Codex surfaced in round 4 were split out with verified evidence instead of expanding this PR: lab-ops-hub: Worker-fallback extractor — complete HTML character-reference decoding parity #4007 (complete HTML character-reference decoding) and lab-ops-hub: Worker-fallback extractor — RCDATA/raw-text modes for textarea, iframe, xmp, noembed, noframes #4008 (RCDATA/raw-text modes for textarea/iframe/xmp/noembed/noframes).
    • Links: task 4868 · PR fix(lab-ops-hub): Worker-fallback extractor parity with container Extractor (#569) #3918 · lab-ops-hub: Worker-fallback extractor — complete HTML character-reference decoding parity #4007 · lab-ops-hub: Worker-fallback extractor — RCDATA/raw-text modes for textarea, iframe, xmp, noembed, noframes #4008
  14. dezren39
    removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

app/lab-ops-hubPackage/app: lab-ops-hub (pkgs/ or apps/ in this repo)effort/mMedium: expected under 1 day of workkind/bugSomething isn't working (prefixed form of the classic bug label)meta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)source/humanFiled directly by a human

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.