Skip to content

Loki: Bug fixing on _get_procedure_item#655

Open
rommelDB wants to merge 1 commit intoecmwf-ifs:mainfrom
rommelDB:bugfix/candidates-procedure-item
Open

Loki: Bug fixing on _get_procedure_item#655
rommelDB wants to merge 1 commit intoecmwf-ifs:mainfrom
rommelDB:bugfix/candidates-procedure-item

Conversation

@rommelDB
Copy link
Contributor

@rommelDB rommelDB commented Mar 6, 2026

  • The issue on line 552 is trivial, since item_name is not declared at that point, we got a 'referenced before assignment' error.

  • Then, somehow the output from get_or_create_module_definitions_from_candidates might be a list with duplicated items, so we could get something like: 'RuntimeError: Procedure XXX defined in multiple imported modules: YYY, YYY'. So, it might be better to handle the list as a set.

Copy link
Collaborator

@reuterbal reuterbal left a comment

Choose a reason for hiding this comment

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

I agree on the change in l. 552, that's a bug.

However, do you have a reproducer for the multiple module names? If there's erroneous behaviour right now we ought to add a matching test to ensure such behaviour cannot be reintroduced in the future.

Looking at the implementation, the candidate lookup should only consider modules from unqualified imports, and then procedures defined in these. To me it seems like this would either require the same module to be imported twice via an unqualified import, or the same procedure to be defined multiple times in the module? Happy to be proven wrong of course!

@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.39%. Comparing base (b711b95) to head (df6f3a1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #655   +/-   ##
=======================================
  Coverage   96.39%   96.39%           
=======================================
  Files         266      266           
  Lines       46418    46418           
=======================================
  Hits        44745    44745           
  Misses       1673     1673           
Flag Coverage Δ
lint_rules 96.40% <ø> (ø)
loki 96.39% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants