Skip to content

feat(sales): Draft Contract asks first; its result says the contract was created (#2914) - #2925

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-2914-draft-contract-confirm
Dec 2, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-2914-draft-contract-confirm

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Irene · project thread

Fixes #2914

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

维护者速读

  • 销售在订单上点「起草合同」时先弹确认框,点取消什么都不建;确认后弹窗标题改为「合同已创建」,写明合同已保存、关闭不会撤销,并给出「打开合同」链接直达新合同。
  • 解决标准版测试里发现的误会:一点就建合同、结果框的「完成」让人以为点叉就是取消。
  • 出错时最坏是确认框或结果框文案不对,合同照常起草;改的只是文案和一个确认步骤,可直接撤回。
  • 无(结果框底部按钮仍是平台固定的「完成」,暂不能改名为「关闭」,平台卡由席位代立)。

What changes

  • draft_contract (order record page) declares confirmText: Draft a contract from order {{ record.order_number }}? Its amount is taken from the order total. The console's action runner asks before it starts the flow; Cancel starts no run, so no contract is written.
  • sales_order_draft_contract's result screen: title Contract Created (was the node label Contract Drafted), the description now says the contract is saved and closing the window does not undo it, and the record link is labelled Open Contract.
  • zh-CN / ja-JP / es-ES copy for both (en reads the flow screen from source; en pack carries the action's confirmText, as Confirm Order's does).
  • In-app Orders page (en + zh) says the action asks first and that closing the result keeps the contract.

Platform gap — the "Done" button. Option A asked for Open Contract (primary) and Close buttons. On 19.0.0-next.3 a flow screen cannot name its buttons:

  • ScreenConfigSchema (@objectstack/spec/automation) is strict and carries title, description, fields, waitForInput, objectName, idVariable, mode, recordId, defaults: no button-label or primary-action key.
  • The console's flow dialog (useConsoleActionRuntime) draws a display-only screen's single button as common.done ("Done" / 完成), unconditionally.
  • An action-level onSuccess.navigate is refused at a paused screen by its own contract ("a run that pauses at a screen ... performs no navigation"), and dropping the screen to navigate straight to the contract would remove the Close choice the ruling kept.

So this PR does what the platform allows: the record link carries "open the contract" (one click, measured below), and the copy states that closing does not undo. The seat files the objectstack card for author-named screen buttons / a record-open primary action; nothing here routes around it.

Tests

test/sales-order-draft-contract.test.ts gains a describe of two tests: the confirm copy rendered through the platform's template engine names the order; and a real run as a sales rep pauses on a screen titled Contract Created whose contractLink is { label: 'Open Contract', type: 'record_link', reference: 'crm_contract', defaultValue: CONTRACT_ID }.

Ablation: both new tests fail with the action and flow edits reverted
× asks before drafting, naming the order and where the amount comes from
× the result screen says the contract was created, and opens it from one link
AssertionError: expected 'undefined' to be 'Draft a contract from order SO-0042? …'
AssertionError: expected 'Contract Drafted' to be 'Contract Created'
Tests  2 failed | 18 passed (20)

Restored: Tests 20 passed (20).

Acceptance notes

Verification

Read first: src/sales/flows/sales-order-draft-contract.flow.ts (result screen node), src/sales/actions/sales_order.actions.ts (confirmText), src/sales/translations/zh-CN/app.ts.

Two-minute check: pnpm dev, open any order without a contract → Draft Contract → expect a confirm naming the order; Cancel → nothing; confirm → dialog titled Contract Created with an Open Contract link.

Gates on the final head

All on head d9416b8d:

  • pnpm validate exit 0 · pnpm typecheck exit 0 · pnpm lint (os lint --strict) exit 0 · pnpm hygiene exit 0 (source hygiene clean)
  • Full suite, vitest run --shard=N/6 through the shared verify lock, each VERDICT command-exit 0:
    • 1/6: 61 files, 923 passed, 14 skipped
    • 2/6: 61 files, 1049 passed, 1 skipped
    • 3/6: 61 files, 1174 passed, 11 skipped
    • 4/6: 61 files, 1030 passed, 24 skipped
    • 5/6: 61 files, 1282 passed, 6 skipped
    • 6/6: 61 files, 1396 passed, 2 skipped
  • pnpm build not run locally (CI).

🤖 Generated with Claude Code

https://claude.ai/code/session_01J8VVAk8tegvAi1ECkgCFfc

…was created (#2914)

The order's Draft Contract action carries confirmText, so Cancel starts no
run. The flow's result screen is titled Contract Created, says closing it
does not undo the contract, and labels the contract link Open Contract.
zh-CN / ja-JP / es-ES copy, in-app Orders page, and a test with ablation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J8VVAk8tegvAi1ECkgCFfc
@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:16am UTC

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation ci/cd CI plumbing and the verification pipeline metadata Declarative metadata — schema, security posture, UI surfaces backend Server-side behaviour — hooks, flows, actions labels Dec 2, 2026
@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 2, 2026 10:19
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:hotcrm#1 · huangyiirene · session_01J8VVAk8tegvAi1ECkgCFfc

ACCEPT · 2026-12-02T10:19Z

Head-sha: d9416b8d

维护者速读

  • 改了什么:订单上点「起草合同」会先弹确认框(「根据订单 SO-0002 起草合同?合同金额取自订单总额。」),点取消不建合同。建好后的弹框标题改为「合同已创建」,写明已保存、关窗不会撤销,并有「打开合同」链接,一点就打开新合同。
  • 没做到的:弹框底部的按钮仍叫「完成」,改不成「打开合同 / 关闭」——平台的流程弹框不能自定义按钮名(需平台支持)。
  • 要你做什么:无。按您「派吧」与「做完的,没有问题的都自动合并」,席位合并。

席位核对

  • Form: Fixes #2914; draft → ready to main. confirmText on draft_contract; result screen retitled with a saved-and-cannot-undo sentence and an Open Contract record link; zh-CN / ja-JP / es-ES copy; in-app Orders page en + zh — on the amended claim surface, plus a test and a patch changeset.
  • Gap (platform): a flow screen cannot name its buttons (ScreenConfigSchema strict, console draws common.done); not worked around.
  • Test: 20 passed; ablation → 2 failed. Full suite as 6 locked shards on d9416b8d, all exit 0; validate/typecheck/lint/hygiene exit 0. Browser en + zh-CN: Cancel left 0 contracts; confirm created 1; Open Contract opened it.
  • Landing: seat lands on the maintainer's standing word 「做完的,没有问题的都自动合并」 (2026-11-26T10:39Z); auto-merge waits for required checks.

@objectstack-fleet
objectstack-fleet Bot enabled auto-merge December 2, 2026 10:20
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit 835cf33 Dec 2, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Server-side behaviour — hooks, flows, actions ci/cd CI plumbing and the verification pipeline documentation Improvements or additions to documentation metadata Declarative metadata — schema, security posture, UI surfaces

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[decision] Order "Draft Contract" creates the contract on one click with no confirm, and the result dialog's "Done" reads as if nothing was saved yet

2 participants