feat(dns): support content-scoped record delete - #433
Conversation
This comment has been minimized.
This comment has been minimized.
Code Coverage ReportTotal Coverage: 52.1% Generated from commit: 26105e8 |
4292654 to
422113c
Compare
This comment has been minimized.
This comment has been minimized.
422113c to
03800c5
Compare
This comment has been minimized.
This comment has been minimized.
03800c5 to
9c46876
Compare
This comment has been minimized.
This comment has been minimized.
9c46876 to
16c88bf
Compare
This comment has been minimized.
This comment has been minimized.
|
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
|
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 |
16c88bf to
e951b77
Compare
This comment has been minimized.
This comment has been minimized.
e951b77 to
9616335
Compare
This comment has been minimized.
This comment has been minimized.
|
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 |
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.
9616335 to
e63d137
Compare
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Exposes the content-scoped record delete added in
ipfs-sdk v0.1.82in thedns records deletecommand, and surfaces the synthesized record id indns records list.dns records deletenow takes an optional--contentselector:--contentdeletes only the record with that exact valueThis lets callers remove a single TXT/record value without wiping every record of that name+type.
dns records listnow shows anIDcolumn for each record, so callers can reference specific record values returned by the API. ThekeepWholeValuetable layout is updated for the new column.Dependency: bumps
go.lumeweb.com/ipfs-sdktov0.1.82and absorbs theWebsiteItem.zone_idrename (DnsZoneId->ZoneId) that shipped in that SDK release.Tests:
--contentselector to the serviceSummary
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: TheDeleteRecordmethod signature now accepts an optionalcontent ...stringvariadic 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:--contentargument to thedns_records_deleteoperation, allowing users to specify the exact content value of the record(s) to delete.DNSRecordDeleteResult.Content), making single-record deletion more precise.Contentfield to theDNSRecordDeleteResultstruct (withomitemptyfor backward compatibility).Improved DNS Record Table Output
internal/cli/dns.goandinternal/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.goandinternal/cli/websites.go: Fixed the field name used to display a website's DNS Zone ID from the outdatedDnsZoneIdto the currentZoneId, ensuring the correct data is shown.Testing
internal/catalogops/tool_controls_test.go: AddedTestDNSRecordsDeleteContentScopedverifying that:--contentforwards the exact value to the service for targeted deletion.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.