Skip to content

fix(plugin-approvals): approval notifications reach their recipient with their text, sent as body, the field messaging reads - #21888

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-21847-approval-notification-body
Oct 5, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-21847-approval-notification-body

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #21847
Clause-②: no

What changes

Every notification the approvals service sends reached its recipient as a title over an empty body. That covers a comment, a request-info question, a send-back note, a reassignment, a reminder, an escalation, an SLA breach and an out-of-office substitution. The service put the text in payload.message. The messaging service builds the delivered notification from payload.title and payload.body only: the inline fan-out and the outbox snapshot in messaging-service.ts, and processRow in dispatcher.ts. So GET /api/v1/notifications answered body: "", and the inbox row's body_md was empty.

  • packages/plugins/plugin-approvals/src/approval-service.ts: the twelve notify() call sites send their text as body. The texts are byte-identical: each removed message: line equals its added body: line once the key is stripped, indentation included (12 of 12). Who is notified, and when, is unchanged.
  • notify() now declares its payload as a local, non-exported type ApprovalNotificationPayload (title, body, actionUrl, and a reminder's actions). It used to take a free-form string-keyed record. A call site that spells the text any other way is now a compile error (Leg B below). No package entry gains an export.
  • No edit to service-messaging or packages/spec, and no message alias anywhere. There is one field, as EmitInput documents, per the triage direction on the card.
  • .changeset/21847-approval-notification-body.md: a patch for @objectstack/plugin-approvals.

Measured before the change (origin/main e864db5)

  • H1 holds. All twelve call sites put the text in payload.message (approval-service.ts :3076 :3087 :4209 :4252 :4512 :4571 :4594 :4788 :4835 :5880 :5898 :5911). Messaging reads only payload.body (messaging-service.ts :1101 and :1221, dispatcher.ts :341). The red reading is under Tests.
  • H2. No call site bypasses notify(): the only messaging.emit in the package is the helper's own. The helper forwards the payload each call site builds, so the one fix inside the helper is the declared payload type. The renames happen at the call sites.
  • H3. Nothing reads payload.message from an approval notification.
    • This repo: git grep for payload.message, payload?.message and {{ message }} answered 5 hits. None reads a notification: an SMS transport's HTTP error, CLI and runtime test fixtures, and a PM script.
    • objectui at the .objectui-sha pin 0abd4f9f: 7 hits, all HTTP error-response readers. For example, apps/console/src/services/approvalsApi.ts:200 reads a failed request's JSON. Control term /notifications answered 58 lines at the same tree.
    • One possible reader stays unmeasured. template-renderer.ts spreads the payload into the template context, so a tenant-authored sys_notification_template row for an approval.* topic could have written {{ message }}. This repo seeds no such row. The changeset names the {{ body }} spelling.
  • H4. The texts name the object and record, and for an out-of-office substitution the two user ids. Every recipient is already a party to the request. The texts are unchanged.
  • No content/docs/** sentence is made false. The notification passages in content/docs/automation/approvals.mdx describe topics and deep links, not the field.

Tests

Both pins read plugin-approvals source. The unit file imports ./approval-service.js. The dogfood isolated project aliases @objectstack/plugin-approvals to src/index.ts. Leg A proves this: dist/ held the fix while the door pin went red.

  • plugin-approvals/src/approval-notification-body.integration.test.ts (new) drives the real ApprovalService on ObjectQL over SqlDriver (in-memory better-sqlite3). It pins three things:
    • the battery reaches every call site that can notify anyone (11 of 12);
    • a comment, a request-info question and a send-back note are their recipient's body;
    • every payload carries a non-empty body and no field outside the declared type.
  • packages/qa/dogfood/test/approval-notification-body.dogfood.test.ts (new) boots an app with real approvals, messaging and REST, and an email-authored user approver. A submitter's comment and an approver's request-info question are read back from each recipient's GET /api/v1/notifications. Each is the one row of its topic and has a title, so the old defect reads as a body that lost its text, not as a missing notification.

Red, at 68baad4 (the tests only, unfixed service):

  • unit: Tests 2 failed | 1 passed (3). The comment read expected [ [ 'u_alice' ], undefined ]. There were 22 offenders, body is undefined plus undeclared payload field 'message', at each of the 11 reached sites. The coverage pin was green.
  • door: AssertionError: the comment is the notification's body: expected '' to be 'The signed contract is attached to th…'. The row count of 1 and the non-empty title both held.

Green, at 7ca65ce:

  • pnpm --filter @objectstack/plugin-approvals typecheck: exit 0. The test layer held 8 files, 324 errors and 27 pinned signatures, and the new file is clean.
  • pnpm --filter @objectstack/plugin-approvals exec vitest run --maxWorkers=2: Test Files 61 passed (61), Tests 898 passed (898).
  • pnpm --filter @objectstack/dogfood exec vitest run --maxWorkers=2 --project isolated test/approval-notification-body.dogfood.test.ts: Tests 1 passed (1).
  • pnpm --filter @objectstack/dogfood typecheck: exit 0.
  • Build: pnpm turbo run build --filter='@objectstack/dogfood^...' --filter='@objectstack/plugin-approvals^...' --concurrency=1 ran 63 of 63 tasks, 48 cached. plugin-approvals was rebuilt at 7ca65ce.

Ablation, at 7ca65ce (scripts/ablation-replace.mjs, wrap mode, plus a trap restore)

  • Leg A: message put back in the helper. The anchor severity: 'info', ...event, payload, audience, went from 1 hit to 0. It was replaced by a call that sends { ...rest, message: body }, and the replacement went from 0 hits to 1. The blob moved from 9a1822845a2f to d066658afd62.
    • unit: exit 1, 2 failed (comment body undefined; 22 offenders).
    • door: exit 1, expected '' to be 'The signed contract…'.
    • Restore: blob 9a1822845a2f equals HEAD, and git diff HEAD is empty. The trap's restore leg repeated that proof at exit.
  • Leg B: one call site spells the text message. At the request-info site, body: input.comment.trim(), became message: input.comment.trim(),. tsc --noEmit exited 1 with src/approval-service.ts(4810,11): error TS2353: Object literal may only specify known properties, and 'message' does not exist in type 'ApprovalNotificationPayload'. Restore: blob equals HEAD.

Gates, at 7ca65ce

  • node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack (no paths) derived 70 commands, and all 70 ran.
    • On the first pass, 69 exited 0. pnpm check:dual-build-cjs-loads exited 3 (PREREQUISITE NOT MET: 8 packages had no dist/).
    • Those 8 were built (41 of 41 tasks cached) and the gate re-ran with exit 0: 106 entry points across 66 packages load.
  • --ran verdict: 70 derived, 70 run, 0 NOT-MEASURED, 0 UNRUN.
  • Narrowed lint: pnpm exec eslint --no-inline-config --format json on the three touched .ts files. The JSON reports 3 files linted, with 0 errors and 0 warnings.
    • Population: eslint.config.mjs's packages/**/*.{ts,…} blocks match all three, and none is ignored.
    • Invariance: the config never enables type-aware linting (no parserOptions.project), so this diff cannot change the verdict on any untouched file.
    • The full pnpm lint, the full dogfood suite and the full turbo test are CI's.

Acceptance notes

  • The reminder to a slot literal never reaches messaging. That is the remind fan-out's branch for position:P-style pending entries. Its audience holds only slot literals, and notify() drops every audience entry containing a colon, so it returns 0 before emitting. Its payload is renamed with the rest and held by the compiler, and the producer battery covers the other eleven call sites.
    • Not filed: this run did not measure it at a public door.
    • Whether a position holder should receive that nudge is a different question from this card.

Generated by Claude Code

claude added 2 commits October 5, 2026 14:09
…nd at the inbox door

Two new pins, committed ahead of the fix so their red reading is taken on
the unfixed service:

- plugin-approvals: every call site that notifies, driven through the real
  ApprovalService on ObjectQL over SqlDriver; a comment, a request-info
  question and a send-back note are their recipient's body, and every
  payload carries a non-empty body and no undeclared field.
- dogfood: a comment and a request-info question read back from the
  recipient's GET /api/v1/notifications on a booted app with the real
  approvals + messaging chain.

Claude-Session: https://claude.ai/code/session_011K3zqE8Pv1Evw5hc8tZCnN
Co-authored-by: Claude <noreply@anthropic.com>
…y, the field messaging reads

Every notification the approvals service sent put its text in
payload.message. The messaging service builds the delivered notification
from payload.title and payload.body only (the inline fan-out, the outbox
snapshot and the dispatcher alike), so GET /api/v1/notifications served
each one as a title over an empty body.

- The twelve call sites now send the text as body. The texts themselves
  are byte-identical; who is notified, and when, is unchanged.
- notify() declares its payload (title, body, actionUrl, and a
  reminder's actions), so a call site that spells the text any other way
  does not compile.
- No alias in service-messaging: one field, as EmitInput documents.

Claude-Session: https://claude.ai/code/session_011K3zqE8Pv1Evw5hc8tZCnN
Co-authored-by: Claude <noreply@anthropic.com>
@os-steve os-steve self-assigned this Oct 5, 2026
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tests tooling labels Oct 5, 2026
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-approvals, touching 10 documentable anchor(s).

8 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/client-sdk.mdx (via approvals.getRequest (sdk, the route ledger binds it to GET /api/v1/approvals/requests/:id, selected by route anchor /approvals/requests/:id), getRequest (sdk, the bare tail of client method approvals.getRequest, bound to GET /api/v1/approvals/requests/:id))
  • content/docs/api/plugin-endpoints.mdx (via /approvals/requests/:id (route, bridged from symbol requestInfo — its route source's handler names it; bridged from symbol sendBack — its route source's handler names it))
  • content/docs/automation/approvals.mdx (via getRequest (sdk, the bare tail of client method approvals.getRequest, bound to GET /api/v1/approvals/requests/:id), /approvals/requests/:id (route, bridged from symbol requestInfo — its route source's handler names it; bridged from symbol sendBack — its route source's handler names it))
  • content/docs/automation/flows.mdx (via /approvals/requests/:id (route, bridged from symbol requestInfo — its route source's handler names it; bridged from symbol sendBack — its route source's handler names it))
  • content/docs/deployment/validating-metadata.mdx (via actionUrl (symbol, a field of type ApprovalNotificationPayload))
  • content/docs/kernel/services-checklist.mdx (via /approvals/requests/:id (route, bridged from symbol requestInfo — its route source's handler names it; bridged from symbol sendBack — its route source's handler names it))
  • content/docs/permissions/system-context.mdx (via requestInfo (symbol, a method of class ApprovalService), sendBack (symbol, a method of class ApprovalService))
  • content/docs/protocol/kernel/i18n-standard.mdx (via actionUrl (symbol, a field of type ApprovalNotificationPayload))

⛔ 2 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v16.mdx (via actionUrl (symbol, a field of type ApprovalNotificationPayload), getRequest (sdk, the bare tail of client method approvals.getRequest, bound to GET /api/v1/approvals/requests/:id))
  • content/docs/releases/v17/17-0.mdx (via actionUrl (symbol, a field of type ApprovalNotificationPayload), getRequest (sdk, the bare tail of client method approvals.getRequest, bound to GET /api/v1/approvals/requests/:id))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 7 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 54 of 206 client-bound route-ledger rows — the other 152 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 152: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 97 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 6 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json e864db56dffc2dec3290e5f0700f9d1606a1c830 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from e6e00a4b5a0ed7bf3007405e0b77d7d2f671ed95 — the merge of head 7ca65ce74c1c49489492d687ad96f603257b502d into base e864db56dffc2dec3290e5f0700f9d1606a1c830, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin e6e00a4b5a0ed7bf3007405e0b77d7d2f671ed95 && git checkout e6e00a4b5a0ed7bf3007405e0b77d7d2f671ed95
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e864db56dffc2dec3290e5f0700f9d1606a1c830 7ca65ce74c1c49489492d687ad96f603257b502d && git checkout -B drift-repro e864db56dffc2dec3290e5f0700f9d1606a1c830 && git merge --no-ff 7ca65ce74c1c49489492d687ad96f603257b502d

node scripts/docs-audit/affected-docs.mjs --json e864db56dffc2dec3290e5f0700f9d1606a1c830

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs e864db56dffc2dec3290e5f0700f9d1606a1c830 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 5, 2026 15:41
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 5, 2026 15:41
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 5, 2026
Merged via the queue into main with commit 255a777 Oct 5, 2026
37 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-21847-approval-notification-body branch October 5, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tests tooling

Projects

None yet

2 participants