Repository navigation
A review saved with decision Approved leaves 结论时间 (decided_at) empty — the deviation stamps it, the review does not - #163
Merged
Conversation
A review saved as approved, changes requested or rejected kept an empty decided_at, while a decided deviation and a completed signing round are stamped by their hooks. review_decision_stamp fills decided_at on insert and update when the decision changes to a non-pending value, unless one is set; it never overwrites or clears a value, so a typed time is kept and a return to pending leaves the field alone. decided_at gets a description and its en / zh-CN help. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017nzWFRUo2U7evMkPdVniAn
Contributor
Author
席位核对 — ACCEPT · head
|
| check | reading |
|---|---|
| shape | draft → main, Fixes #159; mergeable clean |
| CI on the head | both Validate check-runs success on 4041dd1 = PR head.sha |
| scope | 4 files (+41): the review_decision_stamp hook in contract.hook.ts, the decided_at description in review.object.ts, and its en / zh-CN help (the i18n gate asked). This is within the claim's surface. Nothing governed; lint has only main's one existing warning |
| the defect | measured on 18.2.0 as Legal Counsel 1 in the browser and over the API, before and after. Before: 结论 = 通过 saved with decided_at null. After: it is stamped. A typed time is kept, a pending review stays empty, and a comments-only PATCH leaves it unchanged |
| code | follows the deviation stamp (deviation_state_machine): it fills an empty value and never overwrites or clears one. It stamps only on a real change of decision away from pending |
| seat call — back to pending | A, as shipped: the stamp stays. This matches the deviation, needs no §03 change, and the field stays editable on the form. No card |
| observation | the hook spells out the empty check inline; the file's isSet helper (used by the deviation stamp) says the same. Not a defect, no change asked |
Landing: under the maintainer's merge authorization (project thread: 「你可以自己审核的就自己合并」).
Generated by Claude Code
zhuangjianguo
marked this pull request as ready for review
October 27, 2026 09:11
This was referenced Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #159
Clause-②: no
Metadata-protocol: none
A review saved with a decision kept 结论时间 (
decided_at) empty. A decided deviation is stamped bydeviation_state_machineand a completed signing round bysignature_state_machine; the review had no stamp at all. This adds one, in the same file and the same pattern.What changed
src/objects/contract.hook.ts: new hookreview_decision_stamponclm_review,beforeInsert+beforeUpdate, priority 200. When a write gives the review a decision (approved, changes requested or rejected) that differs from the one it had, and nodecided_atis present (in this write or already on the row), it stampsdecided_atwith the current time. It never overwrites and never clears a value. File header lists the hook.src/objects/review.object.ts:decided_atgets a description: "Stamped when the review is given a decision, unless set explicitly." (the deviation's wording).src/translations/en|zh-CN/objects.lifecycle.ts: the matchinghelp(zh-CN: 给出结论时自动写入,除非显式指定。). The i18n gate asked for the zh-CN key (objects.clm_review.fields.decided_at.help, measured red before it was added); the en line keeps the en bundle in step with the deviation's.No
decided_by:clm_reviewhas no such field and DESIGN.md §03 lists onlystarted_at · decided_aton the review. Therevieweris who decides. No field was added.Back to
pendingThe decision may go back to
pending(§03 gives the review's decision no transition table, unlike the deviation's open → final machine), and the hook leavesdecided_atas it is. This matches the deviation's stamp, which only fills an empty value and never erases one. Clearing would also erase a time the lawyer typed, because the hook cannot tell a stamped value from a typed one. The field stays editable on the same form, so a lawyer can clear or correct it. The trade-off: a review decided again after going back to pending keeps its first time (measured, step I below). Refusing the back-edge or clearing on it would be a product decision. It is raised in the report and not made here.One step beyond the card's wording ("leaves pending"): a change between two decisions (for example approved → rejected) on a row that has no
decided_atis stamped too. Those are exactly the rows this defect produced before the fix. Re-deciding one gives it a time instead of leaving it empty (step K).Measurement: @objectstack 18.2.0,
pnpm demo:zh --port 3144, fresh DB before and afterPersona created the README way, as the dev admin:
POST /api/v1/auth/admin/create-userLegal Counsel 1→ 200 (mustChangePassword: true),POST /api/v1/data/sys_user_position{ position: clm_legal_counsel }→ 201, then as the personaPOST /api/v1/auth/change-password→ 200.security/explain(clm_review, create) → allowed, permission setsclm_legal, clm_requester, member_default. Every reading below was taken signed in as Legal Counsel 1, in Chromium (/opt/pw-browsers/chromium, locale zh-CN).Browser, before (origin/main 21f2319). Contract DPA-2026-0005 (数据处理协议 — 渡鸦安保) › 审查与偏离 › 审查 › 新建. Steps: 审查人 = Legal Counsel 1, 结论 = 通过, 创建.
POST /api/v1/data/clm_review → 201, and the row then reads{"decision":"approved","decided_at":null}. The record page shows 结论 通过 and no 结论时间. The contract's review grid has no 结论时间 column at all, because every row's value is empty.Browser, after (4041dd1). Same contract, same steps, on a fresh DB.
{"decision":"approved","decided_at":"2026-10-27T09:04:05.678Z"}(created_at 09:04:05.667Z). The record page reads结论时间 2026/10/27 上午9:04, and the contract's grid now shows the 结论时间 column with2026/10/27 上午9:04on that row.2026/10/01 09:30→decided_at: "2026-10-01T09:30:00.000Z".{"decision":"pending","decided_at":null}.PATCH → 200, thendecided_at: "2026-10-27T09:05:42.961Z"and the page reads结论时间 2026/10/27 上午9:05.{"decision":"pending","decided_at":"2026-10-27T09:05:42.961Z"}: the stamp is left in place.API path (REST, as Legal Counsel 1), before → after
Seed untouched: as the dev admin, 67 reviews in the table (60 seeded + 7 written above). Exactly 4 carry a
decided_aton or after 2026-10-27, all four written above, so no seeded review was restamped. 0 decided reviews have an emptydecided_at. Both boots end with the same seed summary (inserted 830 · errored 404, the README's documented unnamed-persona references), before and after.Gates (final head 4041dd1)
Before the translation was added:
lint:i18n-gateEXIT=1 ([zh-CN] objects.clm_review.fields.decided_at.help), and lint showed a second warning for the same key. Both cleared.Acceptance notes
🤖 Generated with Claude Code
https://claude.ai/code/session_017nzWFRUo2U7evMkPdVniAn