Skip to content

Rename delegator -> delegate#392

Open
altafan wants to merge 1 commit intomasterfrom
delegate-alias
Open

Rename delegator -> delegate#392
altafan wants to merge 1 commit intomasterfrom
delegate-alias

Conversation

@altafan
Copy link
Copy Markdown
Contributor

@altafan altafan commented Apr 3, 2026

This contains changes for the migration to the right naming of the delegate service (delegator -> delegate).

Includes breaking changes to grpc and env vars:

  • delegator.proto -> delegate.proto, the same renaming is applied to the defined service and rpcs.
  • FULMINE_DELEGATOR_* -> FULMINE_DELEGATE_*

The changes are non-breaking for REST clients:

  • GetDelegateInfo is mapped to /v1/delegate/info and also to old /v1/delegator/info, and the endpoint returns both delegateAddress and old delegatorAddress.

Changes to service.proto are deliberately breaking because that's considered admin interface.

Please @sekulicd @Kukks review

Summary by CodeRabbit

Release Notes

  • API Updates

    • Renamed gRPC service and endpoints from "delegator" to "delegate" terminology
    • /v1/delegate/info endpoint now available (replaces previous naming)
    • Response field names updated for consistency
  • User Interface

    • Dashboard renamed from "Delegator" to "Delegate"
    • Updated web interface routes and labels
  • Configuration

    • Environment variables and configuration keys renamed (e.g., FULMINE_DELEGATE_ENABLED)

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 3, 2026

📝 Walkthrough

Walkthrough

This pull request systematically renames all "Delegator" terminology to "Delegate" across the codebase, including gRPC service definitions, protobuf messages, configuration structures, application services, domain models, database repositories, and UI components. The renaming also updates related field names (e.g., DelegatorPublicKeyDelegatePublicKey) and RPC method signatures while preserving underlying control flow.

Changes

Cohort / File(s) Summary
API Specification (Protobuf)
api-spec/protobuf/fulmine/v1/delegate.proto, api-spec/protobuf/fulmine/v1/service.proto
Renamed service from DelegatorService to DelegateService; renamed RPC GetDelegatorInfo to GetDelegateInfo; updated message types (GetDelegatorInfoRequest/ResponseGetDelegateInfoRequest/Response); added delegate_address field to response; renamed delegator_public_key to delegate_public_key in Delegate message.
API Specification (Swagger)
api-spec/openapi/swagger/fulmine/v1/delegate.swagger.json, api-spec/openapi/swagger/fulmine/v1/service.swagger.json
Updated OpenAPI service title and tag names to reference DelegateService; added GET /v1/delegate/info endpoint; renamed response schema from v1GetDelegatorInfoResponse to v1GetDelegateInfoResponse; updated field mappings to use delegateAddress and delegatePublicKey.
Configuration & Environment
internal/config/config.go, internal/config/permissions.go, internal/config/permissions_test.go, envs/dev.env, envs/dev.2.env, cmd/fulmine/main.go
Renamed config struct fields (DelegatorPort/Fee/EnabledDelegatePort/Fee/Enabled); updated environment variable keys (FULMINE_DELEGATOR_*FULMINE_DELEGATE_*); renamed permission entity constant (EntityDelegatorEntityDelegate); updated whitelist service descriptor references.
Core Application Services
internal/core/application/delegator_service.go, internal/core/application/delegator_batch_handler.go, internal/core/application/service.go, internal/core/application/utils.go
Renamed service class (DelegatorServiceDelegateService); renamed public method GetDelegatorInfo()GetInfo(); updated DelegateInfo struct fields (DelegatorPublicKey/DelegatorAddressPubKey/Address); renamed config type DelegatorConfigDelegateConfig; updated batch handler naming and initialization.
Domain Models
internal/core/domain/delegate.go
Renamed DelegateTask.DelegatorPublicKey to DelegatePublicKey; normalized variadic parameter formatting in DelegateRepository interface methods.
Database Layer
internal/infrastructure/db/badger/delegate_repo.go, internal/infrastructure/db/sqlite/delegate_repo.go, internal/infrastructure/db/db_test.go
Updated DTO field mapping from DelegatorPublicKey to DelegatePublicKey in both Badger and SQLite implementations; corrected test fixture and assertions to use new field names.
gRPC Interface
internal/interface/grpc/config.go, internal/interface/grpc/handlers/delegate_handler.go, internal/interface/grpc/handlers/utils.go, internal/interface/grpc/service.go
Renamed handler class (delegatorHandlerdelegateHandler); updated RPC method (GetDelegatorInfoGetDelegateInfo); renamed config field and helper methods (DelegatorPortDelegatePort); updated service wiring to use delegate components; changed response field mappings to use PubKey and Address.
Web Interface & Templates
internal/interface/web/handlers.go, internal/interface/web/server.go, internal/interface/web/types/delegate.go, internal/interface/web/templates/pages/delegate.templ, internal/interface/web/templates/pages/delegate_templ.go, internal/interface/web/templates/modals/delegate_task.templ, internal/interface/web/templates/modals/delegate_task_templ.go
Renamed HTTP handlers (delegator/delegatorActivedelegate/delegateActive); updated route paths (/delegator/delegate); renamed template components (DelegatorTab/DelegatorTabs/DelegatorPartialContentDelegateTab/DelegateTabs/DelegatePartialContent); updated JSON field mappings and display labels; changed HTMX targets and DOM element IDs.
Testing
internal/test/e2e/delegate_test.go, internal/test/e2e/utils_test.go, test.docker-compose.yml
Updated e2e tests to use GetDelegateInfo RPC and newDelegateClient helper; renamed test variables and service clients; updated Docker Compose environment variable from FULMINE_DELEGATOR_ENABLED to FULMINE_DELEGATE_ENABLED.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • Kukks

