Skip to content

Send for Approval, Start Signing and Activate confirm with the generic 「操作已成功完成」 instead of saying what happened - #167

Merged
zhuangjianguo merged 1 commit into
mainfrom
claude/issue-158-transition-success-messages
Oct 27, 2026
Merged

zhuangjianguo merged 1 commit into
mainfrom
claude/issue-158-transition-success-messages

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #158

Clause-②: no
Metadata-protocol: none

Submit, Withdraw, Accept for Review, Send for Approval, Start Signing, Activate and Terminate declared no successMessage. Each press toasted the console's generic 「操作已成功完成」 ("Action completed successfully"), so the user had to read the status chip to learn what happened. Each now says what changed.

What changed

  • src/actions/contract-lifecycle.actions.ts: transition(…) takes a required successMessage (after description) and puts it on the action. Every transition therefore has to say what it did. The six actions it builds get one sentence each. terminate_contract is hand-written rather than built by transition(…), but the card names it, so it gets its own successMessage.
  • src/translations/{en,zh-CN}/objects.contract.ts: the same sentences, under each action's _actions.NAME.successMessage. These are the keys start_renewal, launch_contract and executed_upload already use.
action en (source) zh-CN
submit_contract Contract submitted. 合同已提交。
withdraw_contract Draft withdrawn. The contract is cancelled. 草稿已撤回,合同已作废。
accept_contract Accepted into legal review. 已受理,进入法务审查。
send_for_approval Sent for approval. 已送审,进入审批。
start_signing Signing started. 已进入签署。
activate_contract Contract activated. 合同已生效。
terminate_contract Contract terminated. 合同已终止。

The submit sentence does not say where the contract went next. A type without legal review hops straight to approval, and one with it goes to a lawyer, so any wording that named a destination would be wrong for one of the two.

Measured: {{ record.contract_number }} renders, but is not shipped

18.2 made successMessage a template slot over result and record (objectstack 384bb7b). I tried it before choosing the wording, as an uncommitted probe on ce953fa with a fresh DB and the same personas. Terminate became Contract {{ record.contract_number }} terminated. / 合同 {{ record.contract_number }} 已终止。, and Send for Approval became {{ record.contract_number }} sent for approval. / {{ record.contract_number }} 已送审,进入审批。.

  • pnpm validate EXIT=0, pnpm lint EXIT=0 (same 1 warning and 6 suggestions), pnpm lint:i18n-gate EXIT=0.
  • In the browser (Legal Counsel 1): zh-CN 「MSA-2026-0016 已送审,进入审批。」 and 「合同 AMD-2026-0001 已终止。」; en "Contract AMD-2026-0002 terminated." The hole is filled from the translated sentence too.

The hole works, but I left it out. These actions sit in the record header only (locations: ['record_header']), so the toast always shows on the contract's own page, directly under a header that already reads 合同编号 MSA-2026-0016. Without the number the sentence is shorter and matches the existing ones ("Renewal draft created.", "Contract launched."). Adding the number later is a one-line change per key.

Browser measurement: @objectstack 18.2.0, pnpm demo:zh --port 3145, fresh DB before and after

Personas were set up the README way, as the dev admin. create-user was run for Business Requester 1, Legal Counsel 1, Legal Counsel 2, Records Manager and Executive (each 200). The last four got sys_user_position rows clm_legal_counsel ×2, clm_records_manager and clm_executive (each 201). Each persona ran change-password (200), and set-user-manager made Executive the manager of Business Requester 1 (200). Then pnpm demo:zh was run again on the same DB to hand over the rows (updated: 209). Each reading was taken in Chromium (/opt/pw-browsers/chromium), signed in as the persona who presses the button, and read from the sonner toast.

Before = origin/main 91a79dd. After = ce953fa.

persona action contract before after
Business Requester 1 提交 SOW-2026-0004 → 审批中 操作已成功完成 合同已提交。
Business Requester 1 (owner) 撤回 (confirm 继续) NDA-2026-0020 → 已作废 操作已成功完成 草稿已撤回,合同已作废。
Legal Counsel 1 受理审查 MSA-2026-0016 → 审查中 操作已成功完成 已受理,进入法务审查。
Legal Counsel 1 送审 MSA-2026-0016 → 审批中 操作已成功完成 已送审,进入审批。
Records Manager 发起签署 NDA-2026-0010 → 签署中 操作已成功完成 已进入签署。
Records Manager 生效 NDA-2026-0010 → 生效中 操作已成功完成 合同已生效。
Legal Counsel 1 (terminate_contract) 终止 (reason, 确认) AMD-2026-0001 → 已终止 操作已成功完成 合同已终止。
Legal Counsel 1, en-US Terminate AMD-2026-0002 → Terminated Action completed successfully Contract terminated.
Legal Counsel 1, en-US Accept for Review ICA-2026-0005 → In Review — Accepted into legal review.

