Repository navigation
Commit 44fe210
fix(plugin-approvals): name the record by object label and id in every approval notification body (#24064)
Fixes #23978
Clause-②: no
## What changed
Every approval notification body that names its record now names it
through `nameSubjectRecord`. The record is named by the object's label
and the record id (`Deal D_123`), or by the object's API name and the id
when the schema declares no label. No body carries a title, from any
source. This is the form ruling B of #23556 / #23594 set, and the one
`approval.requested` already sent. The rest of each sentence is
unchanged.
`packages/plugins/plugin-approvals/src/approval-service.ts`, line
numbers at this head. Each method names the record once and every body
in that method uses that name:
- `sendBack`, `subject` at `:4752`: `approval.returned` revision-limit
auto-reject (`Your Deal D_1 exceeded the revision limit …`), and the
send-back with no note (`Your Deal D_1 needs rework …`).
- `reassign`, inline at `:5118`: `approval.reassigned` (`You are now an
approver on Deal D_1.`).
- `remind`, `subject` at `:5164`: both `approval.reminder` bodies, the
one with action links and the one to slot literals.
- `escalateRequest`, `subject` at `:6508`: `approval.escalated`, plus
`approval.sla_breached` to the approvers and to the submitter.
Rendered before / after, for a `crm_deal` labelled `Deal`: `A decision
on crm_deal/D_1 is overdue.` became `A decision on Deal D_1 is overdue.`
### Two sites beyond the claim's eight (a declared widening, its own
commit `a42511d0ac`)
`approval.ooo_substituted` (`:3624`) and `approval.ooo_skipped`
(`:3636`) in `openNodeRequest` built
`${input.object}/${input.recordId}`. That renders the same slash form
under a different variable spelling, so the claim's search for the
`raw.object_name` spelling missed it. The battery's new slash sweep
found both bodies. I fixed them in place because all four bounded
in-place conditions hold:
1. They have the same defect class as this card.
2. The fix is mechanical, and the same method already calls the same
helper at `:3691`.
3. No other claim holds the file (the claim records no open PR touching
it).
4. They use the same test battery, so there is no new verification
surface.
To drop the widening, revert `a42511d0ac`. The battery's sweep then goes
red on those two bodies, which is the defect itself.
### Not changed (claim exclusions)
- The `DUPLICATE_REQUEST` refusal text at `:4903`.
- `nameSubjectRecord` and `objectLabelOf`.
- `sys-approval-request.object.ts`.
- Anything in `packages/spec`.
## Premise check (`origin/main` `5c2ac83a23`)
All eight claimed sites built `${raw.object_name}/${raw.record_id}` into
a notification `body`. Each `raw` is a `sys_approval_request` row, read
by `loadPendingRow` (`sendBack`, `reassign`, `remind`) or by the
`runEscalations` scan (`escalateRequest`). When the request opens, its
`object_name` and `record_id` are written from `input.object` and
`input.recordId` (`:3556-3557`), so they are the subject record.
`nameSubjectRecord` answers the label and the id, or the object name and
the id when there is no label. All eight are the same family.
## Pin
`approval-notification-body.integration.test.ts` is the battery that
already drives every notifying call site. It runs the real
`ApprovalService` over a real `ObjectQL` on `SqlDriver` (better-sqlite3,
in memory), with the messaging surface recording what reaches it. This
PR adds two requests to it:
- `rework`: a send-back with no note.
- `bare`: a reminder about a `crm_memo` record, an object whose schema
has no label (the control).
It also adds one test. The test asserts the record's name in each body
(not the sentence around it): the reminder, both SLA-breach bodies, the
escalation, the hand-off, both send-back sentences and both
out-of-office sentences. For the control it asserts `crm_memo D_bare`.
It also sweeps every body the battery sent for the slash form.
- **Red against the unfixed source** (test-only commit `a941d0711d`):
seven of the claimed sites received `crm_deal/D_…`, including the
reminder (`A decision on crm_deal/D_thread is still waiting on you.`)
and the SLA breach (`A decision on crm_deal/D_sla_notify is overdue.`).
The four existing tests stayed green with the two added requests.
- **Green** at `a42511d0ac`: the battery passes 5/5, and the package
passes 81 files / 1104 tests (`vitest run --maxWorkers=2`). `pnpm
--filter @objectstack/plugin-approvals typecheck` exits 0, and
`check:test-typecheck` holds the ledger unchanged (8 files / 324
errors).
- **Ablation** (`scripts/ablation-replace.mjs`, WRAP mode): I put the
SLA-breach body back to the slash form. The anchor went from 1 hit to 0
and the blob changed from `c01b0f0749dd` to `46ea05a5b390`. The run went
red with exactly one offender: `approval.sla_breached@sla_notify: A
decision on crm_deal/D_sla_notify is overdue.` The restore was proven:
the blob is `c01b0f0749dd`, equal to HEAD, and `git diff HEAD` is empty.
The test imports the subject relatively from `src/`, so the ablation has
no `dist/` leg.
- The slot-literal reminder body (`:5201`) never reaches messaging,
because `notify()` drops every slot-address audience. The battery's
docblock already records this, and the compiler holds its shape.
## Gates (head `54a1f98fe6`, after merging `origin/main` `905f57bc74`)
- I ran all 67 commands from `node scripts/pm/dispatch-gates.mjs
--commands --repo objectstack-ai/objectstack` and recorded each exit
before any pipe. 65 exited 0.
- 2 exited 3 (`PREREQUISITE NOT MET`), so they are NOT MEASURED. This is
a declared narrowing; CI's `Lint & Repo Gates` runs both on a full
build.
- `pnpm check:dual-build-cjs-loads` needs every package's `dist/` (37
absent), which means a whole-workspace build.
- `pnpm check:i18n` needs the CLI's build closure plus ten packages.
This diff changes no translatable source: no object or field label,
nothing under `translations/`.
- `dispatch-gates --ran`: 67 derived, 65 run, 2 NOT-MEASURED (derived
from the recorded exit 3), 0 UNRUN. It exits 0.
- Changeset level axis, measured offline: `node
scripts/check-changeset-no-major.mjs --base 5c2ac83 --event` with
this body's first two lines exits 0 (`patch` under `Clause-②: no`).
## Acceptance notes
- **Persons named by raw user id (not fixed here, reported to the
seat).** The two out-of-office bodies name the people by raw user id,
for example `You are covering an approval on Deal D_ooo while u_ooo is
out of office.` and `… was routed to u_bob …`. This is a person-naming
defect, not record naming, so it stays outside this card's family.
- **Stale docblocks.** The `objectLabelOf` and `nameSubjectRecord`
docblocks still describe the helper as shared by the
`approval.requested` body only. The claim excluded both from this edit,
so they are left as they stand.
---
_Generated by [Claude
Code](https://claude.ai/code/session_018VqJPGA1NDNSCZsnecsChP)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent c7168ac commit 44fe210
3 files changed
Lines changed: 97 additions & 15 deletions
File tree
- .changeset
- packages/plugins/plugin-approvals/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
40 | 52 | | |
41 | 53 | | |
42 | 54 | | |
| |||
102 | 114 | | |
103 | 115 | | |
104 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
105 | 125 | | |
106 | 126 | | |
107 | 127 | | |
| |||
142 | 162 | | |
143 | 163 | | |
144 | 164 | | |
145 | | - | |
146 | | - | |
| 165 | + | |
| 166 | + | |
147 | 167 | | |
148 | | - | |
| 168 | + | |
149 | 169 | | |
150 | 170 | | |
151 | 171 | | |
| |||
167 | 187 | | |
168 | 188 | | |
169 | 189 | | |
170 | | - | |
| 190 | + | |
171 | 191 | | |
172 | 192 | | |
173 | 193 | | |
| |||
202 | 222 | | |
203 | 223 | | |
204 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
205 | 232 | | |
206 | 233 | | |
207 | 234 | | |
| |||
235 | 262 | | |
236 | 263 | | |
237 | 264 | | |
| 265 | + | |
| 266 | + | |
238 | 267 | | |
239 | 268 | | |
240 | 269 | | |
241 | 270 | | |
| 271 | + | |
242 | 272 | | |
243 | 273 | | |
| 274 | + | |
244 | 275 | | |
245 | 276 | | |
246 | 277 | | |
| |||
263 | 294 | | |
264 | 295 | | |
265 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
266 | 330 | | |
267 | 331 | | |
268 | 332 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3603 | 3603 | | |
3604 | 3604 | | |
3605 | 3605 | | |
3606 | | - | |
| 3606 | + | |
| 3607 | + | |
3607 | 3608 | | |
3608 | 3609 | | |
3609 | 3610 | | |
| |||
3620 | 3621 | | |
3621 | 3622 | | |
3622 | 3623 | | |
3623 | | - | |
| 3624 | + | |
3624 | 3625 | | |
3625 | 3626 | | |
3626 | 3627 | | |
| |||
3632 | 3633 | | |
3633 | 3634 | | |
3634 | 3635 | | |
3635 | | - | |
| 3636 | + | |
3636 | 3637 | | |
3637 | 3638 | | |
3638 | 3639 | | |
| |||
4747 | 4748 | | |
4748 | 4749 | | |
4749 | 4750 | | |
| 4751 | + | |
| 4752 | + | |
4750 | 4753 | | |
4751 | 4754 | | |
4752 | 4755 | | |
| |||
4806 | 4809 | | |
4807 | 4810 | | |
4808 | 4811 | | |
4809 | | - | |
| 4812 | + | |
4810 | 4813 | | |
4811 | 4814 | | |
4812 | 4815 | | |
| |||
4850 | 4853 | | |
4851 | 4854 | | |
4852 | 4855 | | |
4853 | | - | |
| 4856 | + | |
4854 | 4857 | | |
4855 | 4858 | | |
4856 | 4859 | | |
| |||
5112 | 5115 | | |
5113 | 5116 | | |
5114 | 5117 | | |
5115 | | - | |
| 5118 | + | |
5116 | 5119 | | |
5117 | 5120 | | |
5118 | 5121 | | |
| |||
5157 | 5160 | | |
5158 | 5161 | | |
5159 | 5162 | | |
| 5163 | + | |
| 5164 | + | |
5160 | 5165 | | |
5161 | 5166 | | |
5162 | 5167 | | |
| |||
5172 | 5177 | | |
5173 | 5178 | | |
5174 | 5179 | | |
5175 | | - | |
| 5180 | + | |
5176 | 5181 | | |
5177 | 5182 | | |
5178 | 5183 | | |
| |||
5196 | 5201 | | |
5197 | 5202 | | |
5198 | 5203 | | |
5199 | | - | |
| 5204 | + | |
5200 | 5205 | | |
5201 | 5206 | | |
5202 | 5207 | | |
| |||
6499 | 6504 | | |
6500 | 6505 | | |
6501 | 6506 | | |
| 6507 | + | |
| 6508 | + | |
6502 | 6509 | | |
6503 | 6510 | | |
6504 | 6511 | | |
| |||
6539 | 6546 | | |
6540 | 6547 | | |
6541 | 6548 | | |
6542 | | - | |
| 6549 | + | |
6543 | 6550 | | |
6544 | 6551 | | |
6545 | 6552 | | |
| |||
6558 | 6565 | | |
6559 | 6566 | | |
6560 | 6567 | | |
6561 | | - | |
| 6568 | + | |
6562 | 6569 | | |
6563 | 6570 | | |
6564 | 6571 | | |
| |||
6572 | 6579 | | |
6573 | 6580 | | |
6574 | 6581 | | |
6575 | | - | |
| 6582 | + | |
6576 | 6583 | | |
6577 | 6584 | | |
6578 | 6585 | | |
| |||
0 commit comments