Skip to content

feat(model): add alert Block Kit block#1610

Draft
zimeg wants to merge 1 commit into
mainfrom
chore/block-kit-alert
Draft

feat(model): add alert Block Kit block#1610
zimeg wants to merge 1 commit into
mainfrom
chore/block-kit-alert

Conversation

@zimeg

@zimeg zimeg commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

Adds the alert Block Kit layout block to slack-api-model, following the existing HeaderBlock / MarkdownBlock conventions (Lombok @Data @Builder @NoArgsConstructor @AllArgsConstructor, TYPE constant, javadoc docs link).

The alert block displays an inline alert message and is currently only supported in modals.

Fields

  • textplain_text or mrkdwn text object (modeled as TextObject), max 200 characters. Required.
  • level — severity: default | info | warning | error | success. Defaults to default when omitted.
  • block_id — optional unique identifier.

Changes

  • New AlertBlock model class.
  • Registered alert type in GsonLayoutBlockFactory.
  • Added alert(...) DSL helper to Blocks.
  • Added parseAlertBlocks (deserialization) and buildAlertBlock (builder + serialize round-trip) tests in BlockKitTest.

Docs reference

https://docs.slack.dev/reference/block-kit/blocks/alert-block

Validation

Ran the touched module's tests:

./mvnw -pl slack-api-model test -Dtest=BlockKitTest -Djacoco.skip=true

Result: PASSTests run: 45, Failures: 0, Errors: 0, Skipped: 0 (includes the two new alert tests).

Note: JaCoCo coverage instrumentation had to be skipped because the repo's pinned JaCoCo version cannot instrument Java 25 (Unsupported class file major version 69) class files in this environment; this is a local toolchain limitation unrelated to this change. The unit tests themselves pass.

Co-Authored-By: Claude svc-devxp-claude@slack-corp.com

Add the `alert` layout block to slack-api-model, mirroring the existing
HeaderBlock/MarkdownBlock conventions.

- AlertBlock with text (plain_text|mrkdwn TextObject), level, blockId
- Register type in GsonLayoutBlockFactory
- Add alert(...) DSL helper to Blocks
- Add parse + builder round-trip tests in BlockKitTest

Ref: https://docs.slack.dev/reference/block-kit/blocks/alert-block

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.33%. Comparing base (a312395) to head (8259f2d).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #1610   +/-   ##
=========================================
  Coverage     73.32%   73.33%           
- Complexity     4520     4522    +2     
=========================================
  Files           478      478           
  Lines         14300    14302    +2     
  Branches       1490     1490           
=========================================
+ Hits          10486    10488    +2     
  Misses         2923     2923           
  Partials        891      891           
Flag Coverage Δ
jdk-14 73.33% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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