Skip to content

fix(comparison): keep unsupported function facets unknown - #2450

Merged
morluto merged 4 commits into
morluto:mainfrom
Melon-tgj:fix/function-facet-coverage-20261013
Oct 13, 2026
Merged

morluto merged 4 commits into
morluto:mainfrom
Melon-tgj:fix/function-facet-coverage-20261013

Conversation

@Melon-tgj

Copy link
Copy Markdown
Contributor

Summary

Keep unavailable function dossier facets unknown in structural comparisons.

Problem and expected behavior

When IDA does not collect comments, typed references, function-referenced strings/names or CFG blocks, analyze_function returns empty arrays. Comparing that dossier with itself currently labels those dimensions unchanged, which turns missing coverage into a claim of observed equality. This was reproduced through real MCP/IDA 9.5 sessions on both ARM64 and x86_64 samples against main ca2d15b3. Expected behavior is unknown when observation coverage is absent.

Change and scope

This adds an optional strict facet_availability contract, declares IDA's supported and unsupported facets at the producer, and keeps unavailable dimensions unknown with explicit reasons and null counts. Empty legacy facets without a coverage declaration stay unknown; explicitly observed empty facets remain comparable. Existing call relationship coverage checks are preserved. The MCP contract reference documents the added coverage field. Maintainer scope decision: not applicable to a routine evidence interpretation fix within existing analysis boundaries.

Contract and boundary impact

  • Semantic owner and earliest changed stage: dossier producer coverage is declared in the domain contract; the IDA adapter supplies its coverage facts.
  • Contribution scope: truthful interpretation of existing read-only analysis results.
  • CLI/MCP contract: optional strict field in function dossier Evidence; comparison statuses and counts become conservative for unavailable coverage.
  • Provider/platform compatibility: additive dossier shape; existing nonempty legacy facets remain usable. Real IDA 9.5 ARM64/x86_64 observed; real Hopper/Ghidra behavior unverified.
  • Evidence/provenance: observed absence and unavailable observation remain distinct; Evidence inputs are not rewritten.
  • Target selection/authority/cleanup: selected target and existing owned-database lifecycle unchanged.
  • Generated metadata/package/installation: catalog/schema generation consumes the new optional field; ignored generated files and local installation settings are not committed.

Expected effects: this compares captured data and existing read-only provider observations. Existing native analysis may launch its configured engine. The change introduces no new target execution, mutation, injection or protection recovery.

Evidence and regression coverage

  • 34 function comparison tests pass, including undeclared empty coverage, explicit unsupported coverage, observed-empty equality and malformed availability declarations.
  • Real public MCP/IDA 9.5 dual-architecture regression: the four affected dimensions fail as unchanged before the fix and pass as unknown after it; 16 checks pass in the tested local build.
  • Typecheck, lint and build pass using Node 24.20.0.

Validation performed

  • npm run test:local -- src/domain/functionComparison.test.ts src/ida/IdaMcpConnection.test.ts src/ida/IdaOperationFailures.test.ts — 67 pass in the combined local validation build, including all 34 comparison tests.
  • npm run check:fast and npm run build:cached — pass.
  • Real public MCP/IDA 9.5 dual-architecture regression — 16 pass after the fix; 8 before-fix failures show the four affected dimensions reported as unchanged on both architectures.

Compatibility, safety, and release

The optional field is additive, but legacy empty facets become deliberately more conservative. Other provider producers can adopt explicit availability when they can prove observed absence. This does not add IDA comments, typed references or CFG capability. No private targets or machine-specific configuration are included. Broad cross-provider conformance and completed-task performance/memory costs remain unmeasured. I welcome feedback on the coverage contract before integration.

Before merge

  • Concrete problem, focused title, owning contract documentation and regression coverage.
  • Final diff checked for secrets, unrelated changes and private targets.
  • Observations, failed attempts, provenance and unsupported outcomes remain visible.
  • Maintainer review of the optional availability contract and conservative legacy-empty behavior. No separate issue is linked because this PR includes the bug reproduction.

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

@greptileai review

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues remain in the reviewed changes.

