Repository navigation
build(allowances): vendor the catalog from commandcode-catalog - #15
Merged
Merged
Conversation
Move the scraper out of the app: commandcode-catalog now owns the docs parsing and publishes catalog.json weekly. The app vendors a validated snapshot for go:embed, so builds stay offline and a bad upstream deploy cannot affect a released binary. go generate ./internal/app now runs cmd/vendor-allowances, which checks the schema and model invariants before replacing the snapshot. The vendored copy picks up tencent/hy4-flash.
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.
Follow-up to #14: the catalog and its scraper now live in commandcode-catalog, which refreshes
catalog.jsonweekly.This PR
cmd/gen-allowances(moved to the catalog repo).cmd/vendor-allowances: fetches the publishedcatalog.json, validates it (schema version, source, captured date, model count, duplicate ids, positive allowances), and replacesinternal/app/allowances.jsonatomically. It is idempotent.go generate ./internal/appnow vendors instead of scraping, so the app never parses the docs page.tencent/hy4-flash, published upstream after feat(quota): derive per-model allowance and expose boosted usage #14.Why vendor instead of fetching at runtime
go:embedkeeps builds offline and a bad upstream deploy cannot affect a released binary. The catalog repo absorbs the parsing fragility; the app only trusts a versioned schema.Not included
An app-side scheduled vendor workflow. A push made with the default
GITHUB_TOKENdoes not trigger CI, so it would need a PAT/GitHub App token; keepinggo generatemanual avoids that secret. The catalog itself still refreshes weekly.Tested
go test ./...,go vet ./..., andgo generate ./internal/appagainst the published catalog (100 models, schema 1).