Repository navigation
test(scripts): the Go-limits HTML reader, which is the half that broke - #143
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
thread as a cell so a header row is a row;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;parseGoLimitsDocand yields the allowances the meter reads. Either half can be wrong alone; only that case exercises both.Verification
Planted the filter's removal:
And
pnpm run limits:shimstill reports up to date (28 models) against the live page, so the extraction is wired end to end.vp checkscripts/check.ts