Summary

The PR adds optional facet_availability declarations so missing observations do not count as observed equality.

  • Function comparisons keep unobserved facets unknown.
  • IDA dossiers report which function facets were observed.
  • Native facet views show when requested data is unavailable.
  • Call-path searches stay unknown when a function's callees are unavailable.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Function dossier] --> B{Required facet observed?}
  B -->|Unavailable| C[Comparison unknown with null counts]
  B -->|Available| D[Compare recorded values]
  A --> E[Native facet view]
  E -->|Unavailable| F[Return availability and reason]
  A --> G[Call-path search]
  G -->|Observed path exists| H[Return found]
  G -->|No path and missing callee coverage| I[Return unknown]
Loading

Reviews (4) · Last reviewed commit: "fix(analysis): preserve unavailable face..." · Reviewed by Greptile

Comment thread src/ida/IdaOperationRunner.ts Resolved
Comment thread src/ida/IdaOperationRunner.ts Resolved
@morluto
morluto marked this pull request as ready for review October 13, 2026 11:47
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T13:46:18.834177Z 5121721 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.

@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: 1575954ded

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/ida/IdaOperationRunner.ts Resolved
Comment thread src/ida/IdaOperationRunner.ts Resolved

@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: c1956b8cd0

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/domain/hopperValues.ts Resolved
Comment thread src/ida/IdaOperationRunner.ts Resolved

@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: 5121721eb1

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

coverage: completeWithinViewCoverage(1, 1),
...common,
});
if (availability?.available === false) return ok(singleton(availability));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Retain observations from unavailable facets

When a valid imported or future-provider dossier carries partial observations together with available: false (the new contract intentionally accepts this, and the comparison test constructs a nonempty comments array in that state), this unconditional return replaces those observations with the availability object. An inspect_analysis_view request can therefore no longer page the retained comments, references, or other facet values even though they remain useful partial evidence; keep the retained value and surface the reason in unknowns, using the singleton only when there is no retained value.

AGENTS.md reference: AGENTS.md:L29-L29

Useful? React with 👍 / 👎.

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open.

  1. thread 1

Fixed in 5121721.

Root cause: The call-path search predated facet availability and derived completeness only from relationship coverage and generic limitations.

Structural fix: callPath.inspectSearch now reads the dossier owner’s callee availability, preserves its reason, and marks expanded coverage incomplete. Terminal-goal handling still avoids requiring outgoing coverage from the goal.

Source validation: Added a call-path regression using Evidence with only unavailable callees and no duplicate legacy metadata; inspected the existing exhaustive/terminal rules. Targeted formatting used pinned Node 24.18.0 with two threads; git diff --check passed. Tests, typechecks, lint, builds, provider workloads, and CI reruns were intentionally not executed at the user’s request. Authored regressions remain unexecuted.

Remaining cleanup: no directly related source cleanup identified in this bounded pass. Runtime/provider behavior remains unverified by this revision.

  1. thread 1

Fixed in 5121721.

Root cause: The retained native view projected collections without consulting the dossier’s availability facts.

Structural fix: The selected native facet now maps to its owning availability declaration; unavailable facets return that declaration inline and preserve its reason in unknowns. Reference/string/CFG aliases map to their existing shared facet facts.

Source validation: Added retained-view regressions for comments and incoming references; inspected the typed view and dossier schemas. Targeted formatting used pinned Node 24.18.0 with two threads; git diff --check passed. Tests, typechecks, lint, builds, provider workloads, and CI reruns were intentionally not executed at the user’s request. Authored regressions remain unexecuted.

Remaining cleanup: no directly related source cleanup identified in this bounded pass. Runtime/provider behavior remains unverified by this revision.

@morluto morluto added bug Something isn't working area: domain Domain logic, errors, and pure functions area: server Server layer and tool wiring area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior P2: medium Medium priority issue labels Oct 13, 2026
@morluto
morluto merged commit b17487f into morluto:main Oct 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior area: server Server layer and tool wiring bug Something isn't working P2: medium Medium priority issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants