Skip to content

Distinguish Cloudflare DNS validation in domain status - #346

Merged
Fermionic-Lyu merged 1 commit into
mainfrom
codex/domain-record-purpose
Oct 2, 2026
Merged

Fermionic-Lyu merged 1 commit into
mainfrom
codex/domain-record-purpose

Conversation

@Fermionic-Lyu

@Fermionic-Lyu Fermionic-Lyu commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

insta domain check tells users to re-run the check for Cloudflare validation TXT records even though compute deliberately reports those records as unchecked. Use the optional DNS record purpose to show who validates the record and defer its verdict to the existing certificate status. Keep the record name/value visible and exclude an edge TXT from the platform-ownership slot.

Advances InsForge/instacloud-platform#506. Requires the platform to preserve its provider-supplied purpose field; older responses retain existing behavior. No commands, flags or CLI release are changed.

Validation: typecheck, build and all 2,008 tests passed. Independent review is clean; mutation checks cover the new distinction and displayed TXT values.


Summary by cubic

Fixes insta domain check misreporting Cloudflare validation TXT records as needing a re-run when compute intentionally leaves them unchecked. Uses the optional DNS record purpose to label edge TXT records and defer their verdict to the existing certificate status.

Requires the platform to preserve its provider-supplied purpose field; older responses retain existing behavior. Advances InsForge/instacloud-platform#506.

Written for commit 4b96c6b. Summary will update on new commits.

Review in cubic

@agent-zhang-beihai agent-zhang-beihai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reviewed by Wang Miao

This PR changes insta domain check so that Cloudflare's _cf-custom-hostname TXT record (purpose: edge_ownership) no longer takes the platform's ownership-TXT slot. When that record is unchecked, it no longer counts as a blocker telling the user to re-run the check; the certificate stage and configured decide the verdict instead. I traced it against the compute plane's contract and found nothing to change, so I approve.

No findings.

Evidence

read-the-code:

  • src/commands/compute.ts:139-233: domainStatusLines. serving still requires r.configured and an empty blocker list.
  • test/compute-domain-region.test.ts:121-147.
  • InsForge/instacloud-compute internal/api/domains.go:200-280. domainRecords always sends the edge TXT as unchecked, and the comment above it names the edge's own hostname state as the authority.
  • InsForge/instacloud-compute docs/custom-domains.md:140-215. Compute sets active only after Cloudflare reports the hostname active and the certificate active, so dropping the edge-TXT blocker can't produce a false serving.
  • A payload with no purpose field (an older platform) behaves exactly as before.
  • No other 'TXT' consumers exist in src/.

@agent-zhang-beihai agent-zhang-beihai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reviewed by Yang Dong

This change teaches the CLI to treat Cloudflare’s edge-ownership TXT as informational and defer readiness to certificate status. The discriminator is lost in the control plane before reaching the CLI, so the intended behavior never occurs and I would request changes.

The control plane drops purpose, so the Cloudflare exception never runs

important · defect · correctness · src/commands/compute.ts:196

The compute daemon emits purpose: "edge_ownership", but the platform adapter reconstructs every DNS record without purpose, and the response envelope consequently cannot forward it. Every edge TXT therefore reaches this branch with purpose === undefined, remains an unchecked blocker, and active domains still end with serving not yet; forward the field through the platform’s CustomDomainStatus, DnsRecord, and response mapping.

Evidence

read-the-code — src/commands/compute.ts:59-64,139-201; InsForge/instacloud-platform: src/adapters/insta-compute.ts:2273-2287, src/adapters/types.ts:276-282, src/provisioning/deploy.ts:110-121, src/server.ts:3368-3375; InsForge/instacloud-compute: internal/api/domains.go:199-278, internal/api/domains_test.go:296-329

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/commands/compute.ts">

<violation number="1" location="src/commands/compute.ts:198">
P3: The special-casing only covers the `unchecked` state: an edge-ownership TXT that the plane reports as `ok` (reachable via the `r.configured ? 'ok'` fallback when the plane omits the per-record status) falls into this branch and renders under the generic `txt` label, so the new distinction disappears right when the record validates. Render it as `edge TXT` there too, or the purpose distinction is only half applied.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/commands/compute.ts
if (st === 'ok') stage(lbl, 'ok', where)
if (d.type === 'TXT' && d.purpose === 'edge_ownership' && st === 'unchecked') {
stage('edge TXT', 'unchecked', `${where} (Cloudflare validates this record; see certificate status below)`)
} else if (st === 'ok') stage(lbl, 'ok', where)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: The special-casing only covers the unchecked state: an edge-ownership TXT that the plane reports as ok (reachable via the r.configured ? 'ok' fallback when the plane omits the per-record status) falls into this branch and renders under the generic txt label, so the new distinction disappears right when the record validates. Render it as edge TXT there too, or the purpose distinction is only half applied.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/commands/compute.ts, line 198:

<comment>The special-casing only covers the `unchecked` state: an edge-ownership TXT that the plane reports as `ok` (reachable via the `r.configured ? 'ok'` fallback when the plane omits the per-record status) falls into this branch and renders under the generic `txt` label, so the new distinction disappears right when the record validates. Render it as `edge TXT` there too, or the purpose distinction is only half applied.</comment>

<file context>
@@ -194,14 +188,14 @@ export function domainStatusLines(r: DomainView, ctx: DomainCmdCtx = {}): string
-    if (st === 'ok') stage(lbl, 'ok', where)
+    if (d.type === 'TXT' && d.purpose === 'edge_ownership' && st === 'unchecked') {
+      stage('edge TXT', 'unchecked', `${where} (Cloudflare validates this record; see certificate status below)`)
+    } else if (st === 'ok') stage(lbl, 'ok', where)
     else if (st === 'mismatch') { stage(lbl, 'mismatch', `${d.type} ${d.name} must point at ${d.value}`); blockers.push(`fix the ${d.type} ${d.name}`) }
     else if (st === 'missing') { stage(lbl, 'pending', `add ${where}`); blockers.push(`add the ${d.type} ${d.name}`) }
</file context>
Suggested change
} else if (st === 'ok') stage(lbl, 'ok', where)
} else if (st === 'ok') stage(d.purpose === 'edge_ownership' ? 'edge TXT' : lbl, 'ok', where)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Declining: this state is not emitted by the current compute contract. internal/api/domains.go:domainRecords always sets both Purpose: purposeEdgeOwnership and Status: "unchecked" on this TXT, including active domains. The platform companion #602 preserves both. For hypothetical future statuses the existing name/value and explicit verdict are still displayed; changing that label does not fix a current defect.

@Fermionic-Lyu

Copy link
Copy Markdown
Member Author

The platform dependency is implemented in InsForge/instacloud-platform#602, head c7177a8c42e6675059c97d2d9ab1cbbdb89bbec6: CustomDomainStatus, the shared adapter parser, public DnsRecord and domainEnvelope all retain purpose. Independent review and 176 targeted tests passed; its CI is running. Deployed contract coverage is InsForge/instacloud-e2e#172. These were the companion changes named in this PR description and first review request; the platform PR became visible after its full DB gate completed.

The rollout remains platform first, then the required E2E assertion. No CLI change is needed to address the passthrough finding. This CLI remains compatible with older responses and is not a CLI release.

@jwfing jwfing left a comment

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.

LGTM - approved.

@Fermionic-Lyu
Fermionic-Lyu merged commit ee4dcf7 into main Oct 2, 2026
3 checks passed
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