Skip to content

fix: address merged-PR ako follow-up polish items#469

Open
hjotha wants to merge 5 commits intomendixlabs:mainfrom
hjotha:submit/merged-pr-ako-polish
Open

fix: address merged-PR ako follow-up polish items#469
hjotha wants to merge 5 commits intomendixlabs:mainfrom
hjotha:submit/merged-pr-ako-polish

Conversation

@hjotha
Copy link
Copy Markdown
Contributor

@hjotha hjotha commented May 1, 2026

Batches the remaining polish items ako flagged in reviews of PRs that already merged.

Scope

PR #357 — Java return-type inference

  • Remove the dead case javaactions.ListType: value form from inferGenericJavaActionReturnType. The parser always stores ListType as a pointer.
  • Replace the `exprToString` → strip quotes → strip `$` → look up in varTypes string-mangling with a direct *ast.VariableExpr type assertion. The old form only worked for simple variable references and silently produced garbage keys for any compound expression.
  • Add TestAddJavaAction_EntityReturnRegistersEntityType — the EntityType case was the only return shape without a unit test.

PR #363 — change refresh modifier

  • Restore the CE0032 reference in the addChangeObjectAction comment. Developers searching for the Studio Pro error code no longer hit a dead end.

PR #364 — enum split

  • Collapse the dual return true branches of isTerminalStmt's EnumSplitStmt arm into one return true and expand the comment documenting the intentional divergence from bodyReturns in validate_microflow.go.
  • Add a doc comment on hasExplicitFalseBranchAnchor explaining the AnchorTop → AnchorBottom heuristic.
  • Add TestHasExplicitFalseBranchAnchor covering nil, default right→left, split default bottom→top, authored top→bottom, and both single-sided-customised edge cases.

Validation

  • `make build`
  • `go test ./mdl/executor -run 'TestAddJavaAction_EntityReturn|TestHasExplicitFalseBranchAnchor' -count=1`
  • `make test`
  • `make lint-go`

Related

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

AI Code Review

Review Summary

