Repository navigation
feat: publish release-independent pricing consumer contract - #11512
Merged
Merged
Conversation
Expose exact, authority-separated pricing data through a versioned read-only contract and the reviewed GitHub catalogue publication channel. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
Documentation PreviewDocumentation has been built for this PR. To view locally:
Built from commit 126b341 |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The consumer tests do not pin the v1 schema hash, allowing schema changes to pass CI while breaking compatibility with installed consumers and older data pins.
1 open issue
What changed in this PR
Adds a versioned pricing consumer contract so downstream tools can adopt reviewed AWF pricing data independently of firewall releases, without changing runtime pricing authority.
Changes:
- Adds lossless pricing exports, strict validation, and deeply frozen/read-only consumer APIs.
- Extends atomic catalogue publication with a dedicated pricing channel and immutable snapshots.
- Adds packaging, compatibility, integrity, and publication regression coverage, plus consumer documentation.
| File | Description |
|---|---|
shared/model-information/publication-contract.cjs |
Adds pricing paths, pointer validation, and envelope integrity checks. |
shared/model-information/pricing-consumer.v1.schema.json |
Defines the strict pricing consumer data schema. |
shared/model-information/pricing-consumer.js |
Adds bundled, offline, and published snapshot readers. |
shared/model-information/pricing-consumer.d.ts |
Defines deeply readonly pricing types. |
scripts/model-information/publish.cjs |
Publishes pricing atomically alongside model channels. |
scripts/model-information/publication.test.ts |
Covers pricing updates, history, rollback, and publication failures. |
scripts/model-information/pricing-consumer.test.ts |
Covers validation, immutability, exact pricing, and packaged consumption. |
scripts/model-information/maintain.cjs |
Allows maintenance of the generated pricing export. |
scripts/model-information/compile.test.ts |
Checks tariff preservation in the consumer projection. |
scripts/model-information/compile.cjs |
Generates and validates the pricing snapshot. |
scripts/model-information/build-publication.cjs |
Produces the validated pricing publication artifact and digest. |
docs/model-catalogue-publication.md |
Documents consumer APIs, trust requirements, and scope boundaries. |
containers/api-proxy/catalogue-contract/publication-contract.cjs |
Synchronizes the packaged publication contract helpers. |
.github/workflows/publish-model-catalogue.yml |
Validates and publishes the additional pricing artifact. |
Review effort: Max (auto)
Comment on lines
+108
to
+109
| it('rejects unknown schemas, changed content, malformed decimals, scopes, dates and authority', () => { | ||
| const snapshot = fixture(); |
This was referenced Nov 13, 2026
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.

Summary
Implement Step 1 of AWF pricing ownership: a versioned, read-only consumer data/API foundation backed by existing canonical sources, without changing runtime pricing authority.
Pricing data updates are independent of firewall versions. Extend the existing reviewed-source publication workflow to atomically publish a third channel on
catalogue-dataafter relevant merges tomain:channels/pricing/v1/current.jsonsnapshots/pricing/v1/<content-revision>.jsonDistribution uses GitHub and SHA-256 integrity, with immutable content-addressed snapshots and digest verification; no signatures or signing infrastructure are required. The npm package provides an offline seed, not the pricing update boundary. Consumers can adopt a newer compatible data revision without upgrading the firewall, or pin an older revision for offline/reproducible use.
Consumer contract
Under
shared/model-information/:pricing-consumer.v1.generated.json: language-neutral pricing data, directly usable by Go or JavaScript.pricing-consumer.v1.schema.json: strict versioned schema reusing canonicalschema.v1.jsondefinitions.pricing-consumer.js/.d.ts:getPricingSnapshot(),readPricingSnapshot(), andreadPublishedPricingSnapshot(), returning deeply frozen/readonly views.Keep three authority-separated sections: maintained tariffs, legacy native compatibility policy, and scoped OpenRouter imports. Preserve exact decimal text, provider/channel/deployment applicability, source provenance and revisions, strict context thresholds, effective intervals/promotions/successors, and absent/unavailable/zero distinctions. No cross-provider price borrowing or manufactured fast-model coverage.
The ordinary compiler and stale checks own the generated export; the existing source-maintenance projection allowlist includes it. Publication retains trusted-main ancestry, exact-source read-only validation, artifact digest checks, immutable history, no-op/rollback handling, out-of-order protection, and atomic updates. The publication reader checks the strict pointer/path, file digest, content revision, supported schema, and exact reviewed-source bytes; transport authentication and main-ancestry verification remain caller responsibilities.
Scope boundaries
Documentation:
docs/model-catalogue-publication.md.Validation
npm run models:generateandnpm run models:check— passed.npx jest --runInBand scripts/model-information scripts/ci/model-api-mapping-updater-workflow.test.ts— 7 suites, 182 tests passed.publication.test.tsandpricing-consumer.test.ts— 43 tests passed.npm run build,npm run type-check, andnpx markdownlint docs/model-catalogue-publication.md— passed.git diff --check— clean.Regression coverage exercises the actual extracted npm tarball off-tree, readonly TypeScript types, consumption with network/writes prohibited, exact decimals and authority/scope/date/tier boundaries, unknown-schema rejection, and real local bare-Git atomic publication/update/rollback. The same schema/API/package code consumes two distinct compatible pricing revisions and preserves pinned history.