Skip to content

feat(model): add plan block - #1680

Merged
mwbrooks merged 2 commits into
mainfrom
feat-plan-block
Nov 9, 2026
Merged

mwbrooks merged 2 commits into
mainfrom
feat-plan-block

Conversation

@zimeg

@zimeg zimeg commented Nov 9, 2026

Copy link
Copy Markdown
Member

This pull request adds the plan layout block to the Java SDK model.

  • PlanBlock (plan) with title, tasks, and blockId, with Javadoc copied from the docs fields table.
  • tasks is List<TaskCardBlock>, matching the Python and Node SDKs.
  • PlanBlock is registered in GsonLayoutBlockFactory.
  • Blocks.plan(...) builder helper.
  • BlockKitTest parses the docs example and builds the same plan.

Kotlin DSL support is left for a follow-up, like task_card.

Category (place an x in each of the [ ])

  • bolt (Bolt for Java)
  • bolt-{sub modules} (Bolt for Java - optional modules)
  • slack-api-client (Slack API Clients)
  • slack-api-model (Slack API Data Models)
  • slack-api-*-kotlin-extension (Kotlin Extensions for Slack API Clients)
  • slack-app-backend (The primitive layer of Bolt for Java)

Testing

  1. Post a plan with chat.postMessage:

    import static com.slack.api.model.block.Blocks.*;
    
    ChatPostMessageResponse response = slack.methods(token).chatPostMessage(r -> r
        .channel(channelId)
        .text("A plan")
        .blocks(asBlocks(plan(p -> p
            .title("Thinking completed")
            .tasks(Arrays.asList(
                taskCard(t -> t.taskId("call_001").title("Fetched user profile information").status("in_progress")),
                taskCard(t -> t.taskId("call_002").title("Generated comprehensive user report").status("complete"))
            ))))));
  2. Confirm response.isOk() and that both tasks render under the plan title with their statuses.

  3. Read the message back with conversations.history and confirm the block parses as a PlanBlock with two TaskCardBlock tasks.

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you agree to those rules.

🤖 Generated with Claude Code

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg
zimeg requested a review from a team as a code owner November 9, 2026 21:43
@zimeg zimeg added this to the 1.54.1 milestone Nov 9, 2026
@zimeg zimeg added enhancement M-T: A feature request for new functionality project:slack-api-model project:slack-api-model semver:minor labels Nov 9, 2026
@zimeg zimeg self-assigned this Nov 9, 2026
@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.73%. Comparing base (849d3f7) to head (1373585).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #1680   +/-   ##
=========================================
  Coverage     73.73%   73.73%           
- Complexity     4676     4678    +2     
=========================================
  Files           487      487           
  Lines         14667    14669    +2     
  Branches       1528     1528           
=========================================
+ Hits          10814    10816    +2     
  Misses         2944     2944           
  Partials        909      909           
Flag Coverage Δ
jdk-14 73.73% <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.

@zimeg zimeg left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid and simple implementation just one QQ!

Comment on lines +38 to +42
/**
* A unique identifier for a block. If not specified, one will be generated. Maximum length for this field is
* 255 characters. {@code block_id} should be unique for each message and each iteration of a message. If a
* message is updated, use a new {@code block_id}.
*/

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🪓 quibble: Let' s match other block implementations

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the block_id comment in 1373585 to match TaskCardBlock, CardBlock, and the other recent blocks.

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

@mwbrooks mwbrooks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Thanks @zimeg, the plan block slots right in beside task card and parses the docs example as-is.


// PlanBlock

public static PlanBlock plan(ModelConfigurator<PlanBlock.PlanBlockBuilder> configurator) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Could we add a plan(...) case to BlocksTest like the taskCard one? The checklist in slack-api-model/AGENTS.md asks for a test per helper.

@mwbrooks
mwbrooks merged commit fe0c436 into main Nov 9, 2026
7 checks passed
@mwbrooks
mwbrooks deleted the feat-plan-block branch November 9, 2026 23:07
@zimeg

zimeg commented Nov 9, 2026

Copy link
Copy Markdown
Member Author

🌟 Thanks for the kind review and merge @mwbrooks! Plan blocks in Java now match Python and Node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement M-T: A feature request for new functionality project:slack-api-model project:slack-api-model semver:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants