Skip to content

fix(cli): close handle on all error paths, return Optional from openOnWorker#59

Merged
dfa1 merged 1 commit into
mainfrom
fix/cli-sonar-reliability
Jun 19, 2026
Merged

fix(cli): close handle on all error paths, return Optional from openOnWorker#59
dfa1 merged 1 commit into
mainfrom
fix/cli-sonar-reliability

Conversation

@dfa1

@dfa1 dfa1 commented Jun 19, 2026

Copy link
Copy Markdown
Owner

ViewCommand leaked the opened VortexHandle if anything threw between opening it
and entering the grid-source try block (Sonar S2095, BLOCKER → reliability E):
the close lived only in the inner try's finally. Wrap every post-open step in a
try/finally that closes the handle on the worker thread.

CliHandles.openOnWorker now returns Optional instead of null, and
ViewCommand/TuiCommand branch on isEmpty(). The null sentinel made Sonar flag
the missing-file guards as always-false (S2583) because it lost dataflow across
the runAndAwait lambda; Optional both removes the smell and is idiomatic.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

…nWorker

ViewCommand leaked the opened VortexHandle if anything threw between opening it
and entering the grid-source try block (Sonar S2095, BLOCKER → reliability E):
the close lived only in the inner try's finally. Wrap every post-open step in a
try/finally that closes the handle on the worker thread.

CliHandles.openOnWorker now returns Optional<VortexHandle> instead of null, and
ViewCommand/TuiCommand branch on isEmpty(). The null sentinel made Sonar flag
the missing-file guards as always-false (S2583) because it lost dataflow across
the runAndAwait lambda; Optional both removes the smell and is idiomatic.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dfa1 dfa1 merged commit 27446d8 into main Jun 19, 2026
6 checks passed
@dfa1 dfa1 deleted the fix/cli-sonar-reliability branch June 19, 2026 16:20
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