Refactor `platform` validation
Metadata
Current evaluation
Closed as completed after platform validation was refactored and the build planner moved to the craft-application 5 and craft-platforms architecture.
Resolution: closed resolved
Reason: Maintainer mr-cal closed the issue as completed on 2025-04-24, citing completed validation cleanup/refactoring and the build-planner architecture change. No specific resolving PR or commit was identified in the available record.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Based on Rockcraft, the `platform` validation occurs in `snapcraft.models.SnapcraftBuildPlanner` and `snapcraft.models.Project`. This can be combined in `snapcraft.models.Project`.
Scope of work:
- [ ] move and rework validation code
- [ ] adjust unit tests
- [ ] adjust types in both models and satisfy the type checkers
### Source
It feels that we handle this by defining a platform model separately and let pydantic do the heavylifting of hierarchically validating `platforms` as a list of platform models, isn't that possible? It would reduce the complexity of this validator.
_Originally posted by @cmatsuoka in https://github.com/canonical/snapcraft/pull/4630#discussion_r1517943384_
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Closed as completed after platform validation was refactored and the build planner moved to the craft-application 5 and craft-platforms architecture. | |
| stealth/space-bunny-alpha | — | closed resolved | Platform validation cleanup and refactoring were completed. The maintainer closed the task after craft-application 5 and craft-platforms changed the build-planner architecture. | |
| qwen/qwen3.6-35b-a3b | — | — | Platform validation refactoring completed. The build planner was restructured with craft-application 5 and craft-platforms, rendering the original scope obsolete. Validation logic was consolidated and cleaned up. | |
| qwen/qwen3.6-35b-a3b | — | — | The platform validation refactoring was completed. The maintainer closed the issue after noting the code was cleaned up and the build planner architecture significantly changed with craft-application 5 and craft-platforms, rendering the original scope obsolete. | |
| qwen/qwen3.6-35b-a3b | — | — | The platform validation refactor was completed. The original scope was superseded by architectural changes in craft-application 5 and the introduction of craft-platforms, which already addressed the validation requirements. The issue was marked as completed. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Platform validation refactored and cleaned up. The build planner was significantly restructured with craft-application 5 and craft-platforms, resolving the original scope. Closed as completed. |
Update history
No update history recorded yet.
Related work
-
Related To:
canonical/snapcraft#4630
(confidence 100%)
The source design comment originated in PR #4630.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #502 Refactor platform validation | rockcraft | open | Refactor platform validation by consolidating it in Project and removing BuildPlanner. Resolved via migration to craft-application 5. | |
| #633 fix: improve `platforms.<platform>.build-on` validation | rockcraft | closed | Closed unmerged as redundant: PR canonical/rockcraft#567 had already improved build-on validation by adopting craft-application's default BuildPlanner. | |
| #209 feat: validate platform names | craft-platforms | merged | Merged PR #209 (commit 2a92a08): get_build_plan now validates platform names and a new craft_platforms.validators/platform_types module offers validation helpers. Shipped in craft-platforms 0.11.0. | |
| #347 Improve platform validation error message | craft-application | open | Platform validation now produces user-facing CraftValidationError messages, while the affected BuildPlanner model was removed in 5.0.0; the issue appears resolved. | |
| #632 Confusing schema validation message for `platforms.<platform>.build-on`. | rockcraft | closed | Resolved by merged PR #567 (5f898b32): validation now identifies platforms.<platform>.build-on; the reporter confirmed the clearer message and requested closure. | |
| #639 Move the build planner logic into craft-platforms | rockcraft | closed | Build planner logic extracted to craft-platforms in merged PR canonical/craft-platforms#25 (commit d9ff004); rockcraft later simplified in commit 5f898b32. Maintainer mr-cal confirmed completion. |