ID |
|
|---|---|
Status |
Spec |
Bucket |
bug |
Priority |
3 |
Theme |
nodeid |
Created |
2026-11-23 |
Updated |
2026-11-25 |
An unrouted @nodeId argument under a field-level @condition(override: true) is refused, though the override suppresses the predicate a route would serve
Goal
A @nodeId(typeName:) argument or input field whose implicit predicate an enclosing @condition(override: true) suppresses builds without a foreign-key route from the field’s table to the node’s table. The override leaves the condition method as the only thing narrowing the rows, so nothing joins to the node’s table and a route has nothing to serve; the id is decoded and handed to the method, which is the whole of what the author asked for. Today the build refuses every spelling of this, and the remedy it names, a @reference path, asks the author to describe a join the generated query never makes.
The shape, on the sakila catalog, where film_actor sits between film and actor and no foreign key joins the two directly:
type Query {
filmsByActors(actorIds: [ID!] @nodeId(typeName: "Actor")): [Film!]!
@condition(condition: {
className: "no.sikt.graphitron.rewrite.test.conditions.ProjectedKeyConditionFixtures",
method: "filmsWithAnyActor",
argMapping: "actorIds: actorIds.actor_id"
}, override: true)
}
filmsWithAnyActor(Table<?> film, List<Integer> actorIds) writes the EXISTS over film_actor itself. When this item lands the field builds as written: the method receives the decoded actor_id values, a malformed or wrong-type id is the usual client error, and an omitted list reaches the method as null. The same field without override: true stays refused, because the condition then adds to the implicit predicate actorIds binds on film, and that predicate needs the route.
This is the schema of GitHub issue 583: organisations that are members of one of several collections, through a membership table. Its reporter cannot keep @nodeId on the argument without writing paths that mean nothing.
What happens today
Two judges refuse a schema. The store is the fact store, the database a build captures a schema into; a defect row it holds stops the build. The walk is the older classifier, which still classifies every field of a graph the store’s verdict accepts, and whose refusals reach the author as validation errors. Since f34cef0 the walk renders no condition code; the store’s ConditionEmitter does, decode included.
Probed on trunk at 29c56d5 against the sakila catalog, with a condition method on the classpath for each row. The store’s answer was read through FactExpectationTest over a scratch fact document; what an author is told was read by generating the rows the store accepts as a scratch scenario through GenerateTestSchemas, the run the build makes. film and actor share no foreign key, and film has two to language; both kinds of missing route behave alike. A parameter bound to an id whole, by name or by an entry stopping on the argument, must be the node’s record or a tuple of its key, and no fixture has one, so those rows also drew NODE_ID_KEY_ARITY_EXCEEDS_SLOT for the fixture’s List<Integer>; that row is the fixture’s and is left out below. For the entry stopping on the argument the walk’s answer was therefore read from the classifier alone, through TestSchemaHelper.buildSchema.
Every row below is under an enclosing override: true, written on the field unless the row says otherwise.
| The id | Store | Walk, where the store accepts |
|---|---|---|
A direct argument, read by a parameter named after it |
|
not reached |
A direct argument no parameter reads |
|
not reached |
An input field whose argument a parameter takes whole, directly under the argument or one input object deeper |
|
not reached |
The same, the override written on the argument |
|
not reached |
A direct argument an |
none |
Refused: "no foreign key found between tables 'film' and 'actor'; auto-discovery is single-hop …" |
An input field an |
none |
Refused at the input field with the same message, and at the field as "1 input field could not be resolved" |
The reported shape, a list and a single id read by one condition through entries naming each key column |
none |
Refused, once per argument |
The id’s own |
none |
Builds |
So no spelling builds under an enclosing override, and which judge refuses depends on the spelling. Only the id’s own override builds, which is no help to a condition reading two arguments.
Without the override every spelling is refused by the store with NODE_ID_LANDS_ON_TABLE, by name and through argMapping alike. That is the rule and not part of this item; see the next section.
The rule, and where the code falls short of it
A condition without override: true is ANDed with every argument’s implicit predicate (docs/manual/reference/directives/condition.adoc), that predicate needs the route, and none or several foreign keys is NODE_ID_LANDS_ON_TABLE with @reference as the remedy (Alf, 2026-11-06 and 2026-11-07, recorded in R876’s graph and in docs/architecture/reference/code-generation-triggers.adoc). An id an argMapping entry hands to the method is still compared by the filter, so it owes the route as well: 83034e2 put that in the store’s rule, facts/defects/node-id-lands-on-table.graphqls pins it at filmsMapped, and defects/NODE_ID_LANDS_ON_TABLE.adoc says it.
The reporter says the by-name spelling built and ran on 10.0.0-RC56 with no paths written, its ids decoded before their method ran. What that build generated is not established. The release tags are not on this remote, and the store’s arm as it stood on trunk on 2026-11-12, 11-15 and 11-18, the days before the commit RC57 was cut from, has no exemption for an id bound by name: by its text it draws the defect. The reading that fits both is that the reporter’s tables are joined by exactly one foreign key in some direction beside the membership table, so the route was inferred, nothing was refused, and the generated query compared the ids over that key and ANDed the method’s EXISTS to it. That would be a narrower filter than the one they meant, and a test would pass on it wherever the two agree. It is a reading, not a finding; see Questions.
Under an override, three statements already agree that no route is owed:
-
The manual: field-level
override: true"suppresses the implicit predicates from the field’s direct arguments and from any input-typed argument nested under them". -
The store’s rule, in the comment on the arm that draws the row: "An id that binds no table predicate owes no route".
-
The walk’s author-owned arm,
NodeIdLeafResolver.Resolved.AuthorOwnedPredicate: the author has taken the predicate, so only the decode is needed.
Neither judge follows them past the id’s own directive.
The store already holds the fact. graphitron_occurrence_overridden has one row per occurrence (a field, argument or input field at one place it is reached from, so one input field used under two fields is two occurrences) that is at or under a @condition(override: true): the field, each of its arguments, and every input field under them. The other filter arms of the same rule view read it, as does graphitron_occurrence_taken. The arm for a named id with no path does not. It tests the id’s own @condition by joining graphitron_directive_application to graphitron_ast_input_value_condition_entry, which re-derives the first arm of graphitron_occurrence_overridden_rule and none of the second, and it is keyed on the declaration, so it could not tell an input type used under an overridden field from the same type under a plain one. An id under an enclosing override is then exempt only where an argMapping landing names it, which is why the rows of the table split as they do.
The walk refuses a second time what the store has already judged. NodeIdLeafResolver.resolve turns a route nobody wrote and no single foreign key supplies into a refusal, unless its authorOwnedPredicate argument is set, and its five callers (FieldBuilder.buildNodeIdArgPlan, walkInputTypeForSameTableNodeId, collectNestedNodeIdResolutions and classifyArgument, each through leafOverride, and BuildContext.classifyInputFieldInternal reading the field’s own directive) set it from the leaf’s own override alone. At every spelling probed with no override covering the id, the store’s verdict stopped the build before the walk ran, so that refusal reached an author in one case only: where the store had accepted the id, which is the rows above. The walk’s treatment of a column is the contrast. An argument or input field naming no column is never refused there: it becomes ScalarArg.UnboundArg or InputField.UnboundField, carriers that bind nothing, are admitted where an enclosing override suppresses them, and are otherwise left to the store’s COLUMN_UNRESOLVED, "whose verdict stops the build first" in their own javadoc.
A defect raised on a valid schema is a regression fixed ahead of planned work (docs/architecture/explanation/defects-as-facts.adoc), which is why this item sits above the ones around it.
Implementation
Two commits, the store’s first. Neither adds a relation, a stage, a defect code, a classifier arm or a message; the second removes a refusal.
The store’s exemption reads the stored fact (fix). In graphitron_occurrence_node_id_landing_entry_defect_rule, in the arm commented "A named node id with no route written, at a slot on a table other than the node’s":
-
Replace the
NOT EXISTSovergraphitron_directive_applicationandgraphitron_ast_input_value_condition_entrywith aNOT EXISTSovergraphitron_occurrence_overriddenat the occurrence,o.coordinate. It covers the id’s own override, which is that relation’s first arm, so nothing that is exempt today stops being exempt. -
Drop the inner
NOT EXISTSovergraphitron_occurrence_overriddeninside the filter-term test of the same arm, which the line above makes redundant. -
Restate the arm’s comment as the one rule: an id under an override binds no table predicate and owes no route, as one an
argMappingentry hands to a call and one under a@servicedo not.
occurrence-overrides runs at stage 35 and occurrence-builds, which owns this rule, at 42, so the read goes upstream. The grain becomes the occurrence: an input type reached under one overridden field and one plain one still draws its row for the plain occurrence, reported at the declaration as today.
What the change leaves alone, each checked in the probe or stated by the arm above it:
-
A path the author wrote that ends off the node’s table is still refused under an override, by the arm for written and inferred paths. Naming a foreign key asks the build to check it, which is also the walk’s rule.
-
A
@lookupKeyneeds no carve-out. A lookup key drives its lookup’s join whatever stands in for the filter, and a node id of another table as a lookup key isLOOKUP_KEY_OFF_TABLEunder an override already (probed: that row and no other). -
An id under an override that nothing reads keeps
ARGUMENT_UNBOUNDand loses the second row beside it.
The change only widens an exemption, so it can draw no new row. Count the rows it stops drawing over the FS-plattform captures, as 83034e2 did, and put the count in the commit message.
The walk stops refusing a route nobody wrote (fix; Filip, 2026-11-25: go with removing the walk’s refusal of this scenario). The store owns validation (Alf, 2026-11-13, docs/architecture/explanation/pipeline-overview.adoc), and a walk refusal that duplicates a stored defect is removed where it untangles simply (defects-as-facts.adoc). This one does, along the line the column case already drew:
-
NodeIdLeafResolver.resolveloses itsauthorOwnedPredicateparameter. A leaf with no stated route and none or several foreign keys resolves to one arm whatever overrides it, today’sResolved.AuthorOwnedPredicate, renamed for what it now says: no route, and the walk does not judge that. The five callers stop computing the flag andFieldBuilder.leafOverridegoes. -
Where the leaf carries its own
@condition(override: true), the consumers build what they build today,ScalarArg.ConditionOwnedArgand its input-field counterpart, andFieldBuilder.firstMixedContractkeeps refusing a multitable field where some participants route such a leaf and others do not. That check concerns the leaf’s own method, which is handed a different table on each side of the split; under an enclosing override the method is the field’s and receives the field’s table either way, so the check does not widen. -
Everywhere else the leaf takes the unbound carrier,
ScalarArg.UnboundArgorInputField.UnboundField: nothing to bind, admitted where an enclosing override suppresses it, and otherwise a shape the store’sNODE_ID_LANDS_ON_TABLEhas refused before the walk ran. A leaf whose own@conditiondoes not override keeps the treatment the column case gives it. -
A stated route that fails to resolve stays the walk’s refusal, as does every refusal about the leaf itself (an unknown type, a polymorphic container, a key past jOOQ’s
Row22).
Two things the implementer has to establish, not assume:
-
Nothing the walk refused alone is left without a stored answer. The probe found a stored
NODE_ID_LANDS_ON_TABLEat every unrouted spelling with no override. The walk’s own tests of this refusal (NodeIdLeafResolverTest, and the cases found by its two messages, "no foreign key found between tables" and "multiple foreign keys found between tables", inGraphitronSchemaBuilderTestand the pipeline tests) each name a shape: a bare@nodeId, a multitable participant, a nested input. Each moves to a fact document row stating the stored defect for that shape. A shape the store states no defect for and no override covers is a finding to bring back to this item before the refusal goes, not a schema that starts building. -
The decode ledger tells the truth about these coordinates.
NodeIdDecodeLedger.recordLeafrecords today’s arm as a decode the walk installs, andFieldBuilder.disposeRefusedNodeIdArgumentrecords anUnboundArgas a refusal; for an id that builds under an enclosing override with its decode rendered by the store’sConditionEmitter, both are false, and the ledger keeps a coordinate’s first row, so a false one also shadows the projected-key rowNodeIdDecodeCoverage.violationsfolds in from the store. The constraint here is narrow: such a coordinate does not fail the coverage rule, is not recorded as refused, and is not recorded as a walk install it does not carry. What row a decode the store emits should get is not settled on any page and this item does not settle it; it goes onto R876’s routes node.NodeIdDecodeCoverage.violationsonly asks that a row exists, so it is no evidence of a decode: the execution test’s malformed-id case is.
Removing the refusal takes no help from an author. Its message, with the candidate keys, is one the store’s verdict already pre-empts wherever the route is owed.
R876’s node "The classifier reads its routes from the store, the @nodeId filter first" deletes the resolver’s route search. This commit leaves it less to delete and adds nothing for it to migrate.
Docs, in the commit whose rule they state:
-
docs/manual/reference/directives/condition.adoc, as drafted below. -
docs/manual/reference/directives/reference.adoc, path rules, anddocs/architecture/reference/code-generation-triggers.adoc, "Paths on arguments and input fields": both say a@nodeId(typeName:)"always has a path". The store has exempted an id under a@service, one anargMappingentry hands to a call, and one with its own override for some time, so the sentence gains "where a table predicate compares it" and the list of what does not. The architecture page states a dated ruling of Alf’s; see Questions. -
docs/architecture/reference/argument-resolution.adoc:ConditionOwnedArgis described as a@nodeIdargument with no route "whose own@condition(override: true)`" owns the predicate; say that an unrouted id without one is an `UnboundArg. The javadoc ofScalarArg.UnboundArgandInputField.UnboundFieldsays such a slot "compares nothing, the store’s `COLUMN_UNRESOLVED`"; it gains the unrouted id and its code. -
graphitron-model/src/main/resources/no/sikt/graphitron/model/defects/NODE_ID_LANDS_ON_TABLE.adoc: its last sentence names theargMappingcase "without `override: true`"; restate it as the rule, an id is judged where a filter compares it and an override at or above it means none does. -
roadmap/changelog.md, at Done: the entry states the rule and its two remedies, a path or an override. It says nothing about 10.0.0-RC56 unless Questions, 2 is answered by then.
User documentation (first-client check)
condition.adoc, the override row of the argument table, its last sentence but one:
On a
@nodeIdleaf with no join route to its node’s table, an override that suppresses the leaf’s predicate also suppresses the route demand: nothing compares the id on a table, so there is nothing for a@referencepath to describe, and the method receives the leaf’s decoded key.
The constraint that today begins "On a @nodeId leaf whose route to the target table does not resolve, override: true takes the whole WHERE contribution" gains what "the override" is and what each kind hands the method:
This holds for whichever override suppresses the leaf’s implicit predicate: the leaf’s own, the enclosing field’s, or that of an argument or input field the leaf is nested under. With the leaf’s own override its method receives the resolving table and the decoded key. Under an enclosing override the leaf has no method of its own; the enclosing condition’s method reads it as it reads any argument, by a parameter bound to it or by an
argMappingentry, and an id nothing reads is refused asARGUMENT_UNBOUND. A path written on such a leaf is still checked, and one that ends off the node’s table is refused. Without an override at or above the leaf the route is required: write it with@reference.
That reads as one rule with one exception list, which is the test this section is for.
Tests
-
The defect’s minimal pair, in its keystone.
facts/defects/node-id-lands-on-table.graphqlsowns the code. It gains a field overfilmwith anActorid read by a parameter named after it, written twice: under a field-leveloverride: trueit draws nothing, and without the override it drawsNODE_ID_LANDS_ON_TABLEat the argument with detailpublic.film. Two input types of one shape, each holding anActorid and taken whole byInputFieldConditionFixtures.outerOverrideMethod, pin the nested case the same way, one under an overridden field and one under a plain field; a third under an argument-level override on its argument draws nothing. The header says what each is there for. The by-name pair needs a condition method taking the id whole, as aRow1<Integer>or the node’s record, which no fixture has; it goes ingraphitron-sakila-servicebesideInputFieldConditionFixtures.projectNameAtlas, the composite-key one. -
ARGUMENT_UNBOUNDalone.facts/defects/argument-unbound.graphqlsgains an unrouted id under a field-level override that no parameter reads, beside one the method does read: one row at the unread id, and noNODE_ID_LANDS_ON_TABLEat either. -
A scenario that generates.
facts/scenarios/condition-filter.graphqlshas five ids under four fields carrying a field-level override, each id with a@referencepath written only because the build demanded one.filmsByLanguagesWithOriginal, the reported shape, andOptionalLanguageFilter.languageRefdrop theirs;filmsByLanguagesandLanguagesPick.languageIdskeep theirs, so a written path under an override stays covered. The document’sgraphitron_pathclaim follows (EMPTYwhere the path went). A scenario stores no defect andGenerateTestSchemasgenerates every one, so this document is where the store’s verdict and the walk’s are held to the same answer, andConditionEmitterExecutionTestgoes on compiling and running what it emits. -
Execution.
filmsByActorsas in the Goal goes intographitron-sakila-example’s schema with `filmsWithAnyActorinProjectedKeyConditionFixtures, and beside it a field reading the same list whole by a parameter named after the argument, its method taking aListofRow1<Integer>or of the node’s record, the fixture the keystone’s by-name pair adds. An execution test besideProjectedNodeIdListConditionExecutionTestruns both against PostgreSQL: the films of the named actors come back, a malformed id in the list is the client’s error, an omitted list constrains nothing. -
What stays refused. The keystone’s existing rows are unchanged,
filmsMappedamong them, and it gains a row for each shape the walk’s deleted cases named (see Implementation).NodeIdLeafResolverTestkeeps its cases for a stated route that fails, with and without the leaf’s own override; its cases for the flag go with the flag. -
Acceptance. The table above, row by row. Row 2 keeps
ARGUMENT_UNBOUNDas its one stored row and does not build. Every other row has no stored defect and builds, the last as it does today.
Retired vocabulary
-
NodeIdLeafResolver.resolve’s `authorOwnedPredicateparameter,FieldBuilder.leafOverride, and its javadoc sentence "An enclosing cascade does not count here". -
NodeIdLeafResolver.Resolved.AuthorOwnedPredicateunder that name. The manual’s "author-owned" for a leaf whose own override takes the predicate stays. -
The resolver’s two auto-discovery refusals at an argument or input field, "no foreign key found between tables …; auto-discovery is single-hop …" and "multiple foreign keys found between tables …", wherever no other caller still mints them.
-
"the leaf’s own
@condition(override: true)`" as the condition for owing no route: the resolver’s javadoc, the SQL comment on the store’s arm ("one whose own @condition(override: true) takes the predicate on itself"), and `argument-resolution.adoc.
How this sits against other items
-
R1202 (done) made an
argMappingentry naming a key column past a list of node ids build at a@condition. Its probes all had a route, and its scenario rows carry the paths this item removes. With both landed the issue 583 schema builds withoverride: true, entries naming the key column, and no paths. -
R876. The store’s commit is what survives, and the walk’s is a subtraction ahead of the node "The classifier reads its routes from the store, the @nodeId filter first", whose list of what goes loses the refusal and the flag when this lands. That node also takes the two findings named above: the arm’s overlap with
COMPARED, and what the decode ledger records for a decode the store emits. Nodepends-on: nothing here waits on a node. -
R1139 asks for the same exemption for an argument matching no column, and the 2026-11-25 staleness audit reads it as delivered. This item is the
@nodeIdcase that remains; if R1139 is discarded its changelog line points here. Nothing of it is folded in.
Other solutions we’ve considered
Widening the walk’s escape. The five callers could pass the leaf’s own override or the enclosing one, which the walk carries as fieldOverride and ClassifyContext.enclosingOverride, so the resolver returns its author-owned arm under either. It is the smaller diff and it was this spec’s first draft. It loses to the plan above on three counts: ClassifyContext’s own javadoc says the classifier does not read `enclosingOverride to decide a variant, so this would be the first place it does, a new axis in a classifier pipeline-overview.adoc calls "a surface being drained, not a place to extend"; it keeps a walk-side definition of "covered by an override" beside graphitron_occurrence_overridden, free to drift from it; and it leaves the duplicate refusal standing for R876 to delete later.
The walk standing down at these fields, as it does at a @service: its errors dropped where the store owns the field. Not available. A table-bound read is still planned from the walk’s classification (R876’s "The walk’s read path is gone" is blocked, and "The root query fetchers are emitted from the store" is open and not landed), so a field the walk leaves unclassified gets no fetcher. The plan classifies the field and only stops refusing it.
Folding the arm’s other tests into one stored fact. The arm’s remaining tests, a filter term, an argMapping landing and a @service, together re-derive part of what graphitron_occurrence_taken states as COMPARED. That relation is written by occurrence-tenants at stage 43, after this rule, so the arm cannot read it. Folding them means storing "binds a table predicate" ahead of stage 42 or moving the arm a stage later, and either is a change to the model’s shape, not to this exemption. It goes onto R876’s routes node as a finding.
Questions for Alf or Filip
-
The dated ruling. "`@nodeId(typeName:)` … always has a path" is Alf’s wording of 2026-11-06, and the store’s rule has had exemptions to it since. Qualifying the sentence states what the code already does and adds no rule, but it edits a ruling’s text, so Alf should see the new wording before or at review. Parked by Filip on 2026-11-25; it does not hold up the gate.
-
What RC56 generated. Not a ruling but a missing fact, and the reporter or anyone with the fs-plattform catalog can supply it: whether a foreign key joins
organisasjonandorganisasjonssamlingdirectly, in either direction, and likewiseorganisasjonandmiljo; and the body of the condition method RC56 generated fororganisasjonerISamlinger. If a key exists, RC56 did what trunk does today for a routed id without an override, the reporter’s query was filtering on that key as well as on theirEXISTS, and they should be told. If none exists, RC56 accepted a shape trunk has refused since at least 2026-11-12, and which commit it was cut from is the next thing to find. Either answer changes nothing in the plan above.
Architect consult
Consulted twice.
At take-up, with the store read of graphitron_occurrence_overridden and a widened walk flag as the proposed design. It raised: that replacing the own-directive test is the right shape and also corrects the test’s grain from declaration to occurrence (taken, Implementation); that the arm must not read graphitron_occurrence_taken, which is downstream, and that the overlap with COMPARED is a finding for R876 (taken, Other solutions); that a @lookupKey should keep owing its route under an override (settled by the probe: LOOKUP_KEY_OFF_TABLE already states it, so no carve-out is written); that the walk should read the stored fact and not recompute it, or the refusal be deleted if it feeds no emission (not taken then, taken in substance after the second consult); that "always has a path" is already untrue and its correction qualifies a dated ruling (Questions, 1), with reference.adoc’s path rules and `argument-resolution.adoc changing beside it (taken, Docs); that R1139 is a cross-reference only (taken); and that one overridden scenario field should keep a written path (taken, Tests).
Before handover, on the drafted spec with the widened flag. It raised: that the draft’s premise was wrong, the classifier not reading enclosingOverride to decide a variant, and that the column case shows the shape that deletes, an unrouted leaf as an unbound carrier with the store’s defect the only refusal (taken: the walk half is rewritten as that removal, and the widened flag moved to Other solutions); that the stand-down claim holds but rules out only leaving the field unclassified (taken, Other solutions); that the resolver has five callers, not three (taken); that the ledger row for these coordinates would be false and NodeIdDecodeCoveragePipelineTest proves nothing about them (taken: the constraint is stated, the evidence is the execution test, and the open half goes to R876); that the by-name execution field cannot take a List<Integer> (taken, Tests); that the acceptance bullet contradicted row 2 (taken); that the unbound carriers' javadoc needs the new case (taken, Docs); that the question about patching the walk was a false binary once the removal exists (taken, and what was left of it Filip decided: the removal); and that the changelog’s claim about RC56 is a ruling in disguise (taken: on looking, what RC56 did turned out not to be established at all, Questions, 2).