Poem

🐰 From Delegator to Delegate we've journeyed far,
Each field renamed, each method under a new star,
Service and schema now aligned as one,
The refactoring's grand redesign is done! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.21% 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 accurately summarizes the main change: a comprehensive renaming from 'delegator' to 'delegate' terminology throughout the codebase, which is evident across all modified files.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch delegate-alias

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@arkanaai
Copy link
Copy Markdown
Contributor

arkanaai bot commented Apr 3, 2026

🔍 Arkana Review — fulmine#392 Rename delegator → delegate

Scope: 40 files, ~1700+/1600-, primarily a naming migration across proto definitions, generated code, Go services, config, env vars, handlers, templates, and tests.

Architecture & Backward Compatibility

REST API — well handled. The additional_bindings approach in delegate.proto preserves /v1/delegator/info as an alias for /v1/delegate/info. The response also populates both delegator_address (field 3, deprecated) and delegate_address (field 4, new). Clean migration path for REST clients.

gRPC — intentionally breaking, as noted in the PR description. Service name changes (DelegatorServiceDelegateService) and RPC rename (GetDelegatorInfoGetDelegateInfo) will break any gRPC client. Makes sense for what the PR describes as an admin interface.

⚠️ Wire-Breaking Change in service.proto

service.proto Delegate message field 5 renamed from delegator_public_keydelegate_public_key. While protobuf binary encoding uses field numbers (unchanged at 5), the JSON field name changes from delegatorPublicKey to delegatePublicKey. Any REST/JSON client using ListDelegates and parsing delegatorPublicKey will silently get null/empty for that field.

Consider whether ListDelegates consumers (admin dashboard, web UI) need a compat shim here too, or if this is acceptable as an admin-only breaking change.

Config & Env Vars

All FULMINE_DELEGATOR_* env vars renamed to FULMINE_DELEGATE_*. The validation error message correctly updated ("delegate must not run on same port of the wallet"). Operators upgrading will need to update their env files — worth a note in release/migration docs.