Every press answered POST /api/v1/actions/clm_contract/ACTION → 200 {"success":true}, and the header then showed the new status. The browser console in every run showed the same two resource errors (one 404, one 401), before and after. Nothing new appeared. No boot logged degraded or no such table. Every boot ended with the same seed summary: first boot inserted 830 · errored 404, the re-run updated 209 · errored 170. The errors are the README's documented unnamed-persona references.

The prerequisites for each press were written through the API by the persona who would do that work, before the press:

  • Business Requester 1 filed version 1 on SOW-2026-0004.
  • Legal Counsel 1 set themself legal_owner on MSA-2026-0016, then recorded an approved legal review (0 open deviations).
  • The legal owner, Legal Counsel 2, filed the current clean version on NDA-2026-0010 and, after 发起签署, the completed wet-ink round with its executed copy. F7 then filed the final_signed version.

On the before boot, the Records Manager's own attempt to file the clean version (on DPA-2026-0001) answered 403 PERMISSION_DENIED ("master 'clm_contract' not editable by this user (row-level security)"), so the legal owner filed it. 发起签署 on DPA-2026-0001 without a clean version toasted the server's A current clean version is required before signing. (422). The error path is unchanged by this PR.

Gates (head ce953fa)

pnpm install                  EXIT=0
pnpm validate                 EXIT=0   ✓ Validation passed (781ms)
pnpm lint                     EXIT=0   1 warning(s), 6 suggestion(s): the warning is main's security-controlled-by-parent-owner-policy-without-opt-in
pnpm typecheck                EXIT=0   tsc --noEmit
pnpm lint:i18n-gate           EXIT=0   ✓ i18n gate · COVERAGE : 0 missing keys across 2 locale(s)
CLM_DEMO_SEED=1 pnpm validate EXIT=0   ✓ Validation passed (862ms)

Acceptance notes

  • The wording is the seat's to review, as triage said. The card's three examples are used word for word.
  • The records manager cannot file a version on an approved contract (row-level edit on the master). The legal owner can. This was not investigated further here. It is noted, not filed.

🤖 Generated with Claude Code

https://claude.ai/code/session_017nzWFRUo2U7evMkPdVniAn

Submit, Withdraw, Accept for Review, Send for Approval, Start Signing,
Activate and Terminate declared no successMessage, so every press toasted
the console's generic 「操作已成功完成」 / "Action completed successfully".
Each now names the change ("Sent for approval." / 「已送审,进入审批。」),
with the zh-CN sentence under the same _actions key the existing
successMessage translations use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017nzWFRUo2U7evMkPdVniAn
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对 — ACCEPT · head ce953fa · 2026-10-27T09:46Z

check reading
shape draft → main, Fixes #158; mergeable clean against the current main
CI on the head both Validate check-runs success on ce953fa = PR head.sha
scope 3 files (+29): transition(…) now requires a successMessage, and terminate_contract gets its own; en and zh-CN strings are under _actions.<name>.successMessage, the existing key. This is within the claim's surface. Nothing governed; lint shows only main's one warning
the defect measured on 18.2.0, before and after, each press made by its own persona in zh-CN. Before: all seven toasts read 「操作已成功完成」. After: 合同已提交。· 草稿已撤回,合同已作废。· 已受理,进入法务审查。· 已送审,进入审批。· 已进入签署。· 合同已生效。· 合同已终止。 In en: 'Contract terminated.' and 'Accepted into legal review.'
wording the three examples in the card are used verbatim. No {{ record.contract_number }}: the template was measured to work, but the toast sits under the contract's own header. Accepted
observation to prepare 发起签署, the records manager could not add the clean version to an approved contract (403, master edit). Legal owns the clean version (§06), so this is as designed. Noted, no card

Landing: under the maintainer's merge authorization (project thread: 「你可以自己审核的就自己合并」).


Generated by Claude Code

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.

Send for Approval, Start Signing and Activate confirm with the generic 「操作已成功完成」 instead of saying what happened

2 participants