Skip to content

Cover Function Scope in the IDALib integration test - #20

Merged
danielplohmann merged 1 commit into
mainfrom
test/function-scope-idalib-coverage
Sep 16, 2026
Merged

danielplohmann merged 1 commit into
mainfrom
test/function-scope-idalib-coverage

Conversation

@danielplohmann

Copy link
Copy Markdown
Collaborator

Closes the coverage gap that let the 1.1.10 bug ship.

Why

The IDALib integration test uploads a report, runs a matching job and reads the result back, but it never queries a single function through the Function Scope path. So it passed on every push to main while that path was broken for anyone on SMDA 4.8 — which is exactly how 1.1.9 shipped with Function Scope returning nothing from the second function onward.

What it does

_exercise_function_scope queries several functions the way FunctionMatchWidget.updateViewWithCurrentFunction does: build an outline with getLocalSmdaReportOutline, put one function in its xcfg, call querySmdaFunctionMatches.

It asserts on which offset reaches the server, not on match counts. That matters: the failure is silent. With the old getter the second query short-circuits on the first function's already-cached offset and issues no request at all, so there is nothing to time out, nothing to log, and no match count that distinguishes "wrong function submitted" from "this function genuinely has no matches".

HeadlessMcritContext gains the two attributes the outline getter keeps its state in (local_smda_report_outline, _outline_source, plus local_smda_report which the smoke test already set dynamically), so the real getter runs against it unchanged rather than against a test double.

One wart worth flagging: the step has to bind ida_mcrit.SmdaReport itself, because _load_dependencies() is GUI-gated behind _require_gui() and never runs under IDALib. Commented in place. #17 moves this logic to McritSession, where it is reachable headlessly, so this should get simpler there.

Verified

IDA Pro 9.3, SMDA 4.8.0, live MCRIT, real 145-function x86-64 sample:

  • current getter → passes, every query carries the function it asked for
  • pre-1.1.10 getter restored → fails on the second query with outline report still carries a previous query's functions; getLocalSmdaReportOutline returned a reused object rather than a fresh one

Repo checks: 86 pytest, ruff check, ruff format --check, run_quality_checks.py, verify_metadata_sync.py, verify_settings_sync.py all pass.

No version bump: this adds test coverage and changes no shipped behaviour.

🤖 Generated with Claude Code

The IDALib test uploaded, matched and read results back, but never queried a
single function through the Function Scope path, so it passed on every push to
main while that path was broken for anyone on SMDA 4.8. That is how 1.1.9
shipped with Function Scope returning nothing from the second function onward.

_exercise_function_scope queries several functions the way
FunctionMatchWidget.updateViewWithCurrentFunction does: build an outline with
getLocalSmdaReportOutline, put one function in its xcfg, then call
querySmdaFunctionMatches. It asserts on the offset that reaches the server
rather than on match counts, because the failure is silent - the second query
short-circuits on the first function's cached offset and issues no request at
all, so there is nothing to time out or log.

HeadlessMcritContext gains the two attributes the outline getter keeps its
state in, so the real getter runs against it unchanged.

Checked against IDA 9.3, SMDA 4.8.0 and a live MCRIT on a 145-function sample:
passes on the current getter, and with the pre-1.1.10 getter restored it fails
on the second query.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@danielplohmann

Copy link
Copy Markdown
Collaborator Author

Rebased onto 3255e29 (post-#15). Applied no-changelog: this touches helpers/HeadlessMcritContext.py, so the path check fires, but the change is additive test-support state and alters none of what CHANGELOG.md says it tracks - settings, minimum IDA version, or Python dependencies. The test file itself does not ship.

97 pytest and ruff pass on the rebase.

@danielplohmann
danielplohmann force-pushed the test/function-scope-idalib-coverage branch from fc0bebb to 8677ca5 Compare September 16, 2026 12:27
@danielplohmann danielplohmann added the no-changelog This PR intentionally needs no CHANGELOG.md entry label Sep 16, 2026
@danielplohmann
danielplohmann merged commit f3003de into main Sep 16, 2026
8 of 9 checks passed
@danielplohmann
danielplohmann deleted the test/function-scope-idalib-coverage branch September 16, 2026 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR intentionally needs no CHANGELOG.md entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant