fix: validate platforms type before vectorisation
Metadata
Current evaluation
Fixes AttributeError when platforms is a list by validating type before vectorisation. Approved, CI passing except CLA.
Suggested action: needs review
Reason: PR is approved with 0 unresolved comments and CI passing (except the external CLA requirement). The fix is small (+23/-2 lines), well-tested with regression tests, and addresses issue #1217 by providing a proper validation error instead of an AttributeError. The author needs to sign the Canonical CLA before merge, as noted in @lengau's comment.
Evaluated by: mr-cal-bot
Impact:
45
Quick Win:
29
Complexity:
15
Confidence:
80
Actionability:
75
Issue body
Fixes #1217.
Problem
When "platforms" is provided as a list instead of a mapping, "_vectorise_platforms()" attempts to call ".items()" before the input type is validated. This raises an "AttributeError" instead of a useful project validation error.
Changes
- Validate non-mapping "platforms" inputs using the existing Pydantic adapter before vectorisation.
- Preserve the existing processing of valid platform mappings.
- Add regression tests covering nonempty lists, empty lists and string inputs.
Verification
The targeted project-service unit tests, Ruff lint checks and formatting checks passed in the fork's GitHub Actions regression workflow.
The broader QA and Spread workflows have not yet been confirmed passing. A separate OSV scan identified a vulnerable "certifi" dependency; that finding is outside the scope of this fix.
---
- [x] I've followed the [contribution guidelines](https://github.com/canonical/craft-application/blob/main/CONTRIBUTING.md).
- [x] I've signed the [CLA](http://www.ubuntu.com/legal/contributors/).
- [x] I've successfully run `make lint && make test`.
- [x] I've added or updated any relevant documentation.
- [x] In documents I changed, I [added a meta description](https://canonical-starflow.readthedocs-hosted.com/how-to/add-a-page-meta-description/) if one was missing.
- [x] I've updated the relevant release notes.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b |
Impact:
45
Quick Win:
29
Complexity:
15
Confidence:
80
Actionability:
75
|
needs review | Fixes AttributeError when platforms is a list by validating type before vectorisation. Approved, CI passing except CLA. | |
| qwen/qwen3.6-35b-a3b |
Impact:
50
Quick Win:
24
Complexity:
20
Confidence:
75
Actionability:
60
|
needs review | Fixes AttributeError when platforms is a list instead of a mapping by validating type before _vectorise_platforms(). Small change (+23/-2) with regression tests. Awaiting review. |
Update history
| Date | Change |
|---|---|
| updated | |
| updated | |
| updated | |
| created |
Related issues
No related issues found above the similarity threshold.