Repository navigation
Slack account linking in the app: one place, safety DM, People confirm moves to the app - #1902
Open
abhishek255 wants to merge 7 commits into
Open
abhishek255 wants to merge 7 commits into
abhishek255 wants to merge 7 commits into
Conversation
…m moves to the app (Code API 1.31)
One place to link a Slack account: Account in the web app. The person confirms the code Slack sent them (GET and POST /v1/dev/me/slack-links/pending/{token}), lists and unlinks their own links (opaque linkId, never a Slack user id in an address), and a company owner or admin lists who linked and removes one person's links (GET /v1/dev/company/slack/people, DELETE .../{personId}). All web-app-only.
Rules enforced on the server: one Slack account per person per workspace (a place row written in the link's own transaction, so two requests at once cannot both link), another person's account is never taken over, no silent link by email (the preview answers match, different or unknown, never the address, unknown without the Slack email scope). Every successful link sends the Slack user a safety message with an unlink link to Account; link and unlink write audit rows (company.slack_linked, company.slack_unlinked) in the same transaction.
Connect Slack in Connected sign-ins is no longer a dead end: after the sign-in link succeeds, when the Slack team is the company's connected workspace the same account becomes the company channel link (idempotent, audited, reports linked_to_other instead of overriding).
F4: a code that is used or expired gets a fresh one at once (the notice claim lives as long as the code and a link ends it). F7: /rovara asks the link-aware person resolver; the task notifier names a plan owner by link too. F2: every refused browser-return sign-in shows a page with a fixed reason instead of a silent redirect. The "sign in with Slack" notices now point at Account.
The People confirmation moves to the app: GET and POST /v1/dev/me/people-confirm/{token}. The old pages answer a 302 to the app when WEB_APP_ORIGIN is set (derived from the attention-email host).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…t two route functions The broker reads the web app's origin as WEB_APP_ORIGIN, packed from the existing CoreAttentionEmailHost (setting `wo`, https origin; empty stays empty) instead of a separate environment variable, so the broker's 4 KB environment is unchanged in shape. Template pins moved for exactly that (a Rule D helper takes it out), the route-table pins carry the eight new rows, the company inventory lists the new link-code index row, the person slot row and the six Slack link routes, and the complexity baseline drops for two files that got simpler. Fixes: the Slack link store wrapper passes query and delete through (a redeem read the person's links); slack-person-link-routes and people-confirm-app-routes functions split under the complexity limit; the broker's Slack company wiring is built before the developer configuration reads it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nce, growth baseline, F2 golden The broker reads WEB_APP_ORIGIN where the environment is already read (the developer configuration and the Slack company wiring), so broker.ts adds no direct process.env read. The settings growth baseline names the one new broker setting (the web app origin, packed from the existing CoreAttentionEmailHost: no new stack parameter and no new config key). The legacy packed-environment list and the broker-environment fixture carry it. The browser-callback error test now pins the F2 page (fixed reason, no redirect, no detail) in place of the old silent redirect. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…(1.31 and 1.32 are taken) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…contract, grant the notifier's link read, erase counts - People confirm: the page redirect goes to /app/people/confirm/<token> (the website's route); POST answers COMMITTED/PENDING and refusals are 404/409/503 errors, as the website reads them. - IAM: the notifier's F7 read of ORG#<c>#CHANNEL_LINK#slack/* had no grant (swallowed AccessDenied); granted, with a key-family-to-grant test and template re-pins. - Erase no longer counts the workspace place row as a link; unlink with a malformed address reads unlinked:false. - Tests: open-redirect, cross-team/cross-company unlink, replay, expiry, one safety message, revoked member. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…d safety-message the old page, mask short ids - Connected sign-ins' Slack finish: an identity of the install's own workspace names no team; it was linked to the company's workspace unchecked. Now linked only when the install's workspace (SLACK_TEAM_ID) IS the company's. - The old /review/link page (served while WEB_APP_ORIGIN is unset, where every notice points) linked with no audit row and no safety message. Its confirmation now goes through the app's own confirmation; another company's or a disconnected workspace's code never falls through to the plain redeem. - maskChannelUserId hides at least three characters (a 7-character id was shown whole). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # docs/architecture/company-inventory.md # packages/broker/src/aws/broker.ts # packages/code-api/src/version.ts # tests/contract/admin-health.test.ts # tests/contract/admin-read-contracts.test.ts # tests/contract/code-api-version.test.ts # tests/contract/core-engine-infrastructure.test.ts # tests/contract/developer-contracts.test.ts # tests/contract/developer-identity-server.test.ts # tests/contract/developer-share-contracts.test.ts # tests/contract/developer-signin-infrastructure.test.ts # tests/contract/developer-task-shapes.test.ts # tests/contract/legacy-templates.test.ts # tests/contract/named-templates.test.ts # tests/fixtures/signin-company-goldens/configuration.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Slack account linking in the app: one place (Account), a safety message after every link, and the People confirmation page moves from Code's own page to the app. Code API 1.33 (1.31 is taken on mainline, 1.32 by #1899; 1.30 is held by open changes). Pairs with the website PR #521.
Contract (all routes are web-app-only, full access; a refusal on the pending routes is an ANSWER, HTTP 200
{ error })Person's own links
GET /v1/dev/me/slack-links->{ links: [{ linkId, teamId, workspaceName, slackUserMasked, slackDisplayName?, linkedAt }] }.linkIdis opaque. The raw Slack user id is never sent;slackUserMaskedis display only and is not used in any address.GET /v1/dev/me/slack-links/pending/{token}->{ workspaceName, slackDisplayName?, slackUserMasked, companyName, expiresAt, emailMatch }or{ error }.emailMatchis"match" | "different" | "unknown", never the address;"unknown"when the Slack email scope is absent. Read only.POST /v1/dev/me/slack-links/pending/{token}/confirm(empty body) ->{ linked: true, workspaceName, slackDisplayName? }or{ error }.DELETE /v1/dev/me/slack-links/{teamId}/{linkId}->{ unlinked }. No Slack user id in the address.erroris one ofexpired_or_used,wrong_company,no_company,linked_to_other,already_yours,already_have_other,workspace_removed,not_set_up.Company admin (owner or admin; a member is refused)
GET /v1/dev/company/slack/people->{ people: [{ personId, name, slackUserMasked, slackDisplayName?, linkedAt }] }.DELETE /v1/dev/company/slack/people/{personId}->{ unlinked }(audited; keyed by personId).People confirmation (F10), on the app
{token}=<taskId>.<requestId>, two lower-case UUIDs joined by a dot. The app page is<web app>/app/people-confirm/{token}; treat the token as opaque.GET /v1/dev/me/people-confirm/{token}->{ taskId, requestId, status: "pending", requestedBy, change, effect, companyName?, expiresAt }or{ taskId, requestId, status: "complete" }or{ error }.requestedBy: the signed-in person's name.companyNameis optional.changeis{ kind: "takeOwnership" }or{ kind: "role", personName, role, roleLabel };effectis the same change as one sentence.POST /v1/dev/me/people-confirm/{token}(empty body) ->{ taskId, requestId, status: "complete" | "pending" }or{ error }.erroris one ofnot_found(not yours and no such task read the same),changed,unavailable./review/<task>/task/people/confirm/<request>answers a 302 to${WEB_APP_ORIGIN}/app/people-confirm/<token>for one release; the old/review/link/<code>answers a 302 to${WEB_APP_ORIGIN}/app/account/slack/link/<code>. With noWEB_APP_ORIGINboth stay as they were.Behaviour
linked_to_other).company.slack_linkedandcompany.slack_unlinkedin the same transaction as the change.slackLink). A contract test proves such a person is recognised in a Slack DM.Infra and IAM
webAppOrigin(packedwo, read asWEB_APP_ORIGIN) packed from the existingCoreAttentionEmailHost: no new stack parameter, no new config key.scripts/settings-growth-baseline.jsonnames it; the reason is the owner's 2026-12-05 decision to move the pages to the app. Empty stays empty and the broker keeps the API host's pages.Checks
tests/contract,tests/journeysand the company, inventory and settings unit suites: 1056 files pass.wo(Rule D helperwithoutWebAppOrigin); the code-api version digest line for 1.33 is added.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.