← Back to issue list

Refactor platform validation

View original Github issue

Metadata

Project
rockcraft
Number
#502
Type
issue
State
open
Author
mr-cal
Labels
—
Created
Updated
Closed
—

Current evaluation

Refactor platform validation by consolidating it in Project and removing BuildPlanner. Resolved via migration to craft-application 5.

Suggested action: close resolved

Reason: The issue requests consolidating platform validation and removing BuildPlanner. The current codebase no longer has a BuildPlanner class, and validation is handled in Project._validate_all_platforms using craft_application.models.Platform, consistent with the resolution of snapcraft#4650.

Evaluated by: mr-cal-bot

Impact: 0 Quick Win: 0 Complexity: 0 Confidence: 90 Actionability: 100

Issue body

### What needs to get done `platform` validation occurs in `rockcraft.models.BuildPlanner` and `rockcraft.models.Project`. This can be combined in `rockcraft.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_ ### Why it needs to get done Code debt

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b
Impact: 0
Quick Win: 0
Complexity: 0
Confidence: 90
Actionability: 100
close resolved Refactor platform validation by consolidating it in Project and removing BuildPlanner. Resolved via migration to craft-application 5.
stealth/space-bunny-alpha
Impact: 30
Quick Win: 15
Complexity: 40
Confidence: 96
Actionability: 85
close resolved Platform validation was consolidated into Project using craft-application's Platform model; BuildPlanner was removed, completing the requested cleanup despite the issue remaining open.
qwen/qwen3.6-35b-a3b
Impact: 0
Quick Win: 0
Complexity: 0
Confidence: 100
Actionability: 100
close resolved Platform validation was moved from BuildPlanner to Project and refactored to use Pydantic. BuildPlanner no longer exists, and validation is handled by Project._validate_all_platforms.
qwen/qwen3.8-27b
Impact: 15
Quick Win: 9
Staleness: 75
Complexity: 40
Confidence: 65
Support Request: 0
close stale Code debt: consolidate platform validation from BuildPlanner into Project model. BuildPlanner no longer exists in the codebase; platform validation is now in Project using craft_application's Platform model. Inactive for 381 days, no labels or maintainer engagement.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 40
Confidence: 75
Support Request: 5
close stale Refactor platform validation logic in rockcraft models into a single location. Unassigned, unlabeled, and inactive for over a year due to internal code debt.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 40
Confidence: 75
Support Request: 5
needs triage Unlabelled refactoring issue proposing to consolidate platform validation logic into the Project model, update tests, and fix types. No maintainer assessment or recent activity in over a year.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 40
Confidence: 75
Support Request: 0
close stale Refactor platform validation logic by consolidating it into the Project model, updating tests and types to reduce code debt. Currently inactive for over a year with no maintainer action or labels.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: snapcraft#4650 (confidence 90%)

    The snapcraft issue describes the same refactoring which was completed, leading to the removal of BuildPlanner in rockcraft.

Related issues

Issue Project State Summary Similarity
#4650 Refactor `platform` validation snapcraft closed Closed as completed after platform validation was refactored and the build planner moved to the craft-application 5 and craft-platforms architecture.
88%
#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.
75%
#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.
72%
#440 refactor(project): drop ProjectValidationError rockcraft merged Merged #440 as 47b1576a, replacing ProjectValidationError with craft-application's CraftValidationError and removing duplicated error-formatting code.
72%
#391 Use craft-platforms for build plans craft-application closed Build planning and filtering moved to craft-platforms in merged PR #25 (d9ff004); craft-application adopted the planner through merged PR #666 (621d1a32).
71%
#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.
70%
#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.
70%