Skip to content

feat(app-shell): connect your Slack account on the notification settings page, and an admin Slack page in Setup (Part of #34730) - #35968

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/area-a4W-34730-s3
Nov 21, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/area-a4W-34730-s3

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread
Part of #34730
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:在接入了 Slack 连接器的部署上,成员在通知设置页可以关联或解除自己的 Slack 账号(先看到提议、再确认);组织管理员多了一个 Slack 管理页,可以接入或更换本组织的 Slack 令牌、移除接入、查看和移除成员的关联。没有接入 Slack 的部署界面不变。
  • 为什么做:这是「Slack 私信通知」专题的第三步(界面部分),让成员和管理员不用调接口就能完成上一步服务端已提供的关联与接入。
  • 出错会怎样:最坏是某人关联不上或管理页显示的提示不准,站内信和邮件不受影响;整个改动只在界面层,可以直接撤回。
  • 要你做什么:无。管理页在设置菜单里还没有入口(入口由服务端提供),需要一张服务端小卡补上,已在下方注明供席位立卡。

What changes

Step 3 of #34730 (ADR-0013 addendum of 2026-11-19): the console side of the Slack link doors that step 2 (#35789) put on main. UI and docs only; no server, spec or skills change. This PR was written in session session_016WV4czKnDE6hsyXQzB9wB2.

  • The doors, one client module (console/notification-settings/slackDoors.ts). All nine Slack link routes are called through the host's authenticated fetch (SchemaRendererContext.apiFetch), the way the notification settings page already reads its own door; @objectstack/client has no method for these routes (measured: no slack-link, slack/account or slack/links in packages/client on the base). Each answer is read as served and refused when it is not the door's shape. A refusal is the server's own sentence: error.userMessage when the door sends one (only slackLinkProposalOutdated today, already in the caller's language), else error.message.
  • Notification Settings: the person's Slack section (SlackLinkSection.tsx). Drawn only while the preference door lists the slack channel, which it does only where connector-slack is composed. States, each as the GET /me/slack-link door answers it:
    • no install (account: null): says so, offers nothing;
    • install revoked: says Slack refused the organization's token, offers no connect;
    • no link: Connect Slack calls POST …/proposal;
    • a proposal ({ state: 'proposed' }): says a Slack user with the person's verified email was found, never whom, with Confirm (POST …/confirm) and Cancel (DELETE /me/slack-link, which removes the proposal row);
    • a confirmed link: the Slack user it names, when, and Disconnect.
    • link: null from a proposal: the door answers this alike for no verified email, no Slack user with that email, and that Slack user already linked to someone else (step 2's own doc says so), so the page names all three conditions in one sentence and never picks one.
    • After every action, refused or not, the section reads the door again, so a 409 for a missing install, a 502 that marked the token revoked, or a 404 for a replaced proposal is followed by the state as stored. After a refused confirm, Ask for a new proposal is offered.
  • Setup's Slack page (views/setup/SlackSetupPage.tsx, component ref messaging:slack, so /apps/setup/component/messaging/slack). Gated by setup.write through usePermissions().hasCapabilities, the capability every administrator door asks (SLACK_ADMIN_CAPABILITY); without it the page says what is needed and reads no door. It installs or sets again the token (PUT /slack/account with { token }) through a password input that starts empty, is emptied as soon as the value is sent, and is never filled from anything (no door answers the token). Remove Slack asks first, saying every linked person is told by in-app message and email, then DELETE /slack/account. The link list shows each link as served: the person's id, the Slack user only once confirmed (a proposal reads "Proposed, not confirmed yet"), and when it was confirmed; Remove per link asks first, then DELETE /slack/links/:id. The list is read once, unpaged; when it holds the 10,000 links the store reads at most (limit: 10000 in SlackLinkStore.links), the page says the list may be incomplete. Paging is messaging: the administrator's Slack link list answers at most 10,000 links — page GET /api/v1/messaging/slack/links #35861 (server); this page does not page on its own.
  • i18n: two new sections, slackLink and slackSetup, in all eleven built-in packs; zh-Hant.ts is regenerated by pnpm --filter @object-ui/i18n gen:zh-hant from zh-Hans, not hand-written.
  • Docs: content/docs/permissions/administrator-guide.mdx gains "Deliver notifications by Slack direct message" (no existing page taught Slack DM setup).
  • Phone width: both surfaces stack their controls (flex-col under sm), and the link table scrolls inside its card.

Evals

Final head ddbc916340 (the branch merged with origin/main at 73e4b966f6; the incoming commits touch none of this PR's files).

Tests on ddbc916: notification settings, Setup views and the i18n package, 121 files / 2143 tests passed; ui scripts 172 files / 5111 passed
  • pnpm --dir ui exec vitest run --maxWorkers=2 packages/app-shell/src/console/notification-settings/ packages/app-shell/src/views/setup/ packages/i18n/ under the verify lock: Test Files 121 passed (121), Tests 2143 passed | 13 skipped (2156), VERDICT command-exit 0.
  • pnpm --dir ui exec vitest run scripts/ (derived): Test Files 172 passed | 2 skipped (174), Tests 5111 passed | 2 skipped (5113), VERDICT command-exit 0.
  • New pins: SlackLinkSection.test.tsx (connect, proposal, confirm, linked; cancel; disconnect; no install; revoked; link: null; stale proposal via userMessage; replaced proposal 404; token refused 502 then revoked; no install at click 409; failed read), SlackSetupPage.test.tsx (hidden without setup.write and no door read; install; update never pre-fills and shows a refusal; remove install with confirm; list and remove a link with confirm; the cap text at the cap and not below; the ref resolves; key and placeholder parity of both sections in every pack), and in NotificationSettingsPage.test.tsx the gate (section and door read with slack listed; neither without).
  • Red first: the gate pin ran red before the section existed, at 3494958712: Tests 1 failed | 16 passed (17).
  • An earlier run of the same set on the pre-merge head failed three i18n package pins on my locale additions (the Loading… group grew by one; Slack served verbatim as a title in non-Latin packs; zh-Hant.ts hand-written instead of generated). Fixed at ddbc916340 by a distinct setup loading line, translated titles, and the generator.
Ablation of the `slack`-listed gate: red as intended, restored to HEAD

node scripts/ablation-replace.mjs on NotificationSettingsPage.tsx, anchor apiFetch && prefs.channels.some((c) => c.channel === SLACK_CHANNEL) && replaced by apiFetch && /* ABLATION-slack-gate-removed */ : anchor 1 to 0, blob 3cd1154f0563 to a7bdd0eba035; the page test ran Tests 1 failed | 16 passed (17), the failure being "without slack listed, no section and no Slack door is called"; restored, blob equals HEAD and git diff HEAD empty. A first attempt used a replacement that was a substring of the anchor; the tool refused it as a mutation that did not land (replacement count 1 to 1) and restored, so it measured nothing.

Type-check, lint and gates
  • pnpm --filter @object-ui/app-shell --filter @object-ui/i18n run type-check on ddbc916340: VERDICT command-exit 0 (both tsconfig.json and tsconfig.test.json; the test files are in the program, since an earlier run reported errors in them, now fixed).
  • eslint on the changed app-shell files: exit 0, no warning in the new files.
  • ui: check:i18n-keys, check:i18n-drift, check:i18n-dead-keys, check:new-line-citations: exit 0 each.
  • node scripts/pm/dispatch-gates.mjs --commands derived 74 commands, re-derived identical on ddbc916340; the gate results are in the report. check:skill-examples (after building @objectstack/client-react) and check:type-check-debt (under the lock) exit 0.
  • node scripts/pm/overlap-check.mjs --branch=claude/area-a4W-34730-s3: VERDICT clean exit 0 (five open PRs share the locale packs; each merges cleanly).
  • Not run locally, CI's: the whole app-shell suite (2,463 test files; a local two-worker run was stopped after 21 minutes, so it is NOT MEASURED here and Test UI's 16 shards carry it), Lint UI, Type Check UI, Build & E2E UI.

Verification

Two minutes, on a dev stack with connector-slack composed: open Notification Settings as a member; under the matrix a "Slack direct messages" card shows. With no install it says an administrator installs Slack first. As an organization administrator open /apps/setup/component/messaging/slack, paste a bot token and choose Install: the workspace and "Active" show and the field is empty again. Back as the member, Connect Slack shows the proposal without a name; Confirm shows the Slack user.

Files to read first, by risk: SlackSetupPage.tsx (the token input and the two confirm dialogs), slackDoors.ts (what is read from each answer and which sentence a refusal shows), SlackLinkSection.tsx (the state after each action is re-read, never inferred).

Acceptance notes

  • No Setup navigation entry yet. Setup's entries are contributed by the server package that owns the door (the pattern CONNECTOR_CREDENTIALS_UI_BUNDLE in service-automation follows; the shell declares none), so the entry that opens this page belongs in service-messaging: Setup, group group_integrations, componentRef: 'messaging:slack', requiredPermissions: ['setup.write'], contributed only where the slack channel registers. That is a server change, outside this PR's surface; it is named for the seat to file. Until it lands the page is reached by its address, which the docs section names.
  • Link list paging is messaging: the administrator's Slack link list answers at most 10,000 links — page GET /api/v1/messaging/slack/links #35861; this page reads the list as served and says so at the cap.
  • Person column shows the user id the door serves; no name is resolved, as ordered.
  • The step-2 changeset sentence owed on messaging.slack_link_removed (listed as a topic on every deployment) belongs in @objectstack/service-messaging's changeset, outside this PR's surface; it is not carried here.
  • ui/AGENTS.md ✨ Set up Copilot instructions #2 asks for a package README update for features; @object-ui/app-shell's README documents no individual page, so none was added.
  • Soft size: 1,718 net added lines (561 of them the eleven locale packs), about 1.9 times the order's 900, under the 2,700 hard stop.

🤖 Generated with Claude Code

… door lists slack (red)

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
…ngs page, and an admin Slack page in Setup

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
…ngeset; effect reads set state in callbacks

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
…line, zh-Hant regenerated from zh-Hans

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 21, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

L1 verdict (L1-a): ACCEPT at head ddbc916340e401b21d39aa493af678e1ece4cef2 (Part of #34730, step 3: the console side of the Slack link doors). The client matches the server door for door, and the tests bite. No blocker. Two notes below, neither owed. Land with or after step 3b (the Setup nav entry), as a4-W plans.

Gates on this head: l1-face --pr 35968 CLEAN (13 items, none flagged). Check-runs at ddbc916: 52 success, 10 expected skip, 0 failed, 0 pending, Test UI's shards included. Lint & Repo Gates and TypeScript Type Check both success. Dogfood battery not owed (UI only, no !, no narrowing).

The benefit boundary: client against server. I read slackDoors.ts against packages/services/service-messaging/src/slack-link-routes.ts on main:

  • All nine routes match in path and method: the person's GET, /proposal, /confirm and DELETE; the admin GET, PUT and DELETE on /slack/account; GET /slack/links; and DELETE /slack/links/:id. The client encodeURIComponents the id.
  • The answer keys match what the handlers return: { account, link }, { link }, { removed }, { account }, { links }. accountView serves id, workspace (from displayName, a required field), workspaceId and status. linkView serves slackUserId and slackUserName as null until confirmed, with confirmedAt ?? null. ownLinkView serves only { state } for a proposal. readLink and readOwnLink accept exactly those shapes.
  • Refusals. The door's sendError adds userMessage only when the error has a messageId (in the caller's language). The client shows error.userMessage, else error.message.
  • The capability. The server checks systemPermissions.includes('setup.write') in the current organization. The page asks hasCapabilities(['setup.write']) and reads no door without it. Where that answer is unreported, the doors still refuse.
  • The cap. SLACK_LINKS_SERVED_CAP = 10000 mirrors the store's unpaged read. Paging is messaging: the administrator's Slack link list answers at most 10,000 links — page GET /api/v1/messaging/slack/links #35861.

Local runs and positive controls. I ran the two new test files plus the notification-settings folder from ui/ at this head: Test Files 4 passed (4), Tests 54 passed (54). Two controls of my own, beside the dev's gate ablation:

  • Dropping the setup.write gate from SlackSetupPage turned "without setup.write: says what is needed and reads no door" red (1 failed | 9 passed).
  • Dropping userMessage from the refusal reader turned "a stale proposal: the server's own sentence (its userMessage)…" red (1 failed | 10 passed).

Both were restored, and git status is clean.

What the screens say, checked against the server:

  • Token. "Slack checks it before it is saved; it is stored encrypted and never shown again" is true: install calls auth.test first, bot_token is a secret field the engine encrypts, and no view serves it. The input starts empty, is cleared when the token is sent, and never takes a value from an answer.
  • Removal notices. "each linked person is told by in-app message and email" is true: removeLink notifies channels: ['inbox', 'email'] on admin removal and uninstall, under messaging.slack_link_removed.
  • No match. The noMatch sentence names all three reasons the door does not tell apart (no verified email, no Slack user with it, already linked to someone else), as step 2's doc comment says.
  • Proposals. The proposal never names the Slack user, matching ownLinkView. "Nothing reaches them on Slack before they confirm" agrees with "Slack delivers only to a confirmed link".

The changeset and administrator-guide.mdx, sentence by sentence: all hold against the above. The admin page path /apps/setup/component/messaging/slack matches the messaging:slack registration in builtinComponents.tsx. The bump is a patch on @object-ui/app-shell (private) and @object-ui/i18n. zh-Hant.ts comes from the generator per the body, and CI's i18n gates are green.

Scope: Part of #34730 is right, because steps 3b and later remain. The diff is UI, i18n and docs only, with no server, spec or skills change, so it is not governed. Clause-②: no and Metadata-protocol: none fit. The size (+1721, of which 561 are locale packs) is over the order's soft 900 and under the 2700 hard stop. That's the area's call, and I found no padding.

Notes (not owed):

  • N1. The Setup page is reachable by its address even without connector-slack. The link routes are always mounted (messaging-service-plugin.ts:816). On such a deployment the page reads "not installed" and offers Install, and the PUT is refused 503 with the server's own sentence ("This server has no Slack transport: compose ConnectorSlackPlugin…"), which the page shows. Nothing breaks, but the guide's "Without the connector none of this appears" is true of the nav entry 3b adds, not of the address. A clause such as "and Setup's Slack page answers that no Slack transport is composed" would make it exact. It could ride 3b.
  • N2. A refused install empties the token field. The field is cleared before the answer arrives, so after a refusal (a bad or revoked token, or a 503) the admin pastes it again. That is consistent with "never kept on the page", so it's a deliberate trade-off, not a defect.

Landing: not governed. a4-W lands with or after step 3b, which adds the Setup nav entry.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Landing (area a4-W, seat 4) · 2026-11-21T09:33Z · head ddbc916340e401b21d39aa493af678e1ece4cef2

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 21, 2026 09:33
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit 8896822 Nov 21, 2026
63 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/area-a4W-34730-s3 branch November 21, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/xl 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