Skip to content

feat: publish release-independent pricing consumer contract - #11512

Merged
lpcox merged 1 commit into
mainfrom
lpcox-awf-pricing-consumer-contract
Nov 13, 2026
Merged

lpcox merged 1 commit into
mainfrom
lpcox-awf-pricing-consumer-contract

Conversation

@lpcox

@lpcox lpcox commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

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-data after relevant merges to main:

  • channels/pricing/v1/current.json
  • snapshots/pricing/v1/<content-revision>.json

Distribution 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 canonical schema.v1.json definitions.
  • pricing-consumer.js / .d.ts: getPricingSnapshot(), readPricingSnapshot(), and readPublishedPricingSnapshot(), 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

  • No twice-daily schedule yet. Publication follows reviewed canonical-source merges, using the existing workflow.
  • No gh-aw migration, automatic-override removal, or reporting-consumer migration; those are subsequent steps.
  • No runtime pricing-authority or request-charge behavior change, staged target activation, or new pricing resolver/CLI/service.
  • No live publication, workflow dispatch, provider credential fetching, token exchange, or live inference was performed.
  • No signing infrastructure, merge, or auto-merge changes.

Documentation: docs/model-catalogue-publication.md.

Validation

  • npm run models:generate and npm run models:check — passed.
  • npx jest --runInBand scripts/model-information scripts/ci/model-api-mapping-updater-workflow.test.ts — 7 suites, 182 tests passed.
  • Independent parent rerun of publication.test.ts and pricing-consumer.test.ts — 43 tests passed.
  • npm run build, npm run type-check, and npx markdownlint docs/model-catalogue-publication.md — passed.
  • git diff --check — clean.
  • Commit hooks: ESLint passed with existing warnings, build and commitlint passed.

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.

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>
Copilot AI adaptive review requested due to automatic review settings November 12, 2026 23:51
@github-actions

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation has been built for this PR.

Download preview artifact

To view locally:

  1. Download the docs-preview-pr-11512 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit 126b341

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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();
@lpcox
lpcox merged commit 4e04a30 into main Nov 13, 2026
40 of 42 checks passed
@lpcox
lpcox deleted the lpcox-awf-pricing-consumer-contract branch November 13, 2026 00:17
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.

2 participants