Skip to content

Conversation

@vbro
Copy link
Contributor

@vbro vbro commented Nov 11, 2025

This allows org-level retention setting to be updated in _admin. Update of per-category retention settings is already supported in _admin.

This PR is stacked on top of #103118, and is a follow up to https://github.com/getsentry/getsentry/pull/18800

@vbro vbro requested a review from a team November 11, 2025 00:40
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 11, 2025
@vbro
Copy link
Contributor Author

vbro commented Nov 11, 2025

Screenshot 2025-11-10 at 4 22 30 PM

Comment on lines 86 to 89
standard: orgStandard === '' ? null : Number(orgStandard),
downsampled: null,
};

Copy link

Choose a reason for hiding this comment

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

Bug: If orgRetention.standard is null and the "Org Retention" field is untouched, form submission incorrectly converts null to 0.
Severity: HIGH | Confidence: 0.95

🔍 Detailed Analysis

When a subscription has orgRetention.standard = null and a user opens the modal without modifying the "Org Retention" field, the form submission incorrectly converts null to 0. This happens because Number(null) evaluates to 0. This changes the customer's retention configuration unintentionally, as null signifies using the plan's default retention, while 0 explicitly sets retention to zero.

💡 Suggested Fix

Update the submission logic for orgRetention.standard to explicitly check for null values. Change orgStandard === '' ? null : Number(orgStandard) to orgStandard === '' || orgStandard === null ? null : Number(orgStandard).

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: static/gsAdmin/components/customers/updateRetentionSettingsModal.tsx#L86-L89

Potential issue: When a subscription has `orgRetention.standard = null` and a user opens
the modal without modifying the "Org Retention" field, the form submission incorrectly
converts `null` to `0`. This happens because `Number(null)` evaluates to `0`. This
changes the customer's retention configuration unintentionally, as `null` signifies
using the plan's default retention, while `0` explicitly sets retention to zero.

Did we get this right? 👍 / 👎 to inform future reviews.

const orgRetention = {
standard: orgStandard === '' ? null : Number(orgStandard),
downsampled: null,
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug: Empty Field Values Mapped Inconsistently

The orgRetention.standard value is inconsistently handled when the field is cleared. If orgStandard is null (when the field starts empty and isn't modified), Number(null) converts it to 0 instead of null. If orgStandard is '' (when a filled field is cleared), it correctly becomes null. This creates different behavior for the same user action (clearing the field) based on the initial value, violating the expected semantics where empty fields should consistently map to null.

Fix in Cursor Fix in Web

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This comment is outdated.

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

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants