Skip to content

test(ghidra): assert projected limitations instead of a stale literal - #9268

Merged
cursor[bot] merged 4 commits into
morluto:mainfrom
2SinceJuly:fix/9267-ghidra-limitation-assertion
Nov 10, 2026
Merged

cursor[bot] merged 4 commits into
morluto:mainfrom
2SinceJuly:fix/9267-ghidra-limitation-assertion

Conversation

@2SinceJuly

@2SinceJuly 2SinceJuly commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #9267.

tests/boundary/mcp/ghidraEvidenceMcp.test.ts asserted that an analyze_function result carried a limitation containing original executable bytes are never written. 8eff65127 (#9246) rewrote that entry in src/ghidra/GhidraProviderCapabilities.ts:25 and removed the prose checks in src/ghidra/GhidraProvider.behavior.test.ts, but this boundary test was not updated. Test shard (5/8) and Portable tests failed before #9276 updated that literal on main.

Problem and expected behavior

Trigger: run npx vitest run tests/boundary/mcp/ghidraEvidenceMcp.test.ts on c5301e614. The MCP result now carries the checkpoint-disabled wording, the test still demands the removed phrase, and one of eleven tests fails. After #9276 updated the literal, this follow-up removes the duplicated wording and checks that every source-declared limitation reaches the MCP result.

Change and scope

The removed literal is replaced with a comparison against limitationsFor("analyze_function") itself: each limitation the capability table declares for that operation must be present in the projected MCP result.

This keeps the projection-completeness coverage without a second copy of prose the provider owns, matching #9246's stated intent to remove prose-driven checks. A limitation dropped between the capability table and the MCP result still fails the test — verified with a negative control (see below).

Not included: src/ghidra/GhidraProviderCapabilities.ts is unchanged. The default auto-analysis complete assertion is kept as-is; it covers a different sentence that #9246 did not touch.

Follow the contribution scope. This is an ordinary test fix within existing boundaries; no maintainer scope decision applies.

Contract and boundary impact

  • Semantic owner and earliest changed stage: unchanged. limitationsFor in src/ghidra/GhidraProviderCapabilities.ts remains the sole producer; only the test's assertion changed.
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: unchanged.
  • Provider, bridge, target-format, or platform compatibility: unchanged.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged.
  • Target selection, authority, upstream behavior, and cleanup details: not applicable.
  • Generated metadata: none.

Expected effects: documentation or usability only; no target interaction. This PR changes a test assertion only.

Evidence and regression coverage

  • Tests added or updated: tests/boundary/mcp/ghidraEvidenceMcp.test.ts — the stale literal assertion is replaced with a limitationsFor("analyze_function") containment check.
  • Base reproduction: on c5301e614 before the change, the test fails with AssertionError: expected { …(16) } to match object { operation: 'analyze_function', …(3) } and the diff showing the received checkpoint-disabled limitation. Test Files 1 failed (1) / Tests 1 failed | 10 passed (11).
  • Negative control: appending a "negative-control-limitation" entry to the expected set made the test fail with expected [ …(10) ] to include 'negative-control-limitation', then the control was reverted. The containment check therefore still catches a limitation that the MCP result drops.
  • User-visible CLI/MCP output: none; no production code changed.
  • Remaining proof gaps: this run is against a simulated Ghidra bridge, as before. No real Ghidra installation was used, so it establishes the MCP projection invariant only — not real-provider limitation text.

Boundary regression applicable here: projection/parity between the capability table and the MCP boundary result. No lifecycle regression applies — no resource ownership or cleanup path is touched.

Validation performed

  • PATH=/opt/homebrew/opt/node@24/bin:$PATH npx vitest run tests/boundary/mcp/ghidraEvidenceMcp.test.ts — 11/11 passed.
  • npm run check:fast — typecheck and lint successful (2 tasks, 7.0s).
  • Negative control described above — failed as intended, then reverted.

The earlier validation did not run the full suite, npm run test:focused, or sharded CI; the focused run after the base update is recorded below.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.

  • Real Hopper/Ghidra, browser, or OS coverage: none. The existing test uses the simulated bridge in ghidraMcpHarness.ts.

  • Package or release metadata impact: none.

  • Security, privacy, process, or containment review: none; test-only change.

  • After merging current main in 880c0e0590, npm run test:focused -- tests/boundary/mcp/ghidraEvidenceMcp.test.ts passed all 11 tests against the simulated bridge.

On current head fde786c, the wording-tolerant follow-up also passed the 11-test Ghidra MCP boundary suite locally. This uses a simulated bridge; real Ghidra was not run.

Author readiness

Human owner: @2SinceJuly

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

8eff651 (morluto#9246) replaced the checkpoint-disabled health limitation but
left tests/boundary/mcp/ghidraEvidenceMcp.test.ts asserting the removed
"original executable bytes are never written" text, so Test shard (5/8)
and Portable tests have been red on main since.

Compare the MCP result's limitations against limitationsFor() itself, so
the boundary test keeps covering projection completeness without holding a
second copy of prose the provider owns. A limitation dropped between the
capability table and the MCP result still fails the test.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T21:15:27.390788Z aba2805 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This test-only PR appears safe to merge.

Summary

This test-only change checks that source-declared Ghidra limitations reach the MCP result and relaxes the remaining auto-analysis wording check.

  • The Ghidra boundary test checks every declared limitation in MCP output.

Reviews (4) · Last reviewed commit: "test(ghidra): keep the auto-analysis che..." · Reviewed by Greptile

# Conflicts:
#	tests/boundary/mcp/ghidraEvidenceMcp.test.ts
main added two more limitation expectations to the dossier block while
this branch replaced the prose literals with assertions derived from
limitationsFor. Keep both: the branch's derivation for every declared
limitation, plus main's added expectations.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aba2805c03

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

The parent test matched /auto.analysis.*complete/iu so a harmless reword of
the source-health limitation would not fail it. This change replaced that with
an exact substring and regressed the coupling the surrounding loop avoids: the
loop below already pins the provider's own text, so the literal only re-copies
prose the provider owns.
@CassieFox23

Copy link
Copy Markdown
Contributor

TL;DR: I ran the PR's one changed test file at head fde786c on Node 22.23.4, 24.22.1 and 26.12.1. Each run passed all 11 tests. I did not run the probes that would show whether the new assertions catch a dropped entry.

Findings

Check Node 22.23.4 Node 24.22.1 Node 26.12.1
tests/boundary/mcp/ghidraEvidenceMcp.test.ts pass: Test Files 1 passed (1); Tests 11 passed (11) pass: Test Files 1 passed (1); Tests 11 passed (11) pass: Test Files 1 passed (1); Tests 11 passed (11)
  • Against the merge base 2d25a09, the PR changes 1 file. The 1 file is the test file tests/boundary/mcp/ghidraEvidenceMcp.test.ts, with 0 other files.
  • The head is 47 commits behind main 99d00d1.
  • Workflow runs on the head: CI completed/success, PR readiness completed/success (2 runs), PR title completed/success (2 runs), CodeQL production completed/skipped.
  • 19 check runs succeeded. The 19 include Source tests, Portable tests, Static checks, Build package, CI required and Test shard (1/8) through Test shard (8/8).
  • 27 check runs were skipped. The 27 include ghidra_bridge.
  • The commit status PR readiness is success.
  • GitHub shows mergeable true, state clean, and not a draft.

Not run

  • A run of npx vitest run tests/boundary/mcp/ghidraEvidenceMcp.test.ts at fde786c with a temporary expect(limitationsFor("analyze_function").length).toBeGreaterThan(0) added.
  • A probe that drops one entry from the MCP projection, not the expected side, to see whether tests/boundary/mcp/ghidraEvidenceMcp.test.ts fails.
  • A merge with current main, 99d00d1.
Test setup
  • Box: Fedora 44 VM (4 vCPUs, 8 GB) on my Nobara 44 PC, Linux 7.2.11
  • Node: 22.23.4, 24.22.1, 26.12.1
  • Head / base: fde786c / 2d25a09 (merge base with main)
  • Install: npm ci --offline and npm run test:prepare on Node 24.22.1
Commands
npm ci --offline
npm run test:prepare
xvfb-run -a npm run test:focused -- tests/boundary/mcp/ghidraEvidenceMcp.test.ts

🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

@2SinceJuly

Copy link
Copy Markdown
Contributor Author

Ran the two probes you flagged as not run, at fde786cc4f on Node 24.22.1.

Does the new assertion catch a dropped entry? Yes. Removing one health limitation from the projection (ghidraHealthLimitations(source).slice(1) in limitationsFor) turns ghidraEvidenceMcp.test.ts red at :679 with 10 passed | 1 failed, and the diff shows exactly the dropped string missing from limitations. Restored immediately; the file is unchanged.

Is the loop stronger than the literal it replaced? Yes. The literal was two regexes picked from the provider's prose, so a provider-side wording change either broke the test or was silently tolerated by the /iu pattern. limitationsFor("analyze_function") is the same array the projection spreads, so the loop fails on any entry the projection drops and does not care how the prose is worded. The two stringMatching assertions are kept because they pin the two limitations this test is actually about.

No code changed. The only thing I did not run is your merge against current main (4a1c4a59b); this branch is 47 commits behind and I would rather not push a merge you have not reviewed. Say if you want it in this PR.

@cursor
cursor Bot merged commit 27edc5c into morluto:main Nov 10, 2026
47 checks passed
@morluto morluto added area: tests Test suite and verification provider: ghidra Analysis provider / engine: ghidra labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tests Test suite and verification provider: ghidra Analysis provider / engine: ghidra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] ghidraEvidenceMcp asserts a limitation string that #9246 removed, leaving main CI red

3 participants