Implementation plan: wave-based decomposition; waves 1-2 decomposed (11 tasks)
docs/plans/implementation.md records the wave structure (core -> substrate fork || pg engine -> sqlite engine -> contract suite -> release), the decided points (contract-suite layout = option (a), engine-tests vs equivalence-suite split, no CI, mem-engine/fuzzing deferrals surfaced), and the review-gate rhythm. Wave 1 (foundations): workspace scaffold, core errors/validation, value types, trait surface, contract-suite scaffold (+ADR-022), review gate. Wave 2 (substrate fork): fork scaffold/provenance, connection+watcher port, queue-op re-derivation on contract v1, provenance/floor close, review gate.
This commit is contained in:
1 parent
83767e880b
commit
49743c690e
12 files changed
+1009
No files matched your search
@@ -0,0 +1,72 @@
|
||||
---
|
||||
id: core-errors-and-validation
|
||||
name: Core error taxonomy and name validation
|
||||
status: pending
|
||||
depends_on: [scaffold-workspace]
|
||||
scope: narrow
|
||||
risk: low
|
||||
impact: project
|
||||
level: implementation
|
||||
tags: [wave-1, core]
|
||||
---
|
||||
|
||||
## Description
|
||||
|
||||
Implement the core crate's error taxonomy and the name-validation
|
||||
helpers every entry point shares.
|
||||
|
||||
**Error taxonomy** (ADR-008 §5, exact): one top-level `Error`,
|
||||
`thiserror`-typed, `#[non_exhaustive]` (ADR-017 §3 — mechanically
|
||||
enforces catch-all matching). Variants:
|
||||
|
||||
- `PayloadTooLarge { limit }` — universal variant; produced pg-side
|
||||
only (the occurrence asymmetry is engine work, not core's — core
|
||||
defines the variant and its doc text)
|
||||
- `ReservedName { name }`
|
||||
- `InvalidName { name }`
|
||||
- `Closed`
|
||||
- `Codec`
|
||||
- `Database` — the opaque fallback; engine detail rides the source
|
||||
chain (`#[source]`), no engine-specific variants ever minted
|
||||
|
||||
**Name validation** (ADR-008 §4): a shared validation helper applied at
|
||||
every name-bearing entry point — non-empty (`InvalidName`) and
|
||||
reserved-prefix rejection for the `__alkstore_` prefix
|
||||
(`ReservedName`). The helper distinguishes the two name classes:
|
||||
|
||||
- Shared-namespace kinds (channels, streams, queues, outboxes, locks,
|
||||
schedule names): non-empty + reserved-prefix rejected.
|
||||
- Consumer-local identifier classes (stream-consumer names, `owner` on
|
||||
`try_lock`, `worker_id` on claims): non-empty only — a leading
|
||||
`__alkstore_` is legal (ADR-008 §4 third-round annotation).
|
||||
|
||||
Also the reserved-string constant: `__alkstore_listener_reconnected__`
|
||||
(the one v1-reserved string, ADR-008 §4) — public in core so the pg
|
||||
engine and the contract suite reference the same constant.
|
||||
|
||||
`Result<T>` alias in the crate's prelude shape. No panics; no
|
||||
`unwrap()`/`expect()`.
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] `Error` with exactly the six v1 variants, `#[non_exhaustive]`,
|
||||
`thiserror`-derived, `Database` carrying `#[source]`
|
||||
- [ ] Validation helper(s) covering both name classes, unit-tested
|
||||
(empty, whitespace-only, reserved-prefix, reserved string
|
||||
itself, legal names)
|
||||
- [ ] Reserved-string constant exported
|
||||
- [ ] `cargo test -p alkstore`, clippy `-D warnings`, fmt clean
|
||||
|
||||
## References
|
||||
|
||||
- docs/architecture/decisions/008-contract-v1-pinning.md §4, §5
|
||||
- docs/architecture/decisions/017-contract-versioning.md §3
|
||||
- docs/architecture/core-contract.md §Errors, §Naming / reserved namespace
|
||||
|
||||
## Notes
|
||||
|
||||
> To be filled by implementation agent
|
||||
|
||||
## Summary
|
||||
|
||||
> To be filled on completion
|
||||
Reference in new issue
Block a user