Skip to content

fix: use Long for DND epoch timestamp fields to avoid Integer overflow - #1725

Merged
AmyScript merged 1 commit into
mainfrom
fix/dnd-timestamps-long
Nov 24, 2026
Merged

AmyScript merged 1 commit into
mainfrom
fix/dnd-timestamps-long

Conversation

@AmyScript

@AmyScript AmyScript commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #1719.

When a user has no scheduled DND end, Slack returns "next_dnd_end_ts": 9999999999. That value is larger than Integer.MAX_VALUE, so Gson fails with JsonSyntaxException (caused by NumberFormatException) when deserializing dnd.* responses and dnd_updated* events.

This PR changes the epoch-seconds fields nextDndStartTs, nextDndEndTs, and snoozeEndtime from Integer to Long in:

  • DndEndSnoozeResponse
  • DndInfoResponse
  • DndSetSnoozeResponse
  • DndTeamInfoResponse.DndTeamMemberInfo
  • DndUpdatedEvent.DndStatus
  • DndUpdatedUserEvent.DndStatus

snoozeRemaining stays Integer because it's a duration in seconds, not a timestamp.

⚠️ Breaking change (source and binary): the generated getters and setters now use Long instead of Integer. Code that stores these values as Integer/int (e.g. int end = r.getNextDndEndTs();) or passes Integer to the setters will no longer compile, and apps compiled against 1.56.x will hit NoSuchMethodError until they are recompiled. Because of this, the PR is labeled semver:minor and will ship in the next minor with an IMPORTANT release note, like #1703 did in v1.56.0.

Out of scope: #1520 (ChannelCreatedEvent.Channel.created) is a separate overflow of the same kind and isn't touched here.

Testing

  • Added regression tests that deserialize 9999999999 for every affected class (DndTest#timestampsLargerThanIntegerMaxValue, DndUpdatedEventTest and DndUpdatedUserEventTest#deserialize_timestampsLargerThanIntegerMaxValue).
  • Updated existing event tests to compare against Long values.
  • Ran locally on JDK 17 (Zulu): DndUpdatedEventTest, DndUpdatedUserEventTest, and DndTest all pass.

Category

  • 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)

Requirements

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

Slack returns `next_dnd_end_ts: 9999999999` when a user has no scheduled
DND end, which exceeds Integer.MAX_VALUE and fails Gson deserialization
with a NumberFormatException.

Change nextDndStartTs, nextDndEndTs, and snoozeEndtime from Integer to Long in:
- DndEndSnoozeResponse
- DndInfoResponse
- DndSetSnoozeResponse
- DndTeamInfoResponse.DndTeamMemberInfo
- DndUpdatedEvent.DndStatus
- DndUpdatedUserEvent.DndStatus

snoozeRemaining stays Integer since it is a duration, not a timestamp.

Fixes #1719

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@AmyScript AmyScript closed this Nov 24, 2026
@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.05%. Comparing base (74edb7a) to head (78127b9).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1725      +/-   ##
============================================
- Coverage     74.07%   74.05%   -0.02%     
+ Complexity     4829     4827       -2     
============================================
  Files           490      490              
  Lines         15033    15033              
  Branches       1584     1584              
============================================
- Hits          11135    11133       -2     
- Misses         2971     2972       +1     
- Partials        927      928       +1     
Flag Coverage Δ
jdk-14 74.05% <ø> (-0.02%) ⬇️

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.

@AmyScript AmyScript reopened this Nov 24, 2026
@AmyScript
AmyScript marked this pull request as ready for review November 24, 2026 22:00
@AmyScript
AmyScript requested a review from a team as a code owner November 24, 2026 22:00

@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.

The fix looks right and the regression tests cover every class that changed. I'd approve once we've settled how the type change below ships.

private boolean dndEnabled;
private Integer nextDndStartTs;
private Integer nextDndEndTs;
private Long nextDndStartTs;

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.

question (blocking): Since these getters and setters change from Integer to Long, apps compiled against 1.56.0 will hit NoSuchMethodError until they rebuild. Could we label this semver:minor and ship it in the next minor with an IMPORTANT release note, the same way #1703 did in v1.56.0?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, agreed. Changing the return type changes the method descriptor, so apps compiled against 1.56.0 would hit NoSuchMethodError until they rebuild. It's also a source break for anything like int end = r.getNextDndEndTs();. I've labeled this bug + semver:minor and will hold it for the next minor (1.57.0) instead of 1.56.1. I've also updated the PR description to cover the binary break. Proposed release note, in the same style as #1703:

Important

The DND timestamp fields nextDndStartTs, nextDndEndTs, and snoozeEndtime are now Long instead of Integer (#1725). Slack sends 9999999999 when no DND end is scheduled, which is larger than Integer.MAX_VALUE, so these responses and events failed to parse. This affects DndInfoResponse, DndEndSnoozeResponse, DndSetSnoozeResponse, DndTeamInfoResponse.DndTeamMemberInfo, DndUpdatedEvent.DndStatus, and DndUpdatedUserEvent.DndStatus. Code that stores these values as Integer or int needs to use Long or long, and apps need to be recompiled against this version. snoozeRemaining is still Integer.

Does that wording work for you?

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.

That wording works for me, it names every affected class and the recompile step. Thanks for updating the description too!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mwbrooks which milestone should this go under? The only open 1.x milestone right now is 1.56.1, which is a patch release, so it doesn't seem right for a semver:minor change. Should I create a 1.57.0 milestone, or is there another one you'd like to use?

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.

Good question! I'd put it under 1.56.1, since that milestone is a placeholder for the next release. It already has 9 semver:minor PRs (#1704, #1712, and others), so it'll ship as 1.57.0 and get renamed at release time, the same way the 1.49.1 milestone shipped as v1.50.0.

@AmyScript AmyScript added bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented semver:minor project:slack-api-client project:slack-api-client project:slack-api-model project:slack-api-model labels Nov 24, 2026

@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 @AmyScript, the semver:minor label and that IMPORTANT release note cover the type change nicely.

@AmyScript AmyScript added this to the 1.56.1 milestone Nov 24, 2026
@AmyScript
AmyScript merged commit 724f34a into main Nov 24, 2026
11 checks passed
@AmyScript
AmyScript deleted the fix/dnd-timestamps-long branch November 24, 2026 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented project:slack-api-client project:slack-api-client project:slack-api-model project:slack-api-model semver:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dnd.endSnooze/dnd.info fail with NumberFormatException: next_dnd_end_ts is Integer but should be Long (overflow > Integer.MAX_VALUE)

2 participants