Skip to content

test(scripts): the Go-limits HTML reader, which is the half that broke - #143

Merged
viztor merged 1 commit into
mainfrom
test/go-limits-html
Oct 31, 2026
Merged

viztor merged 1 commit into
mainfrom
test/go-limits-html

Conversation

@viztor

@viztor viztor commented Oct 31, 2026

Copy link
Copy Markdown
Owner

The allowance table is generated from the vendor's page, and the reader had to learn a new shape when the docs moved under /v2/docs/console/ and started serving HTML.

That conversion lived inside a top-level-await script, so nothing could exercise it — and a conversion nobody can exercise is one nobody knows works. Its failure mode is quiet: a page it cannot read writes a generated file with every allowance missing, which still looks valid.

What moved

scripts/go-limits-html.ts — the page → markdown conversion, extracted so it is a function of its argument. The script keeps the network, the catalog resolution and the file write.

What the test holds it to

  • the cells: tags stripped and trimmed, th read as a cell so a header row is a row;
  • the selection: a table is taken by its header (Monthly limit), not by its position or its shape — the page carries other six-column tables, and reading one as an allowance is the failure this exists for;
  • the refusal: fewer than two such tables throws, because an empty document would read as "no models" rather than as a broken source;
  • the round trip: the markdown it builds goes through the real parseGoLimitsDoc and yields the allowances the meter reads. Either half can be wrong alone; only that case exercises both.

Verification

Planted the filter's removal:

FAIL test/go-limits-html.test.ts > takes a table by its HEADER, not by its position or shape
AssertionError: expected '<TabItem label="Go">…' not to contain '1,200'

And pnpm run limits:shim still reports up to date (28 models) against the live page, so the extraction is wired end to end.

gate result
suite 1217 passed / 81 files (+1)
vp check 0 errors
scripts/check.ts passes

The allowance table is GENERATED from the vendor's page, and the reader had to
learn a new shape when the docs moved under `/v2/docs/console/` and started
serving HTML. That conversion lived inside a top-level-await script, so nothing
could exercise it — a conversion nobody can exercise is a conversion nobody
knows works, and its failure mode is quiet: a page it cannot read writes a
generated file with every allowance missing and still looks valid.

It is now `scripts/go-limits-html.ts`, and `test/go-limits-html.test.ts` holds
it to four things:

- **the cells**: tags stripped, trimmed, `th` read as a cell so a header row is
  a row;
- **the selection**: a table is taken by its HEADER ("Monthly limit"), not by
  its position or its shape — the page carries other six-column tables, and
  reading one as an allowance is the failure this exists for;
- **the refusal**: fewer than two such tables throws, because an empty document
  would read as "no models" rather than as a broken source;
- **the round trip**: the markdown it builds goes through the REAL
  `parseGoLimitsDoc` and yields the allowances the meter reads. Either half can
  be wrong alone; only that case exercises both.

Planted the filter's removal, the header case fails with the request count it
should have ignored. `pnpm run limits:shim` still reports "up to date (28
models)" against the live page, so the extraction is wired end to end.
@viztor
viztor merged commit b7cc8cf into main Oct 31, 2026
3 checks passed
@viztor
viztor deleted the test/go-limits-html branch October 31, 2026 17:39
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.

1 participant