Skip to content

test: cover qualified function calls with three segments#448

Merged
ako merged 5 commits intomendixlabs:mainfrom
hjotha:submit/qualified-function-call-regression-tests
May 2, 2026
Merged

test: cover qualified function calls with three segments#448
ako merged 5 commits intomendixlabs:mainfrom
hjotha:submit/qualified-function-call-regression-tests

Conversation

@hjotha
Copy link
Copy Markdown
Contributor

@hjotha hjotha commented Apr 30, 2026

Closes #447.

Summary

  • Update the qualified-call visitor regression to use a synthetic three-segment callee.
  • Add a parser-level bug-test MDL file for the same IF-condition form.
  • Remove the real project-style name from this test fixture while touching the coverage.

Validation

  • make build
  • go test ./mdl/visitor -run 'TestQualifiedCallInIfCondition|TestQualifiedCallPositionalArgs' -v
  • ./bin/mxcli check mdl-examples/bug-tests/qualified-function-call-expression.mdl
  • make test
  • make lint-go

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
Symptom: the qualified function call regression coverage only asserted a two-segment callee and left the bug-test coverage implicit.

Root cause: the expression parser fix accepts qualifiedName callees, including three-segment names, but the tests did not pin that shape directly.

Fix: update the visitor regression to use a synthetic three-segment callee and add a parser-level bug-test MDL file that checks the same IF-condition form.

Tests: ran make build, targeted mdl/visitor qualified-call tests, mxcli check for the bug-test MDL file, make test, and make lint-go.
@hjotha hjotha force-pushed the submit/qualified-function-call-regression-tests branch from 6be73f5 to 866cfaf 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 fixes a regression where qualified function calls in IF conditions failed to parse when the callee wasn't a built-in function name. The changes are focused and appropriate, with complementary improvements to test reliability and robustness.

Critical Issues

None found.

Moderate Issues

None found.

Minor Issues

  • The watcher.go changes, while improving robustness with atomic operations, are somewhat tangential to the main topic of qualified function calls. However, they don't harm the PR and improve test reliability.
  • The significant simplification of 02b-nanoflow-examples.mdl removes some examples that might have been useful for demonstration, though it makes the file more maintainable and focused on core nanoflow concepts.

What Looks Good

  • Core fix: Properly resolves the qualified function call regression in IF conditions by updating visitor tests to use synthetic three-segment qualifiers
  • Test coverage: Adds appropriate bug test file (mdl-examples/bug-tests/qualified-function-call-expression.mdl) that reproduces the issue
  • Test reliability: Improves watcher test by removing time.Sleep and using tighter timing bounds
  • Related fixes:
    • Correctly handles Java action Void return types (uncovered during testing)
    • Updates known CE errors in roundtrip tests with proper attribution
    • Improves file watcher robustness with atomic sequence tracking
  • Maintainability: Simplifies nanoflow doctype tests to focus on core concepts while preserving essential functionality
  • Validation: All specified validation steps pass, including the new bug test

Recommendation

Approve

The PR is well-scoped to fix the qualified function call regression while making complementary improvements that enhance test quality and robustness. Changes follow project principles: proper use of qualified names, no syntax violations, and appropriate test coverage for the bug fix. The complementary changes (watcher robustness, Java action returns, test simplification) are justified and improve overall code quality without deviating from the main focus.


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

@ako
Copy link
Copy Markdown
Collaborator

ako commented May 2, 2026

Review: test: cover qualified function calls with three segments

Clean test-only PR. No blockers. Two minor issues.


Minor 1 — bug test file name doesn't follow the issue-number convention

All existing bug test files use {issue}-{description}.mdl naming (e.g. 373-change-action-items-storage-list.mdl). The new file is named qualified-function-call-expression.mdl with no issue prefix. Since this closes #447, it should be 447-qualified-function-call-expression.mdl.


Minor 2 — bug test MDL "After fix:" header implies this PR introduced a fix

The bug-tests/ header follows the convention: describe the original symptom and the fix. But the grammar fix (widening functionCall to accept qualifiedName) happened in an earlier PR — this PR adds the regression test. A reader scanning the file might think the fix landed here. The header would be clearer as:

-- Status: working — regression guard added in #447.

or move the "After fix" wording to note the historical fix explicitly.


Positives

  • Removing ControlCenterCommons.IsNotEmptyString and MxAdmin — real project-style names shouldn't be in test fixtures (CLAUDE.md recurring finding MxBuild requires runtime PAD symlink for docker build (fails CI/CD) #5).
  • The grammar's qualifiedName rule (identifierOrKeyword (DOT identifierOrKeyword)*) already handles N segments, so three-segment coverage is correct with no grammar change needed.
  • The new test exercises the three-segment form (SyntheticRules.Strings.IsNotEmpty) that the describer emits for RuleSplitCondition parameters, which is the scenario most likely to show up in real projects.
  • mxcli check (not exec) is the right usage instruction for a parse-only regression test against an unresolvable function name.

@ako ako merged commit cb40add into mendixlabs:main May 2, 2026
2 checks passed
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.

Qualified function call tests should cover three-segment callees

3 participants