Skip to content

Comments

refactor: remove PluginID custom type, use plain string#550

Open
RaghavSood wants to merge 3 commits intomainfrom
remove-plugin-id-type
Open

refactor: remove PluginID custom type, use plain string#550
RaghavSood wants to merge 3 commits intomainfrom
remove-plugin-id-type

Conversation

@RaghavSood
Copy link
Collaborator

@RaghavSood RaghavSood commented Feb 8, 2026

Summary

  • Removes the PluginID custom type (type PluginID string) from the public types package
  • Replaces all 178+ usages across 42 files with plain string
  • Moves fee and recurring-sends constants to internal/types/registry.go as plain string constants
  • Removes PluginVultisigPayroll_0000 entirely; tests use PluginVultisigRecurringSends instead
  • Eliminates all .String() calls, type conversions (PluginID(x)), and type assertions (.(PluginID)) that were only needed due to the custom type

Test plan

  • go build ./... passes
  • go vet ./... passes (no new warnings)
  • go test ./... all tests pass
  • Verify no downstream breakage in dependent services

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Simplified plugin identifier handling across the platform by standardizing IDs to plain strings, streamlining plugin, policy, billing, reporting, image and transaction flows.
    • No functional changes to public behavior; this reduces type-related friction and improves internal consistency for integrations and maintenance.

Drop the PluginID custom type from the public types package and replace
all usages with plain string throughout the codebase. Plugin ID
constants (fees, recurring-sends) are moved to internal/types/registry.go.
PluginVultisigPayroll_0000 is removed entirely; tests now use
PluginVultisigRecurringSends.

Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 8, 2026

Walkthrough

Migrates plugin identifier representation from a typed PluginID alias to plain string across the codebase: updates structs, constants, service/storage/public API signatures, DB implementations, syncer/cache, and related call sites; introduces internal string constants for plugin IDs.

Changes

Cohort / File(s) Summary
Type & Constants
types/registry.go, internal/types/registry.go
Removes the public PluginID type and its constants; adds internal/types/registry.go with plain-string plugin ID constants (e.g., PluginVultisigFees, PluginVultisigRecurringSends).
Public/Exported Types
types/policy.go, types/pricing.go, types/registry.go, types/keysign.go, types/transaction.go
Replaces PluginID typed fields with string in exported structs (Policy, Pricing, Transaction/fee responses, keysign usage); deletes the public PluginID type and constants.
Internal Types
internal/types/*.go (plugin.go, api_key.go, plugin_image.go, plugin_owner.go, policy_sync.go, report.go, plugin_image.go)
Updates internal structs to use string for plugin identifiers (Plugin, APIKey, PluginImageRecord, PluginOwner, PluginPolicySync, PluginReport, PauseHistoryRecord).
API Layer
internal/api/*.go (plugin.go, policy.go, fee.go, server.go)
Switches API handlers and internal logic to use plain string plugin IDs, removes .String() casts, updates vault/fee constant comparisons to use internal string constants.
Service Interfaces & Logic
internal/service/*.go (plugin.go, policy.go, report.go, auth_test.go)
Changes service interface signatures and implementations to accept string plugin IDs and []string where applicable; updates tests/mocks to match.
Storage Interfaces
internal/storage/db.go, plugin/policy/storage.go, plugin/tx_indexer/pkg/storage/types.go
Updates repository/storage interface signatures to use string and []string instead of types.PluginID and []types.PluginID.
Postgres Storage Implementations
internal/storage/postgres/*.go (plugin.go, plugin_image.go, plugin_owner.go, policy.go, fees.go, pricing.go, reports.go, db_test.go)
Implements signature changes in Postgres backend, updates queries/bindings and map keys to string, refactors plugin image and owner routines to accept strings.
Plugin Package & Indexer
plugin/* (policy/service.go, policy/policy_pg/repo.go, server/server.go, tx_indexer/*)
Adjusts plugin package service/storage and tx-indexer types & APIs to accept string plugin IDs; updates tests to use new string IDs.
Fee Management & Syncer
internal/fee_manager/fees.go, internal/syncer/*.go, internal/tx_indexer/indexer.go
Changes RegisterInstallation and related fee flows to accept string plugin IDs; updates syncer cache and server-info lookups to use string keys; updates fee-related constant comparisons to internal constants.
Portal & Scripts
internal/portal/images.go, scripts/migrate-images/main.go
Adapts image management and migration scripts to pass plugin IDs as strings; removes unused external type imports.
Tests & Misc
internal/service/auth_test.go, internal/storage/postgres/db_test.go, plugin/tx_indexer/worker_test.go
Updates test fixtures and mocks where plugin ID types changed; adjusts a test plugin ID value in worker_test.

Suggested reviewers

  • SunshineRider
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the primary change: removing a custom PluginID type and replacing it with plain strings throughout the codebase.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch remove-plugin-id-type

No actionable comments were generated in the recent review. 🎉


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

@webpiratt webpiratt removed their request for review February 17, 2026 11:57
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