Skip to content

fix(revenue): link the demo's accepted quote to its seeded order (#2668) - #2924

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-2668-acme-quote-order
Dec 3, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-2668-acme-quote-order

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Closes #2668

Clause-②: no
Metadata-protocol: none
Metadata-impact: reviewer

维护者速读

  • 用户能看到什么变化:在演示数据里,已接受的报价「Acme Annual Renewal 2025 Quote」现在是对应订单的来源报价,报价页的订单列表也会列出该订单;中文演示数据同样关联。
  • 为什么做:这是订单功能那次改动的复核遗留项,平台修好了种子数据里跨模块查找字段的缺陷,现在可以补上。
  • 出错会怎样:最坏情况是演示订单的来源报价仍为空或指错,只影响演示数据,不影响真实客户数据,撤回这次改动即可恢复。
  • 要你做什么:无。

What changes

  • src/revenue/data/sales-order-quote.seed.ts (new): a revenue-module dataset on crm_sales_order, mode: 'update', keyed by the order's name, over the order merged with the module's crm_quote extension field. It sets the Acme renewal order's Source Quote to the accepted quote and inserts nothing. Its zh-CN twin is sales-order-quote.zh-CN.seed.ts; zhOrderName and zhQuoteName are now exported where the twins already built them.
  • objectstack.composition.ts: the two datasets replay right after the quotes, in CrmSeedData / CrmSeedDataZhCN, and are registered by the revenue package. The revenue stack now gets artifactObjects (the app package's object names), so defineStack accepts a dataset on an app-package object. This widens seeds and grants only, and revenue declares no grants.
  • test/seed-locale-twins.test.ts: a new case pins the link in both boots. It also leaves update datasets out of the per-object row counts and the natural-key fixture, because an update dataset adds no row.

The link lives in the module that owns the field. With the quote module disabled, the order is seeded as before.

Tests

Dev-boot measurement (the card's required reading)

On a fresh objectstack dev --no-watch with an empty SQLite file and the 19.0.0-next.3 pin, signed in as the dev admin:

  • en: GET /api/v1/data/crm_sales_order returned 3 orders. Acme Annual Renewal 2025 Order has crm_quote: "Lr0CSHbeFgAiOlY1", and that id is Acme Annual Renewal 2025 Quote with status accepted. Globex and Initech are null. Filtering orders by that quote id returns exactly the Acme order. The seed settled with 487 rows.
  • zh-CN: the built artifact with i18n.defaultLocale set to zh-CN returned 3 orders. 艾克美 2025 年度续约订单 has crm_quote: "Ivcp1uD_1jg3dd41", and that id is 艾克美 2025 年度续约报价 with status accepted. The other two are null.

The column now holds the quote's id. On 18.6.0 it held the raw quote name.

@objectstack/verify

vitest run test/seed-locale-twins.test.ts: 20 passed, 1 skipped (VERDICT command-exit 0). On this pin, verify agrees with the dev boot.

Ablation: with the link datasets left out of the stacks' registration (the union unchanged), the new case fails in both boots with orders naming the accepted quote: expected [] to deeply equal [ 'Acme Annual Renewal 2025 Order' ], and the zh-CN equivalent. Restored and confirmed by cmp.

Acceptance notes

  • With mode: 'update', the link is written on every replay that finds the order under its sample name. That is harmless because the field is readonly and the quote_accepted_order flow writes it.
  • I did not measure whether an existing database gets the link on its next start, so the changeset does not claim it.
  • In the console UI, I read the Source Quote through REST and the quote's Orders tab only through its filter, not on screen.

Verification

  • pnpm validate, pnpm typecheck, pnpm lint, pnpm hygiene and pnpm build each exited 0 locally.
  • The full pnpm test is NOT MEASURED locally: it ran past the container's 10-minute foreground cap, and two later runs of a seed-test subset never got the shared verify lock. CI runs it.

Files to read first:

  1. src/revenue/data/sales-order-quote.seed.ts: the merge of the extension field and mode: 'update'.
  2. objectstack.composition.ts: the replay position and the revenue artifactObjects.
  3. test/seed-locale-twins.test.ts: the count exemption.

Two-minute check: pnpm dev, open Orders, then Acme Annual Renewal 2025 Order. Source Quote reads Acme Annual Renewal 2025 Quote.

🤖 Generated with Claude Code

https://claude.ai/code/session_017xRBcUpajguxop2zMyDN9K

The accepted quote "Acme Annual Renewal 2025 Quote" left its completed order
with an empty Source Quote. The revenue module now seeds the link itself: a
mode 'update' dataset on crm_sales_order, keyed by the order's name, over the
order merged with the module's crm_quote extension, replayed after the
quotes. The revenue stack is handed the app package's object names
(artifactObjects) so defineStack accepts a dataset on an app-package object.
The zh-CN twin links the Chinese pair.

test/seed-locale-twins.test.ts pins the link in both stories and leaves
update datasets out of its row counts and natural-key fixtures.

Claude-Session: https://claude.ai/code/session_017xRBcUpajguxop2zMyDN9K
@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
hotcrm Ignored Ignored Dec 2, 2026 10:31am UTC

Request Review

@github-actions github-actions Bot added ci/cd CI plumbing and the verification pipeline metadata Declarative metadata — schema, security posture, UI surfaces configuration Build and app configuration files labels Dec 2, 2026
- package-ownership: a seed family that only sets, on rows another package
  seeded, fields its own package adds through objectExtensions is that
  package's; any other column on another package's object is still a stray.
- saas-composition: the revenue stack now registers crm_sales_order (the link)
  after its quote families, in both stories.
- territory-seed-coverage: the new family module is in FAMILIES.

Claude-Session: https://claude.ai/code/session_017xRBcUpajguxop2zMyDN9K
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:hotcrm@sunhaolin · sunhaolin · session_017xRBcUpajguxop2zMyDN9K

席位核对 · independent review · head 21b1631f35 · 2026-12-02T10:29Z

独立审阅结论(只读、隔离;AGENTS.md「Who decides a change」):

类别:种子内容本身属于 reviewer 类。守卫收窄是规则 3 的新例外,测试自己的注释写明「needs a ruling of its own」(test/package-ownership.test.ts:60-66),所以整张 PR 留草稿,等维护者裁定。

审阅者的核对:

  • 平台加载器的 update 模式找不到行就跳过,从不插入。
  • 订单上 O2C 的四个流程都不会被这次写入触发。
  • 模块缺席时,链接数据集也不在。
  • 上一个 head 失败的三个守卫,这次如实登记并通过。CI 19/19。
  • 审阅者自做的消融:多写一个应用包字段、改模式、换对象、写 O2C 的扩展字段、复合 externalId,每种都仍被拦下。

不阻断的发现:

  • 守卫有两个盲点(空记录、只含主键的 update 记录)。
  • 种子注释把「在报价之后重放」归因于数组位置,不准确。
  • defineStack 对营收的第二层防线没了;saas-composition 的注释已不成立。
  • AGENTS.md:109 和 module-split-plan.md:702 的文字没有跟上(AGENTS.md 是受管路径)。

需维护者裁决:规则 3 是否允许「模块用 update 种子,只在别包已种的行上写自己通过 objectExtensions 加的字段」?

  • A 允许:字段是营收的,应用包的种子写不了它;O2C 在 crm_sales_order 上的流程留在 O2C 是同类先例;其余越界仍被拦下。批准后本 PR 原样可合,盲点和注释另做小修。
  • B 不允许:链接改由应用包在营收存在时写入,或者干脆不做这条演示链接。代价是应用包要知道模块的字段,违背拆分方向。
  • 审阅者建议:A。

Generated by Claude Code

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Dec 2, 2026
#2668)

Review follow-up on #2924. A seed family on another package's object is
exempt only if it has records and each record writes at least one field the
package adds through objectExtensions, besides its key. An empty update
family, or one whose records carry only the key, is a stray again.

The link seed's comment now credits the right mechanism for loading after the
quotes: the loader's object-dependency sort, plus registration order within
one object. It names test/seed-locale-twins.test.ts as the pin that catches
a reversed order.

Claude-Session: https://claude.ai/code/session_017xRBcUpajguxop2zMyDN9K
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:hotcrm@sunhaolin · sunhaolin · session_017xRBcUpajguxop2zMyDN9K

Ruling recorded · 2026-12-02T11:27Z

The maintainer, in chat: 「2924 选 A」. This settles the rule-3 question in 7342549818.

A module may use a mode-update seed that writes, on rows another package seeds, only fields the module itself adds through objectExtensions. The narrowed package-ownership sweep encodes this (38a14b5 closed the empty-record and key-only blind spots). It is now a ruled reading of rule 3, not an unruled exception.

Follow-up: AGENTS.md:109 and docs/architecture/module-split-plan.md:702 should say this. AGENTS.md is a governed path, so it is the maintainer's edit.

Status: CI on 38a14b5 is 19/19 success. The PR is maintainer class, stays a draft, and carries pm:awaiting-merge. It goes to the maintainer's merge, or to his word to the seat.


Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 3, 2026 01:06
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit 983ca96 Dec 3, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd CI plumbing and the verification pipeline configuration Build and app configuration files metadata Declarative metadata — schema, security posture, UI surfaces pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue

Projects

None yet

2 participants