intent: resolve a seeded status name in schedules[].where (#7251) - #7269
Merged
Conversation
#7164 taught `StatusSymbolResolver` to resolve a seeded status NAME in a create-from's `items: where:`. The construct that shape was modelled on - a `schedules[].where` row query, "the same { field, op, value } triples" - had no rewrite, and nothing refused a non-numeric value against a `function: EntityStatus` relation there either. So schedules: - name: dunning cron: "0 0 8 * * ?" entity: SalesInvoice where: - { field: Status, op: eq, value: OVERDUE } parsed, generated `.eq("Status", "OVERDUE")` into the job, and matched nothing for as long as the schedule kept ticking - the exact silent failure #6645 removed for every other status site, at the site a status guard is written most often (dunning, staleness sweeps, month-end runs), where replacing a positional id with a name is most tempting. `rewriteSchedules` resolves the condition naming the source's own status relation, on that source's nomenclature. It shares `rewriteConditions` with the items rule, so the two constructs cannot drift apart again by having one of them taught and the other not. Same-model source only: a cross-model source (`model: <uses alias>`) is not in this file's entities, so neither its nomenclature nor even WHICH of its conditions names its status is knowable here, and it keeps the numeric seed id exactly as every other cross-model status site does. The second half is the invariant at the consuming site, independent of the resolver's site list: a `where` condition on the queried entity's own `function: EntityStatus` relation must carry an integer by the time validation runs (`validateWhereStatusValue`, on both where sites). A value no status can equal - a stage word, a blank, a moment token - is refused by name instead of rendering into a query that matches nothing. That check alone catches the drift this issue is about: with the rewrite disabled, it reports the authored name. Covered by `StatusSymbolIntentTest` (the schedule query joins the every-site case; a mistyped name is refused) and `GlueSchedulesTest` (the rendered criteria - `Criteria.create().eq("Status", 3).lt("DueOn", ...)`; a value that is no status refused). Documented in the `schedules` section of the assistant guide and in the site list of "Statuses may be named, not numbered". Fixes #7251 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Sep 10, 2026
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
#7164 taught
StatusSymbolResolverto resolve a seeded status NAME in a create-from'sitems: where:(rewriteGeneratesItemsWhere). The construct that shape was explicitly modelled on - aschedules[].whererow query, "the same{ field, op, value }triples" - never got the rewrite, and the parser did not refuse a non-numeric value against afunction: EntityStatusrelation there either. Soparsed, generated
.eq("Status", "OVERDUE")into the job and matched nothing for as long as the schedule kept ticking - the silent failure #6645 removed for every other status site, at the site a status guard is written most often (dunning, staleness sweeps, month-end runs), and the one where replacing a positional id with a name is most tempting.Change
StatusSymbolResolver.rewriteSchedulesresolves the condition naming the source's ownfunction: EntityStatusrelation, on that source's nomenclature. It sharesrewriteConditionswith the items rule (which now delegates to it), so the two constructs cannot drift apart again by having one taught and the other not.model: <uses alias>) is not in this file'sentities, so neither its nomenclature nor even WHICH of its conditions names its status is knowable in the parser (itswherefield references are resolved at generation time against the owner's.model); it keeps the numeric seed id, exactly as every other cross-model status site does. This is the one place the issue's wording could not be followed literally - there is nothing identifiable to "say so" about, so the boundary is stated in the guide and the javadoc instead of as a refusal.IntentParser.validateWhereStatusValueis the invariant at the consuming site, independent of the resolver's site list: awherecondition on the queried entity's own status relation must carry an integer by the time validation runs. A value no status can equal - a stage word, a blank, a moment token - is refused by name instead of rendering into a query that matches nothing. Applied to bothwheresites (schedules[]anditems:).schedulessection of the assistant guide gains the dunning example and the rule (incl. the cross-model boundary);schedules[].whereanditems: where:join the site list of "Statuses may be named, not numbered";engine-intent/CLAUDE.mdand.claude/docs/intent-layer.mdrecord the drift and the backstop.No behaviour change for an authored numeric id, which is what the fleet uses today (
base-timesheets:{ field: Status, op: eq, value: 2 } # 2 = ACTIVE- the comment this makes unnecessary).Verification
mvn -pl components/engine/engine-intent test: 1190 tests green, formatter cache wiped +formatter:validategreen.StatusSymbolIntentTest.everySiteResolvesTheNameToItsSeedIdcovers the schedule query alongside every other site, andanUnknownStatusNameInAScheduleQueryIsRejectedpins the mistyped name;GlueSchedulesTest.aSeededStatusNameInTheQueryRendersAsItsSeedIdpins the rendered criteria (Criteria.create().eq("Status", 3).lt("DueOn", java.time.LocalDate.now())) andaValueThatIsNoStatusAtAllIsRefusedthe backstop.rewriteSchedulescommented out, the new tests fail, and the parser guard reports the authored name (schedule [dunning] where-condition on the status relation [Status] compares it with [OVERDUE], which is not a status ...) - i.e. the guard alone would have caught this drift..eq("Status", <int>)) is the one existing schedules already emit andIntentEmissionCoverageITalready compiles and runs.Fixes #7251
🤖 Generated with Claude Code