Skip to content

fix: skip dynamic analysis with a clear message when the runtime analyzer is missing - #54

Open
Arthurvroum wants to merge 7 commits into
mainfrom
41-runtime-analyzer-availability
Open

Arthurvroum wants to merge 7 commits into
mainfrom
41-runtime-analyzer-availability

Conversation

@Arthurvroum

@Arthurvroum Arthurvroum commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

The sidebar selects coretrace-runtime-analyzer by default, and the preflight only checked the static tools. On a Mac, whose releases do not include it, ctrace reported "Command not found in PATH: coretrace-runtime-analyzer", which installing the static tools cannot fix.

  • Before a run with dynamic analysis requested, the extension looks for the runtime analyzer where ctrace does: in its release (libexec), then on PATH (inside WSL on Windows).
  • Without it, the run goes on with the static tools only, and a warning says why, with a button that turns dynamic analysis off in the sidebar.
  • With dynamic analysis off, nothing changes.

Fixes #41

…yzer is missing

The sidebar selects coretrace-runtime-analyzer by default, and the
preflight only checked the static tools. On a Mac, whose releases do not
include it, ctrace reported "Command not found in PATH:
coretrace-runtime-analyzer", which installing the static tools cannot fix.

- Before a run with dynamic analysis requested, the extension looks for
  the runtime analyzer where ctrace does: in its release (libexec), then
  on PATH (inside WSL on Windows).
- Without it, the run goes on with the static tools only, and a warning
  says why, with a button that turns dynamic analysis off in the sidebar.
- With dynamic analysis off, nothing changes.

Fixes #41
@Arthurvroum Arthurvroum changed the title fix: skip dynamic analysis with a clear message when the runtime anal… fix: skip dynamic analysis with a clear message when the runtime analyzer is missing Nov 25, 2026
Comment thread src/extension.ts Resolved
Comment thread src/ctrace/RuntimeAnalyzer.ts Resolved
Comment thread src/ctrace/RuntimeAnalyzer.ts Resolved
Comment thread src/ctrace/RuntimeAnalyzer.ts Resolved
- Honor tools.coretrace-runtime-analyzer.path from the config file, and the
  build-tree libexec next to ctrace.
- Require an executable regular file, as ctrace does.
- Run the probe where ctrace runs: the WSL distribution chosen for the input,
  and the /tmp copy's layout in the Windows fallback.
- Stop a run with no tool left (static off, analyzer missing) instead of
  reporting a clean result.
- Isolate the integration tests from the host PATH.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Y58KK133XU78kVyRoxXi8
@sh00kapic

Copy link
Copy Markdown
Contributor

Full review comments:

  • [P1] Keep runnable Python files when no C analyzer remains — /private/tmp/coretrace-pr54.NJ7B0E/src/extension.ts:333-334
    In a workspace containing both .c and .py files, select only the Python static analyzer and the runtime analyzer. If the runtime analyzer is missing, buildCtraceArgs(..., 'c') correctly returns no tool flags, but the Python invocation still has --static. Returning here cancels the entire workspace scan and reports “No tools selected” instead of checking the Python files. Skip the C files and stop only if no input has a runnable analyzer.
  • [P1] Disable the missing analyzer in the effective ctrace config — /private/tmp/coretrace-pr54.NJ7B0E/src/extension.ts:332-333
    Setting dynamicEnabled: false removes --dyn, but does not override analysis.dynamic: true in uiState.configFile. I verified that ctrace v0.85.0 still attempts the missing runtime analyzer and reports an incomplete analysis with that config, even when the only CLI tool flag selects a static analyzer. Apply the fallback to the per-run config as well, including an explicit runtime entry in analysis.invoke, without modifying the user's file.
  • [P2] Apply runtime availability per WSL execution target — /private/tmp/coretrace-pr54.NJ7B0E/src/extension.ts:329-332
    With a Windows-hosted ctrace and workspace roots in two WSL distributions, buildCommand selects the distribution for each input, but this check applies the first file's result to every file. If only one distribution has the analyzer, file order determines whether the other distribution attempts a missing tool or the working distribution loses dynamic coverage. Cache the probe by execution target and apply its result to the files that run there.
  • [P2] Make the warning action effective for the command that showed it — /private/tmp/coretrace-pr54.NJ7B0E/src/extension.ts:348-349
    “Turn Off Dynamic Analysis” only changes the sidebar webview. Run Analysis from the Command Palette again and it uses an empty uiState, which requests dynamic analysis by default; ctrace.auditFunction explicitly sets it to true. Both paths therefore show the same warning after the user chose to turn it off. Either have those commands honor the saved choice or offer the action only for sidebar runs and label its scope.
  • [P2] Validate dynamicTools before calling includes — /private/tmp/coretrace-pr54.NJ7B0E/src/ctrace/RuntimeAnalyzer.ts:59-60
    A caller of the registered ctrace.runAnalysis command can pass dynamicTools: null. buildCtraceArgs previously handled non-array values through normalizeTools, but this new predicate throws after isRunning has been set. Subsequent scans then report that an analysis is already in progress until the extension reloads. Use the same array check and default as the argument builder.
  • [P3] Skip POSIX test setup on Windows — /private/tmp/coretrace-pr54.NJ7B0E/src/test-workspace/runtimeAnalyzer.test.ts:45-48
    The Windows skip is inside each test, so suiteSetup still tries to create a /bin/sh symlink. On a Windows developer machine without symlink privileges, that hook fails before Mocha can skip any tests. Skip the suite before creating the POSIX fixture or changing PATH.
  • [P3] Retain the skip reason without claiming static analysis finished — /private/tmp/coretrace-pr54.NJ7B0E/src/extension.ts:345-347
    The warning says the static tools “ran as usual” before scan setup or any tool invocation. If setup fails or the run is cancelled, that statement is false. The later output.clear() also erases the skip reason from the run log. Describe the fallback in future tense and write it after the output channel is cleared so users can tell which coverage the run omitted.

claude and others added 4 commits November 27, 2026 21:43
…nfig

- Probe each WSL execution target once and skip dynamic analysis only for
  the files that run where the analyzer is missing.
- When no C tool remains, drop those C files instead of cancelling the
  scan, so Python files are still analysed; stop only if nothing is left.
- Turn analysis.dynamic and a runtime entry in analysis.invoke off in a
  per-run copy of the user's config, which ctrace would otherwise follow.
- Offer "Turn Off Dynamic Analysis" only for runs started from the sidebar.
- Treat a non-array dynamicTools like buildCtraceArgs does.
- Word the notice in the future tense and log it after the output is cleared.
- Skip the POSIX test fixture on Windows in suiteSetup.
…r runs

The helper had been inserted between the doc comment and its function.
Only Run Analysis and Run Workspace Analysis get fromSidebar: the other
allowed commands keep their arguments unchanged.
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.

Dynamic analysis is selected by default even when the runtime analyzer is unavailable

3 participants