Priority
Medium
Context
Generated identifier failures are currently represented by generatedIdentifierError, raised with panic, and recovered at top-level app-generator entry points. Unrecognized panic values are rethrown.
The compiler architecture policy otherwise states that malformed IR and generated-output boundary failures should be returned as diagnostics or ordinary errors rather than panics.
Problem
Using panic/recover for expected validation or construction failures obscures function contracts, complicates local reasoning and testing, and risks converting future programmer defects incorrectly or allowing expected errors to escape a boundary that lacks the recovery wrapper.
Proposed direction
Make identifier builders and all dependent source/AST planning functions return explicit errors. Attach endpoint/source context while propagating the error. Keep recovery only at an outer process or request boundary for truly unexpected faults, not as normal generator control flow.
Acceptance criteria
Affected areas
internal/appgen/identifier_errors.go, identifier helpers in generated source planners, appgen public entry points, compiler/generator architecture documentation.
Priority
Medium
Context
Generated identifier failures are currently represented by
generatedIdentifierError, raised withpanic, and recovered at top-level app-generator entry points. Unrecognized panic values are rethrown.The compiler architecture policy otherwise states that malformed IR and generated-output boundary failures should be returned as diagnostics or ordinary errors rather than panics.
Problem
Using panic/recover for expected validation or construction failures obscures function contracts, complicates local reasoning and testing, and risks converting future programmer defects incorrectly or allowing expected errors to escape a boundary that lacks the recovery wrapper.
Proposed direction
Make identifier builders and all dependent source/AST planning functions return explicit errors. Attach endpoint/source context while propagating the error. Keep recovery only at an outer process or request boundary for truly unexpected faults, not as normal generator control flow.
Acceptance criteria
error.recoverGeneratedIdentifierErrorandgeneratedIdentifierErrorare removed.Affected areas
internal/appgen/identifier_errors.go, identifier helpers in generated source planners, appgen public entry points, compiler/generator architecture documentation.