Skip to content

feat(messaging): Slack DM delivery — slack channel, per-person link store, approval requests by DM (Part of #34730) - #35789

Merged
os-zhuang merged 20 commits into
mainfrom
claude/area-a4W-34730-s2
Nov 20, 2026
Merged

os-zhuang merged 20 commits into
mainfrom
claude/area-a4W-34730-s2

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread

Part of #34730

Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: none — skills/objectstack-automation states channels as RAW with default inbox and lists no channel values (its evals use inbox / email only), so no skill sentence becomes false; slack delivers only where connector-slack is composed.

维护者速读

  • 用户能看到的变化:在接入了 Slack 连接器的部署上,组织管理员可以接入本组织自己的 Slack 应用,通知设置页和流程的通知节点多出 Slack 这个渠道;邮箱已验证的成员确认与自己的 Slack 账号关联后,审批请求会以 Slack 私信送达,私信里的链接与审批邮件指向同一页面;没有关联的人照旧只收站内信和邮件。
  • 为什么做:这是「Slack 私信通知」专题的第二步(服务端部分),让审批人不必盯着控制台铃铛或邮箱。
  • 出错会怎样:最坏是某位审批人收不到 Slack 私信,或令牌失效后该组织停发私信,站内信和邮件不受影响;没有接入 Slack 连接器的部署,通知设置页和流程可选的渠道都不变,只多出两张空表、几个回答「未接入 Slack」的接口,以及通知设置页里一个新的通知主题「Slack 关联被移除」(messaging.slack_link_removed,所有部署都会列出,但只有接入 Slack 的部署才会真的发出);整个改动可以直接撤回。
  • 要你做什么:无。

What changes

Server side of step 2 of #34730 (ADR-0013 addendum of 2026-11-19, ruling of record 7023437637, riders of 7024100939). One PR, as ordered; the settings page UI is step 3.

  • Binding store (service-messaging): two new engine-owned objects. sys_channel_account is one organization's Slack install, one row per organization (unique per organization on channel_id), with the bot token in bot_token, a secret field. sys_channel_user_link is a person's link to their own Slack user, proposed then confirmed; user_id cascades (as sys_user_device), account_id cascades, and the indexes allow one link per person per install and one person per Slack user per install. SlackLinkStore (slack-links.ts) does every read and write; each write is an engine write under a system context naming who acted, so the platform's write audit records each creation, confirmation and removal with its actor.
  • Proposal and confirm: a Slack link is proposed only for a verified email and names no one before it is confirmed. A proposal looks the person's own email up with Slack users.lookupByEmail only while sys_user.email_verified reads verified (isEmailVerifiedUserRow); an unverified email gets exactly the answer no match gets, and Slack is not asked. No match, a deleted or bot Slack user, or a Slack user already linked in the install proposes nothing. Before the person confirms, no answer names the Slack user: the person's own view of a proposal is { state: 'proposed' }, and the administrator's list shows it with slackUserId and slackUserName null. A confirmation holds only while the email is still verified and still the one the proposal was made for (the link keeps its SHA-256 digest, proposal_email_hash); otherwise 409 RESOURCE_CONFLICT, whose sentence is in all eleven locales and answered as the envelope's userMessage in the caller's language. Confirm applies only to the proposal that was checked: the write is conditioned on the link's id, its proposed state and that email digest (a predicate write, multi: true), and a write that changes no row answers the same 409. A new proposal replaces one made for another email. A proposal delivers nothing until the person confirms it.
  • Doors (slack-link-routes.ts, nine routes, all in the messaging route ledger, all with an empty closed query set):
    • the person, about themselves in their current organization: GET/DELETE /api/v1/messaging/me/slack-link, POST /api/v1/messaging/me/slack-link/proposal, POST /api/v1/messaging/me/slack-link/confirm;
    • an organization administrator: GET/PUT/DELETE /api/v1/messaging/slack/account (PUT takes only { token }, proven with Slack auth.test before anything is saved; a token for another workspace than the installed one is refused 409), GET /api/v1/messaging/slack/links, DELETE /api/v1/messaging/slack/links/:id.
  • The admin permission (rider 5): SLACK_ADMIN_CAPABILITY = 'setup.write', held in the caller's current organization (ExecutionContext.systemPermissions), the capability the in-app message door already asks of an organization administrator; not isPlatformAdmin.
  • Riders (ruling 7024100939): (1) every removal is an attributed engine delete, so the write audit records it; (2) an administrator's removal, one link or the whole install, emits messaging.slack_link_removed to the person on inbox and email, translated in all eleven locales (keyed text); one link is found by a pushed-down read on its id and the install, and the uninstall reads the install's links in pages, in id order, so every linked person is told; (3) a link goes with the person (cascade), when they are banned (sys_user update setting banned), and when their sys_member row in that organization is deleted or moved, through engine hooks registered by the plugin and unregistered on destroy; (4) an administrator's removal deletes the link, so the person can propose and confirm again at once.
  • slack channel (slack-channel.ts): registered only on a composition where connector-slack's slack client service resolves at kernel:ready (ConnectorSlackPlugin registers it at init), then mounted per lookup like email/sms/push. Without it the messaging service does not know slack, so the /automation save doors still refuse a notify node naming it (400) and the two preference doors do not list it, as on main. With it, slack is a new accepted value on a notify node, hence Metadata-protocol: added. isAvailable answers the organization (an active install, else transport_not_configured). It sends conversations.open then chat.postMessage with the title in bold, linked to the notification's deep link made absolute under OS_AUTH_URL (legacy BETTER_AUTH_URL), then OS_BASE_URL (the same chain the approval email's link defaults to), then the body; Slack's control characters are escaped and unfurling is off. Classification: a refused token (invalid_auth, token_revoked, token_expired, account_inactive, not_authed) is permanent and marks the install revoked; a person Slack cannot DM, or a link gone by send time, is invalid_recipient (suppressed, never dead); HTTP 429 or ratelimited is rate_limited (retried); anything else is retryable. The DM carries no text of its own, so it needs no catalog keys.
  • Per-recipient skip (channel.ts, messaging-service.ts): MessagingChannel gains an optional reachableRecipients. Fan-out asks each channel that has it once per emit, after the preference filter, and drops the recipients it cannot reach on that channel before any delivery row exists: no row, no send, no failure, no suppressed_channels entry. A throw keeps everyone (fail-open, warn). Preferences, digest and quiet hours run before it as for every channel.
  • connector-slack: ConnectorSlackPlugin registers a slack service, createSlackClientService(options), whose client(token) sends with a token the caller holds (each organization's own), over the plugin's transport options. service-messaging reaches it through the service registry because importing connector-slack would close a workspace cycle (measured: turbo Cyclic dependency detected, via connector-slack's devDependency on service-automation).
  • First consumer (plugin-approvals, one hunk at the emit site): approval.requested also asks for slack, and only while the composition mounts the channel, so a deployment without connector-slack does not log a refusal on every request. ApprovalMessagingSurface declares the optional getChannel it reads.
  • Hardening of token input and proposal audit (slack-link-routes.ts, slack-links.ts), pinned in slack-links.integration.test.ts.
  • Registries: PLATFORM_OBJECTS_BY_PACKAGE['service-messaging'] lists the two objects (the registry's own contract: "Each group is the exact set that package registers"), the organization ownership inventory gives each a row (fate attribution; a link's install carries its organization), the tenancy census is regenerated, the objects are provisioned at boot and in the manifest, messaging.slack_link_removed joins the platform topic list, and the route-envelope gate's module list declares slack-link-routes.ts conformant (every body through the shared sendOk / sendError / sendServerFault). Touching packages/spec makes this Tier H, so per the claim amendment's fold rule ADR-0013's addendum is edited here (below).

Step-2 choices (for the ADR follow-up)

ADR-0013's addendum records, in this PR (fold rule of the claim amendment), the admin permission, the token store and the proposal rule, the choices its addendum asks step 2 to name; the other choices below are recorded in this body only:

  • Admin permission: setup.write in the caller's current organization.
  • Proposal rule: a Slack link is proposed only for a verified email and names no one before it is confirmed; the confirmation checks again that the email is verified and unchanged, and applies only to the proposal that was checked.
  • Token at rest: sys_channel_account.bot_token, a secret field (ADR-0100), the channel sys_connector_credential uses (ADR-0143). The engine encrypts it on write through the host's ICryptoProvider, with scope object_secret_field, namespace sys_channel_account, key bot_token and the organization as tenantId in the context; the ciphertext is a sys_secret row and the column holds only its reference; every read path masks it; the write audit masks it; only resolveSecretField() dereferences it, server side, called by SlackLinkStore.slackFor alone. No route answers it. The object is engine-owned, apiEnabled: false with no API methods, and access: private. With no crypto provider the write is refused (fail-closed).
  • Multi-match: one Slack user is linked to at most one person per install; a second person whose email resolves to an already linked Slack user is proposed nothing. ADR-0013's "Risks & open questions, item 4" (two sys_users sharing one email) stays open; the cite in the addendum is corrected from "§8 risk 4".
  • Who is asked for slack: the producer (approvals) names the channel; fan-out is not changed to add channels.
  • Skip, not dead-letter: reachableRecipients, a per-recipient counterpart of isAvailable.
  • Deep link origin: the deployment's OS_AUTH_URL / OS_BASE_URL chain.

Scope out

Generated files (reviewers can skip)

  • The eleven-locale object bundles, written by node scripts/check-i18n-bundles.mjs --write --filter=service-messaging (the non-English labels then translated in place): packages/services/service-messaging/src/translations/ar.objects.generated.ts, de.objects.generated.ts, en.objects.generated.ts, es-ES.objects.generated.ts, fr.objects.generated.ts, ja-JP.objects.generated.ts, ko.objects.generated.ts, pt-BR.objects.generated.ts, ru.objects.generated.ts, zh-CN.objects.generated.ts, zh-Hant.objects.generated.ts.
  • Their fill records, by the same writer: packages/services/service-messaging/src/translations/de.source-hashes.generated.ts, pt-BR.source-hashes.generated.ts.
  • scripts/platform-object-tenancy-census.json (node scripts/platform-object-tenancy-census.mjs --write) and pnpm-lock.yaml (the approvals devDependency, +3).

Evals

This round (the review of 73b116f0fe) runs on head 938fa8f8c8: the round's commits, a merge of origin/main with no conflicts, and one test commit; origin/main had nothing newer at push time. The readings below this round's are from 73b116f0fe and earlier, as each one names.

This round, on 938fa8f: typecheck and full suites of service-messaging (78 files, 1054 tests), plugin-approvals (126 files, 1792 tests), connector-slack (3 files, 11 tests); runtime's touched files (21 tests)

Under the shared verify lock (VERDICT command-exit 0), after building the dependency closure of runtime, plugin-approvals and cli under it (VERDICT command-exit 0):

  • service-messaging: typecheck exit 0; vitest run Test Files 78 passed (78), Tests 1054 passed (1054).
  • plugin-approvals: typecheck exit 0; vitest run Test Files 126 passed (126), Tests 1792 passed (1792).
  • runtime: automation-notify-slack-composition.test.ts and automation-authoring-doors-durable.test.ts: Test Files 2 passed (2), Tests 21 passed (21). The rest of runtime's suite is CI's (Test Core); runtime's published surface is unchanged.
  • connector-slack: Test Files 3 passed (3), Tests 11 passed (11).
  • Derived gates on 938fa8f8c8: node scripts/pm/dispatch-gates.mjs --commands (137), every command run with its exit code captured before any pipe; --ran reconciliation: 137 derived, 135 run, 2 NOT MEASURED, 0 UNRUN. The two NOT MEASURED are check:dual-build-cjs-loads and check:i18n-coverage (exit 3, PREREQUISITE NOT MET: they read a full workspace build this box does not hold); CI runs both. check:i18n and check:i18n-walk-parity first answered exit 3 (the CLI not built) and are recorded from their rerun after building the CLI and the packages they extract under the lock: both exit 0, check-i18n-bundles: OK (10 package(s) — all bundles in sync). check:engine-double-contract exit 0 (OK — 1370 pinned; the six seams this round adds are in the pinned ledger, written with --write; no baseline entry added); check:platform-object-tenancy-census exit 0 (108 objects, 57 in reach); check:route-envelope exit 0. The changeset gates with this body as the pull_request event: check-changeset-no-major.mjs --base origin/main exit 0, its level axis reading Metadata-protocol: added and @objectstack/service-messaging: minor; its --self-test, check-adr-0087-registration, check-changeset-fixed and check-empty-changeset exit 0. overlap-check --branch=claude/area-a4W-34730-s2: VERDICT clean exit 0 (origin/main, chore: version packages #35129, fix(settings)!: offer the knowledge settings only where the knowledge service is mounted #34223).

New pins:

  • slack-channel-composition.test.ts (service-messaging, 2): a real MessagingServicePlugin without a slack service does not know or mount slack, and neither preference door lists it; with one, slack is known, mounted and listed by both.
  • automation-notify-slack-composition.test.ts (runtime, 2): over the same real plugin, a notify node naming slack is refused 400 VALIDATION_FAILED at POST /automation without connector-slack and nothing is saved (a node naming inbox and email saves), and saves with it.
  • slack-links.integration.test.ts (now 20): an administrator removes only a link to their own organization's install (404 otherwise); the uninstall tells every linked person across more than one page of links; rider 3's membership moved to another organization removes the link, audited as who moved it, and a membership write that keeps the organization removes nothing; a ban removes the person's links in every organization in one engine delete, with one audited afterDelete per removed link (measured over two installs: one delete call on sys_channel_user_link, two dispatches, each naming who banned); and the hardening of token input and proposal audit (3 cases).
service-messaging on 73b116f: typecheck + full suite (77 files, 1045 tests)

pnpm --filter @objectstack/service-messaging typecheck exit 0; vitest run Test Files 77 passed (77), Tests 1045 passed (1045). New: slack-links.integration.test.ts (13: the token encrypted in the stored row, never in an answer, opening only under its organization; proposal and confirm; refusals; riders 1 to 5; the proposal rule: an unverified email answered exactly as no match with no users.lookupByEmail call made, a match naming no Slack user or Slack id to the person or an administrator before confirmation, a confirmation refused 409 once the email changed or is no longer verified with the sentence in the caller's language, an unchanged verified email confirming, a proposal row changed between the check and the write answered 409 and left unconfirmed, and a new proposal replacing one made for another email), slack-channel.test.ts (10: send, the five error classes, the unlinked recipient, the deep link and origin chain), recipient-reach.test.ts (3), ledger conformance (now enumerates the Slack doors).

plugin-approvals on 73b116f: typecheck + full suite (126 files, 1792 tests), including the Slack DM end to end (its approver's email now verified)

typecheck (tsc, scripts tsconfig, check:test-typecheck OK at its recorded debt) exit 0; Test Files 126 passed (126), Tests 1792 passed (1792). approval-requested-slack-dm.integration.test.ts, real ObjectQL on SqlDriver, the real MessagingServicePlugin with its outbox and dispatcher, the real ApprovalsServicePlugin, connector-slack's real client stubbed at fetch: a confirmed link gets a slack delivery at success, conversations.open with the linked user, and a chat.postMessage whose link opens the same page as the approval email's (the same string, for the test's canonical origin); a muted slack and quiet hours send no DM; a proposed link and no link give email + inbox rows only; no connector-slack: no slack ask and no refusal logged.

connector-slack, spec, cli

On 73b116f0fe, after the merge: spec platform-object-names.test.ts 14/14 and cli organization-ownership-inventory.test.ts 26/26 (main's two working-calendar objects and this branch's two Slack objects both listed); check:platform-object-tenancy-census (self-test and check) green on the regenerated census, 108 objects, 57 in reach. On 99277cfb01: connector-slack typecheck exit 0, Test Files 3 passed (3), Tests 11 passed (11), the client service sending with the caller's token, not the plugin's static one; spec typecheck exit 0, platform-object-names.test.ts + scripts/platform-catalog.test.ts 34/34; cli typecheck exit 0, vitest run --project unit Test Files 433 passed (433), Tests 6176 passed (6176). The cli integration layer is left to CI.

Derived gates on 73b116f: 137 derived, 135 run green, 2 NOT MEASURED

node scripts/pm/dispatch-gates.mjs --commands on 73b116f0fe, every command run and recorded with its exit code; --ran reconciliation: 137 derived, 135 run, 2 NOT-MEASURED, 0 UNRUN. The two NOT MEASURED are check:dual-build-cjs-loads and check:i18n-coverage (exit 3, PREREQUISITE NOT MET: they read a full workspace build this box does not hold); CI runs both. check:platform-object-tenancy-census (self-test and check) green on the census regenerated after the merge: on 11ef4c3d74 CI's merge with origin/main had found the committed census stale beside main's two new working-calendar objects. check:route-envelope green since the Slack route module's declaration. check:type-check-debt re-measured under the lock: 0 raw errors above any recorded number. check:i18n and check:i18n-stale-fill green. overlap-check: clean against origin/main, #35129 and #34223. CI on 73b116f0fe: 62 success, 9 skipped, no failure.

Ablations (one per behaviour, each restored with `git diff HEAD` empty)
  1. The reach step removed in messaging-service.ts (const reached = targets): 4 red, recipient-reach 2 and the approvals end-to-end proposed / none cases, which received slack:u_approver:suppressed. Restored to the HEAD blob.
  2. The mounted-channel guard removed in approval-service.ts (always ask for slack), through scripts/ablation-replace.mjs under the lock (anchor 1 to 0, blob c0a7c038924b to 7098bc5123b7): the without connector-slack case red, receiving the warning channel 'slack' is not registered; refused 1 delivery row(s). Restored: blob equals HEAD (c0a7c038924b) and git diff HEAD empty. A first attempt never got the lock (exit 99, not measured) and was restored the same way.
  3. The verified-email check in SlackLinkStore (any email used): 2 red, the unverified-email case and the unverified half of the confirmation case.
  4. The person's pre-confirmation view (the full link answered): 3 red, the cases reading the person's proposal.
  5. The administrator's pre-confirmation view (the Slack user always named): 1 red, the no-one-named case.
  6. The confirmation re-check (always confirming): 1 red, the refused-confirmation case.
  7. The replacement of a proposal made for another email (the old one always answered): 1 red, the replacement case.
  8. The confirm write keyed on the id alone ({ where: { id } }, by-id): 1 red, the row-changed-before-the-write case.

Ablations 3 to 8 ran through scripts/ablation-replace.mjs under the lock against slack-links.integration.test.ts (12 tests; 13 for ablation 8), each mutation landing (anchor 1 to 0) and each restored with its blob equal to HEAD and git diff HEAD empty.

This round, on b6e7b432f7 (its slack-links, routes and plugin sources are byte-identical at dfa7308cb9), through scripts/ablation-replace.mjs outside the lock (the narrowing above), each mutation landing (anchor 1 to 0) and restored with its blob equal to HEAD and git diff HEAD empty:

  1. The plugin's slack registration made unconditional: slack-channel-composition.test.ts 1 failed | 1 passed, the without-a-slack-service case.
  2. The uninstall's paging cut to one page: 1 red of 19, the more-than-one-page case.
  3. The administrator's removal read by id alone, not by id and install: 1 red, the other-organization case.
  4. Hardening of token input and proposal audit: each of its three mutations turned its own pin red.
  5. Rider 3's moved-membership trigger short-circuited: 1 red, the moved case.

Verification

Read first, by risk:

  1. packages/services/service-messaging/src/slack-links.ts: propose and confirm (the proposal rule), install (the token proven, then written as a secret under the organization), slackFor (the one reader), removeLink (the notice), bindSlackLinkRemovalTriggers.
  2. packages/services/service-messaging/src/slack-link-routes.ts: door(), the gate order and the setup.write check; linkView / ownLinkView (nothing named before confirmation).
  3. packages/services/service-messaging/src/messaging-service.ts: dropUnreachable and where step 3c sits in emit.

Two-minute check: pnpm --filter @objectstack/plugin-approvals exec vitest run src/approval-requested-slack-dm.integration.test.ts shows 6 passed, the first case printing nothing and asserting the DM link equals the email's.

Acceptance notes

  • Size, measured against the merge base on 938fa8f8c8: 52 files, +3330 / -30, net 3300 (the order's soft size ~900, hard stop 2700). On 73b116f0fe it was 2866; this round's four commits added 434: the two composition test files 241, slack-links.integration.test.ts 107, source 56 (slack-links.ts 40, approvals 7, the plugin 6, the routes 3), and the engine-double ledger 30. It is past the stop and reported to the seat, not trimmed. What drives the total (additions on 938fa8f8c8): tests 1164; generated files and ledgers 718 (the 11 *.objects.generated.ts translation bundles, 638 of it, plus the route ledger, census, inventory and engine-double ledger); provider and link code about 1410, mostly slack-links.ts 561, slack-link-routes.ts 222, slack-channel.ts 172 and the two new objects 124; docs and changeset 36. The seat accepted the size with no split, since the PR is Tier H and a maintainer reads it anyway.
  • File surface beyond the claim's: packages/spec (registry constant and its test), packages/cli (one inventory row per object), scripts/platform-object-tenancy-census.json (regenerated), scripts/check-route-envelope.mjs (one module declared), docs/adr/0013 (fold rule), plugin-approvals package.json / vitest.config.ts (connector-slack as a devDependency, aliased to source) and the lockfile.
  • Without ConnectorSlackPlugin composed, the slack channel is not mounted and approvals do not ask for it. With it composed and an organization with no install, isAvailable records transport_not_configured on that event, as for email without a transport.
  • The PUT token and every Slack answer are never logged; refusals name Slack's error code only.

Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2

🤖 Generated with Claude Code

…R-0013, changeset

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
…gate

Every body slack-link-routes.ts answers goes through the shared sendOk /
sendError / sendServerFault pair, so the module is declared conformant at
zero hand-built bodies, as its three messaging siblings are.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
@github-actions github-actions Bot added size/xl dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation protocol:system tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 5 package(s): @objectstack/cli, @objectstack/connector-slack, @objectstack/plugin-approvals, @objectstack/service-messaging, @objectstack/spec, touching 193 documentable anchor(s). ⚠️ 3 changed file(s) yielded no anchor (packages/plugins/plugin-approvals/vitest.config.ts, packages/services/service-messaging/src/index.ts, packages/services/service-messaging/src/objects/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

117 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 2ad42b5d056322b179fbf7decb68731831e3b4f2.

⛔ 22 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/plugins/plugin-approvals/vitest.config.ts, packages/services/service-messaging/src/index.ts, packages/services/service-messaging/src/objects/index.ts) — pages documenting those are invisible to this run
  • 2 cross-cutting symbol(s) contributed no route anchor: userId (5 routes), isSystem (5 routes)
  • 3 anchor(s) matched too much of the corpus to be a work list: PERMISSION_DENIED (literal, 55 pages), organization_id (literal, 41 pages), sys_user (literal, 56 pages)
  • 28 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 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 — 185 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 2ad42b5d056322b179fbf7decb68731831e3b4f2 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 4119acc30162dc12dcc876fdface88a8d182b62f — the merge of head 938fa8f8c8509655ef8fc84855b2866b1821850b into base 2ad42b5d056322b179fbf7decb68731831e3b4f2, 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 4119acc30162dc12dcc876fdface88a8d182b62f && git checkout 4119acc30162dc12dcc876fdface88a8d182b62f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 2ad42b5d056322b179fbf7decb68731831e3b4f2 938fa8f8c8509655ef8fc84855b2866b1821850b && git checkout -B drift-repro 2ad42b5d056322b179fbf7decb68731831e3b4f2 && git merge --no-ff 938fa8f8c8509655ef8fc84855b2866b1821850b

node scripts/docs-audit/affected-docs.mjs --json 2ad42b5d056322b179fbf7decb68731831e3b4f2

⚠️ 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 2ad42b5d056322b179fbf7decb68731831e3b4f2 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…ng no one before it is confirmed

- A proposal looks a Slack user up only while the person's sys_user email
  is verified; an unverified email is answered as no match.
- Before the person confirms, no answer names the Slack user (no name, no
  Slack id); the person's view says only that a match was found.
- A confirmation holds only while the email is still verified and still
  the one the proposal was made for (a digest kept on the link); otherwise
  409 RESOURCE_CONFLICT, its sentence in all eleven locales. A new
  proposal replaces one made for another email.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
…the changeset

A Slack link is proposed only for a verified email and names no one
before it is confirmed.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
…al that was checked

The confirm write is conditioned on the link's id, its proposed state and
the digest of the email it was proposed for; a write that matches no row
answers the same 409 RESOURCE_CONFLICT as an outdated proposal.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
…erged tree

The merge with origin/main took the census without a text merge; the
generator, run on the merged tree, adds main's two working-calendar
objects beside this branch's two Slack link objects (108 registered, 57
in reach).

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4czsTwiYB5WxgWqEVcu

L1 verdict (L1-a): ACCEPT at head 73b116f0fec4a8fa30f89a465d50a86c4c44f0f1 (Part of #34730, step 2: Slack DM delivery, server side).

Gates on this head: l1-face --pr 35789 CLEAN (13 items, none flagged): open, draft, base main, first line Part of #34730, no closing keyword, changeset covers all five published packages touched, Clause-②: yes (widening) / Metadata-protocol: none. Check-runs at 73b116f: 64 success, 11 expected skip, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check both success. Mergeable: clean. Dogfood battery not owed (no !, no narrowing arm).

What I checked (holds):

  • Net change and merge. Reviewed git diff dc0fc3586^2 73b116f0: 49 files, +2896/-30. dc0fc3586^2 is 7878cf055 and is on origin/main. git show --remerge-diff dc0fc3586 shows no hand resolution. Its only output is the repo's merge-driver note that the census is not text-merged. The merge kept the branch's census blob (e77b1df9). 73b116f touches only scripts/platform-object-tenancy-census.json (+16/-2: main's two sys_work_calendar* rows and new totals 108/57).
  • Census is generated only. I ran node scripts/platform-object-tenancy-census.mjs --write on the head. git status stayed empty. check-platform-object-tenancy-census.mjs passes: "108 platform-namespace objects, 57 in the machinery's reach".
  • The five riders of 7024100939:
    1. Audit on every removal. Every delete goes through the engine with userId set. The paths are removeLink (slack-links.ts:421-422) and removeAllOf (:347-355). sys_channel_* is not in plugin-audit's SKIP_OBJECTS. Pinned by "(1)(2)(4)…" and "(1) the person's own removal and the uninstall…": afterDelete is attributed to u_admin / u_ada.
    2. The person is told. An admin removal emits messaging.slack_link_removed on ['inbox','email'] with keyed text (slack-links.ts:423-442). Strings exist in all 11 locales (messages.ts). Pinned by "(1)(2)(4)…": one notice; a self-removal sends none.
    3. Cascade, ban, leaving. user_id and account_id are declared deleteBehavior: 'cascade' (channel-user-link.object.ts:98-100). Hooks on sys_member afterDelete and afterUpdate (org moved) and on sys_user afterUpdate banned: true (slack-links.ts:502-514). They are unbound on destroy. Pinned by "(3)…": member delete, ban and user delete each remove the link.
    4. Re-link after admin removal. The row is deleted, not tombstoned. Pinned by "(1)(2)(4)…": connect('ada') confirms again.
    5. Named permission. SLACK_ADMIN_CAPABILITY = 'setup.write', checked on context.systemPermissions (slack-link-routes.ts:66, :153). This is the same capability as the in-app message door (in-app-message-routes.ts:132). Pinned by "(5)…": all five admin doors answer ['PERMISSION_DENIED', 403].
  • Link rule matches the stated rule.
    • propose asks Slack only when isEmailVerifiedUserRow holds (slack-links.ts:265-275). Otherwise it answers undefined, the same answer as no match.
    • Before confirm, the person's view is { state } only (ownLinkView, routes:211-213). The admin list nulls slackUserId and slackUserName (linkView, :198-208).
    • confirm re-checks the verified email digest against proposal_email_hash (:314-316). It then writes with where: { id, state: 'proposed', proposal_email_hash }, multi: true and answers 409 when 0 rows change (:319-322).
    • Pinned by four "proposal rule" cases, including a row changed between the check and the write.
  • Token handling. bot_token is Field.secret. The object is apiEnabled: false, has no API methods and is access: private. accountView returns only id, workspace, workspaceId and status (routes:193-195), and no door returns anything else from the account. The only dereference is resolveSecretField in slackFor (slack-links.ts:379-388). The logger and sendServerFault calls name ids and Slack error codes, not the token. The test checks that PUT and GET bodies and the raw driver row do not contain the token, and that resolveSecretField under org_b throws.
  • Per-recipient skip. dropUnreachable runs after the preference filter and before any row is written (messaging-service.ts:1481-1489, 1635-1665). A probe that throws keeps every recipient. The Slack channel answers store.confirmedUsers (slack-channel.ts:71-73), which reads only state: 'confirmed' links on an active install.
  • Approvals. approval.requested adds slack only when messaging.getChannel('slack') resolves (approval-service.ts:2498-2505).
  • Origin chain. deploymentOrigin reads OS_AUTH_URL, then BETTER_AUTH_URL, then OS_BASE_URL. That is the same order as plugin-approvals public-base-url.ts:36-40.
  • ADR-0013 text vs code. The "Step 2 chose" paragraph matches the code: setup.write in the current org, a secret field with org tenantId, resolveSecretField only, data API closed, verified email only, no name before confirm. The item-4 cite fix is correct: "Risks & open questions" item 4 (line 711) is the two-sys_users-one-email case, and the taken check (slack-links.ts:283-284) enforces "one Slack user to at most one person per install".
  • Changeset, sentence by sentence (.changeset/34730-slack-dm-delivery.md). Every published package touched is listed at patch. That is right for Metadata-protocol: none under AGENTS.md:1026-1028.
    • Each sentence holds against the diff: install / auth.test before save; token kept as a secret, masked, never returned, server-only; GET/DELETE install; proposal and confirm doors; "proposed only for a verified email and names no one"; GET/DELETE own link; admin list and remove, the person told, may link again; deleted / banned / leaves; every write names who acted; channel registered while ConnectorSlackPlugin is composed; conversations.open then chat.postMessage with the absolute deep link; preferences, digest and quiet hours; no row for the unlinked; a refused token marks the install revoked until reset; rate limit retried; reachableRecipients once per channel per emit after preferences; the registry and inventory rows.
    • One sentence is imprecise (note 1).
  • Tests assert ADR-0112 code and status. Each refusal pins [code, status]: 400 VALIDATION_ERROR, 403 PERMISSION_DENIED, 404 RESOURCE_NOT_FOUND and 409 RESOURCE_CONFLICT. The 409 also checks userMessage in en and fr. Every call runs envelopeViolations(body) → [].
  • Tests I ran on 73b116f (after pnpm turbo run build of the deps, exit 0):
    • service-messaging: slack-links.integration.test.ts 13/13, slack-channel.test.ts 10/10, recipient-reach.test.ts 3/3, messaging-route-ledger.conformance.test.ts 3/3.
    • plugin-approvals: approval-requested-slack-dm.integration.test.ts 6/6.
    • spec: platform-object-names.test.ts 14/14.
  • Positive controls (each restored with git checkout --, then git status empty):
    • The setup.write check disabled (if (false && admin …)): "(5) every administrator door demands setup.write…" went red, 1 failed / 12 passed.
    • The Slack reachableRecipients made to return every recipient: slack-channel.test.ts went red, 1 failed / 9 passed. In plugin-approvals, the "proposed link" and "none link" cases went red, 2 failed / 4 passed.
  • Dogfood and MCP. No MCP tool description moved. No send or write moved after a response. Grepping packages/qa/dogfood/test finds no case that reads suppressed_channels, delivery channels of approval.requested, or Slack.
  • Follow-ups exist and are open. connector-slack: make ConnectorSlackPlugin's static bot token optional, so a deployment that only uses per-organization Slack tokens (the Slack DM channel) composes the plugin without a placeholder #35791: make connector-slack's static token optional. messaging: Slack link proposals have no per-person cooldown — cache a no-match result per person and email, answer 429 while Slack is rate-limiting, and record no-match lookups #35809: proposal cooldown, cache and 429. messaging: a Slack link proposal that can no longer be confirmed still blocks the next holder of that email — drop or ignore stale proposals #35810: a stale proposal still blocks the next holder of that email.
  • Scope. Every file outside the claim is declared in the body: spec registry and test, cli inventory row, census, route-envelope list, ADR-0013, approvals devDependency, vitest alias and lockfile. The size is over the 2700 hard stop by 166 and is declared.
  • NOT MEASURED:
    • check-i18n-bundles locally: exit 3, the CLI is not built. CI's Lint · repo & tooling gates ran it green.
    • I did not regenerate the 11 object bundles. I took them as generated on the body's word plus that CI gate.
    • cli organization-ownership-inventory.test.ts and connector-slack tests: not run by me. CI Test Core is green.

Non-blocking notes:

  1. Changeset sentence (owed before landing, text only). "approval.requested now asks for slack beside inbox and e-mail" leaves out its condition. The code asks only while the slack channel is mounted (plugin-approvals: getChannel?.('slack') ? ['slack'] : []), that is, while ConnectorSlackPlugin is composed. Add "when the slack channel is registered" or the like. This is not a CHANGES round on its own: fold it into the seat's contract-read round, and L1 delta-reads that line only.
  2. Rider 3 coverage. The sys_member "moved to another organization" afterUpdate path (slack-links.ts:505-510) has no pin. Member delete, ban and user delete are pinned.
  3. The showcase now hits the new path. examples/app-showcase composes ConnectorSlackPlugin, so every approval.requested there now carries slack: transport_not_configured in suppressed_channels for an org with no install. The PR body says so. The Slack isAvailable also reads sys_channel_account once per emit, and reachableRecipients reads links once more. The resolveChannelAvailability docblock (messaging-service.ts:~1594, ~653) still says availability is "answered from in-memory composition state". That is no longer true for every channel, so the comment is now stale.
  4. Trigger removals without an actor. A trigger removal with no session user (removeAllOf(…, actor undefined)) is audited as the system. That is consistent with the audit writer's "absence stays absence" rule. The changeset's "every write names who acted" holds for human-initiated writes.

Landing: governed, Tier H (touches packages/spec platform object registry). Handed to the seat for its xhigh contract read before ready/enqueue. At landing, pm:dispatched stays on #34730 (Part of; steps 3+ remain).


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1PJ4isQ3eD7Fk1fnF

Served-tier: CONTRACT_REVIEW_TIER

Contract review — FAIL at 73b116f · 2026-11-20T11:00Z

Head-sha: 73b116f0fec4a8fa30f89a465d50a86c4c44f0f1
Local-runs: none
Scope: packages/spec/src/system/constants/platform-object-names.ts, docs/adr/0013-bidirectional-messaging.md + packages/services/service-messaging/src/objects/channel-account.object.ts, packages/services/service-messaging/src/objects/channel-user-link.object.ts, packages/services/service-messaging/src/slack-links.ts, packages/services/service-messaging/src/slack-link-routes.ts, packages/services/service-messaging/src/slack-channel.ts, packages/services/service-messaging/src/channel.ts, packages/services/service-messaging/src/messaging-service.ts, packages/services/service-messaging/src/messaging-service-plugin.ts, packages/services/service-messaging/src/messaging-route-ledger.ts, packages/services/service-messaging/src/preference-options.ts, packages/services/service-messaging/src/translations/messages.ts, packages/plugins/plugin-approvals/src/approval-service.ts, packages/connectors/connector-slack/src/slack-connector.ts, packages/connectors/connector-slack/src/connector-slack-plugin.ts, packages/cli/src/utils/organization-ownership-inventory.ts, scripts/platform-object-tenancy-census.json
Security-touching: yes

Read for this record: the diff against merge base 7878cf05 (49 files, +2896 / -30), card #34730 with rulings 7023437637, 7023586880, 7023709522, 7024100939 and the claim amendments 7031552468 / 7031576124, the three dev reports, the L1-a ACCEPT 7037456539, ADR-0013 on main, the code on main the diff cites (read, not reviewed), and the 75 check-runs on the head (64 success, 11 skipped, none failed). Nothing was built or run locally.

This is the newest head. The changeset fix for the approvals sentence (L1 note 1) is not on it. The PR is a draft with no auto-merge armed, so nothing is owed to disarm.

One must-fix, two should-fix, six nits. Everything else asked of this review holds.

Findings

F1 (must-fix): Metadata-protocol: none is wrong, and with it the level.

  • messaging-service-plugin.ts:641 registers the slack channel provider at kernel:ready on every composition. Only the mount waits for connector-slack. So getKnownChannels() (messaging-service.ts:722) lists slack everywhere.
  • The /automation write doors refuse a notify node only for a channel that list does not hold (refuseUnknownNotifyChannels, packages/runtime/src/domains/automation.ts:2383, on main). On main the list holds inbox, email, sms and push, so a notify node naming slack is refused 400. On this head it saves, on every deployment that runs the messaging service.
  • That accept set is a registered authoring surface: notify-channel-unknown-refused in packages/spec/src/migrations/entries/semantic/. The change that closed it (88282a7) declared Metadata-protocol: narrowed. Opening it by one value is the same surface in the other direction.
  • AGENTS.md, Post-Task step 3: a new accepted value is added, and a kind takes at least minor on a package the diff moves.
  • Fix: Metadata-protocol: added in the PR body and the changeset body; @objectstack/service-messaging at minor; one changeset sentence saying the doors now accept slack, and that it delivers only where connector-slack is composed, the organization installed Slack and the recipient confirmed a link.
  • For the spec lane to decide, not owed here: the registered entry's replacement text lists "inbox, email, sms, push".

S1 (should-fix): two existing doors answer differently on every deployment, and the body says they do not.

  • GET /api/v1/messaging/preference-options and GET /api/v1/messaging/me/preferences build their channel list from getKnownChannels() (preference-options.ts:166, my-preferences-routes.ts:119-123). Both now list slack: configured: false without connector-slack, configured: true wherever it is composed, including an organization with no install.
  • The shipped Notification Settings page draws one column per listed channel (NotificationSettingsPage.tsx:22-24). Every deployment gains a Slack column before step 3 gives anyone a way to connect.
  • Two sentences are wrong on this. The 速读 line 「没有接入 Slack 连接器的部署行为不变」. The changeset's "slack is registered beside inbox, email, sms and push while ... ConnectorSlackPlugin is composed": the provider is registered always and mounted while the service resolves.
  • Fix: declare both doors in the changeset, correct the two sentences, and pin slack as known and unmounted when no slack service is registered. No test in the diff reads getKnownChannels() for it.

S2 (should-fix): the administrator's removal filters in the application, over a capped read (Prime Directive 5).

  • removeByAdmin (slack-links.ts:335-341) loads every link of the install through links() and finds one id in memory. findOne on { id, account_id } pushes down.
  • links() reads at most 10,000 rows (:242) with no order and no signal. Past the cap: DELETE /slack/links/:id answers 404 for a link that exists, GET /slack/links answers a truncated list as if it were complete, and uninstall (:230-236) sends the notice to the first 10,000 people only; the rest lose their link by cascade with no notice (rider 2).
  • Fix the lookup here. The list's paging can go with step 3 if a card carries it.

Nits

  • N1. The PR body says the seven step-2 choices are recorded in ADR-0013. The ADR records the permission, the token and the proposal rule, and states the one-Slack-user-per-install behaviour in the open paragraph. Who is asked for slack, the per-recipient skip and the origin chain are in the body only. The addendum asks step 2 to name only the permission and the token store, so the ADR text is enough: correct the body sentence. Adding "the producer names the channel" to the ADR would answer the either/or its seam list still carries (ADR line 793).
  • N2. For the approver: "A Slack link is proposed only for a verified email and names no one before it is confirmed" is a choice the addendum did not hand to step 2, and it cites no ruling. It tightens point 2 and contradicts nothing ruled. The 速读 states it, and this PR's Tier H approval is what accepts it.
  • N3. The publicBaseUrl scope-out has no card. Where a host sets only that option and no OS_AUTH_URL / OS_BASE_URL, the e-mail carries an absolute link and the DM carries none, and nothing says so. Also, "byte-equal" holds for a canonical origin: deploymentOrigin normalises through URL, approvals concatenates the raw value, so a mixed-case host or a default port gives the same destination in different bytes.
  • N4. approval-service.ts:2503 reads getChannel through an inline cast, outside ApprovalMessagingSurface. Declare the optional member on that surface, so the dependency shows where approvals lists what it consumes.
  • N5. Rider 3's "moved to another organization" path (slack-links.ts:505-510) has no pin. removeAllOf (:347-356) reads ids and deletes them one by one where one predicate delete would run the same per-row hooks.
  • N6. auth.test proves the token, not its scopes: an app without users:read.email installs, and every proposal then answers 502. The changeset names no required scopes. The users.lookupByEmail argument in the query string of a JSON POST is pinned against a scripted Slack only.

① Derived judgments

Each new face against the addendum text on main:

  • Objects. sys_channel_account: one row per organization and channel (unique: 'organization' on channel_id), in the tenancy census with organization_id, token as Field.secret, engine-owned, apiEnabled: false, access: private. Matches point 1 and the token-at-rest sentence. sys_channel_user_link: proposed then confirmed, user_id with deleteBehavior: 'cascade' as sys_user_device (rider 3, verbatim), account_id cascade, one link per person and one person per Slack user per install. Matches point 2. The Draft sections 8 and 13 spell the user column sys_user_id; the object ships user_id. Not binding while they are Draft.
  • Routes. Nine, each with a server-only ledger row, enumerated by the conformance test, and the module is declared in check-route-envelope.mjs. The closed query set is empty and refused before the capability check. The gate order equals the in-app message door on main.
  • Permission. setup.write in the caller's current organization (rider 5), the value IN_APP_MESSAGE_CAPABILITY already holds. No new permission.
  • Channel interface. Optional reachableRecipients and RecipientReachQuery. dropUnreachable returns the same targets when no channel has the member, so channels on main behave as before. Matches the addendum's per-recipient skip that is not a dead-lettered delivery.
  • i18n. Eleven object bundles: each +58 lines, no deletions, key skeleton identical to en, leaves translated in place as the file header prescribes. The only byte copies of en (two in de, one in pt-BR) are exactly the three new fill records. Generated, not hand-shaped. Three catalog sentences in eleven locales.
  • Registries. Spec list sorted and its test updated; two CLI inventory rows; census +2.
  • Riders 1 to 5. Built and pinned by the rider cases. Rider 1 is pinned through a stand-in after-hook reading session.userId, which is what plugin-audit's writer reads; neither object is in its skip list.
  • ADR diff. +15 / -2, confined to the addendum's tail: one "Step 2 chose" paragraph and the rewritten open paragraph. The permission and the token are the two things the addendum says step 2 names. The cite fix matches N4 of 7024764224. The status line, points 1 to 3 and the riders are untouched. No ruled text moved.
  • Nothing narrowed for e-mail. Approvals adds slack only when getChannel('slack') resolves; otherwise the channel list is the one on main. Pinned by the "without connector-slack" case.

② Semver level

Wrong at this head: F1. All five published packages the diff touches are in the changeset, and Clause-②: yes (widening) stands. The two spec registry rows alone are none and patch (precedent: sys_unit, #35581); the protocol kind comes from the notify channel, not from the registry.

③ Boundary flags

④ Design judgment

  • platform-object-names.ts. The group stays "the exact set that package registers": MessagingServicePlugin lists and provisions both objects on every composition, with or without connector-slack. First consumers hold: the CLI inventory and the tenancy census each carry both rows.
  • ADR-0013. The paragraph agrees with the code line by line: setup.write in the current organization; a secret field sealed with scope object_secret_field under the organization as tenantId and read back only through resolveSecretField in slackFor; data API closed; verified email before any lookup; no Slack user named before confirmation. The first consumer is real: the approvals case sends the DM end to end through the real client.
  • Implementing files. They agree with the contract they implement, apart from F1, S1 and S2. The confirm write is conditioned on id, state and digest, and a write that changes no row answers 409. Each administrator door reads only its own organization's install. No answer carries the token, and the log lines the diff adds name ids and Slack error codes only.

Implemented-by: claude/area-a4W-34730-s2
Reviewed-by: session_016WV4d1PJ4isQ3eD7Fk1fnF

VERDICT: FAIL

…k is composed

MessagingServicePlugin registers the slack channel provider at kernel:ready
only when connector-slack's slack client service resolves. Without it the
messaging service does not know slack, so the /automation save doors still
refuse a notify node naming it and the two preference doors do not list it.
With it, a notify node may name slack: Metadata-protocol added, and
service-messaging moves to minor.

Pinned on both sides: the preference doors over a real MessagingServicePlugin
(service-messaging), and the /automation save door over the same plugin
(runtime).

ApprovalMessagingSurface declares the optional getChannel it reads.

The changeset names the doors that accept and list slack where connector-slack
is composed, the condition approval.requested asks for slack under, and the
Slack app scopes the calls need.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
… of token input and proposal audit

An administrator's removal of one link reads it by a pushed-down findOne on
its id and the install. The uninstall reads the install's links in pages, in
id order, until a page comes back short, so every linked person is told. A
person's links (rider 3) go in one predicate delete; the engine runs the
delete hooks once per row it removes, so each removal is audited as before.

Hardening of token input and proposal audit.

Pins: a removal by another organization's administrator, the uninstall over
more than one page, and rider 3's membership moved to another organization.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
… through the dispatch helpers

The fake engines behind the slack composition pins dispatch update, delete
and findOne through assertEngineUpdateDispatch, assertEngineDeleteDispatch
and assertEngineFindOnePredicate (@objectstack/metadata-core), so they refuse
what a real engine refuses. The pinned ledger records the six new seams
(check-engine-double-contract --write).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
… in one write, each audited

Rider 3's removal is one predicate delete; measured here over two installs:
one engine delete on sys_channel_user_link, two afterDelete dispatches, each
attributed to who banned the person. The token input cases use plain
malformed values.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1eW7iLBvc8c6xv9Fx

L1 delta verdict (L1-a): CHANGES at head 938fa8f8c8 (Part of #34730, step 2). This is a delta from my ACCEPT 7037456539 at 73b116f0. One item, and it is PR-body text only. Everything else in the round holds (below), so the next delta read covers the body line alone.

C1. The Skills-docs: line is owed and absent. This round moves the body and changeset to Metadata-protocol: added, which is right: slack is a new accepted value on a notify node where connector-slack is composed. A kind other than none owes the PR body a third declaration line (pm-dispatch SKILL.md, the Metadata-protocol: entry): Skills-docs: updated here | follow-up owed — FILES | follow-up #N | none — REASON. l1-face --pr 35789 flags it: "skills-docs owed (kind added) and absent — REWORK". This needs your call, not mine. As a pointer, git grep on this head finds no skill sentence that lists the notify channel values: the automation skill's evals use channels: ['inbox'] and nothing more. So none — <reason> or a follow-up #N both look available. Whichever you write must be true. A follow-up owed — FILES is rewritten to #N by the seat before ACCEPT.

What I checked in the delta (holds):

  • Commits. cba4fbfa, b6e7b432, merge ff91c86b, dfa7308c and 938fa8f8. git show --remerge-diff ff91c86b prints nothing, so it is a clean merge with no hand resolution.
  • F1 (seat FAIL 7037841566): slack is known only where connector-slack is composed. In MessagingServicePlugin, the kernel:ready hook now returns before registerChannelProvider('slack', …) unless getSlack() resolves. Without the provider, getKnownChannels does not name slack, so the /automation save doors and both preference doors answer as on main. Two composition tests pin both sides over a real MessagingServicePlugin: slack-channel-composition.test.ts (service-messaging) and automation-notify-slack-composition.test.ts (runtime, POST /automation refusing a notify naming slack with 400, and saving it with the service). Positive control: with the gate disabled (false && !getSlack()), each of the two files went red, 1 failed / 1 passed. Restored with git checkout --, the package rebuilt and git status empty.
  • My note 1 is closed. The changeset now reads "approval.requested also asks for slack, beside inbox and e-mail, only while the slack channel is registered and mounted (connector-slack composed)". That matches this.messaging.getChannel?.('slack') ? ['slack'] : [].
  • N4. ApprovalMessagingSurface declares getChannel?(id: string): unknown, and the cast at the call site is gone.
  • S2, removals by predicate.
    • removeByAdmin reads one row with findOne({ id, account_id }) instead of scanning the org's links.
    • Uninstall reads the install's links in id order with id > after pages of LINK_PAGE (500) until a page comes back short, then deletes the account.
    • removeAllOf is one delete({ where, multi: true }). The engine runs the delete hooks per row, and 938fa8f8 pins that a ban removes a person's links in every organization in one write, each audited.
  • My note 2 (rider 3, org move) is pinned in slack-links.integration.test.ts.
  • Changeset, the changed sentences.
    • The level moves to '@objectstack/service-messaging': minor with Metadata-protocol: added. The body records check-changeset-no-major reading that level axis green, and CI's lint gates are green.
    • The scopes sentence: chat:write, im:write, users:read, users:read.email. "auth.test does not check scopes, so an app without users:read.email installs and every proposal then answers 502" agrees with the proposal path.
    • The rewritten channel bullet ("only where connector-slack is composed … Without connector-slack, those doors answer as before: a notify node naming slack is refused 400, and neither preference door lists it") holds against the gate and its pins.
  • Tests I ran on 938fa8f (after pnpm turbo run build for the runtime, service-messaging and plugin-approvals closures, 41 tasks, exit 0):
    • service-messaging slack-links.integration + slack-channel-composition + slack-channel: 32/32.
    • runtime automation-notify-slack-composition: 2/2.
    • plugin-approvals approval-requested-slack-dm.integration: 6/6.
  • Gates. Check-runs at 938fa8f: 64 success, 11 expected skip, 0 failed, 0 pending.
  • One l1-face flag is not owed. The face flags @objectstack/runtime as touched with no changeset entry. The only runtime file in the net diff is src/domains/automation-notify-slack-composition.test.ts, and runtime ships files: ['dist', 'README.md', 'CHANGELOG.md']. A test file publishes nothing, so no entry is owed.

Left to others: the hardening part of b6e7b432 is not read here. Size: the net is +3330/-30, past the 2700 stop, and the body declares it with its make-up. That ruling is the seat's.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4czfXrDs6fBNTtekWrL

L1 delta verdict (L1-a): ACCEPT at head 938fa8f8c8509655ef8fc84855b2866b1821850b (Part of #34730, step 2). This closes C1 of my CHANGES 7040549280. The head is unchanged; the round is a PR-body edit only, so this read covers that edit alone. Everything else in 7040549280 holds as written there.

C1 closed: the Skills-docs: line is present and true.

  • The body's third declaration line, right under Metadata-protocol: added, reads: "Skills-docs: none — skills/objectstack-automation states channels as RAW with default inbox and lists no channel values (its evals use inbox / email only), so no skill sentence becomes false; slack delivers only where connector-slack is composed."
  • I checked it on this head with git grep over skills/:
    • skills/objectstack-automation/SKILL.md:136 says "RAW: … channels (default inbox)". Line 131 says "channels: 'email' alone" for the e-mail-field recipient form, and line 122's example writes "channels": ["inbox"]. None of the three lists the set of channel values, so adding slack makes none of them false.
    • Every channels hit under skills/*/evals/ is ['inbox'] or 'email' (flows-triggers-approvals.json lines 27, 105, 116, 248, 396).
    • The only slack hits under skills/ are in objectstack-automation/references/examples-flows.md:54-58. They are about a connector_action step on the slack connector, not a notify channel, and this PR does not change them.
    • No other skill sentence pairs inbox with e-mail as a closed list (git grep -iE "inbox.{0,20}(email|e-mail)|(email|e-mail).{0,20}inbox" over skills/ outside evals: no hits).
  • l1-face --pr 35789 now reads the item ok: "Skills-docs: none — … — its truth is the reviewer's". That truth is the read above.

Gates on this head. Lint & Repo Gates and TypeScript Type Check both success. Check-runs at 938fa8f: 67 success, 11 expected skip, 0 pending. l1-face counts one Check Changeset as cancelled: that is run 136312446056, cut off by the body edit and superseded by run 136313046329 of the same name on this head, which concluded success at 13:23Z. No other failure.

Not read here. The new Size bullet's breakdown (tests 1164, generated files and ledgers 718, provider/link code ~1410, docs 36) is the seat's ruling, and the area reports the seat has accepted it. The one l1-face changeset flag on @objectstack/runtime is still not owed, for the reason in 7040549280 (the only runtime file is a test, and runtime ships dist, README and CHANGELOG only).

Landing: governed (as in 7037456539), so it goes to the seat's contract delta read, then Tier H.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1PJ4isQ3eD7Fk1fnF

Served-tier: CONTRACT_REVIEW_TIER

Contract review — PASS at 938fa8f · 2026-11-20T13:35Z

Head-sha: 938fa8f8c8509655ef8fc84855b2866b1821850b
Local-runs: none
Scope: packages/spec/src/system/constants/platform-object-names.ts, docs/adr/0013-bidirectional-messaging.md + packages/services/service-messaging/src/objects/channel-account.object.ts, packages/services/service-messaging/src/objects/channel-user-link.object.ts, packages/services/service-messaging/src/slack-links.ts, packages/services/service-messaging/src/slack-link-routes.ts, packages/services/service-messaging/src/slack-channel.ts, packages/services/service-messaging/src/channel.ts, packages/services/service-messaging/src/messaging-service.ts, packages/services/service-messaging/src/messaging-service-plugin.ts, packages/services/service-messaging/src/messaging-route-ledger.ts, packages/services/service-messaging/src/preference-options.ts, packages/services/service-messaging/src/translations/messages.ts, packages/plugins/plugin-approvals/src/approval-service.ts, packages/connectors/connector-slack/src/slack-connector.ts, packages/connectors/connector-slack/src/connector-slack-plugin.ts, packages/cli/src/utils/organization-ownership-inventory.ts, scripts/platform-object-tenancy-census.json
Security-touching: yes

This is the delta read from my FAIL 7037841566 at 73b116f0. Files this round did not move keep the judgment of that record.

Read for this record: the diff between the two heads over the PR's 52 files (11 of them differ: four commits and one merge of main, pnpm-lock.yaml by the merge alone), the net diff against merge base e1143241 for the two hits files and the changeset, the PR body as it stands, L1-a's delta notes 7040549280 and 7040671508, cards #35844 and #35791, and the 83 check-runs on this head (67 success, 15 skipped, 1 cancelled: a Check Changeset run cut off by the body edit and followed by a green run of the same name). Nothing was built or run locally.

No must-fix and no should-fix. Five nits. The PR is a draft with no auto-merge armed.

Closure of 7037841566

F1: closed, by both arms.

  • The gate. messaging-service-plugin.ts:646 leaves the kernel:ready hook before registerChannelProvider('slack', …) unless connector-slack's slack service resolves. ConnectorSlackPlugin registers that service in init(), so its absence at kernel:ready is final for the boot (AGENTS.md, Startup registry reads, cure 1). Without it getKnownChannels() does not hold slack, and the /automation save doors refuse the node 400, as on main.
  • The declaration. On a connector-slack composition slack is a new accepted value on a notify node. Metadata-protocol: added is the right kind, the PR body and the changeset body both carry it, and @objectstack/service-messaging is at minor.
  • The condition sentence is in the changeset: "A notify node naming slack delivers only where connector-slack is composed, the organization installed Slack and the recipient confirmed a link."
  • Pins, both over a real MessagingServicePlugin: automation-notify-slack-composition.test.ts (400 and nothing saved without the service, with an inbox and email node saving as the control; saved with it) and slack-channel-composition.test.ts.
  • The registered entry notify-channel-unknown-refused needs no edit on this route. Its replacement reads "inbox, email, sms, push, or one a plugin installed here registers", and slack is known only where the connector-slack plugin is installed.

S1: closed.

  • Without connector-slack neither preference door lists slack. Pinned, with inbox as the control.
  • With it both list it, and the changeset names both doors by path.
  • The two sentences are corrected. The 速读 now ties the new channel to deployments that compose the connector. The changeset bullet reads "only on a composition where connector-slack's slack client service resolves at boot".
  • One residue, on the topic list: N2.

S2: closed, for what it asked here.

  • removeByAdmin (slack-links.ts:362) reads one row with findOne on { id, account_id }.
  • uninstall (:241) reads the install's links by keyset on id, ascending, 500 a page, until a page comes back short, then deletes the account. Every linked person is told. Pinned across more than one page.
  • removeAllOf (:377) is one predicate delete (multi: true). The engine runs the delete hooks per row. Pinned: one delete call, one audited afterDelete per link.
  • The deferred half is N1.

Changeset sentences. The approvals sentence (L1 note 1) is on this head: "only while the slack channel is registered and mounted (connector-slack composed)". That is what approval-service.ts:2510 does.

Nits of 7037841566.

Findings on this head

N1. The deferred half of S2 has no card number.

  • GET /api/v1/messaging/slack/links still answers at most 10,000 links, unordered and with no signal (slack-links.ts:265). No removal reads that list now.
  • The body defers its paging to step 3 in words. 7037841566 allowed that "if a card carries it".
  • Owed: the card number in the Scope-out line. A body edit.

N2. One topic joins both preference doors on every deployment.

  • PLATFORM_NOTIFICATION_TOPICS gains messaging.slack_link_removed on every composition (preference-options.ts:68). GET /api/v1/messaging/preference-options and GET /api/v1/messaging/me/preferences then list one more topic, also without connector-slack, where no install or link can be made.
  • This was on 73b116f0 too, and my FAIL did not list it.
  • No protocol kind: that list is a suggestion list by its own contract ("never a closed set"), and no door refuses by it.
  • Two sentences are off by that one topic: the 速读's "只多出两张空表和几个回答「未接入 Slack」的接口", and the changeset's "Without connector-slack, those doors answer as before". Prose only.

N3. For the approver, unchanged from N2 of 7037841566: the proposal rule is a choice the addendum did not hand to step 2. This PR's Tier H approval is what accepts it.

N4. ADR line 793 still carries the either/or on who requests slack. The body records "the producer names the channel". Optional.

N5. The users.lookupByEmail argument in the query string is pinned against a scripted Slack only. Accepted deviation.

① Derived judgments

  • No new contract face. The hits are the same two files, each byte-identical to 73b116f0. The net diff adds no path under .claude/, .github/, skills/ or content/docs/, does not touch AGENTS.md, and holds nothing under packages/spec/ beyond the registry constant and its test. No barrel and no package.json moved this round. The new members are optional: ApprovalMessagingSurface.getChannel? and SlackLinkStoreOptions.linkPageSize?.
  • The merge. ff91c86b is conflict-free: git show --remerge-diff prints nothing.
  • The save doors' completeness argument (packages/runtime/src/domains/automation.ts, read, not in the diff) still holds: the slack provider registers in the same kernel:ready phase as email, sms and push.
  • Hardening hunks of b6e7b432: security hardening reviewed by security#2 out of band.

② Semver level

Right at this head.

  • Declarations. Clause-②: yes (widening) and Metadata-protocol: added, line-initial, in the PR body and the changeset body, with the same values.
  • Levels. @objectstack/service-messaging minor. @objectstack/connector-slack, @objectstack/plugin-approvals, @objectstack/spec and @objectstack/cli patch. AGENTS.md Post-Task step 3 asks a kind for at least minor on a package the diff moves. service-messaging is the package whose source registers the channel. The other four carry no protocol change.
  • @objectstack/runtime has no entry and owes none: its one file in the diff is a test, and the package publishes dist.
  • ADR-0087. The changeset declares no breaking change, so no disposition marker is owed. No authorable-surface/ or authorable-defaults/ baseline moves. The registered entry needs no edit (F1 above).
  • The gate on this head. Check Changeset, job 136313046329, success. It prints "LEVEL AXIS: this PR declares clause-② yes (widening) and metadata-protocol added, and it grades a package whose published source […] it moves at minor or above" and "check-adr-0087-registration: this PR adds no declared-breaking changeset (1 non-breaking changeset(s) seen)".
  • Skills-docs: none — … is present and true. L1-a 7040671508 read skills/. I read the two prose sentences that list channels: content/docs/automation/flows.mdx:390-392 ("and a plugin can register more") and the registered entry. Both stay true.

③ Boundary flags

④ Design judgment

  • platform-object-names.ts. Unchanged since 73b116f0. MessagingServicePlugin still provisions both objects on every composition, with or without connector-slack, so the group stays "the exact set that package registers".
  • ADR-0013. Unchanged since 73b116f0. The "Step 2 chose" paragraph and the open paragraph agree with the code at this head. The seam "a slack MessagingChannel … beside the channels that register there today" holds with a conditional registration: the addendum does not say on which compositions it registers.
  • Implementing files. The gate and the three removals agree with the contract they implement. The first consumer still asks for slack only while the channel is mounted.

Implemented-by: claude/area-a4W-34730-s2
Reviewed-by: session_016WV4d1PJ4isQ3eD7Fk1fnF

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1PJ4isQ3eD7Fk1fnF

席位核对 — ACCEPT · repo:objectstack#4 · head 938fa8f8c8509655ef8fc84855b2866b1821850b

  • 速读:通知加 Slack 渠道第二步——装了 Slack 连接器的部署才注册 Slack 发送方,用户可绑定/解绑 Slack;新增通知主题「Slack 关联被移除」(各部署都可在偏好中看到,只有装了 Slack 的部署会发)。
  • 档:H(docs/adr/** 命中,另超 3000 行人合线 +3330/-30);L1 ACCEPT 7040671508(第 4 轮 delta,前序 7040549280);合约复审 PASS 7040887222(CONTRACT_REVIEW_TIER,F/S 无,前序 FAIL 7037841566 的 F1/S1/S2 均已闭合)。
  • Security-touching: yes —— 加固部分由 security#2 场外复核通过。
  • 席位意见:可合。
  1. 形态 — Part of notifications: a Slack messaging channel with per-person binding — the org installs a Slack app once, each person's notifications arrive as Slack DMs (ADR-0013 / ADR-0022 / ADR-0030) #34730 第 2 步;Metadata-protocol: added;changeset:service-messaging minor,connector-slack / plugin-approvals / spec / cli patch(Check Changeset 绿)。
  2. 前提实测 — slack 发送方只在 connector-slack 组装时注册;解绑按谓词读取,卸载分页。
  3. 门禁 — head 上 CI 67 success、0 failed;check-governed-merges:GOVERNED,Tier H(人合)。
  4. 接受的偏差 — 体量 +3330/-30 超 2700 指引:席位接受(Tier H 本就人审;第 4 轮再拆需两半全量重审),正文附体量说明。changeset 一句漏提新主题:正文已注明,由下一次提交或第 3 步 PR 补上,本 head 不动。
  5. 范围外去向 — 链接列表分页(上限 10,000)→ messaging: the administrator's Slack link list answers at most 10,000 links — page GET /api/v1/messaging/slack/links #35861(Blocked-by 本 PR);security#2 三项可选加固 → 后续卡。
  6. 落地条款 — pm:awaiting-merge + 请 GOVERNED_APPROVERS(os-zhuang / hotlong)复核;APPROVED 后由席位/本区经队列落地,或维护者亲合。head 若移动,本记录与合约复审皆失效重核。

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 20, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 20, 2026 22:27
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 8e46424 Nov 20, 2026
91 of 93 checks passed
@os-zhuang
os-zhuang deleted the claude/area-a4W-34730-s2 branch November 20, 2026 23:03
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
objectstack-ai#35928) (objectstack-ai#36316)

<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XTRdLmK9YYgMSCJ7NH2PuUY)_

repo:objectstack#7 · zhuangjianguo · session_01QsR2jVTYADzVWfarACx5j3

Fixes objectstack-ai#35928

Clause-②: yes (widening: one new public read, `POST
/api/v1/automation/_record-starts`, and the UI exports that read it)
Metadata-protocol: added
Skills-docs: none — no skill under `skills/**` teaches the console's
stage confirms; `content/docs/automation/flows.mdx` and
`content/docs/frontend/plugins/plugin-grid.mdx` document the read and
the list in this change.
Ruling-ref: 7073655354

## 维护者速读

-
用户在列表单元格或记录页改阶段时,确认框在原来那句话下面列出这次改动会启动的流程名称(按用户语言显示),带审批的流程标「发起审批」;以前只写「可能触发相关自动化」。
- 属于行内编辑专题,按维护者的裁定「能改这条记录的人都看到流程名称」,让用户确认前就知道保存后会发生什么。
- 出错时最多是清单少列或不显示,确认框退回今天那句话,保存本身不受影响;整个改动可以直接撤回。
- 无。

## What changes

**Server (one new read).**

- `@objectstack/spec/api`: `RecordUpdateStartsRequestSchema` (`{ object,
recordId, changes }`, strict), `RecordUpdateStartSchema` (`{ name,
label, startsApproval }`), `RecordUpdateStartsResponseSchema`, and the
contract entry `listRecordUpdateStarts` (`POST
/api/v1/automation/_record-starts`). `_record-starts` joins the
`/automation` domain's reserved position literals (underscore-led, so
the package-namespace install gate is not narrowed).
- `@objectstack/spec/contracts`: `RecordUpdateStartsInput` and the
optional `IAutomationService.listRecordUpdateStarts`.
- `@objectstack/spec/automation`: `recordChangeTriggerHookEvents` /
`recordChangeTriggerFiresOnUpdate`, the record-change token grammar
MOVED out of `@objectstack/trigger-record-change` (whose
`triggerTypeToHookEvents` now delegates to it), so the trigger and the
preview read one rule.
- `@objectstack/service-automation`:
`AutomationEngine.listRecordUpdateStarts` (`record-update-starts.ts`). A
flow is asked only when it is enabled and armed on a `record_change`
trigger for this object whose token binds an update; whether it starts
is `startConditionHolds`, the one start-condition gate every run attempt
passes, over the variables `seedRunVariables` seeds (`record`, its
flattened fields, `previous`). The approval mark is the presence of an
`APPROVAL_NODE_TYPE` node (ADR-0019). A condition that throws is not
listed. Hooks are never listed (ADR-0077 §2).
- `@objectstack/runtime`: the `/automation` domain's `_record-starts`
door, mounted in the dispatcher plugin and recorded in the route ledger.
Order: query parameters refused `400 VALIDATION_ERROR`; body parsed
through the request schema (`400 VALIDATION_FAILED`); `501` when the
engine has no preview; the record read AS THE CALLER through the `/data`
door's own `get` (`callData`), so an unreadable record answers `404
RECORD_NOT_FOUND` exactly like an absent one and the engine is never
asked; a read that answers no record is refused the same `404`; every
`changes` key must be a declared field of the object (else `400
VALIDATION_FAILED` on `changes.KEY`, the engine never asked); then the
engine is handed `previous` = the record read, `record` = that record
with `changes` applied, and the caller's `userId` / `tenantId`.
Anonymous `401`.
- `@objectstack/client`:
`client.automation.listRecordUpdateStarts(request)`.

**UI (two confirms, one reader).**

- `@object-ui/plugin-detail`: `stageChangeStarts.tsx` —
`useRecordUpdateStarts(ask)` (asks the route once per pending move
through the host's `apiFetch`, parses the answer through
`RecordUpdateStartsResponseSchema`, answers `[]` while in flight,
refused, failing, malformed or empty) and `StageChangeStarts` (the list
under the sentence: each flow by its label translated through
`activeFlowsBundle` + the spec's `translateFlow`, the flow runner's
reading; an approval flow marked). Exported for the grid.
- Record page: `recordPathStageChange.tsx` draws it in both
confirmations (the path's `AlertDialog` and the header stage menu's
`RequiredFieldsDialog`, via a new optional `notice` slot in
`@object-ui/fields`).
- List cell: `ObjectGrid`'s state-machine confirm draws it;
`StateChangeConfirm` gains an optional `ask` (the row's record id and
the move).
- `@object-ui/i18n`: `activeFlowsBundle` moves here from
`@object-ui/app-shell`'s module-internal `utils/flowsBundle` (its three
app-shell importers repointed), since the confirms' packages do not
depend on the console; two keys in all eleven packs:
`detail.stageChangeStartsHeading`, `detail.stageChangeStartsApproval`.
- The confirm's sentence is never replaced (not this card: objectstack-ai#35685 S3). A
move that starts nothing, and a failed read, leave the confirm exactly
as today.

Docs: `content/docs/automation/flows.mdx` (§ Which flows a record update
would start), `content/docs/frontend/plugins/plugin-grid.mdx` (the
confirm now names the flows). Changesets:
`35928-record-update-starts-read.md`,
`35928-stage-confirm-names-flows.md`, both carrying the Clause-② and
Metadata-protocol lines.

## Tests

- Engine `record-update-starts.test.ts` (8): condition holds / does not
hold; approval mark CONTROL (an approval flow and a plain flow side by
side); no condition; create / delete / other object / obsolete never
named while `record-before-write` is; an unevaluable condition not
named; an unarmed engine answers nothing; `current_user` evaluated as
the writer named.
- Door `automation-record-update-starts.test.ts` (13): a member is
answered (body parsed through the response schema) and the engine is
handed exactly the record read as the caller; empty list; unreadable
record `404 RECORD_NOT_FOUND` with the engine never asked; unreadable
and absent answer alike; anonymous `401` before any read; malformed body
`400 VALIDATION_FAILED`; query parameter `400 VALIDATION_ERROR`; `501`
without the preview; a GET of the literal is not this door.; a change
key that is not a field `400 VALIDATION_FAILED` on that key (an
undeclared key, a key off the field-name grammar, an inherited member
name), the engine never asked; a change on an object the registry does
not declare refused alike; a read that answers no record `404
RECORD_NOT_FOUND`, never previewed; and the ledger row names
`RecordUpdateStartsRequestSchema` / `RecordUpdateStartsResponseSchema`,
as the clone and publish-drafts suites pin theirs.
- Spec `automation-api.zod.test.ts`: contract count and the new entry's
method/path; request strictness; a leaked `condition` / `nodes` dropped
by the response parse. Each `changes` key is held to the field-name
grammar (refused: a dotted, an upper-case, a digit-initial, a spaced and
an empty key).
- List cell, in its confirm's harness
`ObjectGrid.autosave-35685.test.tsx` (new top-level describe, 3): list
(request body pinned, labels, approval mark under the unchanged
sentence), empty, failure (and Change still saves the move).
- Record page, in each confirm's harness (new top-level describe in
each, 3 + 3): `record-path.stageChange-28199.test.tsx` (the path's
confirmation) and `RecordStageMenu-35891.test.tsx` (the header stage
menu's dialog): list, empty, failure (a refused read, a network error
and a malformed envelope each draw no list).
- `stageChangeStarts-label-35928.test.tsx` (2): a flow named by its
translation where the app's `flows` bundle has one, by its authored
label where not; nothing drawn for no flows.
- Ablation (one-shot under the verify lock, restored by trap, `git diff
HEAD` on both sources empty): removing the `StageChangeStarts` render
from `ObjectGrid.tsx` and from both confirmations in
`recordPathStageChange.tsx` turns exactly the three `list:` pins red
(`Tests 3 failed | 6 passed`); empty and failure pins stay green, as
they should.

## Acceptance notes

- Card acceptance: "Changing a stage that starts a flow shows that flow
by name in both confirms" — pinned in both confirms (list cell, and both
record-page confirmations) and measured live (below); "a stage with
nothing attached shows no list" — the empty pins; "a read failure falls
back to the generic sentence" — the failure pins.
- Residual, stated in the contract docblocks and `flows.mdx`: the
preview binds the caller's user id and tenant only, not their positions,
request params or expand as a live run does, so for a condition reading
those the preview can differ from the save in either direction (it can
miss a flow, or list one a negated test of the writer would stop); the
seat files the follow-up for positions.
- Residual (not widened here): conditions are judged on the record as
the CALLER reads it (field-level security applied), so a condition that
reads a field the caller cannot see is judged on what they see, and one
that throws on a missing field is not listed. The preview can therefore
under-list for a caller with masked fields; it never reveals a masked
value. Documented in `flows.mdx`.
- Residual: the header stage menu's dialog asks with the stage alone;
values typed into that dialog for required fields are not part of the
preview's `changes`.
- Two existing confirm suites (`RecordStageMenu-35891`,
`record-path.stageChange-28199`) now stub `fetch` with a `501` answer in
`beforeEach`, so the new read does not leave for the network under test;
no existing assertion changed. Across the touched UI packages the run
shows 0 `ECONNREFUSED`.
- The approval mark is the ruling's test, "the flow contains an approval
node". Measured live, showcase's `showcase_project_closure` reaches its
sign-off approval through a `subflow` node (the approval node lives in
`showcase_closure_signoff`), so the preview lists it with
`startsApproval: false`. Following subflow references for the mark is a
reading beyond the ruling: filed objectstack-ai#36322.
- Overlap (`overlap-check.mjs` at the head below, exit 1, reported and
not merged around): objectstack-ai#36296 and objectstack-ai#36236 have landed and are merged in.
objectstack-ai#36335 (part of objectstack-ai#35979) moves `activeFlowsBundle` into `@object-ui/i18n`
too and conflicts in `ui/packages/i18n/src/flowsBundle.ts`,
`ui/packages/i18n/src/index.ts` and
`ui/packages/app-shell/src/views/metadata-admin/previews/flow-label-translations.tsx`;
it lands after this PR and drops its copy of the move. Every other open
PR that shares a file merges cleanly.
- Declaration correction: the claim and ruling 7073655354 read
`Metadata-protocol: none`, but the three new `@objectstack/spec/api`
schemas enter the `api` authorable-surface shard (10 keys), which `Check
Changeset` reads as `added` (`none-baseline-moved`). The line is `added`
and `@objectstack/spec` is graded `minor`, as objectstack-ai#32251, objectstack-ai#35789 and objectstack-ai#31883
were for new api request/response schemas. No flow or other metadata key
is added, so the ruling's "no new authorable key" still holds.

## Verification

- Read first: `packages/runtime/src/domains/automation.ts`
`respondToRecordUpdateStarts` (the order of refusals and the
caller-scoped read that admits the engine), then
`packages/services/service-automation/src/record-update-starts.ts`
(which flows are asked and the one gate they pass).
- Live, on a fresh showcase (`pnpm dev -- --fresh`), as a member created
by the admin (`role: user`, not an admin):
- `Website Relaunch` `status: active → completed`: `200
{"flows":[{"name":"showcase_project_closure","label":"Project Closure
with Sign-off (nested pause)","startsApproval":false}]}`
  - same record `→ on_hold` (CONTROL): `200 {"flows":[]}`
- same record `budget 150000 → 250000`: `200
{"flows":[{"name":"showcase_budget_approval","label":"Project Budget
Approval","startsApproval":true}]}`
- an absent record: `404 RECORD_NOT_FOUND`; anonymous: `401
UNAUTHENTICATED`; a body without `changes`: `400 VALIDATION_FAILED`
naming `changes`.
- Zone 2 premise, measured before any code: the same kind of member
reads `GET /api/v1/meta/flow` (200, 33 flows with labels, the admin's
set) and `GET /api/v1/meta/flow/showcase_closure_signoff` (200, its
nodes).
- The console itself was not driven in a browser (its dist is not built
in this container); both confirms are pinned through the real components
above.
- Local, all under `scripts/pm/os-verify-lock.sh` (shared box):
- touched UI packages (`plugin-detail`, `plugin-grid`, `fields`,
`i18n`): `Test Files 1131 passed | 2 skipped` · `Tests 13186 passed | 38
skipped`; after folding the pins into their harness files the three
files plus the label file: `Tests 77 passed (77)`.
- type-check: `tsc --noEmit` (src and test projects) for `i18n`,
`fields`, `plugin-detail`, `plugin-grid`, and src for `app-shell`;
`service-automation`, `runtime`, `client` exit 0.
- server: engine 8/8, door 9/9, `route-ledger.conformance` +
`automation-api-contract-mounts` + `http-dispatcher` green, client
conformance 11, spec `automation-api.zod` + `address-grammar` 87,
`trigger-record-change` 122.
- `dispatch-gates.mjs --commands` (129 families) run and reconciled with
`--ran`: `129 run, 0 NOT-MEASURED`. First pass reds were all this diff's
own owed artefacts, fixed and re-run green: spec `gen:api-surface` /
`gen:docs` / `gen:export-origins` / `gen:declaration-map` /
`gen:strictness-ledger` (api count 533 → 536: the three new schemas),
the route-ledger census sentence (149 → 150), and
`check:test-source-alias` (a spec/automation alias in the trigger
package's vitest config; the door test pays `@objectstack/metadata` at
collection).

- Re-verified after the hand-over (seat 7), main `b3bcfefc` merged in at
`472457d9`, the generated surfaces regenerated at `6bd111ff`
(`gen:schema` → spec build → `gen:api-surface` → `gen:export-origins` →
`gen:declaration-map` → `gen:docs` → `gen:strictness-ledger`;
`check-regen-pending` clear), the changeset correction at `99bfd857`.
Under the verify lock at `6bd111ff`:
- type-check exit 0: `@object-ui/i18n`, `fields`, `plugin-detail` (src
and test; the hand-over's stale-dist red is gone after the closure
build), `plugin-grid`, `app-shell`; `@objectstack/spec`, `runtime` (src
and test layer, after building `@objectstack/driver-turso`),
`service-automation`, `client`, `trigger-record-change`.
- tests: `runtime` Tests 11745 passed | 25 skipped; `service-automation`
4224 passed; `client` 820 passed; `trigger-record-change` 122 passed;
spec `automation-api.zod` + `address-grammar` 87 passed; `plugin-detail`
+ `plugin-grid` + `fields` + `i18n` Test Files 1135 passed | 2 skipped,
Tests 13300 passed | 38 skipped.
- `dispatch-gates.mjs --commands` (129 families): run at `99bfd857` (the
six that started before that commit re-run on it) and reconciled with
`--ran`: `129 derived, 128 run, 1 NOT-MEASURED, 0 UNRUN`. The one
NOT-MEASURED is `check:dual-build-cjs-loads` (exit 3, PREREQUISITE NOT
MET: it needs every package's dist, which this container does not
build); CI runs it in its Lint jobs, green at this head.
- CI at `99bfd857`: every check-run green or skipped by design. Check
Changeset shows two runs: the `synchronize` run (09:07Z, before the body
said `added`) red, the `edited` run (09:08Z) green.
- Contract review rework (L2 at `99bfd857`), at `3ba211dc` and
`d2279e6c` (head):
- the door refuses a change key that is not a declared field of the
object and a read that answers no record; the request schema holds each
change key to the field-name grammar; the ledger row is pinned; the
preview's caller binding is stated in the contract docblocks and
`flows.mdx`; `_record-starts` joins the address module's literal list.
- ablation, one-shot under the verify lock (`ablation-replace.mjs`,
restored by trap, blob == HEAD and `git diff HEAD` empty after each):
the declared-field refusal disabled → `Tests 2 failed | 11 passed` (the
two refusal pins); the no-record refusal disabled → `Tests 1 failed | 12
passed` (its pin).
- local: `runtime` Test Files 637 passed, Tests 11749 passed | 25
skipped; door suite 13/13 at the head; spec `automation-api.zod` +
`address-grammar` 88 passed; type-check exit 0 for `spec`, `runtime`
(src and test layer, at `d2279e6c`), `service-automation`, `client`,
`plugin-detail`.
- `dispatch-gates.mjs --commands` at `3ba211dc`: `129 derived, 129 run,
0 NOT-MEASURED, 0 UNRUN`; the 37 families that read test files re-run at
`d2279e6c` (a one-line test-type fix), all exit 0.
- CI at `d2279e6c`: 70 check-runs, 61 success and 9 skipped by design,
Check Changeset green.
- Delta round (L1-d 7078831268, L2 nit N3 from 7078841748), at
`41487226` (head): the 401 and 501 pins assert `body.error.code`
(`UNAUTHENTICATED`, `NOT_IMPLEMENTED`) beside the status; the spec
changeset names the undeclared-change-key `400 VALIDATION_FAILED` and
the no-record `404` among the door's refusals; the caller-binding limit
reads "can differ from the save in either direction" in the request
schema's docblock, `RecordUpdateStartsInput` and `flows.mdx`. Door suite
13/13; type-check exit 0 for `spec` and `runtime` (src and test layer);
`dispatch-gates.mjs --commands` at `41487226`: `129 derived, 129 run, 0
NOT-MEASURED, 0 UNRUN`; CI at `41487226`: 70 check-runs, 61 success and
9 skipped by design.

https://claude.ai/code/session_01FEkQ5keqTTiV8ptWFNc6ZF
https://claude.ai/code/session_01QsR2jVTYADzVWfarACx5j3

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- signed: repo:objectstack#7 · zhuangjianguo ·
session_01QsR2jVTYADzVWfarACx5j3 -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue protocol:system size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants