Commit 63a5819
committed
test(conformance): drive 0014 state-migration fixtures 039-046
New tests/conformance/test_state_migration.py drives all 8 spec
state-migration fixtures end-to-end against the real engine
(SQLite JSON-mode backend, real graph compile, real resume path).
Harness pieces:
- Migration mock library: add_new_field_default, add_v2_field,
add_v3_field, identity_passthrough, raises_keyerror,
should_not_run, irrelevant. Each fixture's migrate: <name>
resolves through the library.
- _MigrationTrace wraps each mock to capture invocation order
for the migrations_run / migration_count /
single_migration_invocation / migration_order_matches_chain
assertions. Consecutive duplicates collapse (fixture 043 runs
each step once for outer + once for each parent under the
lockstep ordering; the assertion is per-step, not per-entity).
- _seed_record persists a checkpoint matching the fixture's
seeded_record: block before invoke(resume_invocation=...) so
the resume path has data to load.
Harness/model adjustments:
- StateSchema in tests/conformance/harness/directives.py gains
optional schema_version (default '') and the required field
knob (no-default Pydantic field, used by fixture 044's
required_v2_field deserialization-failure case).
- _DEFERRED_FIXTURES in test_fixture_parsing.py loses the
039-046 rows; the CasesFixture model parses them via permissive
extras on CaseSpec.
- Initial-state construction in the resume path uses
state_cls.model_construct() so fixtures with required fields
(044) can pass a placeholder past Pydantic's validator before
the resume even starts; the engine loads state from the
checkpoint, not from the placeholder.
Protocol-attribute shape:
- Checkpointer.supports_state_migration declared as
bool = False (not ClassVar) so SQLiteCheckpointer can set
the value per-instance in __init__ based on serialization mode.
Backends with a static answer (InMemoryCheckpointer) override
at the class level with bool = False — Pyright accepts
either shape because Protocol attribute conformance ignores
the ClassVar marker on subclasses.1 parent fb0c992 commit 63a5819
6 files changed
Lines changed: 435 additions & 19 deletions
File tree
- src/openarmature/checkpoint
- backends
- tests
- conformance
- harness
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| |||
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
44 | | - | |
45 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
46 | 49 | | |
47 | 50 | | |
48 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
166 | 175 | | |
167 | 176 | | |
168 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
59 | 64 | | |
60 | 65 | | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
64 | 69 | | |
| 70 | + | |
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
68 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
69 | 80 | | |
70 | 81 | | |
71 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
54 | 47 | | |
55 | 48 | | |
56 | 49 | | |
| |||
0 commit comments