Skip to content

feat(preprod): Add settings UX for size analysis PR comment rules#120205

Merged
mtopo27 merged 3 commits into
masterfrom
maxtopolsky/eme-939-add-settings-ux-for-size-analysis-pr-comment-rules
Jul 22, 2026
Merged

feat(preprod): Add settings UX for size analysis PR comment rules#120205
mtopo27 merged 3 commits into
masterfrom
maxtopolsky/eme-939-add-settings-ux-for-size-analysis-pr-comment-rules

Conversation

@mtopo27

@mtopo27 mtopo27 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Adds a PR Comments panel to the Size Analysis settings tab (Project Settings → Mobile Builds → Size Analysis), gated behind the preprod-size-analysis-pr-comments feature flag. It mirrors the existing Status Checks panel: an enable toggle plus a list of rules, each configured by metric, measurement, threshold, artifact type, and search filter. The backend (already deployed) persists these to the sentry:preprod_size_pr_comments_enabled / sentry:preprod_size_pr_comments_rules project options.

The rule form, rule item, and shared types are reused unchanged from the status-check panel — the only option-specific additions are the usePrCommentRules CRUD hook and the PrCommentRules panel wrapper.

The one behavioral difference worth reviewer attention: size PR comments default off, whereas status checks default on. The hook reflects this by treating anything other than an explicit true as disabled (project.preprodSizePrCommentsEnabled ?? options[...] === true), rather than the status-check panel's default-true (!== false) logic.

Refs EME-939

Adds a PR comments panel to the Size Analysis settings tab, mirroring the
existing status check rules panel. Users can toggle size PR comments on/off
(default off) and configure rules by metric, measurement, threshold,
artifact type, and search filter.

Refs EME-939
@linear-code

linear-code Bot commented Jul 21, 2026

Copy link
Copy Markdown

EME-939

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 21, 2026
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

Metric Before After Delta
Coverage 94.02% 94.02% ±0%
Typed 136,271 136,288 🟢 +17
Untyped 8,666 8,669 🔴 +3
🔍 4 new type safety issues introduced

Type assertions (as) (4 new)

File Line Detail
static/app/views/settings/project/preprod/useSizeRules.ts 79 as unknownproject[config.rulesField] as unknown
static/app/views/settings/project/preprod/useSizeRules.ts 99 as Partial<DetailedProject>{[config.enabledField]: value} as Partial<DetailedProject>
static/app/views/settings/project/preprod/useSizeRules.ts 115 as Partial<DetailedProject>{[config.rulesField]: newRules as unknown[]} as Partial<DetailedProject>
static/app/views/settings/project/preprod/useSizeRules.ts 115 as unknown[]newRules as unknown[]

This is informational only and does not block the PR.

@mtopo27
mtopo27 marked this pull request as ready for review July 21, 2026 14:51
@mtopo27
mtopo27 requested review from a team as code owners July 21, 2026 14:51
@mtopo27
mtopo27 requested review from a team and removed request for a team July 21, 2026 14:51

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 717e0d0. Configure here.

Comment thread static/app/views/settings/project/preprod/prCommentRules.tsx Outdated
Comment thread static/app/views/settings/project/preprod/prCommentRules.tsx Outdated
Comment thread static/app/views/settings/project/preprod/prCommentRules.tsx Outdated
…d PR comments

The Status Checks and PR Comments size-analysis settings panels were near-verbatim clones, along with their backing hooks. Extract a single config-driven SizeRulesPanel plus a parameterized useSizeRules hook; StatusCheckRules and PrCommentRules become thin wrappers supplying option keys, copy, toasts, the enabled default, and analytics callbacks. Behavior for both panels is unchanged (same option keys, defaults, events, and toasts).

The shared rule editor (StatusCheckRuleForm) previously hardcoded status-check copy, so the PR Comments panel showed 'Fail Status Check When' and a status-check delete confirmation. The form now takes optional copy props (defaulting to the status-check text), and the PR Comments panel supplies PR-appropriate wording and search source.

Also adopt Grid over a hand-rolled styled grid and drop a one-off styled Button wrapper in the empty state, per frontend guidelines.

Refs EME-939
Comment thread static/app/views/settings/project/preprod/sizeRulesPanel.tsx
@mtopo27

mtopo27 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

fwiw, working comment here: EmergeTools/hackernews#830 (comment)

const enabled =
project.preprodSizeStatusChecksEnabled ?? project.options?.[ENABLED_KEY] !== false;
project[config.enabledField] ??
(enabledOption === undefined ? config.defaultEnabled : enabledOption === true);

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.

Maybe worth a test or two to ensure we handle this fallback logic when the explicit field isn't present in the pr comments and status check rules components.

Add component tests for the useSizeRules enabled fallback when the explicit top-level field is absent: option-key true/false for PR comments, and default-on plus option-key override for status checks. statusCheckRules had no spec previously.

Refs EME-939
@mtopo27
mtopo27 merged commit bca6f3f into master Jul 22, 2026
78 checks passed
@mtopo27
mtopo27 deleted the maxtopolsky/eme-939-add-settings-ux-for-size-analysis-pr-comment-rules branch July 22, 2026 00:25
priscilawebdev pushed a commit that referenced this pull request Jul 22, 2026
…20205)

Adds a **PR Comments** panel to the Size Analysis settings tab (Project
Settings → Mobile Builds → Size Analysis), gated behind the
`preprod-size-analysis-pr-comments` feature flag. It mirrors the
existing Status Checks panel: an enable toggle plus a list of rules,
each configured by metric, measurement, threshold, artifact type, and
search filter. The backend (already deployed) persists these to the
`sentry:preprod_size_pr_comments_enabled` /
`sentry:preprod_size_pr_comments_rules` project options.

The rule form, rule item, and shared types are reused unchanged from the
status-check panel — the only option-specific additions are the
`usePrCommentRules` CRUD hook and the `PrCommentRules` panel wrapper.

The one behavioral difference worth reviewer attention: size PR comments
**default off**, whereas status checks default on. The hook reflects
this by treating anything other than an explicit `true` as disabled
(`project.preprodSizePrCommentsEnabled ?? options[...] === true`),
rather than the status-check panel's default-true (`!== false`) logic.

Refs EME-939
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