Skip to content

Give inside a Slack conversation: bot mentions and reactions - #8

Merged
reoring merged 3 commits into
mainfrom
slack-conversation-give
Nov 13, 2026
Merged

reoring merged 3 commits into
mainfrom
slack-conversation-give

Conversation

@reoring

@reoring reoring commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

What

  • Mention: @Peer Bonus @recipient 30 message gives points with the message. Without an amount the bot asks the sender (ephemeral, in the thread) with point buttons; the choice gives. Up to 5 recipients, all-or-nothing.
  • Reaction: an admin-chosen emoji on a message gives a fixed amount to its author; the same emoji on the bot's announce is a clap.
  • Both go through the same validation, ledger and outbox as the web. One give per (message, sender); removing a reaction does not refund.
  • POST /slack/events (Events API: app_mention, reaction_added), gated by a new giveInConversation setting.
  • Admin: point choices, reaction rules, manifest with app_mentions:read, reactions:read and event_subscriptions.
  • catalog/entry.yaml declares the slack inbound endpoint. It was missing, so Slack could not reach /slack/* on catalog installs. The admin API now reads the endpoint URL from the Platform API instead of always returning inbound: null.
  • Slack read methods (users.info, chat.getPermalink, users.lookupByEmail, conversations.list) are sent form-encoded; they were sent as JSON.

Verified

  • go build ./... && go vet ./... && go test ./... -count=1 with a real PostgreSQL: all packages pass.
  • Throwaway integration run (real store + real Slack client against the fake Slack + real inbound handler): challenge, mention with points → thread reply, replay gives once, mention without points → prompt → button by another member refused → sender's button gives → second press refused, reaction gives once across re-add, no thread reply in the announce channel.
  • web: bun run typecheck, bun run test (164 pass); admin page checked in a browser against the mock.

Not verified

  • A real Slack workspace. Existing workspaces must reinstall the Slack app for the new scopes.
  • The inbound endpoint on a live installation (needs a release and the installation's inbound relay).

@reoring

reoring commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in 3c4c13e.

Contract decision: a sender may give only once from the same Slack message, regardless of which configured emoji is used (or whether the original give was a mention). This explicitly replaces the per-emoji RL2 rule in reaction-give.md. Multi-recipient mentions remain atomic: subsequent attempts replay the entire original batch. The persistent uniqueness key is (channel_id, message_ts, sender_id, recipient_id); emoji remains recorded only for reference.

Changes:

  • Removed emoji from both post and clap replay lookups and from the primary key in the PR's new migration 006. No migrations already on main were changed.
  • Added a real-PostgreSQL inbound regression covering two configured emoji on the same message, identical event retries, retries after handler recreation, unchanged ledger/balance/outbox, and a single success reply. Extended existing store coverage for whole-batch replay and clap replay across emoji.
  • Corrected working-peerbonus: web to working-directory: web in CI.
  • Aligned the README and source/schema comments with the decided contract. The external vault was not modified.

Main preservation: git merge origin/main returned Already up to date. No main changes were dropped and no history was rewritten.

Verification:

  • Red phase: go test -count=1 -run 'TestSlackConversationPostsReplayAndPermalink|TestSlackConversationClapAndAnnounce|TestConversationReactionGiveOncePerMessage' ./cmd/server/internal/store ./cmd/server/internal/slackinbound failed as expected against the old behavior, including two posts from different emoji.
  • Green phase: go test -count=1 ./cmd/server/internal/store ./cmd/server/internal/slackinbound passed (store 15.567s; slackinbound 0.358s). Both commands ran through serialize-vm-tests with SERIALIZE_VM_TESTS_TARGET=local and BUILTIN_APPSERVER_TEST_DATABASE_URL pointing to an isolated PostgreSQL 17 container; database tests were not skipped. The temporary container was removed afterward.
  • CI now starts actual jobs: https://github.com/appthrust/peerbonus/actions/runs/43409347741 — server, web, and publisher all started; publisher had passed at observation time.

Not verified locally: repository-wide build/vet/tests, web checks, a real Slack workspace, or any live installation. Please require the remaining CI checks to pass before merging. Release/catalog publication, installation upgrade, Slack app reinstall for new scopes, and live inbound/workspace checks remain post-merge work.

@reoring
reoring merged commit 337aeb2 into main Nov 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant