Skip to content

fix: normalize created proxy rule status in console#3023

Merged
HarshMN2345 merged 1 commit intomainfrom
fix-rule-status-created-ui
May 5, 2026
Merged

fix: normalize created proxy rule status in console#3023
HarshMN2345 merged 1 commit intomainfrom
fix-rule-status-created-ui

Conversation

@HarshMN2345
Copy link
Copy Markdown
Member

What does this PR do?

(Provide a description of what this PR does.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 5, 2026

Greptile Summary

This PR centralizes proxy-rule status handling into a new status.ts utility and normalizes the created state to be treated identically to unverified throughout the console UI. The three add-domain flows also fix a pre-existing bug where rule?.status !== 'created' falsely flagged verifying and unverified rules as successfully verified, incorrectly triggering the "Domain verified successfully" toast and skipping the verification page.

Confidence Score: 4/5

Safe to merge; changes are a clean refactor with a correctness fix and no regressions identified.

All P2 findings — no logic errors or runtime failures found. The two observations are about intentional behavioral changes (log visibility for created status, label copy change) that warrant a quick confirmation but are not bugs. The core fix (correct isProxyRuleVerified check) is clearly an improvement.

src/lib/components/domains/status.ts — verify isProxyRuleLogsViewable intent for created status and the 'Checked'→'Failed' label change.

Important Files Changed

Filename Overview
src/lib/components/domains/status.ts New centralized status utility with normalization logic; isProxyRuleLogsViewable broadens log visibility to all non-verified statuses (incl. created), which is a subtle but intentional behavioral change.
src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/add-domain/+page.svelte Replaces rule?.status !== 'created' with isProxyRuleVerified, fixing a bug where verifying/unverified states incorrectly triggered the success notification.
src/routes/(console)/project-[region]-[project]/settings/domains/add-domain/+page.svelte Same fix as functions add-domain page; replaces incorrect status check with isProxyRuleVerified.
src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/add-domain/+page.svelte Same fix as functions add-domain page; replaces incorrect status check with isProxyRuleVerified.
src/lib/components/domains/nameserverTable.svelte Simplifies badge rendering using getProxyRuleStatusBadge; created now renders "Certificate generation failed" instead of "Verification failed".
src/lib/components/domains/recordTable.svelte Same badge simplification as nameserverTable; logic consolidated into getProxyRuleStatusBadge.
src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/table.svelte Consolidates all status logic (retryable, logsViewable, badge, updated label) behind helpers; removes inline string comparisons throughout.
src/routes/(console)/project-[region]-[project]/settings/domains/table.svelte Same consolidation as functions table.svelte.
src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/table.svelte Same consolidation as functions table.svelte.

Reviews (1): Last reviewed commit: "fix: normalize created proxy rule status..." | Re-trigger Greptile

Comment on lines +29 to +33
export function isProxyRuleLogsViewable(proxyRule: Models.ProxyRule): boolean {
return (
Boolean(proxyRule.logs?.length) &&
normalizeProxyRuleStatus(proxyRule.status) !== ProxyRuleStatus.Verified
);
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.

P2 Broadened log visibility for created status

The old code whitelisted only 'verifying' and 'unverified' for log viewing. The new normalizedStatus !== Verified predicate also includes created (before normalization) and any unrecognized future statuses. Since the PR intentionally treats created as a failure state equivalent to unverified, this is probably correct — but worth confirming that exposing logs on a freshly-created (never-attempted) rule is the desired UX, in case the API returns created for brand-new rules that have no meaningful logs yet.

Comment on lines +36 to +47
export function getProxyRuleUpdatedPrefix(status: ProxyRuleStatusValue): string {
const normalizedStatus = normalizeProxyRuleStatus(status);

if (normalizedStatus === ProxyRuleStatus.Verifying) {
return 'Updated';
}

if (normalizedStatus === ProxyRuleStatus.Unverified) {
return 'Failed';
}

return '';
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.

P2 created timestamp label changed from 'Checked' to 'Failed'

The old updatedLabel emitted 'Checked <time>' for created status. After normalization, created maps to unverified which now returns 'Failed', so the label becomes 'Failed <time>'. This is arguably more accurate, but it's a visible user-facing string change. If "Checked" had a distinct meaning (e.g., "DNS was checked but certificate generation hasn't started"), dropping it may remove useful context for users diagnosing their setup.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@HarshMN2345 HarshMN2345 merged commit bc9a1d6 into main May 5, 2026
4 checks passed
@HarshMN2345 HarshMN2345 deleted the fix-rule-status-created-ui branch May 5, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants