Skip to content

fix: take the run guard before the first await and always release it - #50

Open
Arthurvroum wants to merge 1 commit into
mainfrom
35-run-guard
Open

Arthurvroum wants to merge 1 commit into
mainfrom
35-run-guard

Conversation

@Arthurvroum

Copy link
Copy Markdown
Collaborator

Run Analysis set isRunning only after its preflight: two requests made while the dependency prompt was open could both pass the check. A setup step that threw after the flag was set (opening a file that disappeared, for automatic entry points) left it set, so every later run reported an analysis already in progress. A rejected request also reset the active run's sidebar status.

The handler now runs inside runGuarded(), which takes the guard synchronously, reports setup failures, and releases it on every exit. A rejected request only shows its warning.

Fixes #35

Run Analysis set isRunning only after its preflight: two requests made
while the dependency prompt was open could both pass the check. A setup
step that threw after the flag was set (opening a file that disappeared,
for automatic entry points) left it set, so every later run reported an
analysis already in progress. A rejected request also reset the active
run's sidebar status.

The handler now runs inside runGuarded(), which takes the guard
synchronously, reports setup failures, and releases it on every exit.
A rejected request only shows its warning.

Fixes #35
@sh00kapic

Copy link
Copy Markdown
Contributor

The guard takes ownership before preflight and releases it in finally, but the new tests fail on Windows and can report a false failure on a slow runner. These findings are based on source review; the VS Code test suite was not run.

Full review comments:

  • [P1] Count runner calls instead of matching the SARIF flag — /Users/shookapic/CoretraceProjects/coretrace-vscode/src/test-workspace/runGuard.test.ts:73-74
    On Windows, CommandBuilder.writeWslScript() puts --sarif-format inside a temporary script. The command recorded by the stub contains only the WSL launcher and script path, so this filter returns zero even when the guard correctly allows exactly one run. That fails the Windows CI job. Since staticOff disables the extra stack pass, assert that launched.length is one.
  • [P2] Wait for the runner stub instead of sleeping for 300 ms — /Users/shookapic/CoretraceProjects/coretrace-vscode/src/test-workspace/runGuard.test.ts:58-61
    The first command still has to find the compilation database and build the platform command before it reaches the stub. If setup takes more than 300 ms, this assertion fails on a correct implementation and skips release(), which can leave the first run holding the guard during later tests. Have the stub signal when it starts, await that signal before issuing the second request, and release the gate in finally.

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.

Concurrent run requests can pass preflight together, and setup failures can leave analysis locked

2 participants