Skip to content

fix: parse details.action in audit logs as a string or an object - #1703

Draft
zimeg wants to merge 2 commits into
mainfrom
details-action
Draft

zimeg wants to merge 2 commits into
mainfrom
details-action

Conversation

@zimeg

@zimeg zimeg commented Nov 17, 2026

Copy link
Copy Markdown
Member

Summary

This pull request parses details.action in audit logs as either a string or an object.

  • Slack sends details.action as a string for some actions, such as "update" for usergroup_updated, and as an object with resolution and notify for others, such as app_allowlist_rule_created. With the current String type, any getLogs page that includes the object form fails to parse with JsonSyntaxException: Expected a string but was BEGIN_OBJECT.
  • LogsResponse.Details.action is now a LogsResponse.DetailsAction that holds either form. A new GsonAuditLogsDetailsActionFactory, registered in GsonFactory, reads both, the same way succeededUsers and failedUsers read UserIDs.
  • With failOnUnknownProperties on, unknown keys in the object form raise an error.
  • AAARuleActionNotify gains values.

This is a breaking change for code that reads the field as a string. To migrate, replace details.getAction() with details.getAction().getStringValue(), or read getResolution() and getNotify() for the object form.

This is the base of a stack:

  1. this pull request
  2. feat: add webapi response changes as of 2026-11-17 #1636 webapi response changes

Testing

With an org admin token that has auditlogs:read:

  • slack.audit(token).getLogs(r -> r.action("app_allowlist_rule_created")) parses, and getDetails().getAction().getResolution() is set.
  • slack.audit(token).getLogs(r -> r.action("usergroup_updated")) parses, and getDetails().getAction().getStringValue() is "update".

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

🤖 Generated with Claude Code

zimeg and others added 2 commits November 16, 2026 18:42
❤️
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@zimeg zimeg added this to the 1.55.1 milestone Nov 17, 2026
@zimeg zimeg added bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented project:slack-api-client project:slack-api-client semver:minor labels Nov 17, 2026
@zimeg zimeg self-assigned this Nov 17, 2026
@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 74.54545% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.00%. Comparing base (8fa0566) to head (df8e96e).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...i/util/json/GsonAuditLogsDetailsActionFactory.java 74.07% 8 Missing and 6 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1703      +/-   ##
============================================
+ Coverage     73.95%   74.00%   +0.05%     
- Complexity     4752     4773      +21     
============================================
  Files           487      488       +1     
  Lines         14811    14866      +55     
  Branches       1536     1552      +16     
============================================
+ Hits          10953    11002      +49     
- Misses         2943     2945       +2     
- Partials        915      919       +4     
Flag Coverage Δ
jdk-14 74.00% <74.54%> (+0.05%) ⬆️

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.

This branch has not been deployed

No deployments
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 semver:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant