Skip to content

refactor(dns): remove the unused instance-DNS view and its SQL hostname function#2749

Merged
chet merged 1 commit into
NVIDIA:mainfrom
chet:gh-issue-2709
Jun 22, 2026
Merged

refactor(dns): remove the unused instance-DNS view and its SQL hostname function#2749
chet merged 1 commit into
NVIDIA:mainfrom
chet:gh-issue-2709

Conversation

@chet

@chet chet commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

nico_inet_to_dns_hostname (a PL/pgSQL function) and the dns_records_instance view derived forward A/AAAA names directly from instance IP addresses (10.1.2.310-1-2-3). The view was dropped from the served dns_records view in early 2025 and hasn't been served since — repo-wide, the only thing touching either object was a unit test. IP-derived hostnames are produced by the host-naming strategy (the Rust address_to_hostname helper) and stored in machine_interfaces.hostname, which the shortname/adm views serve, so the SQL function was a stale duplicate of that logic.

  • Migration drops dns_records_instance, then nico_inet_to_dns_hostname(inet).
  • Removes the two tests that exercised them.

Verified no remaining consumers: nothing in code or config queries them (PowerDNS uses the remote backend → the combined dns_records view, which excludes instance), no external grants on the view, and a RESTRICT DROP of both succeeds cleanly against the schema. IP-derived DNS is unchanged — it flows through the naming strategy + the stored hostname, not this view.

Implements #2709. Follow-up to the #2630 reverse-DNS epic.

Draft pending review.

…me function

`nico_inet_to_dns_hostname` and the `dns_records_instance` view derived forward A/AAAA names directly from instance IP addresses (`10.1.2.3` -> `10-1-2-3`). That view was dropped from the served `dns_records` view back in early 2025 and has not been served since; today the only thing that touched either object was a unit test. IP-derived hostnames are produced by the host-naming strategy -- the Rust `address_to_hostname` helper -- and stored in `machine_interfaces.hostname`, which the shortname/adm views serve, so the SQL function was a stale duplicate of that logic.

This drops the view and the function -- verified to have no remaining dependents: nothing in the codebase queries them, there are no external grants, and a RESTRICT drop of both succeeds -- and removes the two tests that exercised them. IP-derived DNS is unchanged; it flows through the naming strategy and the stored hostname, not this view.

This supports NVIDIA#2709.

Signed-off-by: Chet Nichols III <chetn@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 059f286c-e8fa-47cc-9232-76fb6048644f

📥 Commits

Reviewing files that changed from the base of the PR and between f947966 and 894641f.

📒 Files selected for processing (2)
  • crates/api-db/migrations/20260622072105_remove_unused_instance_dns_view.sql
  • crates/api-db/src/dns/mod.rs
💤 Files with no reviewable changes (1)
  • crates/api-db/src/dns/mod.rs

Summary by CodeRabbit

  • Chores
    • Removed unused database objects and their corresponding tests. This maintenance activity eliminates redundant components, reduces technical debt, optimizes the database schema, and improves overall system organization. The internal cleanup enhancements focus on code quality and long-term maintainability without any impact on user-facing features or existing functionality.

Walkthrough

A database migration drops the dns_records_instance SQL view and nico_inet_to_dns_hostname(inet) function using IF EXISTS guards, as equivalent hostname derivation now occurs in Rust. Two integration tests validating those removed database objects, along with their associated test-support imports, are deleted from the DNS module.

Changes

DNS SQL Object Removal and Test Cleanup

Layer / File(s) Summary
Drop dns_records_instance view and nico_inet_to_dns_hostname function
crates/api-db/migrations/20260622072105_remove_unused_instance_dns_view.sql
Migration issues DROP VIEW IF EXISTS dns_records_instance and DROP FUNCTION IF EXISTS nico_inet_to_dns_hostname(inet) to remove stale database objects whose logic has been superseded in Rust.
Remove integration tests for dropped SQL objects
crates/api-db/src/dns/mod.rs
Removes the carbide_test_support, Case/check_cases_async, and sqlx::Row test imports, along with two #[crate::sqlx_test] async tests that validated IPv6 hostname expansion and dns_records_instance qname resolution against the now-dropped SQL objects.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

Possibly related PRs

  • NVIDIA/infra-controller#2691: Directly related — that PR introduced the Rust arpa_qname_to_ip parser and normalization logic that replaces the SQL-based hostname derivation being removed here; both PRs mutate crates/api-db/src/dns/mod.rs in the same functional area.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the primary change: removing an unused DNS view and its supporting SQL function, directly reflecting the changeset.
Description check ✅ Passed The description provides comprehensive context for the changes, explaining why the objects are unused, how functionality was replaced, and verification that removal is safe.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@chet

chet commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chet chet marked this pull request as ready for review June 22, 2026 07:33
@chet chet requested a review from a team as a code owner June 22, 2026 07:33
@github-actions

Copy link
Copy Markdown

🔍 Container Scan Summary

Service Total Critical High Medium Low Other
boot-artifacts-aarch64 3 0 0 3 0 0
boot-artifacts-x86_64 3 0 0 3 0 0
forge-admin-cli-x86_64 264 6 23 99 6 130
machine-validation-runner 704 34 183 258 35 194
machine_validation 704 34 183 258 35 194
nvmetal-carbide 704 34 183 258 35 194
TOTAL 2382 108 572 879 111 712

Per-CVE detail lives in the per-service grype-* artifacts (JSON + SARIF). Severity counts only — no CVE IDs published here.

@chet chet merged commit 276a42a into NVIDIA:main Jun 22, 2026
55 checks passed
@chet chet deleted the gh-issue-2709 branch June 22, 2026 23:19
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