Code Quality

  • DelegatorServiceDelegateService and DelegateInfo field cleanup (DelegatorPublicKeyPubKey, DelegatorAddressAddress) are good simplifications.
  • Batch handler rename is consistent (delegatorBatchSessionHandlerdelegateBatchSessionHandler).
  • GetDelegatorInfoGetInfo on the service layer is a nice simplification.
  • Handler correctly populates both DelegatorAddress and DelegateAddress from the same info.Address.

Security

No concerns — this is purely a naming refactor. No changes to key handling, forfeit tx validation, signing logic, or exit paths. The submitForfeitTxs flow, intent registration/deregistration, and VTXO lookup logic are unchanged.

Cross-Repo Impact

SDKs and clients consuming the delegate/delegator gRPC or REST API:

  • arkade-os/ts-sdk, arkade-os/go-sdk, arkade-os/rust-sdk, arkade-os/wallet — any of these that import the delegator proto or reference FULMINE_DELEGATOR_* env vars will need corresponding updates.
  • The REST backward compat mitigates immediate breakage for REST-based consumers.

LGTM overall. Clean rename with good backward compat for REST. The main action item is ensuring downstream SDK/client repos are updated for the gRPC and env var changes.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/interface/grpc/config.go (1)

31-38: ⚠️ Potential issue | 🔴 Critical

Add a DelegatePort > 0 guard around delegate listener/gateway setup in service.go.

The Validate() method guards the bind check with if c.DelegatePort > 0 (lines 31–38), but the delegate server creation in service.go (starting at line 215) is only guarded by if delegateSvc != nil. This allows the delegate listener to be created on port :0 and the gateway to connect to 127.0.0.1:0 even when DelegatePort == 0, creating a random listener or unusable gateway target.

Update the condition at line 215 to: if delegateSvc != nil && cfg.DelegatePort > 0.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/interface/grpc/config.go` around lines 31 - 38, The delegate
listener/gateway creation in service.go should only run when a fixed delegate
port is configured: update the guard around the delegate server creation from
just checking delegateSvc to also verify cfg.DelegatePort > 0 (i.e., change the
condition to if delegateSvc != nil && cfg.DelegatePort > 0) so the code that
creates the delegate listener/gateway (the block that uses delegateSvc to create
the listener/connector) is skipped when DelegatePort == 0; locate the delegate
setup block using the symbol delegateSvc and the cfg.DelegatePort field and
apply this additional check.
🧹 Nitpick comments (2)
internal/config/permissions_test.go (1)

49-52: Consider subtests per method for clearer failures.

Wrapping each method assertion in t.Run(method, ...) will make failures more diagnosable.

♻️ Proposed refactor
 perms := config.WhitelistedByMethod()
 for _, method := range allMethods {
-	_, ok := perms[method]
-	require.True(t, ok, "missing permission for %s", method)
+	method := method
+	t.Run(method, func(t *testing.T) {
+		_, ok := perms[method]
+		require.True(t, ok, "missing permission for %s", method)
+	})
 }

As per coding guidelines, "**/*_test.go: Write table-driven tests when possible and use subtests for clarity in Go testing".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/config/permissions_test.go` around lines 49 - 52, The loop that
asserts each method exists in perms should be converted to per-method subtests
for clearer failures: replace the for _, method := range allMethods { ... }
block with a t.Run(method, func(t *testing.T) { method := method; _, ok :=
perms[method]; require.True(t, ok, "missing permission for %s", method) }) so
each method runs as a distinct subtest and capture the loop variable (method :=
method) inside the closure to avoid range variable capture issues.
internal/test/e2e/delegate_test.go (1)

65-90: Finish the remaining local terminology cleanup in these tests.

The RPC/client rename is done, but helpers like aliceDelegatorClosure and delegatorVtxoScript still use the old term in several scenarios. A small follow-up rename would make the flows easier to scan and avoid mixing both vocabularies in the same file.

