intent: a cross-model schedules[].where status name is refused at Generate (#7288) - #7310
Open
delchev wants to merge 1 commit into
Open
intent: a cross-model schedules[].where status name is refused at Generate (#7288)#7310delchev wants to merge 1 commit into
delchev wants to merge 1 commit into
Conversation
…erate (#7288) #7251 resolves a seeded status NAME in a schedule's row query for a same-model source and leaves a cross-model one alone on purpose - its nomenclature is seeded in the owner model, and which of the conditions even names the status is unknowable from this file. But the skip was silent on both ends: the parser's own invariant check returns early for a cross-model source, and the generation-time check validates only that each where field EXISTS. So a name against a cross-model source parsed, generated and rendered as .eq("Status", "OVERDUE") against an integer FK - a query matching nothing for as long as the job kept ticking, with no diagnostic. That is #7251's failure one `model:` key away. The refusal is made where the owner's `.model` is in hand: at generation, off the DOCUMENT_STATUS widget that tells which property is the status one, exactly as the sibling cross-model `items: where:` rule is refused (#7225) - both now through one shared `crossModelStatusName`. The message names the relation, the name, the owner model and the id-only rule, and the parser/resolver javadoc that deferred to "keeps the numeric seed id" now says where a name is refused instead. Only the status condition is refused: every other condition compares an ordinary column, where a string literal is just a literal. A seed id renders unchanged. Verified: engine-intent unit suite green (1211 tests), three new tests in GlueSchedulesTest (the refusal names all four facts, a seed id still renders as Criteria.create().eq("Status", 4), a string on a non-status condition still renders), formatter:validate with the cache wiped, and the -P release javadoc build on the module. No integration test run - no IT fixture declares a cross-model schedule with a status condition. Fixes #7288
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.
Cause
PR #7269 (#7251) resolves a seeded status NAME in
schedules[].wherefor a same-model source and skips a cross-model one on purpose - the owner's nomenclature is seeded in its own model, and WHICH of the{ field, op, value }triples names the status is unknowable from this file. The issue asked that a cross-model source "keeps id-only and says so". Nothing said so, at either end:IntentParser.validateWhereStatusValuereturns early whensource == null, andvalidateSchedulessetssource = nullfor every cross-model schedule.isMissing(sourceProps, condition.getField())), never the value.So
parsed, generated and rendered
.eq("Status", "OVERDUE")against an integer status FK - a query matching nothing for as long as the schedule kept ticking, with no diagnostic. That is #7251's own failure mode, onemodel:key away.Change
The refusal is made where the owner's
.modelis in hand: at generation, off theDOCUMENT_STATUSwidget the edm generator gave the status FK, which is what tells which condition is the status one. This is exactly how the sibling cross-modelitems: where:rule is refused (#7225), so the two now share one helper (crossModelStatusName); the items-side check is unchanged behaviourally.GlueIntentGenerator.buildSchedulesthrowsIntentValidationException(a 422) for a cross-model schedule whosewherecompares the owner's status relation with a non-integer, naming the relation, the name, the owner model and the id-only rule - the same sentenceresolveSymboluses for the header-level sites.No new authoring key, and no shape that used to work stops working - the spec already states the rule (
intent-specification1.2: "a nomenclature owned by another model is seeded there ... such a reference is an authoring error directing the author to the numeric id"), so this closes an implementation hole rather than changing the DSL; no doc-site PR is warranted.Verified
mvn -pl components/engine/engine-intent test- 1211 tests, 0 failures.GlueSchedulesTest, against a mocked owner.model(sostatusProperty()is a real fact, not a convention default): the refusal names all four facts; a seed id still rendersCriteria.create().eq("Status", 4)with the perspective read off the owner model; a string on a non-status condition still renders.eq("Number", "SI-1"). A newbuildSchedulesForTest(model, context)hook mirrors the existing generates one.mvn formatter:validatewith the formatter cache wiped - BUILD SUCCESS.mvn -P release ... install -pl components/engine/engine-intent(javadoc) - BUILD SUCCESS.Fixes #7288