Skip to content

fix(navigation): an omitted clause keeps the stored value (mendixlabs/mxcli#1522) - #1420

Merged
ako merged 2 commits into
mainfrom
fix/1522-navigation-omitted-clause-keeps-stored
Oct 17, 2026
Merged

ako merged 2 commits into
mainfrom
fix/1522-navigation-omitted-clause-keeps-stored

Conversation

@ako

@ako ako commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Fixes the partial-navigation part of mendixlabs#1522 (#1404). The maintainer decided that an omitted clause keeps its stored value, as the menu, PWA and sync-error clauses already do.

The bug

navPatchWebProfile (mdl/backend/modelsdk/navigation_write.go) always wrote the home page, the role-based home pages, the login page and the not-found page from the statement, so any of them the statement left out was cleared. On a profile with a home page, create or modify navigation Responsive { menu item 'B' (...) }; removed the home page, and mx check then gave CE0527 "Select a default home page for this profile". navPatchNativeProfile did the same for role-based native home pages.

Fix

  • Omitted fields are kept: each field is written only when the statement states it.
  • Role home pages: home … for <role> replaces only that role's home page. Roles the statement does not mention keep theirs (navMergeRoleHomes, case-insensitive role match).
  • Copy, not in place: both writers patch a copy of the stored profile. The helper used to change the document in place, and one existing test only passed because of that.
  • Docs: the contradictory texts are fixed ("fully replaces" vs "omitting the block leaves it alone"):
    • syntax help navigation.create;
    • the manage-navigation, choose-edit-mode and migrate-design-prototype skills;
    • docs-site: alter-navigation.md, navigation-profiles.md and the quick reference;
    • the executor comment.

Tests

  • TestUpdateNavigationProfile_OmittedClausesKeepStored
  • TestNavPatchWebProfile_StatedClausesReplace
  • TestNavPatchNativeProfile_OmittedRoleHomesKeepStored

Revert check: the tests fail with the fix reverted and pass with it restored.

Measured with mx check

A menu-only statement on a profile that has a home page went from CE0527 (1 error) to 0 errors, on both 11.15.0 and 11.6.6. The bug test mdl-examples/bug-tests/1522-navigation-omitted-clause-keeps-stored.mdl gives CE0527 with the old binary and 0 errors with the new one.

Open questions

  1. No way to clear: MDL has no clause that clears a home page, login page, not-found page or one role's home page. Now that leaving a clause out keeps it, nothing can clear these. Add a clearing syntax?
  2. create or replace navigation follows the same keep-what-is-omitted rule as create or modify, because the parser has always treated them the same. Should replace instead replace everything?

Also: a finding file. make build, make test, make lint and make check-findings pass. Not in this PR: the glyph part (separate PR) and the check for a home page a role cannot open (1404 c).

🤖 Generated with Claude Code

https://claude.ai/code/session_01W3x8Fyvir8kLyPgJs1BDmF


Generated by Claude Code

…#1522)

`create or modify navigation Responsive { menu item ... }` cleared the
profile's home page, role-based home pages, login page and not-found page,
so the next build failed with CE0527 "Select a default home page for this
profile". navPatchWebProfile wrote those four fields unconditionally from
the spec, while the menu, sync block, ON SYNC ERROR and PROGRESSIVE WEB APP
were already left alone when omitted. navPatchNativeProfile rebuilt
RoleBasedNativeHomePages the same way.

An omitted clause now keeps the stored value for every field. `home ... for
<role>` replaces that role's home page only; a role the statement does not
mention keeps its own (navMergeRoleHomes). MDL has no clause that clears a
home, login or not-found page, so such a page can no longer be removed by
leaving it out. describe -> exec is unaffected, since describe states every
clause. Both patchers now work on a copy of the stored profile, because
navSetField writes in place.

The docs said both "fully replaces" and "omitting the block leaves it
alone"; syntax help, skills and docs-site now describe the one rule.

Measured with mx check after a menu-only statement on a profile with a home
page: 11.15.0 and 11.6.6 both CE0527 (1 error) before, 0 errors after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W3x8Fyvir8kLyPgJs1BDmF
Resolve the manage-navigation skill index conflict with #1421 by
regenerating the skill index.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W3x8Fyvir8kLyPgJs1BDmF
@ako
ako merged commit e8a6c79 into main Oct 17, 2026
33 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.

2 participants