Repository navigation
fix(messaging): the approval Slack DM links the Console page under its mount - #36680
Conversation
…s mount The Slack channel made a relative actionUrl absolute as origin + path, with no Console mount, so the approval DM's link to /system/approvals opened a "not found" page on a default deployment (Console under /_console). The channel now reads the mount from the auth service's Console page composer (getConsoleUrl, AuthConfig.uiBasePath) per delivery, takes only its path less any base path shared with the origin, and makes the link absolute under origin + mount; the messaging plugin wires the composer. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzjF6c6pWoGHX3bWhw9
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzjF6c6pWoGHX3bWhw9
📓 Docs Drift CheckThis PR changes 1 package(s): 2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 6 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 79b2999ac79c1772563e7333eb56bb734595c0b3 && git checkout 79b2999ac79c1772563e7333eb56bb734595c0b3
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 115d38788e2d5094ff0cb14b6f8be8f5ef3f1eba 65fe2ea87738b366fef3d78b4f4e2df2ee8315fa && git checkout -B drift-repro 115d38788e2d5094ff0cb14b6f8be8f5ef3f1eba && git merge --no-ff 65fe2ea87738b366fef3d78b4f4e2df2ee8315fa
node scripts/docs-audit/affected-docs.mjs --json 115d38788e2d5094ff0cb14b6f8be8f5ef3f1eba
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W 席位核对 — REWORK · repo:objectstack#3 · head edff20f · 2026-11-23T12:26ZL1 at head M1 —
A Checked and fine (no change asked): the mount rule (composer path less a shared base path, origin stays the channel's), the fallback to the old link when no auth service or no composer, the plugin wiring read per send, and the two test files' pins. |
…ole composer internally The package entry no longer exports consoleLinkBase or ConsolePageComposer, and the published SlackChannelOptions is as it was. MessagingServicePlugin mounts the channel through the module-internal mountSlackChannel, whose wiring carries the auth service composer; createSlackChannel delegates to it with the public options. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzjF6c6pWoGHX3bWhw9
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzjF6c6pWoGHX3bWhw9
|
repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W 席位核对 — ACCEPT · repo:objectstack#3 · head 65fe2ea · 2026-11-23T13:02Z
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W Landing · 2026-11-23T13:02Z · ACCEPT 7101980950 at head 65fe2ea
State: ready + auto-merge (Tier S). On MERGED, #36301 closes by |
Requested by Yibo Wang · project thread
Fixes #36301
repo:objectstack#3 · os-support-ai · session_01WGufzjF6c6pWoGHX3bWhw9
The card's claim naming this branch is comment 7099292948 on #36301.
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
packages/services/service-messagingonly.slack-channel.ts: a relativeactionUrlis a Console route, so the DM link is now made absolute underorigin + Console mountinstead oforiginalone. A module-internalconsoleLinkBase(origin, composer)reads the mount from the auth service's Console page composer (getConsoleUrl, i.e.AuthConfig.uiBasePath), takes only the composer's PATH, strips any base path it shares with the origin (so a sub-path deployment is not prefixed twice — the same rule as plugin-approvalsconsolePageLink), and falls back to no mount when there is no composer, it answers nothing, throws, or answers a non-URL. No origin ⇒ no link, as before. The composer rides on a module-internalSlackChannelWiringtaken by a module-internalmountSlackChannel; the publishedcreateSlackChanneldelegates to it with the public options, which are unchanged, as areslackDmText/absoluteLink. An absoluteactionUrlis sent as it is.messaging-service-plugin.ts: mounts the channel throughmountSlackChannelwithgetConsoleUrlread from theauthservice per delivery (the same lazy reader plugin-approvals and plugin-audit use).index.tsis byte-identical toorigin/main,SlackChannelOptionsis byte-identical, and the builtdist/index.d.ts/index.d.ctscarry zero hits forconsoleLinkBase,getConsoleUrl,ConsolePageComposer,mountSlackChannel,SlackChannelWiring. HenceClause-②: no(L1 M1, comment 7101086524).@objectstack/service-messagingpatch.No new package edge:
service-messagingdoes not importplugin-approvals(the mount rule is restated locally, with a pointer toconsolePageLink), andplugin-approvalsis untouched — its producer keepsactionUrlrelative (/system/approvals?request=ID), which the in-app inbox needs.Tests
slack-channel.test.ts— new block "the deep link under the Console mount": the posted approval DM text carries/_console/; customuiBasePathand/; sub-path origin not prefixed twice; the composer's origin is ignored; no / empty / throwing / non-URL composer ⇒ no mount; no origin ⇒ no base.slack-channel-composition.test.ts— new block throughMessagingServicePluginitself: with an auth service exposinggetConsoleUrl, the mounted channel posts the link under/_console; with one that has none, the link is unchanged (control).scripts/ablation-replace.mjs, restored to HEAD blob each time):slack-channel.tssend path back to the bare origin ⇒ 2 failed / 19 passed (the unit send pin and the composition pin).getConsoleUrl⇒ 1 failed / 20 passed (the composition pin); re-run after the rework onmountSlackChannel, same 1 failed / 20 passed, restored to the HEAD blob.Local runs (head 65fe2ea)
pnpm --filter @objectstack/service-messaging buildthentypecheck⇒ exit 0;test⇒ Test Files 80 passed (80), Tests 1090 passed (1090) (on fc521e1; 65fe2ea changes three docblocks only, slack tests re-run there: 21 passed).node scripts/pm/dispatch-gates.mjs --commands): 73 derived, 73 run, all exit 0;--ran: "73 derived famil(ies) accounted for — 73 run, 0 NOT-MEASURED".check-plugin-teardown-shape --self-testneeded its fixture commit fetched on the shallow clone (exit 3 before, 0 after).Acceptance notes
consoleLinkBase(origin, composer)inslack-channel.ts, whose origin is the caller's. approvals/messaging: the approval Slack DM and the approval email build their deep link from different origins — share one source so a host that sets only publicBaseUrl still gets an absolute DM link #35844 can hand the approvals'publicBaseUrlin through the existinggetPublicOriginoption and keep this mount rule unchanged; nothing in this PR changes which origin the DM uses.createSlackChannel(rather than registeringMessagingServicePlugin) keeps the link it got before; widening the published options to carry the composer would be a Clause-② change and is left out by L1 ruling M1.service-messagingrather than shared with plugin-approvalsconsolePageLink, because neither package depends on the other and the order forbids a new edge. If a shared home is wanted later, it is a lower package both already import (@objectstack/types); noted, not filed.actionUrla Slack DM carries now goes under the mount, not only the approval's: theactionUrlcontract is "the inbox row's call-to-action", a Console route (actionUrlForsynthesises/{object}/{id}the same way), so this is the same fix for any topic a recipient routes to Slack.Verification
Live, on a real
pnpm dev -- --freshshowcase boot (OS_AUTH_URL=http://localhost:PORT) with a Slack Web API sink preloaded (a--importmodule that answershttps://slack.com/api/*locally and records eachchat.postMessagepayload): admin installs Slack (PUT /api/v1/messaging/slack/account), proposes and confirms their own link, then retitles ashowcase_announcement, which startsshowcase_dynamic_approvaland sends the approval DM to the admin (org owner).Captured DM text, before / after
service-messaging, rebuilt): the title "Approval requested" linked tohttp://localhost:42375/system/approvals?request=areq_22f4a2e3-…— on that bootGET /system/approvals?request=xanswers404 ENDPOINT_NOT_FOUND.http://localhost:42051/_console/system/approvals?request=areq_3363946e-…—GET /_console/system/approvals?request=xis the Console mount (it answered503 "The ObjectStack Console is not built…"only because this container has no Console dist; with a built Console it serves the SPA route).Two-minute check:
pnpm --filter @objectstack/service-messaging exec vitest run src/slack-channel.test.ts— expect the "deep link under the Console mount" block green, the first case assertinghttps://os.example.com/_console/system/approvals?request=r1.Read first:
packages/services/service-messaging/src/slack-channel.ts(consoleLinkBaseand thesendline), thenmessaging-service-plugin.ts(thegetConsoleUrlreader).Generated by Claude Code