Also applies to: 315-340, 572-597, 839-863, 1138-1163, 1445-1470

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/test/e2e/delegate_test.go` around lines 65 - 90, Rename the
remaining "delegator" local identifiers to use the new terminology (e.g.
"delegate") so the test file consistently uses the RPC/client rename;
specifically rename aliceDelegatorClosure to aliceDelegateClosure and
delegatorVtxoScript to delegateVtxoScript (and update any related variable
usages such as vtxoTapKey, vtxoTapTree, and calls like
delegatorVtxoScript.TapTree()) and apply the same rename pattern in the other
occurrences mentioned (lines ~315-340, 572-597, 839-863, 1138-1163, 1445-1470)
to avoid mixing vocabularies.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@internal/core/application/delegator_batch_handler.go`:
- Around line 40-49: Move the deletion of in-memory intent hashes to after the
repository write succeeds: build taskIds from h.selectedTasks as before, call
repo := h.delegate.svc.dbSvc.Delegate() and invoke repo.CompleteTasks(ctx,
event.Txid, taskIds...) first, check for an error, and only if nil acquire
h.delegate.intentsMtx and delete h.delegate.registeredIntents entries using
selectedTask.intentIDHash(); do not remove registeredIntents before calling
CompleteTasks to avoid losing context on repository failure.

