Skip to content

fix: preserve nested workSkills/workSkillGroups fields on CapacityCategory - #176

Merged
btoron merged 3 commits into
btoron:masterfrom
be-ant:175-fix-capacity-categories-model
Jun 1, 2026
Merged

fix: preserve nested workSkills/workSkillGroups fields on CapacityCategory#176
btoron merged 3 commits into
btoron:masterfrom
be-ant:175-fix-capacity-categories-model

Conversation

@be-ant

@be-ant be-ant commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The CapacityCategory model silently dropped fields from its nested workSkills / workSkillGroups items (they were typed as the thin Item{label, name}). ratio, startDate, end_date, audit fields, and (for groups) links were lost. Discovered by capturing live responses from a real OFS instance.
  • Added dedicated CapacityCategoryWorkSkill and CapacityCategoryWorkSkillGroup models with the documented fields and extra="allow" so audit/future fields are preserved.
  • Flipped CapacityCategory from extra="ignore" to extra="allow" to stop silent loss at the container level too (aligns with Audit and tighten Pydantic models using extra="allow" to prevent silent data loss #149).
  • timeSlots left unchanged (API returns label-only items).
  • Bumped version to 2.26.2.

Fixes #175

Test Plan

  • New unit tests in tests/metadata/test_capacity_categories.py assert ratio/startDate/end_date are typed, audit fields survive via model_extra and round-trip through model_dump(), workSkillGroups[].links parse, and empty nested lists parse cleanly. These use inline data (no credentials), so they run in CI.
  • Updated tests/test_model.py::test_capacity_category_model_list to assert the now-preserved nested fields (the previously commented-out assertion).
  • Full suite: 445 passed, 8 skipped (credential/local-data tests); ruff clean.
  • Validated against a live captured response: all 43 categories parse with nested fields populated.

Compatibility note

workSkills / workSkillGroups change from ItemList (a RootModel) to plain list[...]. Iteration and indexing are unaffected; only isinstance(x, ItemList) checks on these two attributes would change (none exist in the tree).

@be-ant
be-ant force-pushed the 175-fix-capacity-categories-model branch from a1efc3c to 3dcbf4f Compare June 1, 2026 02:32
@btoron
btoron merged commit 63399c2 into btoron:master Jun 1, 2026
2 checks passed
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.

CapacityCategory model drops nested workSkills/workSkillGroups fields

2 participants