Skip to content

fix(catalog): recurse into loop bodies when extracting references - #45

Merged
ako merged 1 commit into
mendixlabs:mainfrom
engalar:fix/callees-loop-body
Mar 27, 2026
Merged

fix(catalog): recurse into loop bodies when extracting references#45
ako merged 1 commit into
mendixlabs:mainfrom
engalar:fix/callees-loop-body

Conversation

@engalar

@engalar engalar commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • SHOW CALLEES/REFERENCES missed microflow calls, entity creates, retrieves, and page shows inside LOOP bodies
  • Root cause: buildReferences() in builder_references.go only iterated top-level ObjectCollection.Objects without recursing into LoopedActivity.ObjectCollection
  • Extract collectActionActivities() helper that recursively collects all ActionActivity objects from nested loop bodies (including deeply nested loops)

Regarding issue #39

The issue reports two problems:

  1. DESCRIBE MICROFLOW missing loop body — investigation shows this is already implemented (emitLoopBody() in cmd_microflows_show_helpers.go:431-493) with passing roundtrip test (TestRoundtripMicroflow_LoopWithBody). The reporter's specific case may involve a different edge case — requesting their project file to reproduce.
  2. SHOW CALLEES missing loop body callsconfirmed bug, fixed in this PR

Partially fixes #39

Test plan

  • Unit tests for collectActionActivities(): top-level, inside loop, nested loops, nil collection, nil actions
  • All existing catalog tests pass
  • make build succeeds

🤖 Generated with Claude Code

SHOW CALLEES/REFERENCES missed microflow calls, entity creates,
retrieves, and page shows inside LOOP bodies because
buildReferences() only iterated top-level ObjectCollection.Objects
without recursing into LoopedActivity.ObjectCollection.

Extract collectActionActivities() helper that recursively collects
ActionActivity objects from nested LoopedActivity bodies.

Fixes #39 (secondary issue: SHOW CALLEES missing loop body calls)

@ako ako left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Clean fix, good test coverage, model PR scope.

@ako
ako merged commit f653c58 into mendixlabs:main Mar 27, 2026
2 checks passed
ako added a commit that referenced this pull request Jul 27, 2026
This was referenced Jul 27, 2026
ako pushed a commit that referenced this pull request Jul 29, 2026
#45 (alter-page.md): document three ALTER PAGE limitations the ledger project hit,
with the recommended "bind at page creation" pattern — SET cannot rewire a
button's action; REPLACE cannot reuse a widget name from the subtree being
replaced (built before the old is removed → collision); a footer is a marker and
is not addressable by its author-given name (serialized as footer1). These are
design constraints, so the guidance is to define save/reset microflows before the
page and bind buttons at creation rather than altering the page afterward.

#46 (theme-styling.md): DataGrid2 renders role=grid/row/gridcell <div>s, not
table/tr/td — CSS and Playwright must target the ARIA roles; and column `Size` is
a flex weight, not pixels — set a min-width on [role='grid'] with overflow-x:auto.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JXnEgoc2NQP1Y2TWMCMXC4
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.

DESCRIBE MICROFLOW doesn't produce round-trippable MDL for microflows that contain loops.

2 participants