Skip to content

feat: wall off chat-platform integrations for 1.0 (SPAWN_EXPERIMENTAL_CHAT) - #1570

Merged
scttfrdmn merged 4 commits into
mainfrom
feat/wall-off-chat-integrations
Nov 9, 2026
Merged

scttfrdmn merged 4 commits into
mainfrom
feat/wall-off-chat-integrations

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Refs spore-host/spore-host#611, #644

Owner decision (2026-11-09): drop Slack/Teams/Discord for v1 and wall it off. This PR walls it off and removes nothing: no package is deleted, and the code still works behind an explicit opt-in so the feature can return after 1.0.

The opt-in

One name everywhere: SPAWN_EXPERIMENTAL_CHAT=1. The same opt-in can live in ~/.spawn/config.yaml as experimental: {chat: true}. Precedence is env > file > off, so SPAWN_EXPERIMENTAL_CHAT=0 turns a file opt-in off, and a value it doesn't recognise counts as off. The dashboard-api Lambda reads the same variable from its own environment.

Without it, every gated entry point is hidden from --help. It refuses, exits 1, makes no AWS call (no config load and no request), and writes no file:

chat-platform notifications (Slack/Teams/Discord) are experimental and not supported in this release; set SPAWN_EXPERIMENTAL_CHAT=1 to use them

Entry points gated

  • The whole spawn notify group (alias spawn bot): register, deregister, enable, disable, list, workspace add|remove|list|destroy, the four hidden deprecated workspace-* shims, and a bare spawn notify. The gate is the group's PersistentPreRunE.
  • spawn launch --slack-workspace and --notify-platform. These are checked first in runLaunch, ahead of every dispatch (single, sweep, batch queue).
  • spawn defaults set slack-workspace. defaults unset stays open, so a stored value can always be removed.
  • buildLaunchConfig refuses a chat setting without the opt-in. It is the one builder behind single, sweep, pipe and --dry-run launches, so a path that skips the flag gate still can't write chat settings.
  • spawn sweep resume of a checkpoint that recorded chat settings drops them, prints a notice, and resumes the rest.
  • dashboard-api /api/slack/* (oauth, oauth/callback, token/rotate) returns 404 with an explanation unless the function's environment sets SPAWN_EXPERIMENTAL_CHAT=1. The check runs before the AWS config loads. The hosted function has no such variable, and its deploys (deploy.sh, CI) leave the environment untouched, so its next deploy turns the endpoints off.

No built-in bot endpoint (hosted spore-bot is gone)

  • I removed the compiled-in defaults: the hosted Function URL (awdzf7fbbsvqcrnrzusqjsuybm0iiyvf) behind SPORE_NOTIFY_URL, and the hosted spore-bot-role principal behind SPORE_BOT_LAMBDA_ROLE_ARN (DefaultBotLambdaRoleARN, SporeBotRoleName, the per-environment maps).
  • With the opt-in, a chat launch needs SPORE_NOTIFY_URL set to the operator's own bot (https). notify register without --role-arn needs SPORE_BOT_LAMBDA_ROLE_ARN. Each is refused before any AWS call when unset.
  • A value naming the retired hosted bot is refused instead of being used. That covers its Function URL id, its API id g8iytgzrn8, and any *bot* role in 966362334030.
  • bot-cross-account-role.yaml changed in three ways:
  • pkg/bot's sharedBotExternalIDs still lists spawn-bot/prism-bot. It is a deny-list (those values are treated as "not per-account"), not a use.
  • bot_principal_test.go now fails CI if the template gains a default principal or a shared ExternalId again, or if any file names a bot role in the infra account.

Default launch path (no opt-in)

The launch config object (what spored reads at boot) gets no notify-url, notify-command, notify-platform or slack-workspace-id. No chat tag is written either. spored builds its notifier only when NotifyURL is set, so it starts none. A Spot replacement reads the same settings from the request, so it starts none either. User data never carried chat input. A stored defaults.slack_workspace is ignored with a one-line notice and does not fail the launch. TestDefaultLaunchConfiguresNoChat asserts all of this against aws.LaunchConfigObject.

Non-chat notifications: unaffected

  • --completion-webhook-url and --spot-webhook-url keep working. spored POSTs straight to the user's URL (postWebhook), and nothing goes through spore-bot.
  • The reaper's REAPER_NOTIFY_URL is unaffected. It posts a Slack-incoming-webhook-shaped {"text":…} body, but straight to the configured URL, with no spore-bot involved.
  • spawn has no email notifications. lagotto's email (scripts/deploy-custom-dns.sh: 'go build main.go' misses signature.go (build fails) #248) lives in lagotto.

Decision for the owner

  • SMS goes through spore-bot. Twilio runs inside spore-bot (spore-host lambda/spore-bot/sms_notify.go), on the same registrations spawn notify writes. Walling notify therefore walls SMS too, and decommissioning the hosted bot ends it either way. I walled it rather than carving it out, because SMS is impossible without a bot. If SMS should survive 1.0 without the chat stack, it needs its own path.

Docs

  • docs-gen keeps the chat reference: notify.md, the two launch flags and the slack-workspace default are rendered whatever the shell opts in to, each labelled experimental in its own text. gen-docs and the drift test share one generator, so they can't disagree.
  • docs/reference/cli-iam-actions.md keeps the notify rows too, because a user who opts in needs those permissions. Its only change is a spawn notify | none row, since the bare group is now runnable.
  • README: notify is out of the command table, and a new "Experimental: chat-platform notifications" section points to the webhooks.
  • docs/infra-account.md: the spore-bot section is marked experimental, the dashboard-api row notes the gate, and there is a new "Deploy notes" paragraph.
  • spore-bot.yaml gets an "experimental, unsupported in 1.0" header and no functional change.

Deploy checklist

scripts/deploychecklist now collects // deploychecklist:note <text> lines from the files compiled into each Lambda at --to. Each one appears under that Lambda as a - [ ] note: checkbox, and in the JSON as an additive notes field (schema unchanged). dashboard-api carries a note to keep SPAWN_EXPERIMENTAL_CHAT unset on spawn-dashboard-api, with the get-function-configuration command to check it.

Not covered here (other repos)

  • spawn-ts (the TS port) still has slack-workspace / notify-platform (src/core/tags.ts, src/cli/commands.ts).
  • The docs site page that includes docs-gen/notify.md should add its own "Experimental" heading.

Tests

The gates were each seen to fail against a revert that compiles:

  • cmd/chat_gate_test.go. It discovers every runnable command under notify (fails below 14), then checks:
    • each one, plus the launch flags, defaults set and the bot alias, refuses with zero AWS config loads, zero requests and no file written;
    • each one passes the gate with the opt-in;
    • the config-file opt-in works, and env 0 overrides it;
    • help hides the entry points and shows them when opted in;
    • the declared state is hidden;
    • the default launch puts no chat on the instance;
    • a resume strips recorded chat settings;
    • opted in, a missing or retired bot endpoint is refused before AWS.
  • pkg/config: opt-in precedence; defaults set keeps the opt-in; dashboard-api uses the same variable name; no default bot endpoint; URL and ARN validation.
  • lambda/dashboard-api/chat_gate_test.go: every /api/slack route in main.go is covered (discovered from the router). Each returns 404 with no AWS config load for unset, 0, false and an unrecognised value, and reaches its handler when opted in. Other routes are untouched.
  • scripts/deploychecklist: notes come only from compiled files (not test files, not packages the Lambda doesn't compile, not prose or strings), and the real dashboard-api's note is discovered.
  • Existing flag-coverage tests that exercise every launch flag (TestSweepFlagRulesHoldAgainstTheCode, TestResumedMemberIsTheLaunchedMember, TestDetachedResumeRelaunchesFromParamsCarryingEveryFlag) now opt in, and set a self-hosted SPORE_NOTIFY_URL.

Local: make check steps pass with GOTOOLCHAIN=go1.27.3 and the AWS env stripped, except the two known ~/.xtmp path-space failures (TestSetupAllRunsEveryStepFromAnyDirectory, check-build-tags). make cli-iam-actions and make gen-docs were run and committed. semgrep scan --config=auto --error . is clean, and so is cfn-lint on both templates.

@scttfrdmn scttfrdmn added this to the Hardening milestone Nov 9, 2026
@scttfrdmn scttfrdmn added the enhancement New feature or request label Nov 9, 2026
@codecov

codecov Bot commented Nov 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.39623% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/defaults.go 85.71% 2 Missing ⚠️
cmd/iam_coverage_exports.go 0.00% 2 Missing ⚠️
cmd/bot.go 87.50% 1 Missing ⚠️
cmd/gendocs.go 75.00% 1 Missing ⚠️
cmd/root.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 0dc07b9 into main Nov 9, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the feat/wall-off-chat-integrations branch November 9, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant