Repository navigation
Commit f53bf00
committed
feat(stack-encrypt)!: codes, help and fields on every error; dynamic input errors name the field
stack-encrypt was the one crate in the chain with no miette support: its
errors were plain thiserror enums with no codes and no help, and the
dynamic module's input errors were unit variants that could not say which
field was wrong. A Go caller got "malformed input" for a bad plan, a
record that did not fit it, an empty context and an over-long one alike.
Every error type here now derives `miette::Diagnostic` with a
`stack_encrypt::*` code, listed in `ERROR_CODES` and pinned by a test
that builds every variant: `Error`, `PlanError`, `LabelError`,
`LeafBytesError`, `sem::TermError`, `sem::TermBytesError`, and with
`dynamic`, `dynamic::Error` and `dynamic::TargetError`. Help is added
where a caller can act (`ForeignKeyset`, `DescriptorTooLong`,
`EmptyTermText`, the plan refusals), and each implements the shared
`ErrorPayload`: both keyset ids of a `ForeignKeyset`, the field and
expected type of a `FieldType`, a descriptor's length against its limit.
`Error::Kms`, `Term` and `Plan` forward the code of what they carry;
`Kms` is now transparent outright, so a ZeroKMS keyset-not-found reads as
itself.
BREAKING CHANGE: `dynamic::Error::Context`, `Plan`, `Source` and `Record`
are struct variants carrying `field: Option<String>` and a `Reason` from
the new fixed `dynamic::Reason` enum (`MissingContext`, `DuplicateOutput`,
`FieldMissing`, `NoCiphertextNode`, ...), and `Term` gains `field`.
Every site that raised one now names the field it knows, plan builder and
engine refusals included; `in_field` names it from the caller's side for
functions that never see one. `Error::Kms` loses its message prefix.
`ContextMismatch` gives the stored context's length and part count rather
than its descriptor, which a context field can fill with customer data,
and `TermError::Prf` and `MatchPositionOutOfRange` stop repeating
another library's message and a value read from term bytes. The Go
guest's status mapping matches the new shapes; its numbers are unchanged.
Refs #1099
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01URtfKsTToFUCRwq3g7gCUf1 parent f9b1eeb commit f53bf00
19 files changed
Lines changed: 2059 additions & 243 deletions
File tree
- languages/golang/encrypt/guest
- src
- packages
- eql
- stack-encrypt
- fuzz
- src
- dynamic
- plan
- sem
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | | - | |
112 | | - | |
| 111 | + | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
408 | | - | |
| 408 | + | |
409 | 409 | | |
410 | 410 | | |
| 411 | + | |
411 | 412 | | |
412 | | - | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
413 | 420 | | |
414 | 421 | | |
415 | 422 | | |
| 423 | + | |
416 | 424 | | |
417 | 425 | | |
418 | 426 | | |
419 | | - | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
420 | 434 | | |
421 | 435 | | |
422 | 436 | | |
423 | 437 | | |
424 | 438 | | |
425 | 439 | | |
426 | | - | |
427 | | - | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
428 | 454 | | |
429 | 455 | | |
430 | 456 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
12 | 33 | | |
13 | 34 | | |
14 | 35 | | |
| |||
32 | 53 | | |
33 | 54 | | |
34 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
35 | 75 | | |
36 | 76 | | |
37 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
| |||
63 | 68 | | |
64 | 69 | | |
65 | 70 | | |
66 | | - | |
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments