Skip to content

Build a fresh SMDA report outline per function query (1.1.10) - #18

Merged
danielplohmann merged 1 commit into
mainfrom
fix/smda-48-outline-per-query
Sep 16, 2026
Merged

danielplohmann merged 1 commit into
mainfrom
fix/smda-48-outline-per-query

Conversation

@danielplohmann

Copy link
Copy Markdown
Collaborator

Function Scope returns no matches for every function after the first, for anyone running SMDA 4.8 or later. The smda pin is unbounded (>=4.3.10), so a fresh install of 1.1.9 today hits this.

What happens

SMDA 4.8 memoises SmdaReport.getFunctions():

def getFunctions(self) -> Iterator["SmdaFunction"]:
    if self._sorted_functions is None:
        self._sorted_functions = (
            [smda_function for _, smda_function in sorted(self.xcfg.items())] if self.xcfg else []
        )
    yield from self._sorted_functions

getLocalSmdaReportOutline() (ida_mcrit.py:193) returned one cached SmdaReport, and FunctionMatchWidget.updateViewWithCurrentFunction (widgets/FunctionMatchWidget.py:273-274) reassigned .xcfg on that same object for each query. So:

  1. First query for function A populates _sorted_functions with A, the server is asked about A, and the result is cached under A's offset.
  2. Second query sets .xcfg = {B.offset: B}, but McritInterface.querySmdaFunctionMatches (helpers/McritInterface.py:322) does list(smda_report.getFunctions()) and still gets [A].
  3. A's offset is already in function_matches, so the server call is skipped entirely and nothing is stored for B.
  4. Back in the widget, B.offset in function_matches is false, match_report stays None, and the table shows nothing.

Silent: no exception, no error in the activity log. Just an empty Function Scope from the second function onward.

Fix

Cache the outline as a dict and build a fresh SmdaReport from it per call, so each query gets its own uncached getFunctions(). Also track which report the dict came from, so replacing local_smda_report on the upload-on-close path (ida_mcrit.py:292) doesn't leave the outline carrying the previous report's metadata.

Same approach as in #17, ported to the current layout, so the two don't diverge.

Tests

tests/test_smda_report_outline.py uses a stand-in with SMDA 4.8's caching semantics. Against the unfixed getter, test_outline_is_a_fresh_report_per_query and test_outline_follows_a_replaced_local_report both fail; with the fix all four pass.

Local: 86 pytest passed (82 before), ruff check and ruff format --check clean, verify_metadata_sync.py --expected-version 1.1.10, verify_settings_sync.py and run_quality_checks.py pass, package_plugin.py builds the ZIP with the fix in it.

Note on releasing

On current main, pushing v1.1.10 runs the old release.yml, which does not check that the tag matches the declared version. #15 is what adds that guard. Either merge #15 first, or check the tag by hand.

🤖 Generated with Claude Code

SMDA 4.8 memoises SmdaReport.getFunctions() into _sorted_functions on the
first call. getLocalSmdaReportOutline() returned one cached outline object
and FunctionMatchWidget only swapped its xcfg per query, so from the second
function onward the outline still yielded the first function. The query then
found that offset already in function_matches, skipped the server call, and
the widget found nothing under the offset it had asked about: Function Scope
showed no matches for every function after the first.

Cache the outline as a dict and build a fresh SmdaReport from it per call.
Track the report the dict was derived from, so replacing local_smda_report
(the upload-on-close path) no longer leaves the outline on the old report's
metadata.

Bumps to 1.1.10. The smda pin is unbounded (>=4.3.10), so 1.1.9 is affected
for anyone installing today.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@danielplohmann
danielplohmann force-pushed the fix/smda-48-outline-per-query branch from c0155c1 to 31ccb46 Compare September 16, 2026 06:43
@danielplohmann
danielplohmann merged commit 4f808fc into main Sep 16, 2026
6 checks passed
@danielplohmann
danielplohmann deleted the fix/smda-48-outline-per-query branch September 16, 2026 06:58
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.

1 participant