Skip to content

feat(dns): support content-scoped record delete - #433

Merged
pcfreak30 merged 1 commit into
developfrom
feat/dns-content-scoped-delete
Aug 20, 2026
Merged

feat(dns): support content-scoped record delete#433
pcfreak30 merged 1 commit into
developfrom
feat/dns-content-scoped-delete

Conversation

@pcfreak30

@pcfreak30 pcfreak30 commented Aug 20, 2026

Copy link
Copy Markdown
Member

Exposes the content-scoped record delete added in ipfs-sdk v0.1.82 in the dns records delete command, and surfaces the synthesized record id in dns records list.

dns records delete now takes an optional --content selector:

  • providing --content deletes only the record with that exact value
  • omitting it deletes the whole RRSet (backward compatible with previous behavior)

This lets callers remove a single TXT/record value without wiping every record of that name+type.

dns records list now shows an ID column for each record, so callers can reference specific record values returned by the API. The keepWholeValue table layout is updated for the new column.

Dependency: bumps go.lumeweb.com/ipfs-sdk to v0.1.82 and absorbs the WebsiteItem.zone_id rename (DnsZoneId -> ZoneId) that shipped in that SDK release.

Tests:

  • content-scoped delete forwards the --content selector to the service
  • omitting content still deletes the whole RRSet
  • records table renders the id column

Summary

This pull request adds support for content-scoped DNS record deletion, allowing users to delete a single DNS record by its exact content value rather than only deleting the entire RRSet (all records matching a name+type).

Key Changes

Content-Scoped Deletion Support

  • internal/core/dns/service.go: The DeleteRecord method signature now accepts an optional content ...string variadic parameter. When a content value is provided, only the record with that exact content is deleted; otherwise, the entire RRSet (all records for the name/type) is removed as before.
  • internal/catalogops/dns.go:
    • Added a new optional --content argument to the dns_records_delete operation, allowing users to specify the exact content value of the record(s) to delete.
    • The operation now forwards the content selector to the service when provided and returns it in the result (DNSRecordDeleteResult.Content), making single-record deletion more precise.
    • Updated the operation description to document the new behavior, including the distinction between content-scoped deletion and whole-RRSet deletion.
    • Added Content field to the DNSRecordDeleteResult struct (with omitempty for backward compatibility).

Improved DNS Record Table Output

  • internal/cli/dns.go and internal/cli/output.go: The DNS records table now includes the record's ID as the first column (with headers changed from ["NAME", "TYPE", "CONTENT", "TTL", "STATUS"] to ["ID", "NAME", "TYPE", "CONTENT", "TTL", "STATUS"]), helping users identify individual records when a name+type group contains multiple values.

Bug Fix: Website DNS Zone ID Display

  • internal/cli/catalog_websites_wiring.go and internal/cli/websites.go: Fixed the field name used to display a website's DNS Zone ID from the outdated DnsZoneId to the current ZoneId, ensuring the correct data is shown.

Testing

  • internal/catalogops/tool_controls_test.go: Added TestDNSRecordsDeleteContentScoped verifying that:
    • Providing --content forwards the exact value to the service for targeted deletion.
    • Omitting content still deletes the whole RRSet (backward compatible).
  • internal/cli/dns_test.go: Updated mock service signature and existing tests to account for the new ID column in the table output.

Impact

Users can now delete individual DNS records by their exact content value (e.g., a specific TXT record) without having to recreate other records that share the same name and type. The change is backward-compatible—existing behavior (whole-RRSet deletion) is preserved when no content is specified.

@kody-ai

This comment has been minimized.

@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown

Code Coverage Report

Total Coverage: 52.1%

Generated from commit: 26105e8
Repository: LumeWeb/pinner-cli

@pcfreak30
pcfreak30 force-pushed the feat/dns-content-scoped-delete branch from 4292654 to 422113c Compare August 20, 2026 07:05
@kody-ai

This comment has been minimized.

Comment thread internal/catalogops/dns.go Outdated
@pcfreak30
pcfreak30 force-pushed the feat/dns-content-scoped-delete branch from 422113c to 03800c5 Compare August 20, 2026 07:17
@kody-ai

This comment has been minimized.

Comment thread internal/catalogops/dns.go Outdated
@pcfreak30
pcfreak30 force-pushed the feat/dns-content-scoped-delete branch from 03800c5 to 9c46876 Compare August 20, 2026 07:48
@kody-ai

This comment has been minimized.

Comment thread internal/catalogops/dns.go Outdated
Comment thread internal/catalogops/dns.go Outdated
@pcfreak30
pcfreak30 force-pushed the feat/dns-content-scoped-delete branch from 9c46876 to 16c88bf Compare August 20, 2026 07:56
@kody-ai

This comment has been minimized.

@kody-ai

kody-ai Bot commented Aug 20, 2026

Copy link
Copy Markdown

kody code-review Kody Rules medium

All new GORM operations introduced in this PR (e.g. ListRecords calls in the dns_records_delete handler) must use .WithContext(ctx) with a timeout to prevent queries from running indefinitely. This rule does not exempt these calls, so ensure each GORM query includes a context with timeout, unless they are within a db.RetryableComponentLock call.

Kody rule violation: Disallow GORM queries without timeout

1 similar comment
@kody-ai

kody-ai Bot commented Aug 20, 2026

Copy link
Copy Markdown

kody code-review Kody Rules medium

All new GORM operations introduced in this PR (e.g. ListRecords calls in the dns_records_delete handler) must use .WithContext(ctx) with a timeout to prevent queries from running indefinitely. This rule does not exempt these calls, so ensure each GORM query includes a context with timeout, unless they are within a db.RetryableComponentLock call.

Kody rule violation: Disallow GORM queries without timeout

Comment thread internal/catalogops/dns.go Outdated
Comment thread internal/catalogops/dns.go Outdated
@pcfreak30
pcfreak30 force-pushed the feat/dns-content-scoped-delete branch from 16c88bf to e951b77 Compare August 20, 2026 08:15
@kody-ai

This comment has been minimized.

Comment thread internal/catalogops/dns.go Outdated
Comment thread internal/catalogops/dns.go Outdated
Comment thread internal/cli/dns_test.go
@pcfreak30
pcfreak30 force-pushed the feat/dns-content-scoped-delete branch from e951b77 to 9616335 Compare August 20, 2026 08:22
@kody-ai

This comment has been minimized.

@kody-ai

kody-ai Bot commented Aug 20, 2026

Copy link
Copy Markdown

kody code-review Kody Rules medium

In internal/catalogops/dns.go, calls to svc.ListRecords, svc.DeleteRecord, and resolveZoneID pass the request context directly without wrapping in a timeout context, which all GORM operations should use via .WithContext(ctx) with a per-query timeout to prevent runaway queries.

Kody rule violation: Disallow GORM queries without timeout

Comment thread internal/catalogops/dns.go
Expose the content-scoped record delete added in ipfs-sdk v0.1.82 in the
dns records delete command, and surface the synthesized record id in dns
records list.

dns records delete resolves the target to a single (name, type, content)
triple, then deletes it only when exactly one record matches:
- --id deletes the single record with that id (as shown by dns records list)
- --name/--type with --content deletes only the record with that exact value
- --name/--type without content deletes the whole RRSet and goes straight to
  the backend without listing the zone

The apex '@' shorthand is normalized to the empty stored name before matching
so content-scoped deletes of apex records resolve correctly. Single-record
modes list the zone once, resolve the target, and reject it when no record
matches, when the record has empty content, or when several records share the
same content (a content-scoped delete would erase them all), so a delete
never silently removes nothing or everything.

dns records list shows the record id column. ipfs-sdk bumped to v0.1.82 and
the WebsiteItem zone_id rename (DnsZoneId -> ZoneId) is absorbed.

Tests cover: content selector forwarded, apex '@' selector, unknown/ambiguous
content rejected, whole-RRSet delete (without a listing), id delete, unknown
id, empty-content record, and ambiguous duplicate-content id -- each rejected
without calling DeleteRecord; records table renders the id column.
@pcfreak30
pcfreak30 force-pushed the feat/dns-content-scoped-delete branch from 9616335 to e63d137 Compare August 20, 2026 08:29
@kody-ai

kody-ai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug
Performance
Security
Business Logic

Access your configuration settings here.

@pcfreak30
pcfreak30 merged commit 08eb3ba into develop Aug 20, 2026
12 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.

1 participant