check --references: refuse bare bindings ALTER PAGE inserts where no entity is in scope - #693
Merged
Merged
Conversation
…s in scope
`alter page … { insert after textBox1 { image … ImageUrlParams: [{1} = ImageB64] } }`
on Feedback's ShareFeedback_Logo, whose data view is sourced by a nanoflow the
project lacks, passed `check --references`; exec then wrote a bare
AttributeRef and `mx check` could not load the project. A widget inserted
outside every data container fails the same way (a text box's Attribute is
dropped instead: CE7005).
ALTER's entity context lives in the stored document, so `check --references`
now opens it (read-only, as the ALTER … SET dry run already does) and resolves
the insertion point's entity through alterEntityContext — lifted out of the
INSERT/REPLACE exec paths so check and exec share it. With no entity, the bare
bindings of the inserted widgets are reported via bindingsWithoutScope, the
walk lifted out of CREATE PAGE's unscopedBindings (#678).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed-bindings-check
…ed-bindings-check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #678 and #685.
Symptom
On a copy of the stock 11.13.0 project:
mxcli check --referencespassed. The enclosing data view's nanoflow (DS_FeedbackForm) isn't in the project, so there is no entity to qualifyImageB64against, and exec builds a bare attribute reference:mx checkcan't load the project.CREATE PAGE catches the same thing at check time (#678). ALTER didn't.
How ALTER finds the entity at the insertion point
At exec, ALTER opens the stored page (
OpenPageForMutation) and asks the stored document:EnclosingEntity).EnclosingEntityForChildren).EnclosingDataSourceFlow, thengetMicroflowReturnEntityName/getNanoflowReturnEntityName).When the flow is missing, or there is no data container at all, the builder writes a bare name as given.
Fix
alterEntityContext, used by both exec (INSERT and REPLACE) and the new check, so they can't disagree.unscopedBindingsintobindingsWithoutScope, shared by CREATE PAGE and the new check.validate_alter_unscoped.go, in the--referencespass after the ALTER … SET dry run (which already opens the stored page read-only). It reports an error naming the widget, the binding and the missing flow ("or no data container"), and says to qualify it (Module.Entity.Attribute).Evidence
Control. With the check forced to see an entity, the three failure tests fail ("got 0 errors, want 1"). The seven must-not-flag cases pass either way: entity known, qualified binding, nested data view,
$Param/…path, unknown target, flow defined in the script.Real runs (copies of the project):
zzImg,ImageUrlParams {1} = ImageB64; exec refused at its pre-checkFeedbackModule.Feedback.ImageB64)mx check0 errorsinsert into dataView1 { textbox t (Attribute: FullName) }onAdministration.Account_EditNo data container at all, measured with the pre-fix binary. Both are now reported at check time:
{1} = FullNamebeforelayoutGrid1is written bare, and the project can't be loaded;Attribute: FullNameat top level is dropped silently, and the build fails with CE7005.Bug-test
mdl-examples/bug-tests/alter-page-unscoped-insert-bindings.mdl.Not covered
make check-mdlon the bug-test proves only that it parses; the real check needs a second run against the saved page.use fragmentinside an INSERT aren't expanded at check time.Checklist
mx checkmake check-mdlpassesmake check-findingspassesmake build && make test && make lintpass, each exit code checked separately🤖 Generated with Claude Code