feat: auto-validate DNS when Domains page loads - #5001
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
| 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, | ||
| }, | ||
| })); |
There was a problem hiding this comment.
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
| if (!data?.length || !isIpFetched || !isApplicationFetched) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
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
| for (const item of data) { | ||
| if (autoValidatedHostsRef.current.has(item.host)) { | ||
| continue; | ||
| } | ||
|
|
||
| autoValidatedHostsRef.current.add(item.host); | ||
| void handleValidateDomain(item.host); | ||
| } |
There was a problem hiding this comment.
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
91414a1 to
5fadb19
Compare
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.
5fadb19 to
d538902
Compare
Ignore in-flight validation results after switching services, wait for a real server IP before auto-checking, and limit concurrent DNS lookups.
|
Addressed the Greptile review comments:
|
|
|
||
| const handleValidateDomain = useCallback( | ||
| async (host: string, serverIpOverride?: string) => { | ||
| const requestId = validationRequestIdRef.current; |
There was a problem hiding this comment.
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.
|
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.
|
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.
| if (autoValidatedHostsRef.current.has(host)) { | ||
| return false; | ||
| } | ||
|
|
||
| autoValidatedHostsRef.current.add(host); |
There was a problem hiding this comment.
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.
|
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. |
Summary
Test plan
Greptile Summary
This PR automatically validates domain DNS after the relevant domain and server-IP context loads while preserving manual validation.
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: