Skip to content

chore: update staging - #267

Merged
robertmarsal merged 4 commits into
stagingfrom
main
Nov 17, 2026
Merged

robertmarsal merged 4 commits into
stagingfrom
main

Conversation

@robertmarsal

Copy link
Copy Markdown
Contributor

No description provided.

vgoat21 and others added 4 commits November 11, 2026 09:26
* chore(ENG-2785): stop sending advanced_analysis

* feat(ENG-4410): align plugin design with Ghidra themes and RevEng.AI design system (#218)

* fix(ENG-4233): open portal links via OS launcher; right-click to open, double-click to pick (#220)

* fix(ENG-4402): sort and colour BigDecimal similarity and confidence cells (#221)

* fix(ENG-4412): show only status in check status dialog (#222)

* test: assert theme colours in similarity cell colour test

* feat(ENG-4404): open matched binary in portal from function matching results (#223)

* feat(ENG-4399): auto-run single function matching with 5 results (#224)

* feat(ENG-4401): prompt users to update the plugin (#225)

* feat(ENG-4405): always show user submitted debug symbols option (#226)

* fix(ENG-4375): handle unsized data types in decoder (#227)

* feat(ENG-4421): bump ai.reveng:sdk to 4.75.1-rc.1

* ci: run tests on PRs into staging

* fix(ENG-4400): keep Ghidra responsive when the network is down

Bound DNS lookups on the SDK HTTP client, since OkHttp's connect timeout
does not cover resolution and offline it can block for minutes.

Move the analysis status check on program open and the loading of
finished analysis results off the Swing thread into background tasks.

* feat(ENG-4403): add platform, architecture and user filters to function matching

Match the portal's Match Settings: platform (Linux, Windows, Android) and
architecture (x86 64/32-bit, ARM 64-bit) toggles, where none ticked means
any, and a user search backed by v3ListUsers. The selections go out in
MatchFilters for both binary- and function-level matching, which now
share one buildMatchFilters.

* feat(ENG-4406): redesign function matching dialog and fix its progress bar

Split the dialog into "Filter Search" and "Filter Results" sections with
the Match Functions button right-aligned under the filters. Filters get
captions instead of titled boxes, in two equal columns; selectors show a
search hint and only show their tag strip once something is selected.
The results count moves next to the results filter, and the table and
assembly comparison share the space evenly.

Progress: the step reported by the server is now shown (it was dropped),
the bar fills by completed steps, and the Match button turns into a
working Cancel while a run is going. A cancelled run can no longer hide
the progress bar of, or write results into, the run that replaced it.
Renames get a task dialog instead of the hidden matching bar.

* test(ENG-4406): wait for the automatic match before pressing Match Functions

The function-level dialog starts matching when it opens, and the Match
button now reads Cancel while a run is going. On slower CI runners the
tests' press landed during that first run and cancelled it, so the table
never filled. Wait for the first run to finish before pressing.

* fix: guard against null pointer exceptions and related crashes (#230)

* fix: guard against null pointer exceptions

* fix: harden type names, recent analysis picker, chat worker and pull transaction

* test: give each test fork its own Ghidra temp dir

* test(ENG-4406): check the dialog is idle on the EDT before pressing Match

The run is marked finished and the button relabelled in one Swing update;
checking from the test thread could see it half done and find the button
still reading Cancel.

* feat(ENG-4411): transfer name, signature or both from function matching

Replace the Rename buttons with Transfer dropdowns (Name / Signature /
Name and Signature), as in the portal. ApplyMatchCmd takes the part to
transfer; a signature-only transfer keeps the function's name and
namespace and pushes no rename to the portal.

* fix(ENG-4453): don't overwrite real signatures with the server placeholder

Type extraction stores `undefined f(void)` (source SYSTEM, no parameters,
return type id 0 or none) for every function Ghidra had no signature for,
and reports it with has_signature true. Attaching an analysis applied it over
DWARF and analysis signatures, matching transferred it, and sync never pushed
the better local signature because the server seemed to have one.

- Treat the placeholder as no signature when pulling, syncing and matching.
- Don't let a SYSTEM signature replace a local IMPORTED or ANALYSIS one; the
  function still takes the portal's name. Portal edits (USER) still apply.
- Count a placeholder as missing when pushing back. Its row exists, so the
  signature PUT accepts the local signature.

* ci: don't fail the build when publishing the test report flakes

dorny/test-reporter creates the check run and updates it about 0.3 s later.
The update intermittently returns 404, which failed jobs whose tests had
passed and needed re-runs. Failing tests already fail the Run tests step,
so the report step can continue on error.

* Give each TypedApiImplementation its own ApiClient

TypedApiImplementation configured the SDK's process-global default client,
so the setup wizard's validation instance re-targeted the running session
(a typo meant 401s until restart) and every instance stacked another
logging interceptor. Each instance now owns a new ApiClient, the chat
service reads the running service's client, and finishing the wizard
reconfigures the running service in place.

ENG-4454

* Retry idempotent requests on 5xx/429 and give uploads their own client

Adds a RetryInterceptor: GET/HEAD/PUT/DELETE/OPTIONS answered with a 5xx or
429 are retried up to four attempts, backing off 1s/2s/4s, or waiting as
long as Retry-After asks (seconds or HTTP date) up to 30s. POST and PATCH
are never retried.

Uploads go through a separate client with 5 minute read/write timeouts;
every other request keeps 15s.

ENG-4479

* Key debounced local-edit pushes by program as well as address/type path

* Suppress pushback per program and only around the sync's own writes

Pushback suppression was one service-wide flag held for the whole of a sync or
pull, network calls included, so every edit made meanwhile in any open program
was dropped. Because Ghidra delivers change events later from a timer, the
sync's own last events could also arrive after the flag was cleared and be
pushed back.

Suppression is now per program and spans only each write transaction. Events
are flushed before the transaction opens and again before suppression ends,
so the analyst's edits and the sync's own are told apart. Renames are never
suppressed: the plugin only writes ANALYSIS names and only USER_DEFINED ones
are pushed.

* Batch local renames per program, skip local-variable edits, re-tag re-created functions

Renames are debounced per program and sent as one batch request instead of one
request per function. Only parameter symbols and return-type/parameter function
changes schedule a signature push, since local variables never reach the
portal's signature. A function deleted and created again at a mapped address
gets its REVENGAI_SYNCED tag back.

* Wait for in-flight event delivery before ending a server write

Ghidra's event timer runs on the Swing thread and takes and delivers queued
events in one task. A flushEvents from the sync thread could find the queue
already taken and return while the sync's own events were still being
delivered, so suppression ended first and the sync's signature was pushed
back. Queue an empty Swing task after the flush to wait that delivery out.

* Report failed local-edit pushes and send them on the next sync

A push that fails is reported in the plugin log and the status bar, including
unchecked exceptions that used to die inside the discarded future. The edit
stays marked in the program's user data until a push succeeds, and Sync with
portal sends whatever is still marked, as one rename batch and one type pass,
before it reads the remote names.

A rename batch now checks renamed_count and fails when the portal renamed fewer
functions than were sent, and sync reports names and signatures that differ
between Ghidra and the portal instead of keeping the local copy silently.

* Report a failing portal once and retry unpushed edits automatically

Each failed push used to produce its own warning in the plugin log and the
status bar. Now the first failure reports the outage once; the rest go only to
Ghidra's console. The program's unpushed edits are retried in the background
after 30 s, 1 m, 2 m and then every 5 m, straight away when another push gets
through, and once they are up that is reported once too.

* Stop retrying edits the portal will never take, and isolate them

A failed push is now classified: no answer, a timeout, 5xx, 408 or 429 may
pass and is retried with backoff; 401/403 means the API key was refused; any
other 4xx, a rename the portal did not apply, or a local failure is final.

When the portal turns a batch down, the marked edits are sent one at a time,
so the ones it takes go up and only the rejected ones stay marked. Each
rejected edit is reported once and not retried automatically. A refused key is
reported once and retrying resumes when a push next succeeds. Rejected edits
stay marked for the next Sync with portal.

* Report the edits that go up once a refused API key works again

A refused key now counts as an outage for reporting, so the edits pushed once
the key works are reported like those pushed after the portal comes back. The
sync summary no longer promises that failed edits wait only for the next sync.

* fix(ENG-4464): bound the auto-unstrip poller, make it stoppable and stop it on Detach

The poller now ends on completion, failure, stopPolling (even mid-poll),
a 30 minute cap, or a non-transient error. Transient errors (no answer,
5xx, 408, 429) back off and retry. Unexpected runtime errors are reported
instead of killing the poller silently, and every way of giving up is
shown in the RevEng.AI log and the status bar.

Detach now stops the poller and detaches local edit sync before removing
the association, and the post-unstrip sync re-checks that the program is
still attached to the polled analysis.

* fix(ENG-4459): undo a half-finished attach and offer a retry

If pulling the function info failed after the function ids were committed,
the program counted as analysed though nothing was pulled, Local Edit Sync was
not attached, and loading again failed with "Previous function property map
still exists". A failed or cancelled pull now takes the ids back out, loading
replaces any association already on the program, and the analyst gets a Retry
dialog and a Retry loading results action.

* fix(ENG-4457): rename on the portal only the matches applied locally

The binary-level transfer sent every selected match to the portal before
applying them, so functions ApplyMatchCmd skips (analyst-set names, names
with spaces, thunks, unmapped functions) were renamed on the server while
keeping their local name. Apply first, then batch-rename only the matches
that were applied.

"Apply Match" files the function under RevEng.AI::<matched binary>, and
the reactive push sent "<matched binary>::<name>". qualifiedServerName now
leaves out RevEng.AI and every namespace under it.

* fix(ENG-4457): leave the transferred renames to the reactive push

Transferring names also sent its own batch rename, so every applied
rename reached the portal twice, and a portal failure showed a dialog
error on top of the sync service's retry. LocalEditSyncService already
pushes exactly the renames applied locally, so drop the explicit batch.

* fix(ENG-4464): let Detach cancel a running auto-unstrip sync and stop quietly when unstrip never starts

The poller now stays registered until its post-unstrip sync returns, so
stopPolling (Detach, program close, dispose) can cancel it mid-sync. The
sync runs with a monitor that is cancelled with the poller, so its
transactions roll back and the failure is not reported as a warning.

An analysis whose auto-unstrip stays UNINITIALISED or UNKNOWN for five
minutes is no longer announced or warned about; polling ends with a log
line only.

Also: classify RuntimeException-wrapped API errors before giving up, point
at the API key on 401/403, name the outage when the time limit is spent
retrying, and log why a sync was skipped accurately.

* fix(ENG-4459): roll back a failed load in one transaction

Hold one transaction across associating the function ids and pulling the
results, and abort it when the load fails or is cancelled. Undo can no
longer bring back a half-attached program, and changes made before a
local failure part way through the pull are rolled back too.

Skip the Retry dialog for a program closed during the load, disable the
Retry action as soon as a retry starts, and show the API error message
without the wrapping exception's class name.

* fix(ENG-4460): retry transient errors while polling analysis status (#248)

* fix(ENG-4461): bound and back off every status polling loop

Analysis, function matching, Similar Functions and AI decompilation now
poll through one StatusPoller: an interval that doubles while the status
is unchanged (reset on any change), an overall time limit, a terminal
state for unrecognised statuses, and prompt cancellation.

- Analysis: Unknown ends the wait, waits stop after 3 hours, and the
  analyst is told in the RevEng.AI log and status bar. Reopening a
  program resumes Uploaded analyses and reports Unknown ones.
- Matching and Similar Functions: an unrecognised status (e.g. the
  server's CANCELLED) or the time limit ends the run with a message.
- AI decompilation: a non-409 summary trigger failure ends the wait, a
  Regenerate action reruns a FAILED decompilation, and a 404 on the
  status poll is reported as "function not found" instead of being read
  as UNINITIALISED.

* fix(ENG-4461): point unfinished-wait messages at a recovery that works

Check status only shows the current status once and never resumes the wait, so unrecognised-status messages now tell the analyst to reopen the program. The matching timeout message says Match Functions starts the matching again, the AI decompilation message drops the SDK placeholder status name, and the decompilation cache is now a ConcurrentHashMap since background tasks write to it.

* test(ENG-4461): drive StatusPoller timing tests with a fake clock

The backoff and time-limit tests measured real sleeps in milliseconds and
failed on slower CI runners. StatusPoller now takes an injectable clock and
sleeper (package-private, tests only), and the tests assert the exact waits.

* fix(ENG-4476): normalise api and portal hostnames (#250)

* fix(ENG-4465): report server-side analysis errors with the log tail and offer Detach

An analysis started in the session that ended in Error showed nothing: the
program stayed attached, so Create new and Attach stayed disabled. The plugin
now handles the Error status event: it fetches the analysis log off the Swing
thread and shows its last lines in a dialog offering Detach or Keep attached.
Detach runs the same code as the Detach menu action. Each failure is reported
once while the program is open; reopening a program with a failed analysis
goes through the same path instead of its own text-only error dialog.

The analysis log panel now ends with how the analysis ended (completed or
failed) instead of stopping at the last server log line.

* test(ENG-4465): wait for the work behind the error dialog instead of a timeout

The dialog tests waited for the dialog with a fixed timeout, which slow CI
runners exceeded. They now wait for the tasks and Swing events that lead to it.

* test(ENG-4465): wait for every stage before looking for the error dialog

The Queued event, the wait, the Error event, the log fetch and the dialog
alternate between Swing and background tasks; the helper stopped one stage
short, so the dialog was found only when the fetch happened to be quick.

* test(ENG-4465): poll for the error dialog instead of counting task rounds

A fixed number of waitForTasks/waitForSwing rounds was not always enough for the
event, task, event, task, dialog chain on CI runners. Poll for the dialog with a
generous ceiling instead.

* fix(ENG-4478): show the server's error message on API failures (#252)

* test(ENG-4485): cover every SDK method and model the plugin uses

Extend SdkSchemaTest with the AI decompilation status/inline-comment
edit calls, auto-unstrip status, canonical names, IamUsersApi.getMe and
the models they return, plus the MatchedFunction name/binary/hash
accessors.

Add SdkRecordedResponseTest, which serves staging-shaped bodies through
a stub server and drives the plugin's TypedApiImplementation calls, so a
missing required field or an unknown enum value fails here rather than
at runtime.

* feat(ENG-4563): migrate upload and analysis creation to v3 (#253)

* fix(ENG-4475): treat an empty mangled_name as absent

Staging sends mangled_name as "" for functions with no mangled symbol.
FunctionInfo only fell back to the function name on null, so it kept the
empty string, and the FUN_/sub_ guard in the rename branch never matched
it. Fall back on a blank name too.

* fix(ENG-4484): load analysis details off the EDT before opening Function Matching

The matching dialog fetched the analysis' basic info in its constructor,
which runs on the Swing thread from the menu actions. The first fetch is
uncached and can block the UI for several seconds, and when it failed the
constructor returned early and the action still showed a dialog with no
work panel.

The actions now go through AbstractFunctionMatchingDialog.showWhenLoaded,
which fetches the details in a background task and builds the dialog with
them, or reports the failure and shows no dialog. The dialogs take the
details as a constructor argument.

* test(ENG-4483): pin how a transferred signature reaches the portal

The fix itself landed with ENG-4457, which left transferred names to the
reactive push and dropped the comment claiming a signature-only transfer
had nothing to push. Add the missing coverage: a signature-only transfer
pushes the signature once and no rename, and a name-and-signature
transfer pushes each once.

* feat(ENG-4587): add cross-platform installation script (#259)

* fix(ENG-4588): stop staging CI flakes in dialog and sync tests

TestAnalysisLogComponent waited for its error dialog with
waitForDialogComponent(null, OptionDialog.class, 30_000), but Ghidra
ignores that timeout and waits only 2s. On a slow runner the chain from
the Queued event to the dialog (task, Swing, task, Swing) takes longer,
and the test failed with "Timed-out waiting for window". The awaitDialog
helper that polls against a 30s deadline moves from
FunctionLevelFunctionMatchingDialogTest into the shared base class, and
both classes use it. The other waitForDialogComponent calls show their
dialog straight from Swing, so the 2s wait is enough for them.

RejectedLocalEditsTest woke once the mock had recorded both renames, but
the mock records them inside the send, and the unpushed mark is cleared
only after the send returns. Asserting the mark right away could race
the sync thread, so the test now waits for it to clear.

* fix(ENG-4590): stop the analysis wait on Detach and close, ignore stale events

Detaching while an analysis was still running left its monitoring task
polling, and the program stayed in the log component's tracked map. A
new analysis for the same program was then never monitored, and when
the old analysis finished its Complete event loaded the old analysis'
function IDs into a program whose options pointed at another analysis.
Closing the program also left the wait polling, and holding the
program, for up to three hours.

Each wait now runs on its own cancellable monitor that still shows its
progress on the shared TaskMonitorComponent. Detach and programClosed
stop the program's wait, and close also drops its stored logs and
terminal status line. A status event for a different analysis of an
already tracked program replaces the old wait instead of being
ignored, and a finished wait only removes its own map entry. The shared
component's cancelled state is cleared once no wait uses it, so a
Cancel press does not cancel the next wait.

The plugin ignores status events, and skips results loads, for a
ProgramWithID that is no longer the program's known analysis, so a
Complete or Error from a wait that had not yet noticed the detach does
nothing.

* fix(ENG-4589): never push a null data type id

The 500-type closure cap was applied to the union of every function in a
push batch. Since pushes go out in batches (ENG-4482), a large binary
pushed types past the cap without a server id, and the signature and
struct-member writes then sent null data_type_ids. Both endpoints replace
the stored value in full, so this silently erased the portal's types, and
the edits were cleared as if they had gone up.

The cap now bounds each function's closure on its own, and the batch
passes the union of those closures to AnalysisDataTypesService.ensureTypes,
which de-duplicates without capping and already chunks its writes to the
endpoints' 100-type limit. Capping per function keeps the bound on a
single walk while making a function's ids independent of whatever else
shares its batch.

A reference that still has no id is never sent as null: a type
definition that would name one is withheld, and a function whose
signature or reachable types cannot be written in full is not sent. It
stays marked as unpushed and is reported like any other edit the portal
did not take (UnresolvedDataTypesException, classified REJECTED).

Test mocks that answered every create with a generic "pushed" type now
echo the requested types, since a signature naming unresolvable types is
no longer sent.

* fix(ENG-4588): give the matching-status wait its own deadline

testUnrecognisedMatchingStatusStopsPolling waits for the dialog to see
CANCELLED. The dialog first sleeps its 2s poll interval, and Ghidra's
waitForCondition gives up after about the same time, so the test failed
on slow runners. It now uses a shared awaitCondition helper with a 30s
deadline.

awaitDialog also takes an optional failure message. The analysis error
dialog wait uses it again to say "the failed analysis should be reported".

* fix(ENG-4590): drop a results load the program was detached from mid-load

The plugin checked that the program was still attached only before the
load started. Loading makes several requests before it writes the
function IDs, so a Detach followed by Attach or Create new during those
requests still wrote the old analysis' IDs into the program.

The function info is now fetched before the load transaction opens,
and the service checks the attachment again before writing. If the
program was detached during the pull, the function IDs are removed and
the transaction is committed, not rolled back, because the Detach's own
change joined the same transaction. The plugin treats this as an
abandoned load, not a failed one.

Also from review: a stopped wait no longer passes its last log line to
the shared monitor, the deprecated checkCanceled honours a stop, the
shared monitor is updated on the Swing thread, logs for a closed
program are dropped, and a Cancel press now stops each running wait so
the shared monitor can be reset for the next one.

* fix(ENG-4589): explain closure-limit holds and quieten their logging

A function whose own closure is over the 500-type limit can never be
pushed: the types at the edge of the walk refer to ones it never
reached, so it is held back rather than written with null ids. The
limit stays, because it bounds the walk a single reactive edit can
trigger, but the reason now says so. UnresolvedDataTypesException
records whether the closure limit was the cause, and its message
names the limit instead of implying the portal gave no id.

A held-back function is an expected outcome, so the reactive push
logs it without a stack trace, and the sync backfill logs one summary
line with a few examples instead of one warning per function.

Adds a test for a single function over the limit: no null ids, no
partial struct write, no signature, and the edit stays marked. The
test mock's create answer now reuses CreatedDataTypes.echo.

* fix(ENG-4590): use the TaskMonitor names Ghidra 12.2 still has

Ghidra 12.2 removed the deprecated checkCanceled and clearCanceled, so the
wait monitor failed to compile there. Call and override only
clearCancelled and checkCancelled, which every supported version has.

* fix(ENG-4590): drop the duplicate awaitDialog that breaks the test build

ENG-4588 moved awaitDialog into RevEngMockableHeadedIntegrationTest while
ENG-4590 added a private copy to DetachDuringAnalysisTest. With both on
staging, the private static method clashes with the inherited one and
compileTestJava fails. The two are identical, so use the shared helper.

* fix(ENG-4590): drop the duplicate awaitDialog that breaks the test build

ENG-4588 moved awaitDialog into RevEngMockableHeadedIntegrationTest while
ENG-4590 added a private copy to DetachDuringAnalysisTest. With both on
staging, the private static method clashes with the inherited one and
compileTestJava fails. The two are identical, so use the shared helper.

(cherry picked from commit d5191b9)

* test(ENG-4590): dump thread stacks when awaitDialog times out

The error-dialog tests still time out now and then on CI after a full 30s,
never locally. Print every thread's stack on a timeout so the next failure
shows where the work that leads to the dialog stopped.

* fix(ENG-4590): fire analysis status events after the current delivery

Ghidra's EventManager drops an event fired while another of the same type
and name is being delivered, taking it for an event loop. The analysis
wait reports its status from a background thread, so on a slow machine
its first status (an Error or a Complete) could arrive while the Queued
event that started the wait was still being delivered, and was lost:
the failure was never reported, or the results never loaded. This is
what made the error-dialog tests time out on CI after a full 30s.

Fire status events from background threads with fireLater, which hands
them to the Swing thread to be fired once the current delivery is done.

* test(ENG-4590): dump thread stacks when awaitDialog times out

The error-dialog tests still time out now and then on CI after a full 30s,
never locally. Print every thread's stack on a timeout so the next failure
shows where the work that leads to the dialog stopped.

(cherry picked from commit a6867d1)

* fix(ENG-4590): fire analysis status events after the current delivery

Ghidra's EventManager drops an event fired while another of the same type
and name is being delivered, taking it for an event loop. The analysis
wait reports its status from a background thread, so on a slow machine
its first status (an Error or a Complete) could arrive while the Queued
event that started the wait was still being delivered, and was lost:
the failure was never reported, or the results never loaded. This is
what made the error-dialog tests time out on CI after a full 30s.

Fire status events from background threads with fireLater, which hands
them to the Swing thread to be fired once the current delivery is done.

(cherry picked from commit ad40ca3)

* fix(ENG-4588): don't let a late status from a cancelled wait resume it

Since the wait's statuses are fired after the current event delivery
(fireLater), the Queued a wait reported can arrive after the wait has been
cancelled and has ended. With the program no longer tracked,
AnalysisLogComponent took it for a new analysis and started another wait,
which cleared the cancel and polled on. This is what failed
testCancelledMonitoringUntracksProgram on the release PR.

Statuses a wait reports now carry their own source, and never start a
wait: only Start Analysis, reopening a program and the like do.

* ci(ENG-4588): complete a test report check the reporter left in progress

dorny/test-reporter creates its check run and updates it with the
results a moment later. That update intermittently 404s, because the new
check run is not visible to the API yet; continue-on-error keeps the job
green, but the check run stays in progress for good, so the PR never
shows all checks finished.

When the report step fails, find any 'Tests (Ghidra X)' check run for the
head commit that is not completed, retrying while it becomes visible, and
complete it with the outcome of the Run tests step. Look them up with
filter=all: with filter=latest the endpoint returned no runs at all for
two of the three stuck checks.

* chore: bump SDK to 4.77.1 (#266)

---------

Co-authored-by: Brett Cherrington <brett@reveng.ai>
Co-authored-by: Brett Cherrington <brett+github@annalytics.co.uk>
Co-authored-by: Joshua Villalta <93329405+vgoat21@users.noreply.github.com>
@robertmarsal
robertmarsal marked this pull request as ready for review November 17, 2026 14:57
@robertmarsal
robertmarsal requested a review from a team as a code owner November 17, 2026 14:57
@robertmarsal
robertmarsal merged commit 2631b89 into staging Nov 17, 2026
29 checks passed
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