Skip to content

Refactor Provider Interface and Service for Safe Bulk Updates#6

Closed
SamyRai wants to merge 25 commits intofeature/generic-dns-provider-pluginfrom
jules-6071803260271411599-9643d1d0
Closed

Refactor Provider Interface and Service for Safe Bulk Updates#6
SamyRai wants to merge 25 commits intofeature/generic-dns-provider-pluginfrom
jules-6071803260271411599-9643d1d0

Conversation

@SamyRai
Copy link
Owner

@SamyRai SamyRai commented Feb 4, 2026

This PR refactors the DNS Provider interface and Service layer to improve safety and correctness, specifically addressing data loss risks in bulk updates.

Key changes:

  1. Context Propagation: Added context.Context to all Provider and Service methods to enable cancellation and timeout control.
  2. Provider Capabilities: Introduced ProviderCapabilities struct with IsBulkReplaceAtomic flag.
  3. Granular Updates: Added AddRecord, UpdateRecord, and DeleteRecord methods to the Provider interface. This allows the Service layer to perform granular operations instead of dangerous "replace all" operations for providers that don't support atomic bulk replacement (like generic REST providers).
  4. Safe BulkUpdate: Refactored Service.BulkUpdate to check IsBulkReplaceAtomic. If false, it orchestrates the update using granular operations, significantly reducing the risk of data loss if an operation fails.
  5. Provider Updates: Updated NamecheapProvider (atomic) and RESTProvider (granular) to match the new interface.
  6. Tests: Updated tests to cover the new logic, including a test case for non-atomic bulk updates.

PR created automatically by Jules for task 6071803260271411599 started by @SamyRai

SamyRai and others added 24 commits October 5, 2025 14:25
- Add golangci-lint v2 configuration
- Add comprehensive test suite with testify
- Remove code duplications
- Add .golangci.yml to repository
- Update README with correct repository URL
Bumps the go_modules group with 1 update in the / directory: [golang.org/x/net](https://github.com/golang/net).


Updates `golang.org/x/net` from 0.34.0 to 0.38.0
- [Commits](golang/net@v0.34.0...v0.38.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.38.0
  dependency-type: indirect
  dependency-group: go_modules
...

Signed-off-by: dependabot[bot] <support@github.com>
- Remove 'comprehensive' from all documentation
- Change 'Best Practices' to 'Practices'
- Update GitHub repository description
- Verify no credentials in git history
- Add CI workflow with test, lint, build, and security scanning
- Add release workflow for automated releases on tags
- Support multiple Go versions and platforms
- Include code coverage reporting
- Update to golangci-lint-action v7 for v2 support
- Fix workflow formatting
- Set exit-code to 0 for gosec to report but not fail
- Fix workflow formatting
- Add version package with semantic versioning support
- Add prominent disclaimer about pre-1.0.0 status
- Add version command to CLI (--version flag)
- Create version management workflow
- Add version bumping script
- Update release workflow to inject version info
- Mark pre-1.0.0 releases as prerelease in GitHub
- Add VERSIONING.md documentation
…bb8b02913

chore(deps): bump golang.org/x/net from 0.34.0 to 0.38.0 in the go_modules group across 1 directory
- Add badges and status indicators
- Add tables for better organization
- Add collapsible sections
- Improve formatting and structure
- Remove plugin documentation from source (moved to wiki)
- Update plugin README to point to wiki
- Add repository topics (go, cli, dns, namecheap, etc.)
- Add CODE_OF_CONDUCT.md
- Add CONTRIBUTING.md (links to wiki)
- Add issue templates (bug report, feature request)
- Add pull request template
- Add FUNDING.yml placeholder
- Enable all repository features (issues, projects, wiki, discussions)
…vider-plugin

Merge feature/record-id-support: add record ID mapping and delete-by-id support
Merge feature/generic-dns-provider-plugin: provider plugin multi-provider refactor (OpenAPI providers, REST adapter, autodiscovery, CLI changes)

Note: tests pass and provider-area unit tests added. Linter reports legacy repo issues; recommend follow-up cleanup PRs.
- Add `ProviderCapabilities` to `Provider` interface.
- Add granular update methods (`AddRecord`, `UpdateRecord`, `DeleteRecord`) to `Provider` interface.
- Add `context.Context` support to all `Provider` and `Service` methods.
- Update `NamecheapProvider` and `RESTProvider` to implement new interface.
- Refactor `Service.BulkUpdate` to use granular updates for non-atomic providers.
- Add `IsBulkReplaceAtomic` capability flag.
- Add tests for non-atomic bulk update logic.
- Update `TODO.md` with progress.
@google-labs-jules
Copy link

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

…formance suite

- Add `context.Context` to all Provider and Service methods.
- Introduce `ProviderCapabilities` to distinguish between atomic and non-atomic providers.
- Refactor `Service.BulkUpdate` to use safer granular operations for non-atomic providers (avoiding delete-all).
- Add `AddRecord`, `UpdateRecord`, `DeleteRecord` to Provider interface.
- Implement new interface methods in `NamecheapProvider` and `RESTProvider`.
- Create `pkg/dns/provider/conformance` test suite with `MockProvider`.
- Update tests to verify atomic vs. non-atomic behavior and fix record renaming logic.
- Update `TODO.md` with completed tasks.
@SamyRai SamyRai changed the base branch from master to feature/generic-dns-provider-plugin February 4, 2026 22:53
@SamyRai SamyRai closed this Feb 4, 2026
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