In `@internal/infrastructure/db/badger/delegate_repo.go`:
- Around line 153-156: In GetPendingTaskIDsByInputs, don't silently skip
malformed InputJSON: replace the current json.Unmarshal error handling for
outpointJSON (when parsing data.InputJSON) so that instead of continue it
returns an error that includes the offending task's ID and the underlying
unmarshal error; reference the outpointJSON type and the data.InputJSON field
and construct a descriptive error (e.g., "failed to decode pending task input
for task <taskID>: <err>") so callers can surface the bad row rather than
letting the task become invisible.

---

Outside diff comments:
In `@internal/interface/grpc/config.go`:
- Around line 31-38: The delegate listener/gateway creation in service.go should
only run when a fixed delegate port is configured: update the guard around the
delegate server creation from just checking delegateSvc to also verify
cfg.DelegatePort > 0 (i.e., change the condition to if delegateSvc != nil &&
cfg.DelegatePort > 0) so the code that creates the delegate listener/gateway
(the block that uses delegateSvc to create the listener/connector) is skipped
when DelegatePort == 0; locate the delegate setup block using the symbol
delegateSvc and the cfg.DelegatePort field and apply this additional check.

---

Nitpick comments:
In `@internal/config/permissions_test.go`:
- Around line 49-52: The loop that asserts each method exists in perms should be
converted to per-method subtests for clearer failures: replace the for _, method
:= range allMethods { ... } block with a t.Run(method, func(t *testing.T) {
method := method; _, ok := perms[method]; require.True(t, ok, "missing
permission for %s", method) }) so each method runs as a distinct subtest and
capture the loop variable (method := method) inside the closure to avoid range
variable capture issues.

In `@internal/test/e2e/delegate_test.go`:
- Around line 65-90: Rename the remaining "delegator" local identifiers to use
the new terminology (e.g. "delegate") so the test file consistently uses the
RPC/client rename; specifically rename aliceDelegatorClosure to
aliceDelegateClosure and delegatorVtxoScript to delegateVtxoScript (and update
any related variable usages such as vtxoTapKey, vtxoTapTree, and calls like
delegatorVtxoScript.TapTree()) and apply the same rename pattern in the other
occurrences mentioned (lines ~315-340, 572-597, 839-863, 1138-1163, 1445-1470)
to avoid mixing vocabularies.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 82d645cb-7f6b-453c-ac87-6117b622dcf4

📥 Commits

Reviewing files that changed from the base of the PR and between 9dd1bc1 and 154c542.

⛔ Files ignored due to path filters (8)
  • api-spec/protobuf/gen/go/fulmine/v1/delegate.pb.go is excluded by !**/*.pb.go, !**/gen/**
  • api-spec/protobuf/gen/go/fulmine/v1/delegate.pb.gw.go is excluded by !**/*.pb.gw.go, !**/gen/**
  • api-spec/protobuf/gen/go/fulmine/v1/delegate_grpc.pb.go is excluded by !**/*.pb.go, !**/gen/**
  • api-spec/protobuf/gen/go/fulmine/v1/delegator.pb.go is excluded by !**/*.pb.go, !**/gen/**
  • api-spec/protobuf/gen/go/fulmine/v1/delegator.pb.gw.go is excluded by !**/*.pb.gw.go, !**/gen/**
  • api-spec/protobuf/gen/go/fulmine/v1/delegator_grpc.pb.go is excluded by !**/*.pb.go, !**/gen/**
  • api-spec/protobuf/gen/go/fulmine/v1/service.pb.go is excluded by !**/*.pb.go, !**/gen/**
  • api-spec/protobuf/gen/go/fulmine/v1/service_grpc.pb.go is excluded by !**/*.pb.go, !**/gen/**
📒 Files selected for processing (32)
  • api-spec/openapi/swagger/fulmine/v1/delegate.swagger.json
  • api-spec/openapi/swagger/fulmine/v1/service.swagger.json
  • api-spec/protobuf/fulmine/v1/delegate.proto
  • api-spec/protobuf/fulmine/v1/service.proto
  • cmd/fulmine/main.go
  • envs/dev.2.env
  • envs/dev.env
  • internal/config/config.go
  • internal/config/permissions.go
  • internal/config/permissions_test.go
  • internal/core/application/delegator_batch_handler.go
  • internal/core/application/delegator_service.go
  • internal/core/application/service.go
  • internal/core/application/utils.go
  • internal/core/domain/delegate.go
  • internal/infrastructure/db/badger/delegate_repo.go
  • internal/infrastructure/db/db_test.go
  • internal/infrastructure/db/sqlite/delegate_repo.go
  • internal/interface/grpc/config.go
  • internal/interface/grpc/handlers/delegate_handler.go
  • internal/interface/grpc/handlers/utils.go
  • internal/interface/grpc/service.go
  • internal/interface/web/handlers.go
  • internal/interface/web/server.go
  • internal/interface/web/templates/modals/delegate_task.templ
  • internal/interface/web/templates/modals/delegate_task_templ.go
  • internal/interface/web/templates/pages/delegate.templ
  • internal/interface/web/templates/pages/delegate_templ.go
  • internal/interface/web/types/delegate.go
  • internal/test/e2e/delegate_test.go
  • internal/test/e2e/utils_test.go
  • test.docker-compose.yml

Comment on lines +40 to 49
repo := h.delegate.svc.dbSvc.Delegate()
taskIds := make([]string, 0, len(h.selectedTasks))
for _, selectedTask := range h.selectedTasks {
taskIds = append(taskIds, selectedTask.taskID)
h.delegator.intentsMtx.Lock()
delete(h.delegator.registeredIntents, selectedTask.intentIDHash())
h.delegator.intentsMtx.Unlock()
h.delegate.intentsMtx.Lock()
delete(h.delegate.registeredIntents, selectedTask.intentIDHash())
h.delegate.intentsMtx.Unlock()
}

return repo.CompleteTasks(ctx, event.Txid, taskIds...)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Persist completion before clearing registeredIntents.

The in-memory mapping is removed before repo.CompleteTasks(...) runs. If that write fails, the task stays pending in storage but the service has already forgotten the intent hash, which makes retry/recovery lose context. Delete the entries only after the repository update succeeds.

Proposed fix
 func (h *delegateBatchSessionHandler) OnBatchFinalized(
 	ctx context.Context, event client.BatchFinalizedEvent,
 ) error {
 	repo := h.delegate.svc.dbSvc.Delegate()
 	taskIds := make([]string, 0, len(h.selectedTasks))
 	for _, selectedTask := range h.selectedTasks {
 		taskIds = append(taskIds, selectedTask.taskID)
-		h.delegate.intentsMtx.Lock()
-		delete(h.delegate.registeredIntents, selectedTask.intentIDHash())
-		h.delegate.intentsMtx.Unlock()
 	}
 
-	return repo.CompleteTasks(ctx, event.Txid, taskIds...)
+	if err := repo.CompleteTasks(ctx, event.Txid, taskIds...); err != nil {
+		return err
+	}
+	for _, selectedTask := range h.selectedTasks {
+		h.delegate.intentsMtx.Lock()
+		delete(h.delegate.registeredIntents, selectedTask.intentIDHash())
+		h.delegate.intentsMtx.Unlock()
+	}
+	return nil
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
repo := h.delegate.svc.dbSvc.Delegate()
taskIds := make([]string, 0, len(h.selectedTasks))
for _, selectedTask := range h.selectedTasks {
taskIds = append(taskIds, selectedTask.taskID)
h.delegator.intentsMtx.Lock()
delete(h.delegator.registeredIntents, selectedTask.intentIDHash())
h.delegator.intentsMtx.Unlock()
h.delegate.intentsMtx.Lock()
delete(h.delegate.registeredIntents, selectedTask.intentIDHash())
h.delegate.intentsMtx.Unlock()
}
return repo.CompleteTasks(ctx, event.Txid, taskIds...)
repo := h.delegate.svc.dbSvc.Delegate()
taskIds := make([]string, 0, len(h.selectedTasks))
for _, selectedTask := range h.selectedTasks {
taskIds = append(taskIds, selectedTask.taskID)
}
if err := repo.CompleteTasks(ctx, event.Txid, taskIds...); err != nil {
return err
}
for _, selectedTask := range h.selectedTasks {
h.delegate.intentsMtx.Lock()
delete(h.delegate.registeredIntents, selectedTask.intentIDHash())
h.delegate.intentsMtx.Unlock()
}
return nil
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/core/application/delegator_batch_handler.go` around lines 40 - 49,
Move the deletion of in-memory intent hashes to after the repository write
succeeds: build taskIds from h.selectedTasks as before, call repo :=
h.delegate.svc.dbSvc.Delegate() and invoke repo.CompleteTasks(ctx, event.Txid,
taskIds...) first, check for an error, and only if nil acquire
h.delegate.intentsMtx and delete h.delegate.registeredIntents entries using
selectedTask.intentIDHash(); do not remove registeredIntents before calling
CompleteTasks to avoid losing context on repository failure.

Comment on lines 153 to 156
var opJSONs []outpointJSON
if err := json.Unmarshal([]byte(data.InputJSON), &opJSONs); err != nil {
continue
continue
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Don't silently skip malformed pending-task inputs.

GetPendingTaskIDsByInputs is the same-input guard. If a pending row has bad InputJSON, continue makes that task invisible and can let another task reuse the same outpoint. Return the decode failure with the task ID instead of ignoring it.

Proposed fix
 		var opJSONs []outpointJSON
 		if err := json.Unmarshal([]byte(data.InputJSON), &opJSONs); err != nil {
-			continue
+			return nil, fmt.Errorf(
+				"failed to decode inputs for pending delegate task %s: %w",
+				data.ID, err,
+			)
 		}

As per coding guidelines, "Always check errors and use descriptive error messages in error handling".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/infrastructure/db/badger/delegate_repo.go` around lines 153 - 156,
In GetPendingTaskIDsByInputs, don't silently skip malformed InputJSON: replace
the current json.Unmarshal error handling for outpointJSON (when parsing
data.InputJSON) so that instead of continue it returns an error that includes
the offending task's ID and the underlying unmarshal error; reference the
outpointJSON type and the data.InputJSON field and construct a descriptive error
(e.g., "failed to decode pending task input for task <taskID>: <err>") so
callers can surface the bad row rather than letting the task become invisible.

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