Skip to content

feat: auto-validate DNS when Domains page loads - #5001

Open
sagarchhetribird wants to merge 6 commits into
Dokploy:canaryfrom
sagarchhetribird:feat/auto-validate-dns-on-domains-load
Open

feat: auto-validate DNS when Domains page loads#5001
sagarchhetribird wants to merge 6 commits into
Dokploy:canaryfrom
sagarchhetribird:feat/auto-validate-dns-on-domains-load

Conversation

@sagarchhetribird

@sagarchhetribird sagarchhetribird commented Aug 7, 2026

Copy link
Copy Markdown

Summary

  • Automatically validate DNS for each domain when the Domains page loads (application/compose)
  • Wait until domains and IP context are fetched so validation uses the correct server IP
  • Keep the existing Validate DNS badge for manual re-checks
  • Closes feat: auto-validate DNS when Domains page loads #5000

Test plan

  • Open an application/compose Domains tab with at least one domain
  • Confirm each domain shows "Checking DNS..." then Valid/error without clicking
  • Click the DNS badge again and confirm manual re-validation still works
  • Switch to another service Domains tab and confirm validation runs for its domains
  • Add a new domain and confirm it auto-validates after creation/refetch

Greptile Summary

This PR automatically validates domain DNS after the relevant domain and server-IP context loads while preserving manual validation.

  • Discards validation results from prior services and superseded per-host requests.
  • Revalidates domains when the expected server IP changes.
  • Limits automatic validation to five concurrent requests.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (7): Last reviewed commit: "fix: re-run auto DNS validation when exp..." | Re-trigger Greptile

Context used:

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Aug 7, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Comment on lines +175 to +185
setValidationStates((prev) => ({
...prev,
[host]: {
isLoading: false,
isValid: result.isValid,
error: result.error,
resolvedIp: result.resolvedIp,
cdnProvider: result.cdnProvider,
message: result.error && result.isValid ? result.error : undefined,
},
}));

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.

P1 Stale validation crosses services

If a user navigates between services that share a hostname while the first service's automatic check is still running, that request writes into the current host-keyed state after the ID reset, causing the new service to display a DNS result calculated with the previous service's server IP.

Knowledge Base Used: Git Providers and Domains

Comment on lines 207 to 209
if (!data?.length || !isIpFetched || !isApplicationFetched) {
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.

P1 Fetched state permits wrong IP

When the application or compose query finishes without service data while the domain query succeeds, this effect validates against the global IP or an empty string and marks the hostname as processed. This reports valid remote-server DNS as mismatched, or treats any resolvable domain as valid when the expected IP is empty, without correcting the result when service context becomes available.

Knowledge Base Used: Git Providers and Domains

Comment on lines +211 to +218
for (const item of data) {
if (autoValidatedHostsRef.current.has(item.host)) {
continue;
}

autoValidatedHostsRef.current.add(item.host);
void handleValidateDomain(item.host);
}

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 DNS checks have unbounded fan-out

Opening a service with many domains starts every DNS mutation concurrently against an unbounded domain list. Bounding the number of simultaneous checks would reduce resolver pressure, validation latency, and transient lookup errors shown as DNS failures.

Knowledge Base Used: Git Providers and Domains

@sagarchhetribird
sagarchhetribird force-pushed the feat/auto-validate-dns-on-domains-load branch from 91414a1 to 5fadb19 Compare August 7, 2026 03:01
Run domain DNS checks automatically once domains and server IP context are available, so users no longer need to click Validate DNS on every visit.
@sagarchhetribird
sagarchhetribird force-pushed the feat/auto-validate-dns-on-domains-load branch from 5fadb19 to d538902 Compare August 7, 2026 03:01
Ignore in-flight validation results after switching services, wait for a real server IP before auto-checking, and limit concurrent DNS lookups.
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Aug 7, 2026
@sagarchhetribird

Copy link
Copy Markdown
Author

Addressed the Greptile review comments:

  1. Stale validation across services — validation results are tied to a request generation that increments when the service id changes, so in-flight checks from a previous service are ignored.
  2. Wrong/empty IP — auto-validation now waits for a real server IP (remote server.ipAddress, or local settings IP) and won’t mark hosts as processed until that IP is available.
  3. Unbounded fan-out — auto-validation now runs with a concurrency limit of 5.


const handleValidateDomain = useCallback(
async (host: string, serverIpOverride?: string) => {
const requestId = validationRequestIdRef.current;

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.

P1 Automatic check overwrites manual result

If a user manually re-validates a hostname while its automatic check is still running, both calls retain the same service-level request generation and can update the same host state. When the older automatic request finishes last, it overwrites the newer manual result and displays stale DNS status.

Knowledge Base Used: Git Providers and Domains

Track a per-host validation generation so an older automatic check cannot overwrite a newer manual re-validation result.
@sagarchhetribird

Copy link
Copy Markdown
Author

Addressed the new Greptile P1:

Automatic check overwrites manual result — each hostname now has its own validation generation. Starting a newer check (manual or automatic) invalidates in-flight results for that host, so the latest request wins.

Require the application/compose object to be present so auto-validation does not fall back to the global IP when service context is still missing.
@sagarchhetribird

Copy link
Copy Markdown
Author

Addressed the remaining Greptile note:

Global IP fallback without service data — auto-validation now requires the application/compose object to be loaded before running, so it won’t treat a missing service as local and lock in a global-IP result.

Keep the effect dependency list in sync with the service-data guard so auto DNS validation reruns when the loaded service object becomes available.
Comment on lines +264 to +268
if (autoValidatedHostsRef.current.has(host)) {
return false;
}

autoValidatedHostsRef.current.add(host);

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.

P1 Expected-IP changes stay stale

When the application's server IP or the global server IP changes while this page remains mounted, the effect reruns but autoValidatedHostsRef filters out every previously checked hostname, causing the badge to keep showing the DNS result calculated against the old IP until manual revalidation or a component reset.

Knowledge Base Used: Git Providers and Domains

Clear the processed-host cache when the resolved server IP changes so domain badges refresh against the current expected IP.
@sagarchhetribird

Copy link
Copy Markdown
Author

Addressed the new Greptile P1:

Expected-IP changes stay stale — when the resolved server IP changes, the processed-host cache is cleared so domains are auto-validated again against the current IP.

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

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: auto-validate DNS when Domains page loads

1 participant