Skip to content

feat(runtime-host): expose effective pricing projection - #2073

Merged
Astro-Han merged 2 commits into
apache:mainfrom
me2seeks:feat/2015-pricing-projection
Aug 4, 2026
Merged

feat(runtime-host): expose effective pricing projection#2073
Astro-Han merged 2 commits into
apache:mainfrom
me2seeks:feat/2015-pricing-projection

Conversation

@me2seeks

@me2seeks me2seeks commented Aug 4, 2026

Copy link
Copy Markdown
Contributor
English

Summary

  • Evolve pricing.query from override-only pages into a revision-consistent effective pricing projection.
  • Combine the Runtime's bundled table with persisted overrides in the Host, preserving canonical model-key ordering and existing page bounds.
  • Mark each row as Built-in or Custom, and make a Custom row's reset result explicit as restore_builtin or become_unpriced.
  • Cover exact wire decoding, equal-value override provenance, reset/delete behavior, multi-page revision changes, two-client CAS, and Host restart.

Why

The existing query exposed only persisted overrides. A future Desktop adapter would otherwise need to copy the bundled pricing table and infer what deleting an override means, creating a second pricing read model outside the Host.

This keeps effective-value composition and provenance behind the existing Host interface, so clients only assemble and present authoritative pages.

Contract

Validation

  • npm run build:test
  • npm --workspace @maka/runtime-host run test:dist — 629 passed
  • npm run lint
  • npm run format:check
  • git diff --check origin/main...HEAD

Part of #2015.

中文

概要

  • pricing.query 从只返回 override 的分页,演进为 revision 一致的生效价格 projection。
  • 在 Host 内合并 Runtime 内置价格表与持久化 override,并保持规范 model-key 顺序和现有分页边界。
  • 将每一行标记为 Built-in 或 Custom,并明确 Custom 行删除后的结果是 restore_builtinbecome_unpriced
  • 覆盖严格 wire 解码、同值 override 的来源语义、reset/delete、多页 revision 变化、双 Client CAS 与 Host 重启。

背景

现有 query 只暴露持久化 overrides。未来 Desktop adapter 若直接消费它,就必须复制内置价格表并自行推断删除 override 的后果,从而在 Host 外形成第二套 Pricing read model。

本次将生效价格合成与来源判断保留在现有 Host interface 后面,Client 只负责组装并展示权威分页。

契约

验证

  • npm run build:test
  • npm --workspace @maka/runtime-host run test:dist — 629 项通过
  • npm run lint
  • npm run format:check
  • git diff --check origin/main...HEAD

属于 #2015 的一部分。

@Astro-Han Astro-Han 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.

Approve. Two test gaps to close before merge:

  1. The offset-invalid path (usage-pricing-coordinator.ts:217) is untested: continue past the last entry must return invalid_request, but no test exercises it, so an off-by-one would pass CI.
  2. Delete of a missing override is untested. Deleting a key with no override (including a builtin row never overridden) must return { kind: 'unchanged' } without bumping revision; a regression that bumps the revision or errors would pass CI.
    Also on record, non-blocking: the restart test asserts counts and revision but not custom value fidelity; nothing pins the no-production-consumer caveat (a protocol test asserting the old overrides shape is rejected would); the composition is duplicated between buildPricingLookup and projectEffectivePricingEntries.

@me2seeks
me2seeks force-pushed the feat/2015-pricing-projection branch from d8199ce to acbdfd6 Compare August 4, 2026 06:23
@Astro-Han
Astro-Han merged commit a54dde0 into apache:main Aug 4, 2026
10 checks passed
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