Repository navigation
Commit 5f647c4
fix(story-1.6): drop pydantic fallback in MsgspecDecoder
The spec inherited a wrong assumption from the archived AC: msgspec
does NOT decode into pydantic BaseModel subclasses natively (only
msgspec.Struct, dataclasses, attrs, NamedTuples, TypedDicts, and
builtins). The initial Task 2 implementation worked around this with
a hasattr(model, "model_validate_json") fallback, but that muddies
MsgspecDecoder's responsibility, defeats the single C-level pass
property, and crosses ecosystems.
Revert: MsgspecDecoder.decode is now a one-liner that just calls
msgspec.json.decode(content, type=model). Pydantic users use
PydanticDecoder. The test for pydantic decoding is dropped; the
remaining 7 tests cover msgspec.Struct, builtin, list[Struct],
ValidationError, DecodeError, protocol satisfaction, and the
missing-extra construction path.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 37686be commit 5f647c4
2 files changed
Lines changed: 2 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 34 | + | |
| 35 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | 16 | | |
23 | 17 | | |
24 | 18 | | |
| |||
28 | 22 | | |
29 | 23 | | |
30 | 24 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 25 | | |
37 | 26 | | |
38 | 27 | | |
| |||
0 commit comments