Skip to content

chore: migrate knowledge dataclasses to Pydantic — 17 classes, -285 LOC (AC-489, AC-481)#595

Merged
jayscambler merged 2 commits intomainfrom
chore/pydantic-migration-knowledge
Mar 31, 2026
Merged

chore: migrate knowledge dataclasses to Pydantic — 17 classes, -285 LOC (AC-489, AC-481)#595
jayscambler merged 2 commits intomainfrom
chore/pydantic-migration-knowledge

Conversation

@jayscambler
Copy link
Copy Markdown
Contributor

Summary

Batch migration of ~17 knowledge module dataclasses to Pydantic BaseModel, continuing the pattern from analytics (#593, #594).

Changes

8 files converted, -285 LOC net:

File Classes Lines saved
research_hub.py 4 ~140
normalized_metrics.py 3 ~51
lessons.py 2 ~29
weakness.py 2 ~26
hint_volume.py 2 ~21
evidence_freshness.py 1 ~16
mutation_log.py 1 ~16
progress.py 1 ~1

Special cases handled

  • mutation_log.py: __post_init__model_post_init for auto-timestamp population
  • lessons.py: __post_init__model_post_init for last_validated_gen default
  • HintManager: kept as plain class (not a dataclass, accesses private state)

Verification

  • ruff check src — all checks passed
  • mypy src — zero errors
  • pytest tests/ — all tests pass

Issues

Continues AC-489 and AC-481 (analytics + knowledge done, harness/other modules to follow)

…C-481)

Converted ~17 dataclasses across 8 knowledge files from @DataClass to
Pydantic BaseModel. Eliminates ~300 lines of hand-rolled to_dict/from_dict.

Files: hint_volume.py, mutation_log.py, lessons.py, evidence_freshness.py,
research_hub.py, weakness.py, progress.py, normalized_metrics.py

Also fixed:
- mutation_log.py: __post_init__ → model_post_init for auto-timestamp
- lessons.py: __post_init__ → model_post_init for last_validated_gen default
- HintManager: kept custom to_dict (accesses private state, not a BaseModel)
- 1 test file: positional args → keyword args

9 files changed, 81 insertions, 366 deletions (-285 net)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant