Skip to content

feat: add a slack setup page, slash command resync, and daily reports - #33

Merged
sgtoj merged 2 commits into
mainfrom
feat/slack-app-and-quiet-reports
Nov 30, 2026
Merged

sgtoj merged 2 commits into
mainfrom
feat/slack-app-and-quiet-reports

Conversation

@sgtoj

@sgtoj sgtoj commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

This adds three things to the bot, each optional and off by default.

Slack setup page. /slack/setup creates and installs the Slack app the way cruxstack/argocd-slack-app does: it creates the app from this deployment's manifest (with an app configuration token, or by hand), runs Slack's OAuth install, and saves the token and signing secret where the GitHub App installer saves its credentials (STORAGE_MODE env file or SSM), then reloads the configuration. It is enabled with APP_SLACK_SETUP_ENABLED=true; while it is on, Slack credentials it hasn't saved yet leave Slack off instead of failing the configuration. Once installed, it refuses to replace the app's credentials or move it to another workspace. The GitHub App installer keeps /setup.

Slash command resync. /github-ops sync runs the Okta sync and /github-ops security-alerts posts the alerts report. The command answers Slack at once, runs the job afterwards (in the background on the server, in an async self-invocation on Lambda), posts the report even if unchanged, and replies privately to whoever asked with a summary. Requests are checked with APP_SLACK_SIGNING_SECRET, only users in APP_SLACK_COMMAND_ALLOWED_USERS may run actions (anyone may run help), and replies leave out error details.

Daily reports. With APP_REPORT_REPEAT=daily the checks can run hourly without posting hourly. A report posts when the run added or removed team members, when it differs from the last one posted (new or closed alerts, new orphaned users, a team that started or stopped failing), and otherwise once a day at the first run after APP_REPORT_DAILY_TIME in APP_REPORT_TIMEZONE. Alert ages and error text don't count as changes. What each report last posted is kept in SSM parameters under APP_STATE_SSM_PREFIX (required in Lambda), a file, or memory. The default stays every-run, so existing deployments behave as before.

On Lambda, the slash command needs the role to invoke its own function, and daily reports need SSM read and write on the state prefix; cruxstack/terraform-aws-github-ops-app#10 adds matching inputs and permissions.

Testing: make check passes (lint, unit and e2e tests, govulncheck, go mod tidy). New tests cover the report decisions across a simulated day (including DST), the slash command's signature, allowlist, and dispatch, the setup page's CSRF, OAuth state, and refusal cases, the SSM and env file stores, and a service test that installs through the setup page and checks that Slack turns on. Not yet tried against a real Slack workspace or AWS account.

🤖 Generated with Claude Code

sgtoj and others added 2 commits November 30, 2026 14:14
Slack setup:
- /slack/setup creates the Slack app from a manifest, with an app
  configuration token or by hand, runs the OAuth install, and saves the
  token and signing secret where the GitHub App installer saves its
  credentials (env file or SSM), then reloads the configuration
- it never replaces an installed app's credentials or moves it to another
  workspace; while it is enabled, missing Slack credentials leave Slack
  off instead of failing to load

Slash command:
- /github-ops sync and /github-ops security-alerts run the action after
  answering Slack, post the report even if unchanged, and reply to who
  asked with a summary
- requests are signature-checked; only APP_SLACK_COMMAND_ALLOWED_USERS
  may run actions, and replies leave out error details
- the server runs jobs in the background; Lambda invokes itself
  asynchronously, and doesn't fail (so retry) a job that already replied

Reports:
- APP_REPORT_REPEAT=daily posts a report when the run changed team
  members or the report differs from the last one posted, and otherwise
  once a day at the first run after APP_REPORT_DAILY_TIME
- alert ages and error text don't count as changes; empty reports never
  post but are remembered
- what each report last posted is kept in SSM (APP_STATE_SSM_PREFIX,
  required in Lambda), a file, or memory

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- README: the new endpoints, Slack and report variables, how reports
  decide to post, the slash command, and troubleshooting
- slack setup: the setup page, creating the app by hand, adding the
  slash command to an existing app, and finding user IDs
- lambda: job events and the role permissions each feature needs
- the Slack manifest asset gains the slash command and commands scope
- AGENTS.md: the slackapp and state packages and the command's rules

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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