This repository was archived by the owner on Nov 1, 2026. It is now read-only.
Repository navigation
feat(webhook): restore leave approval with AM/DL authz (buttons + conversation) - #808
Merged
Merged
Conversation
The Discord app that fortress-api posts with is now the Hermes desk bot, whose slash commands are delivered over the gateway. Discord delivers interactions either over the gateway or to an app's HTTP endpoint, never both, so that app cannot also carry the interactions endpoint these buttons were answered on. Rendering them anyway gives the lead a button that fails silently, which is worse than no button. Link the Notion page instead so the request is actionable today; approval moves into conversation with the bot next. The custom_id handlers stay: they hold the approve/reject side effects that the conversational path will call.
Add /webhooks/discord/leave/{list,approve,reject}, called by the fortress
MCP behind the Neko Bot desk. These add the authorization the retired
Approve/Reject buttons never had: only an Account Manager or Delivery Lead
on the requester's active deployment (or an admin) may decide a request;
everyone else gets 403. Reuses the existing Notion deployment/stakeholder
resolution and the leave side effects (status + calendar), with an
idempotency guard so a repeat approval cannot double-book the calendar.
Unlike gen-invoice (no HTTP auth, trusts its body), a leave decision is a
state change keyed on a claimed approver handle, so the routes are gated by
fortress's API-key + permission middleware. Handle comparison is
case-folded and discriminator-stripped so a real lead is never refused.
The notification now points leads at the bot command instead of a dead
button. Companion to dfoundation SPEC-087 (the MCP tools + skill) and the
ops-toolkit gateway patch 0009.
Extract the title-resolution and already-decided predicates into pure helpers and test them alongside the handle-normalization authz check. The full handler wiring is proven by the live UAT (a real innno_ leave request posted to #project-talk tagging the AM/DL); a handler-level unit test would need a LeaveService interface refactor, deferred.
Both front-ends now share one authorized backend: the buttons (handled by the Hermes gateway, patch 0010) and the DM tool both call the leave endpoints. Put the buttons back on the notification and make request_id accept either a page id (button custom_id) or a title (DM). The endpoint's AM/DL authz applies to both.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Restores leave approval on Discord after the Neko Bot identity migration broke it, and adds the authorization the old button flow never had.
Two front-ends share one authorized backend:
approve <id>) — the fortress-mcpapprove_leavetool (dfoundation SPEC-087) calls the same endpoints.Endpoints (new)
POST /webhooks/discord/leave/{list,approve,reject}— gated by API-key +PermissionCronjobExecute(unlike gen-invoice, a leave decision is a state change keyed on a claimed handle, so it must be authenticated). Only an Account Manager or Delivery Lead on the requester's active deployment (or an admin) may decide; everyone else gets 403. Reuses the existing Notion deployment/stakeholder resolution and the leave side effects (status + calendar), with an idempotency guard so a repeat approval cannot double-book the calendar.request_idaccepts a page id (button) or a title (DM).Also
notion_leave_{approve,reject}_{pageID}.Tests
go build ./...,go vet,go test ./pkg/handler/webhook/green. Unit tests cover the decision logic (handle normalization, title/page-id match, idempotency). Full-chain proven by a live UAT (a real leave request posted to #project-talk tagging the AM/DL). Handler-level tests need a LeaveService interface refactor, deferred.Follow-up (not in this PR)
Calendar-delete-on-withdraw: approve creates an event; reject/withdraw leaves it orphaned and there is no delete capability yet. Tracked in dfoundation SPEC-087.
Companion PRs: dfoundation (MCP tools + skill), ops-toolkit (gateway patches 0009/0010).