apache / apache/texera

Unused actor helpers, an unreferenced RPC sentinel and four unreachable guards in amber

Open
#7,784 1 comment 0 reactions 1 assignee Claimed by @aglinxinyuan View on GitHub
Dominant language
Scala
Stars
314
Forks
187
Avg merge
1d 21h
Merged PRs (30d)
214

Description

### Describe the bug

Six regions in amber are unreachable or unused. Each was verified by grep across all file types (excluding `target/`, `.git/`, `node_modules/`), including the Python side and `.proto` files where an RPC constant could be mirrored.

1. **`PekkoActorService.sendToSelfOnce` and `ask` have zero call sites.** Both appear only in their own declarations — `ask`'s only other hit is the `pekko.pattern.ask` inside its own body. Three test classes do subclass `PekkoActorService`, but their overrides are `sendToSelfWithFixedDelay` and `scheduleWithFixedDelay`, neither of these.

2. **`AsyncRPCClient.IgnoreReply = -1` is unreferenced.** Every other hit is the distinct `IgnoreReplyAndDoNotLog = -2` (used at `WorkerTimerService.scala:59` and `AsyncRPCClient.scala:196`). There is no Python mirror — `grep -rni "ignore_reply|ignorereply"` over `amber/src/main/python` and `src/test/python` is empty — and no proto sentinel, since `commandId` is a plain `int64`.

3. **`ExecutionResultService.convertWebResultUpdate`'s `case _ => throw` is unreachable.** `WebOutputMode` is a `sealed abstract class` with exactly three `final case class` subtypes, all in the same file and all matched above the default arm.

4. **`UserQuotaResource`'s `executions == null` is a dead guard** — jOOQ's `fetch()` returns a non-null `Result`. The sibling `getUserAccessedWorkflow` a few lines above does an unguarded `.fetchInto(...)`.

5. **`ResultExportService`'s `zipStream == null` guard is unreachable.** `exportOperatorsAsZip` has exactly two exits: it throws, or it returns a `new StreamingOutput { … }` literal. Note the sibling guard on the next path is *not* dead — `exportOperatorResultAsStream` genuinely can return null, and two tests assert the error it raises.

6. **`WorkflowService.lastCompletedLogicalPlan` is a write-only var** — its declaration, a single write, and a spec doc-comment are the only occurrences. Zero readers.

### How to reproduce?

Grep each symbol. For (3), removing the default arm produces no `match may not be exhaustive` warning, which confirms the match was already total.

### Version/Branch

main

### Task Type

- [x] Refactor / Cleanup
- [ ] DevOps / Deployment / CI
- [ ] Testing / QA
- [ ] Documentation
- [ ] Performance
- [ ] Other

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.