Skip to content

Add message retention related data types#2

Open
rnons wants to merge 1 commit into
beeperfrom
rnons/plat-33864
Open

Add message retention related data types#2
rnons wants to merge 1 commit into
beeperfrom
rnons/plat-33864

Conversation

@rnons
Copy link
Copy Markdown

@rnons rnons commented May 29, 2026

image

@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 29, 2026

PLAT-33864

@indent
Copy link
Copy Markdown

indent Bot commented May 29, 2026

PR Summary

Adds Slack message-retention data types so downstream consumers can read conversation-level retention policies via a regular user token and surface workspace-level retention defaults from the boot response.

  • Adds ConversationRetention struct and GetConversationRetention[Context] wrapping the undocumented conversations.getRetention endpoint in conversation.go.
  • Adds six new retention default fields to TeamPrefs in users.go (RetentionType/Duration, GroupRetentionType/Duration, DMRetentionType/Duration) with doc comments mapping the integer enum values.

Issues

2 potential issues found:

  • New TeamPrefs retention fields are typed plain int while existing prefs (MsgEditWindowMins *int, AllowMessageDeletion *bool) use pointers, so a missing field and an explicit 0 decode identically; consider *int for consistency and to preserve the absent-vs-zero distinction. → Autofix
  • The retention Type enum is documented differently in ConversationRetention (0=inherit, 1=never, 2=preset, 3=custom) vs TeamPrefs ("1=retain all, 2=delete after duration, other values mean no automatic deletion"); align the comments so callers know value 3 is possible and that 0 means "inherit". → Autofix

CI Checks

Waiting for CI checks...


⚡ Autofix All Issues

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d59ba1a9-8034-4f31-a5f7-fe574de1a22a

📥 Commits

Reviewing files that changed from the base of the PR and between ff6fd25 and 077047c.

📒 Files selected for processing (2)
  • conversation.go
  • users.go
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test go-1.26
  • GitHub Check: test go-1.25
🔇 Additional comments (2)
conversation.go (1)

598-637: LGTM!

users.go (1)

189-199: LGTM!


📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added support for retrieving message retention policies for conversations.
    • Extended team preferences with message retention configuration options for public channels, private groups, and direct messages.

Walkthrough

This PR extends the Slack API client with message retention support across two layers: it adds a ConversationRetention type and API methods to fetch retention policies for individual conversations, and it augments the TeamPrefs struct with retention configuration fields for public channels, private channels, and direct messages.

Changes

Message Retention Support

Layer / File(s) Summary
Conversation retention API and types
conversation.go
Introduces ConversationRetention struct with retention type and duration, and adds GetConversationRetention and GetConversationRetentionContext methods that call the conversations.getRetention Slack API endpoint and return the decoded retention policy.
Team-wide retention preference fields
users.go
Extends TeamPrefs struct with six new retention fields: RetentionType, RetentionDuration for public channels, GroupRetentionType, GroupRetentionDuration for private channels, and DMRetentionType, DMRetentionDuration for DMs/MPIMs.

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description consists only of a screenshot image with no textual explanation of changes, objectives, or adherence to repository guidelines. Provide a detailed written description following the repository template, including rationale for API changes, test status, and answers to the PR preparation checklist items.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main changes: adding ConversationRetention struct and TeamPrefs retention fields.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rnons/plat-33864

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread users.go
GroupRetentionType int `json:"group_retention_type,omitempty"`
GroupRetentionDuration int `json:"group_retention_duration,omitempty"`
DMRetentionType int `json:"dm_retention_type,omitempty"`
DMRetentionDuration int `json:"dm_retention_duration,omitempty"`
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Type inconsistency with surrounding TeamPrefs fields: the existing prefs in this struct use pointer types (*int, *bool) so callers can distinguish an absent field from a zero value. The new retention fields use plain int with omitempty, which means a JSON payload that omits e.g. retention_type is indistinguishable from one that sends 0. Per your own doc comment, value 0 is meaningful (other values mean no automatic deletion), so an unset field and an explicit unset look the same to callers. Consider matching the existing style with *int for symmetry and to preserve the absent-vs-zero signal.

Comment thread users.go
// Message retention defaults. The *_type fields use 1 = retain all messages,
// 2 = delete after the matching *_duration (in days); other values mean no
// automatic deletion. Public channels use RetentionType/RetentionDuration,
// private channels use the Group* fields and DMs/MPIMs use the DM* fields.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Doc inconsistency with ConversationRetention.Type: the comment over in conversation.go enumerates 0/1/2/3 with concrete meanings (0=inherit workspace default, 3=custom timeline), but here "other values" is left vague. Since both fields are decoding the same Slack retention enum it would be clearer to use the same enumeration here so callers know about the 3 and 0 cases.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant