Repository navigation
fix(slack-bot): stop empty arg values from breaking the approval card - #1987
Merged
Merged
Conversation
An empty-string arg key or value rendered as a rich_text text leaf with zero characters, which Slack rejects outright as invalid_blocks. Per the gateway's fail-closed design, that meant every real permission ask silently denied instead of ever reaching the user (mecatl#1986). Render an empty string as a literal "" instead of leaving it empty. Also adds a cache-backed regression suite: a named set of edge-case inputs (fixtures/blocksValidateCases.ts) gets validated once against Slack's real blocks.validate API (test/record-blocks-validate-cache.ts, requires a live token, run manually) and cached to disk, so day-to-day test runs cross-check current code against real Slack-validated ground truth with no network calls. The cache file itself isn't included yet - run `pnpm record:blocks-validate` with a live SLACK_BOT_TOKEN once to generate it. Fully or partially written by an AI agent. Co-Authored-By: Claude Sonnet 5 <[email protected]>
kantord
marked this pull request as ready for review
September 28, 2026 14:37
JAORMX
approved these changes
Sep 29, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
rich_texttext leaf with zero characters, which Slack rejects outright asinvalid_blocks. Per the gateway's fail-closed design (slack-bot: DM manual permission approvals instead of auto-approving #1707), that meant every real permission ask silently denied instead of ever reaching the user. Confirmed live in a--posture strictdeployment (stacklok/infra#5844). Fixes slack-bot: approval-card blocks fail Slack's schema validation (invalid_blocks) #1986.fixtures/blocksValidateCases.tslists named edge-case inputs,record-blocks-validate-cache.tsvalidates them once against Slack's realblocks.validateAPI and writes the result tofixtures/blocksValidateCache.json, andapprovals.blocksValidate.test.tscross-checks current code against that cache on every run - offline, but grounded in genuine Slack-validated ground truth rather than an assumption this repo wrote itself. If current code renders a case's blocks differently than what's cached, the test fails loudly (never silently trusts new output).Why draft
fixtures/blocksValidateCache.jsonisn't included yet - it needs a liveSLACK_BOT_TOKENto generate (blocks.validatehas no side effect, doesn't post anywhere, any workspace's token works):That writes the cache file, which then needs to be committed before this is ready for real review. Until then,
approvals.blocksValidate.test.tsskips cleanly (visible as 36 skipped cases) rather than failing.Test plan
pnpm testinsdk/typescript/examples/slack-bot- 79 passed, 36 skipped (the cache-backed suite, pending the cache file)pnpm typecheck/pnpm lint- no new errors introduced{"":""}in one steppnpm record:blocks-validatewith a live token and commit the resulting cache fileFully or partially written by an AI agent.
🤖 Generated with Claude Code