Skip to content

Error: HTTP status in code, rule name in reason (#159) - #160

Merged
clabonte merged 1 commit into
mainfrom
error-shape-integer-code-reason
Oct 14, 2026
Merged

clabonte merged 1 commit into
mainfrom
error-shape-integer-code-reason

Conversation

@clabonte

Copy link
Copy Markdown
Collaborator

Closes #159. Generator side: clabonte/generator#2671 (body rewritten to match).

What changes

Field Before After
code string, rule name integer, HTTP status
reason — string, rule name (^[a-z][a-z0-9_]*$, max 64, optional)
status integer, HTTP status removed
id format: uuid plain string
type — $ref: ErrorType (new x-extensible enum, the 8 values domainExceptions requires)
  • API_Handbook.md §11 rewritten (schema, what code / type / reason are each for, the ErrorType requirement, how to set reason from generated C# until #2671 ships, error table recast as type + common reason values). §2.1 and every JSON/YAML example move rule names to reason.
  • init scaffold, hello-orders, samples/endpoint-samples.yaml, spec-drafting skill.
  • compatibility.md §54: decision, measurement, migration for projects on the old shape. §51 / §52 / §53 point to it.
  • CI: example-regen.yml generates domainExceptions from a hello-orders copy and dotnet builds it via .github/ci/error-shape-probe/ErrorShapeProbe.csproj.

Beyond #159

type + ErrorType added. Measured on 0.17.0: domainExceptions fails generate with two ARTIFACT_SCHEMA_DEPENDENCY ERRORs unless Error.type is typed by an ErrorType enum with 8 specific values. No handbook said so. Without it the compile check in #159 can't exist.

Measured (generator 0.17.0, hello-orders copy + domainExceptions)

  • Old Error (+ type): 22 distinct CS0029 (one Id, one Code per exception-built Error).
  • New Error: 0 errors. CI step replayed locally: 0 errors.
  • hello-orders validate: 0 / 19 / 11, unchanged; its own group now generates 15 files (+ErrorType.g.cs). Kit Spectral: same 20 findings, 0 errors.
  • Fresh init scaffold: validates, same five finding codes as §53.

Breaking

For any project scaffolded by kit ≤ 0.26.0 that keeps the kit's Error: wire change for clients branching on code / reading status. Migration in §54. Generated C# never compiled against the old shape, so no generated code depends on it.

🤖 Generated with Claude Code

…eason` (#159)

The kit's Error had a string `code` naming the rule, an integer `status`
and a uuid `id`. It never compiled with the C# domainExceptions artifact
(22 CS0029 on generator 0.17.0). Adopt the shape RestoManager runs end
to end: integer `code` (HTTP status), optional snake_case `reason` (the
rule), plain-string `id`, no `status`. Add `type` and an `ErrorType`
enum, which domainExceptions requires (ARTIFACT_SCHEMA_DEPENDENCY) and
no handbook mentioned.

- API_Handbook §11 rewritten, §2.1 and every example move rule names
  to `reason`; scaffold, hello-orders and endpoint-samples updated.
- spec-drafting skill asserts errors[0].reason.
- example-regen generates domainExceptions from a hello-orders copy and
  builds it (.github/ci/error-shape-probe), so the shape is
  compile-checked on every PR and pin bump.
- compatibility.md §54 records the decision, the measurement and the
  migration; §51, §52 and §53 point to it.

Closes #159.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clabonte
clabonte merged commit f001994 into main Oct 14, 2026
9 checks passed
@clabonte
clabonte deleted the error-shape-integer-code-reason branch October 14, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API_Handbook §11 / compatibility.md §52: adopt integer code (HTTP status) + reason (rule name) as the kit Error shape

1 participant