spec: M092_001 — structured error codes and context for cache_kit::Error#3
Closed
indykish wants to merge 1 commit into
Closed
spec: M092_001 — structured error codes and context for cache_kit::Error#3indykish wants to merge 1 commit into
indykish wants to merge 1 commit into
Conversation
First v0.9.2 milestone spec. Converts the 850-line proposal at plans/error-codes-improvement.md into a 284-line goal-contract spec following the dotfiles TEMPLATE.md format. Scope (additive only; v0.9.2 stays backwards-compatible): - ErrorCode enum keyed by stable u32 values in documented ranges - ErrorContext struct (cache_key, operation) via builder methods on Error - code() / context() / is_retryable() / http_status() accessors on Error - Wire codes through every existing Err(Error::...) construction site - New user-facing error-handling page on the docs site Out of scope (deferred to v1.0): - Wire-format / JSON serialization of errors - Breaking changes to existing Error variant tuple shapes - i18n / translation tables - Codegen for the error catalog page Provenance: agent-generated (pre-spec, derived from plans/error-codes-improvement.md). The proposal is read for intent; the spec's Sections + Tests + Invariants are the executable contract. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3 +/- ##
=======================================
Coverage ? 73.03%
=======================================
Files ? 14
Lines ? 2173
Branches ? 0
=======================================
Hits ? 1587
Misses ? 586
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5 tasks
Owner
Author
|
Consolidated into #2 (docs/nextjs-netlify-migration). Same spec content, single PR. |
12 tasks
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.
Summary
First v0.9.2 milestone spec. Converts the 850-line proposal at
plans/error-codes-improvement.mdinto a 284-line goal-contract spec following the freshly-updateddotfiles/docs/TEMPLATE.md(see indykish/dotfiles#16).No code yet — this PR is the spec only. Implementation happens after the spec lands on
main, on a separatefeat/m092-error-codesbranch per the lifecycle.What the spec defines
Additive-only changes to the v0.9.x error surface — no breaking changes, ships in 0.9.2:
ErrorCodeenum (#[repr(u32)]) with stable codes in documented numeric ranges.ErrorContextstruct (cache_key,operation) via builder methods onError.Error:code(),context(),is_retryable(),http_status().Err(Error::...)construction site insrc/.site/content/integration/error-handling.mdx(hand-authored catalog).Existing
Errorvariant tuple shapes are preserved → consumers'matchpatterns keep compiling.What's deliberately out of scope
plans/comprehensive-code-review.md(circuit breaker, observability, cache warming, etc.) — each gets its own spec when picked up.How this spec is shaped
Five sections in the prologue point the implementing agent at the exact files to read before touching anything (
src/error.rs,src/expander.rs, both backend mappers,examples/actixsqlx/, plus the source proposal for intent only). The spec does not contain Rust pseudocode — every interface is named at contract level, every test is named with prose-only assertions, every invariant names its enforcement mechanism (compile-time exhaustive match, golden-blob test, runtime check).Invariants worth highlighting
ErrorCode::Foo.as_u32()never changes. Enforced by a golden-blob test pinned totests/fixtures/error_codes.golden.Error::code()must map every variant. Adding a new variant without updating the mapping fails to compile.is_retryable()matches the retry loop —src/expander.rs::retry_with_backoffretries ifferror.code().is_retryable(). Drift between the two breaks production retry behavior.Test plan
🤖 Generated with Claude Code