This PR addresses follow-up polish items from three previously merged PRs (#357, #363, #364). It contains:

  1. Comment improvements and clarification in change object action handling
  2. Refactoring of Java return-type inference with improved test coverage
  3. Microflow control flow logic improvements with added tests
  4. New test files for explicit false branch anchor and Java action entity return

Critical Issues

None found.

Moderate Issues

None found.

Minor Issues

  • The PR description mentions "ako flagged in reviews" but doesn't specify who "ako" is - minor documentation clarity issue
  • Some comment lines exceed 80 characters (e.g., in cmd_microflows_builder_actions.go), but this is consistent with existing codebase style

What Looks Good

  • Java return-type inference fix: The replacement of fragile string-mangling with direct type assertion is a significant improvement that fixes silent bugs with compound expressions
  • Test coverage: Added missing test for EntityType return case and comprehensive test for explicit false branch anchor heuristic
  • Code clarity: Improved comments explaining CE0032 behavior and enum split termination logic make the intent clearer
  • Dead code removal: Eliminated unused javaactions.ListType value form case
  • Deterministic logic: The hasExplicitFalseBranchAnchor function now has exhaustive test coverage for all edge cases

Recommendation

Approve - The PR consists of safe, focused improvements that address review feedback from previously merged PRs. Changes are limited to refactoring, documentation, and test coverage without altering functionality. All validation steps passed and the changes follow the project's code quality standards. The PR maintains atomicity by addressing related follow-up items from the same general area (microflow executor). No new MDL syntax is introduced, so full-stack consistency checks are not applicable.


Automated review via OpenRouter (Nemotron Super 120B) — workflow source

hjotha pushed a commit to hjotha/mxcli that referenced this pull request May 1, 2026
The IF-header duplication fix (commit 13d21427, PR mendixlabs#469) was lost
when merging fork/submit/merged-pr-ako-polish into the combined
validation branch — the merge kept the pre-swap emit block that
was supposed to be removed. As a result, every IF with a non-
empty body emitted the @position/@annotation/if … then block
twice, and re-exec failed with "Parse error: missing IF at ';'".

Removed the duplicate emit blocks in both traverseFlow (line ~694)
and traverseFlowUntilMerge (line ~873). Only the post-swap emit
remains, so the negate-and-swap transformation updates the
header before it is written out.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
hjotha pushed a commit to hjotha/mxcli that referenced this pull request May 1, 2026
The IF-header duplication fix (commit 13d21427, PR mendixlabs#469) was lost
when merging fork/submit/merged-pr-ako-polish into the combined
validation branch — the merge kept the pre-swap emit block that
was supposed to be removed. As a result, every IF with a non-
empty body emitted the @position/@annotation/if … then block
twice, and re-exec failed with "Parse error: missing IF at ';'".

Removed the duplicate emit blocks in both traverseFlow (line ~694)
and traverseFlowUntilMerge (line ~873). Only the post-swap emit
remains, so the negate-and-swap transformation updates the
header before it is written out.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hjotha hjotha force-pushed the submit/merged-pr-ako-polish branch from 4a63f63 to 8aedac9 Compare May 2, 2026 08:33
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

AI Code Review

Review Summary

Critical Issues: None
Moderate Issues: None
Minor Issues: None
What Looks Good: All changes are well-scoped, technically sound, and improve code quality without introducing risks.
Recommendation: Approve


Detailed Review

Overlap & Duplication

MDL Syntax Design

  • ⚠️ Not applicable: PR contains no MDL syntax changes (no grammar/AST/visitor modifications). Only executor logic and tests are touched.

Full-Stack Consistency

  • ⚠️ Not applicable: No new MDL feature is introduced, so full pipeline wiring (grammar → LSP → DESCRIBE) is irrelevant.

Test Coverage

  • New executor tests:
    • TestAddJavaAction_EntityReturnRegistersEntityType covers the missing EntityType return case.
    • TestHasExplicitFalseBranchAnchor tests all edge cases for the anchor heuristic (nil, defaults, customizations).
  • Integration paths tested: Tests validate end-to-end behavior via MockBackend.
  • No time.sleep: Tests use synchronous assertions.

Security & Robustness

  • No injection risks: Changes are confined to internal logic (no user input handling).
  • Correct method receivers: No receiver modifications; existing patterns preserved.
  • No silent typo side effects: Logic changes are deterministic (e.g., direct type assertion replaces fragile string parsing).

Scope & Atomicity

Code Quality

  • Dead code removal: Deleted unreachable case javaactions.ListType: (value form) in inferGenericJavaActionReturnType.
  • Simplified logic: Replaced error-prone string-mangling (exprToString → strip quotes → strip $) with direct *ast.VariableExpr type assertion.
  • Improved documentation:
    • Expanded comment on isTerminalStmt explaining intentional divergence from bodyReturns.
    • Detailed doc comment for hasExplicitFalseBranchAnchor clarifying AnchorTop→AnchorBottom heuristic.
  • Consistency: No lingering old patterns; refactors applied fully.

Bugs & Correctness

  • Fixed silent bug: Old exprToString approach failed on compound expressions (produced garbage keys); new type assertion is robust.
  • Error handling: Early returns for nil inputs preserved; no new error paths introduced.
  • Test validity: New tests validate correct behavior (e.g., CreatedOrder type resolves to Orders.Order).

Final Notes

The PR successfully addresses all flagged polish items from prior merges. Changes are minimal, focused, and backed by tests. No checklist violations are found. Approved.


Reviewer: Code Review Assistant
Repo: mxcli
PR: fix: address merged-PR ako follow-up polish items
Status: Ready to merge.


Automated review via OpenRouter (Nemotron Super 120B) — workflow source

hjothamendix and others added 3 commits May 2, 2026 12:00
Symptom: all open PRs against main failed the shared build-and-test job in
make test-integration, even when their local build/test/lint validation passed.
The failures reproduced on origin/main, so they were baseline CI instability
rather than PR-specific regressions.

Root cause: TestWatcherDebounce could allow stale timer callbacks to send an
extra message under slow scheduling, nanoflow integration fixtures used MDL
syntax that no longer matched the grammar, and the doctype mx-check harness did
not classify known page/nanoflow showcase consistency errors as expected
limitations.

Fix: guard watcher debounce callbacks with a generation counter, tighten the
watcher burst test, update nanoflow fixtures to current MDL syntax, and extend
the known consistency-error allowlist for showcase-only limitations.

Tests: make build
Tests: go test ./cmd/mxcli/tui -run TestWatcherDebounce -count=20 -v
Tests: ./bin/mxcli check mdl-examples/doctype-tests/02b-nanoflow-examples.mdl
Tests: go test -tags integration -count=1 -timeout 30m ./mdl/executor -run 'TestRoundtripNanoflow_(Loop|EnumParameter|Annotations)|TestMxCheck_DoctypeScripts/02b-nanoflow-examples.mdl|TestMxCheck_DoctypeScripts/03-page-examples.mdl' -v
Tests: make test
Tests: make lint-go
Tests: make test-integration
Batches the remaining polish items ako flagged in PRs that already
merged:

- PR mendixlabs#357 (Java return-type inference): remove the dead
  `case javaactions.ListType:` value form, replace the
  exprToString→strip→lookup string-mangling with a direct
  `*ast.VariableExpr` type assertion, and add the missing unit test
  for `*javaactions.EntityType` return registration.

- PR mendixlabs#363 (change refresh modifier): restore the CE0032 reference in
  the `addChangeObjectAction` comment so developers searching for the
  Studio Pro error code find the inference logic.

- PR mendixlabs#364 (enum split): collapse the dual `return true` branches of
  `isTerminalStmt`'s EnumSplitStmt arm into one and expand the comment
  documenting the intentional divergence from `bodyReturns`.

- PR mendixlabs#364 minor: add a doc comment on `hasExplicitFalseBranchAnchor`
  explaining the Top→Bottom heuristic, and add
  TestHasExplicitFalseBranchAnchor covering nil, default, and
  single-sided cases.

Validation: make build, make test, make lint-go.

Related: mendixlabs#463 (walkStatements refactor), mendixlabs#468 (TitleOverride nil).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@hjotha hjotha force-pushed the submit/merged-pr-ako-polish branch from 8aedac9 to a8c48c5 Compare May 2, 2026 10:04
@hjotha
Copy link
Copy Markdown
Contributor Author

hjotha commented May 2, 2026

CI stabilization note: merged #412 into this branch so it uses the same integration-CI baseline as the rest of the active PR set.

Symptom: CI failed in TestMxCheck_DoctypeScripts/empty_java_action_argument.mdl because a Java action declared as RETURNS Void was written as an entity return type named .void, and Studio Pro reported CE1613.

Root cause: the generic data-type visitor treats bare qualified names as entity/enumeration references. Java action return types reused that generic path, so the explicit Void spelling became a qualified name instead of ast.TypeVoid.

Fix: add a Java-action return-type wrapper that maps unqualified Void to ast.TypeVoid while leaving generic data-type parsing unchanged for parameters and attributes.

Tests: added visitor coverage for explicit RETURNS Void; verified mxcli check for the doctype fixture and the targeted integration subtest that failed in GitHub Actions.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

AI Code Review

Review Summary

This PR addresses follow-up polish items from three previously merged PRs (#357, #363, #364) along with some additional cleanup. The changes are focused, well-tested, and maintain consistency with the project's architecture and guidelines.

Critical Issues

None found.

Moderate Issues

None found.

Minor Issues

  • Scope: While the PR description states it addresses polish items from PRs fix: infer java action result variable types #357, feat: preserve change object refresh modifier #363, and feat: support enum split microflow statements #364, it also includes unrelated changes to the TUI watcher (cmd/mxcli/tui/watcher.go) and nanoflow examples simplification (mdl-examples/doctype-tests/02b-nanoflow-examples.mdl). These are beneficial improvements but broaden the scope beyond the stated purpose. However, given their small size and low risk, this is acceptable.
  • Documentation: The nanoflow examples simplification removes extensive explanatory comments. While the remaining examples are still valid, some educational value is lost. However, as this is a doctype test file focused on executable MDL rather than documentation, this trade-off is reasonable.

What Looks Good

  • PR fix: infer java action result variable types #357 fixes:
    • Removal of dead code in inferGenericJavaActionReturnType improves correctness.
    • Replacement of fragile string-mangling with direct type assertion enhances reliability.
    • New test TestAddJavaAction_EntityReturnRegistersEntityType closes a coverage gap.
  • PR feat: preserve change object refresh modifier #363 fix:
    • Restored CE0032 reference in comments aids developer troubleshooting.
  • PR feat: support enum split microflow statements #364 fixes:
    • Simplified isTerminalStmt logic with clearer comment improves maintainability.
    • Added documentation and comprehensive test for hasExplicitFalseBranchAnchor heuristic.
  • Additional improvements:
    • Watcher debounce fix using atomic.Uint64 resolves a potential race condition in TUI updates.
    • Nanoflow examples simplification reduces noise while retaining core test cases.
    • Roundtrip test updates reflect actual Studio Pro behavior (known CE errors).
    • Java action visitor improvements properly handle Void return types.
  • Test coverage:
    • Two new focused unit tests added.
    • Existing tests updated to match behavioral changes.
    • No use of time.Sleep for synchronization in tests.
  • Code quality:
    • Changes follow existing patterns and conventions.
    • No duplication or overlap with existing functionality.
    • All modifications are scoped to single responsibilities.

Recommendation

Approve. The PR delivers valuable polish and correctness improvements with minimal risk. The scope expansion is justified by the high-value, low-risk nature of the additional changes (watcher fix and example simplification), and all changes meet the project's quality standards. The new tests provide important coverage for previously untested code paths. No blocking issues identified.


Automated review via OpenRouter (Nemotron Super 120B) — workflow source

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