Snap info should use a Pydantic model
Metadata
Current evaluation
Snapd snap metadata now uses a Pydantic SnapInfo model, merged in PR #908 at commit e996996.
Resolution: closed resolved
Reason: PR #908 added the SnapInfo model and updated get_host_snap_info to validate snapd’s result with it. The change was merged as commit e996996.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### What needs to get done
In the below code, we have to just assume that we'll get the desired output from deserializing JSON:
https://github.com/canonical/craft-providers/blob/5717e2c0907c2bb304d0d3752671be68e9b1fa14/craft_providers/actions/snap_installer.py#L134
This should instead make use of a Pydantic model to validate and type-hint the response from the snapd API.
### Why it needs to get done
A Pydantic model allows type checkers to be used during development for the values returned and enables runtime sanity checks on snapd's response.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Snapd snap metadata now uses a Pydantic SnapInfo model, merged in PR #908 at commit e996996. | |
| qwen/qwen3.6-35b-a3b | — | closed resolved | Implemented Pydantic models for snap info in `craft_providers/models/snaps.py`, including `SnapInfo` and `SnapdResponse`, replacing raw JSON deserialization. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
canonical/craft-providers#908
(confidence 99%)
Merged commit e996996 added SnapInfo and integrated it into snap_installer.
-
Related To:
canonical/craft-providers#784
(confidence 96%)
The maintainer explicitly paired this model work with target snap revision validation.
-
Related To:
canonical/craft-providers#939
(confidence 88%)
PR #939 later added the generic SnapdResponse model used for the paired snap revision path.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #784 Snap revision should use a Pydantic model | craft-providers | closed | Fixed by merged PR #908 (e996996), adding Pydantic SnapdResponse and SnapInfo models for validated snapd API responses. | |
| #908 feat(models): add SnapInfo model for snapd response | craft-providers | merged | Merged PR #908 as commit e996996, adding a Pydantic SnapInfo model, optional publisher handling, and tests for snapd responses; fixes #783. |