fix: preserve nested workSkills/workSkillGroups fields on CapacityCategory - #176
Merged
Merged
Conversation
be-ant
force-pushed
the
175-fix-capacity-categories-model
branch
from
June 1, 2026 02:32
a1efc3c to
3dcbf4f
Compare
btoron
approved these changes
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CapacityCategorymodel silently dropped fields from its nestedworkSkills/workSkillGroupsitems (they were typed as the thinItem{label, name}).ratio,startDate,end_date, audit fields, and (for groups)linkswere lost. Discovered by capturing live responses from a real OFS instance.CapacityCategoryWorkSkillandCapacityCategoryWorkSkillGroupmodels with the documented fields andextra="allow"so audit/future fields are preserved.CapacityCategoryfromextra="ignore"toextra="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).timeSlotsleft unchanged (API returns label-only items).Fixes #175
Test Plan
tests/metadata/test_capacity_categories.pyassertratio/startDate/end_dateare typed, audit fields survive viamodel_extraand round-trip throughmodel_dump(),workSkillGroups[].linksparse, and empty nested lists parse cleanly. These use inline data (no credentials), so they run in CI.tests/test_model.py::test_capacity_category_model_listto assert the now-preserved nested fields (the previously commented-out assertion).Compatibility note
workSkills/workSkillGroupschange fromItemList(aRootModel) to plainlist[...]. Iteration and indexing are unaffected; onlyisinstance(x, ItemList)checks on these two attributes would change (none exist in the tree).