Skip to content

fix(reporter): time out a PasteBin upload instead of hanging forever - #64

Closed
soloturn wants to merge 1 commit into
masterfrom
soloturn-upload-timeout
Closed

fix(reporter): time out a PasteBin upload instead of hanging forever#64
soloturn wants to merge 1 commit into
masterfrom
soloturn-upload-timeout

Conversation

@soloturn

Copy link
Copy Markdown
Contributor

AI-assisted change proposal. Filed by agent driven by @soloturn via GDD.

Summary

Found while manually testing the reporter dialog: clicking "PasteBin" disabled the button, showed "please wait", and never resolved either way. PastebinUploadRunnable.call() makes a real HTTP POST via jpastebin with no timeout of its own, and UploadPanel.upload() just ran it on a bare thread and waited unboundedly for callable.call() to return - a slow or unreachable server left no way to tell "still working" from "will never finish".

upload() now submits to an ExecutorService and waits at most 30s (configurable via a package-private constructor for tests) via future.get(timeout, SECONDS), cancelling the future and reporting a clear "Upload timed out after 30s" failure if it's not done by then.

The wait-and-dispatch logic is split into a small static method, awaitUpload(), that's plain Future/Consumer plumbing with no Swing dependency - lets UploadPanelTest exercise the timeout, success, and underlying-failure-unwrapped-from-ExecutionException paths directly against real Futures, without a button-click harness.

Test plan

  • UploadPanelTest - a deliberately-slow Callable times out and reports a clear IOException (not a hang); a fast one reports success; a Callable throwing surfaces the real exception, not ExecutionException's wrapper.
  • ./gradlew build - clean.

Related

Found while manually testing the reporter dialog: clicking "PasteBin"
disabled the button, showed "please wait", and never resolved either
way. PastebinUploadRunnable.call() makes a real HTTP POST via jpastebin
with no timeout of its own, and UploadPanel.upload() just ran it on a
bare thread and waited unboundedly for callable.call() to return - a
slow or unreachable server left no way to tell "still working" from
"will never finish".

upload() now submits to an ExecutorService and waits at most 30s
(configurable via a package-private constructor for tests) via
future.get(timeout, SECONDS), cancelling the future and reporting a
clear "Upload timed out after 30s" failure if it's not done by then.

The wait-and-dispatch logic is split into a small static method,
awaitUpload(), that's plain Future/Consumer plumbing with no Swing
dependency - lets UploadPanelTest exercise the timeout, success, and
underlying-failure-unwrapped-from-ExecutionException paths directly
against real Futures, without a button-click harness.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 573c39c2-b371-4d0e-91b1-4bc483a0c3dd


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.

@BenjaminAmos

Copy link
Copy Markdown
Contributor

I have some concerns here about unit tests reaching out to external URLs, especially for potentially modifying operations, such as POST. The unit tests should be capable of running completely offline.

@soloturn

Copy link
Copy Markdown
Contributor Author

Superseded by #70, which combines this with #65 into a single PasteBin-upload fix.

@soloturn soloturn closed this Aug 22, 2026
soloturn added a commit that referenced this pull request Aug 22, 2026
Addresses @BenjaminAmos's review concern on #64 (now folded into this
PR): these tests are already fully offline - PastebinUploadRunnable is
never instantiated, and new URL(...) only parses a string, it never
opens a connection. Making that explicit in the class javadoc so it
isn't mistaken for a real network-touching test again.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@soloturn

Copy link
Copy Markdown
Contributor Author

Re: @BenjaminAmos's comment on #64 (now here) about tests reaching out to external URLs - clarifying, since that PR's gone: neither UploadPanelTest nor UploadPanelFailureLoggingTest ever touches the network.

  • new URL("https://pastebin.com/...") only parses a URL string - it never opens a connection (that only happens on openConnection()/openStream(), which these tests never call).
  • Every simulated upload is a hand-written Callable<URL> (sleep-then-return, return-immediately, or throw) passed straight to UploadPanel.awaitUpload()/uploadForTesting(). PastebinUploadRunnable - the class that actually makes the real HTTP POST - is never instantiated by any test here.

So these are already fully offline and deterministic; nothing to change on that front. Happy to add an explicit comment in the test file noting this if it'd help future reviewers.

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.

2 participants