serve base_model in api.json and catalog.json - #3908
Open
arimxyer wants to merge 2 commits into
Open
Conversation
Contributor
Action items
|
Provider model TOMLs already declare base_model — the edge linking an offering to its canonical models/ registry entry — but generate.ts strips the field during inheritance merging, so no served JSON carries it. Consumers that want to group offerings by underlying model have to re-derive the linkage themselves; the site itself works around it by re-parsing every provider TOML a second time (loadProviderBaseModelRefs in render.tsx) just to rebuild the refs the pipeline dropped. Retain the resolved ref on the emitted model instead: - generate.ts keeps base_model on the provider model after the inheritance merge is validated (the ref is already guaranteed to resolve — mergeBaseModel throws otherwise) - ModelShape allows the field as an output-only optional; authored TOMLs still declare it via the BaseModel wrapper, base_model_omit is still stripped, and models.json (registry metadata) is unaffected - render.tsx derives BaseModelRefs from the generated catalog and drops the duplicate TOML scan - SDK Model type documents the field; generated effect schema and drift tests pass - the generate tests are updated to pin the new contract: the factored fixture now expects the retained ref, and the repository-wide leakage test now asserts base_model_omit never leaks while every served base_model resolves to a models/ registry entry bun validate passes; 2,148 refs surface in _api.json/_catalog.json and the derived refs map is verified identical to the previous raw-TOML scan (2,148/2,148, 0 mismatches). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
arimxyer
force-pushed
the
serve-base-model
branch
from
July 31, 2026 18:22
fe49002 to
73cbd0c
Compare
Author
|
Updated the branch to also bring the core test suite along with the contract change:
Note: |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Author
|
Both review action items are addressed: the test contract was updated in the previous push (factored fixture expects the retained ref; the repo-wide test now guards |
Contributor
|
No actionable findings. |
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.
What
Provider model TOMLs already declare
base_model— the edge linking an offering to its canonicalmodels/registry entry — butgenerate.tsstrips the field during inheritance merging, so neitherapi.jsonnorcatalog.jsoncarries it. Consumers who want to group provider offerings by underlying model (e.g. "which providers serveanthropic/claude-opus-4-6, and at what price?") have to re-derive that linkage themselves from heuristics, even though the repository already knows the answer.The site itself pays for this today:
loadProviderBaseModelRefsinpackages/web/src/render.tsxre-parses every provider TOML a second time solely to rebuild the refs the generate pipeline just dropped.This PR retains the resolved ref on the emitted model instead:
generate.tskeepsbase_modelon the provider model after the inheritance merge validates (the ref is guaranteed to resolve at this point —mergeBaseModelthrows otherwise)ModelShapeallows the field as an output-only optional; authored TOMLs still declare it via theBaseModelwrapper schema, andmodels.json(registry metadata) is unaffectedrender.tsxderivesBaseModelRefsfrom the generated catalog and drops the duplicate TOML scanModeltype documents the field (generated effect schema updated viabun run generate)Net diff is ±25 lines.
Why
base_modelis the only provider-agnostic identity signal in the dataset, and it's currently invisible to every API consumer. Serving it makescatalog.jsonself-contained for cross-provider grouping:group_by(model.base_model ?? id)replaces per-consumer name/id heuristics. It also removes the site's own double-parse workaround.Verification
bun validatepasses; 2,148 refs surface in_api.json/_catalog.jsonBaseModelRefsmap is identical to the previous raw-TOML scan: 2,148/2,148 entries, 0 mismatches (so site grouping behavior is provably unchanged)models.jsoncarries no new field (0 occurrences)bun run generate && tsc --noEmit && bun test(23 pass)🤖 Generated with Claude Code