Repository navigation
fix(revenue): link the demo's accepted quote to its seeded order (#2668) - #2924
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
- 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
|
repo:hotcrm@sunhaolin · sunhaolin · session_017xRBcUpajguxop2zMyDN9K 席位核对 · independent review · head
|
#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
|
repo:hotcrm@sunhaolin · sunhaolin · session_017xRBcUpajguxop2zMyDN9K Ruling recorded · 2026-12-02T11:27ZThe maintainer, in chat: 「2924 选 A」. This settles the rule-3 question in 7342549818. A module may use a mode- Follow-up: AGENTS.md:109 and Status: CI on Generated by Claude Code |
Closes #2668
Clause-②: no
Metadata-protocol: none
Metadata-impact: reviewer
维护者速读
What changes
src/revenue/data/sales-order-quote.seed.ts(new): a revenue-module dataset oncrm_sales_order,mode: 'update', keyed by the order's name, over the order merged with the module'scrm_quoteextension field. It sets the Acme renewal order's Source Quote to the accepted quote and inserts nothing. Its zh-CN twin issales-order-quote.zh-CN.seed.ts;zhOrderNameandzhQuoteNameare now exported where the twins already built them.objectstack.composition.ts: the two datasets replay right after the quotes, inCrmSeedData/CrmSeedDataZhCN, and are registered by the revenue package. The revenue stack now getsartifactObjects(the app package's object names), sodefineStackaccepts 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-watchwith an empty SQLite file and the 19.0.0-next.3 pin, signed in as the dev admin:GET /api/v1/data/crm_sales_orderreturned 3 orders.Acme Annual Renewal 2025 Orderhascrm_quote: "Lr0CSHbeFgAiOlY1", and that id isAcme Annual Renewal 2025 Quotewith statusaccepted. Globex and Initech arenull. Filtering orders by that quote id returns exactly the Acme order. The seed settled with 487 rows.i18n.defaultLocaleset tozh-CNreturned 3 orders.艾克美 2025 年度续约订单hascrm_quote: "Ivcp1uD_1jg3dd41", and that id is艾克美 2025 年度续约报价with statusaccepted. The other two arenull.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 bycmp.Acceptance notes
mode: 'update', the link is written on every replay that finds the order under its sample name. That is harmless because the field isreadonlyand thequote_accepted_orderflow writes it.Verification
pnpm validate,pnpm typecheck,pnpm lint,pnpm hygieneandpnpm buildeach exited 0 locally.pnpm testis 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:
src/revenue/data/sales-order-quote.seed.ts: the merge of the extension field andmode: 'update'.objectstack.composition.ts: the replay position and the revenueartifactObjects.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