ID |
|
|---|---|
Status |
Ready |
Bucket |
bug |
Priority |
5 |
Theme |
diagnostics |
Created |
2026-10-30 |
Updated |
2026-10-31 |
A rejected @error type cascades into misleading diagnostics on the types around it
Goal
When a type is rejected, the build reports that one rejection and nothing whose only cause is it. A diagnostic that exists only because another type was already rejected is dropped from the validator’s output, but only when the rejection it depends on is itself reported, so a root cause can never be swallowed.
A rejected type here is a type the classifier demoted to UnclassifiedType: it appears in the
type registry with a Rejection instead of a classified variant, and the validator reports it
once, as Type '<name>': <rejection>.
Today an @error type whose handler names a class the module does not declare produces three
independent-looking errors from one fault:
interface Error { path: [String!]! message: String! }
type KregUgyldigInput implements Error
@error(handlers: [{handler: GENERIC, className: "jakarta.ws.rs.ForbiddenException"}]) {
path: [String!]!
message: String!
}
Before (three errors; the second points at the stable Error interface and suggests @table on an
error type, the third is noise):
Type 'KregUgyldigInput': @error type rejected: @error handler {handler: GENERIC, className: "jakarta.ws.rs.ForbiddenException"}: class '...' is in jakarta.ws.rs:jakarta.ws.rs-api, which this module does not declare: ...
Type 'Error': implementing type 'KregUgyldigInput' is not table-bound (missing @table directive)
Field 'KregUgyldigInput.path': parent type is unclassified
Field 'KregUgyldigInput.message': parent type is unclassified
After (one error, the root cause):
Type 'KregUgyldigInput': @error type rejected: @error handler {handler: GENERIC, className: "jakarta.ws.rs.ForbiddenException"}: class '...' is in jakarta.ws.rs:jakarta.ws.rs-api, which this module does not declare: ...
All three disappear today once the dependency is declared, and still would after this change; the change only stops them being reported while the root cause stands.
What the code does today (verified)
-
The
@errorrejection:TypeBuilder.buildErrorTypecollectsrejectReasonsand returnsUnclassifiedTypewith"@error type rejected: ...". The undeclared dependency reason comes fromTypeBuilder.validateExceptionClass, which asksClasspathNameability.verdictFor; the "which this module does not declare" text isClasspathNameability’s. The item’s quoted message omits the `@error type rejected:prefix; otherwise accurate. -
Interface follow-on:
TypeBuilder.buildParticipantListcallsparticipantClassificationfor each implementor. A member that isUnclassifiedTypefails the!(gt instanceof UnclassifiedType)test and falls to the finalelse, which adds"implementing type 'X' is not table-bound (missing @table directive)". Thatelseconflates two cases: a genuinely directiveless/non-table member (the hint is right) and a member that was already rejected (the hint is wrong). The caller turns the joined errors into anUnclassifiedTypefor the interface (plain interface arm inclassifyType, the union arm, and the@table @discriminateinterface arm viabuildTableInterfaceType). The same wrong message therefore also hits unions with a rejected member. The rule is not@error-specific: any rejected@table,@recordor@errormember triggers it. -
Field follow-on:
FieldBuilder.classifyFieldInnerends withUnclassifiedField(..., Rejection.structural("parent type is unclassified"))for any parent that is not a root, table-backed, result or error type, which is everyUnclassifiedTypeparent. It fires for every field of a rejected type, not justpathandmessage. Earlier branches (@routinechains and the like) can still reject such a field for their own, independent reason. -
Validator:
GraphitronSchemaValidator.validateUnclassifiedTypeandvalidateUnclassifiedFieldeach emit oneValidationErrorper verdict (ValidationError.forType/forField). There is no cause-aware dedup and no existing "because X was rejected" pattern for type verdicts. The nearest precedent isGraphitronSchemaBuilder.rejectDanglingTypeReferences, which appends the reason the type did not classify (attribution, not suppression), andRejectionalready distinguishes typed arms fromStructuralprose. -
Not in the item: a field that returns a rejected type (
Query.x: KregUgyldigInput) is a third possible cascade. It is not part of the reported fault and is left out of scope here. -
No existing test pins either follow-on message (searched
graphitron/src/testfor both strings; only comments inEntityResolutionBuilderTestmention a "missing @table" hint for a different, federation message).UnclassifiedTypeValidationTestpins only that eachUnclassifiedTypeyields one error.
Decision
-
General, not
@error-only. Both follow-on sites key oninstanceof UnclassifiedType, not on@error; an@error-only rule would have to rediscover the cause at a site that does not know it, and a rejected@tabletype (unknown table) cascades identically today. -
Suppress in the validator, attribute in the model. Keep the model total and unchanged: the interface stays an
UnclassifiedTypeand the field stays anUnclassifiedField, so no emitter or registry invariant moves (dropping a member from the participant list, or not producing the field, would). What changes is that the rejection each carries is a new typed arm naming its cause, and the validator drops it from the error stream only when the cause is itself reported. Plain suppression keyed on message text is rejected; so is "attribute only" (still two to four lines for one fault).
Implementation
-
Rejection.AuthorError: add a record armCascadedFrom(List<String> rejectedTypeNames, String reason)whosemessage()reads as a consequence, for any consumer that reads the model rather than the validator stream (for example "implementing type 'X' was rejected, see Type 'X'" and "parent type 'X' was rejected, see Type 'X'"). Extend the exhaustive switches the compiler flags (Rejection.prefixedWith, the diagnostic-facts mapping covered byDiagnosticFactsTest);RejectionKind.ofalready maps the wholeAuthorErrorfamily toAUTHOR_ERROR. -
TypeBuilder.buildParticipantList: whengt instanceof UnclassifiedType, record the member as a cascaded cause instead of adding the "not table-bound" string. Return a cascade rejection only when no genuine error was collected; when both occur, report the genuine ones and omit the cascaded names (the rejected member has its own diagnostic).ParticipantListResultcarries the cascade as a typed value rather than prose so the three callers (plain interface, union,@table @discriminateinterface) buildUnclassifiedType(name, location, CascadedFrom(...)). -
FieldBuilder.classifyFieldInner, final return: whenparentType instanceof UnclassifiedType, returnUnclassifiedFieldcarryingCascadedFrom(List.of(parentTypeName), ...); keep the existing structural message for the remaining case (parent absent from the registry). -
GraphitronSchemaValidator: invalidateUnclassifiedTypeandvalidateUnclassifiedField, skip the error when the rejection isCascadedFromand every named cause is, in the registry, anUnclassifiedTypewhose own rejection is notCascadedFrom(a root cause). If any cause is missing or itself cascaded, emit the error as today, so a cascade can never hide the only report. Cycles are impossible because a cascade is only created from a root or already-cascaded rejection and the root check is one hop. -
Javadoc on the new arm states the invariant (reported cause or reported itself), per the repo’s javadoc conventions; no roadmap ids in comments.
Tests
-
Pipeline tier,
GraphitronSchemaBuilderTest-style or a new*PipelineTest(docs/architecture/how-to/testing.adoc): build the SDL above with a handlerclassNamethe test classpath names but the nameability gate rejects (reuse the fixture the existingClasspathNameabilityTest/@errorhandler cases use), runGraphitronSchemaValidatorand assert exactly one error, forKregUgyldigInput, and none forErroror its fields. Also assert the model still holdsUnclassifiedTypeforErrorandUnclassifiedFieldfor both fields, so the model-unchanged claim is pinned. -
Same shape for a union with a rejected
@errormember, and for a rejected@tabletype with an unknown table implementing a plain interface (pins the general rule). -
Guard cases: an interface with one rejected member and one genuinely directiveless member still reports the directiveless one; a
CascadedFromwhose cause is absent from the registry is still reported (unit tier,UnclassifiedTypeValidationTest). -
Existing field-level
UnclassifiedFieldcases inGraphitronSchemaBuilderTest(unknown column, unknown reference) are unaffected: their parents classify.
Open question
Should a field that returns a rejected type (Query.x: KregUgyldigInput) be folded into the same
rule? Recommended: no, separate item, since it is a different edge and not part of the reported
fault.
Provenance: reported by the kreg Graphitron 10 port session (fs-plattform’s kreg module on 10.0.0-RC46, branch worktree-kreg-g10 at 7858137af4, not pushed), 2026-10-30; the reporter found it present on graphitron origin/main the same day.