← Back to issue list

Redesign Project models

View original Github issue

Metadata

Project
snapcraft
Number
#4885
Type
issue
State
closed
Author
mr-cal
Labels
—
Created
Updated
Closed

Current evaluation

Project model redesign completed through #5543; PR #5730 merged as 7cfb25977, adding inheritance-based Pydantic validation and JSON Schema generation.

Resolution: closed resolved

Reason: The redesign landed in merged PR canonical/snapcraft#5730 at commit 7cfb25977. It introduced the project-model hierarchy, discriminated validation, and declarative JSON Schema generation tracked by #5543.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### What needs to get done Create a base Project model and a set of inherited models for each base and snap type. Some pseudocode from @lengau: ```python class Project: ... class BaseProject(Project): type: Literal["base"] build-base: BaseEnum class AppProject(Project): base: BaseEnum class BareProject(AppProject): base: BaseEnum.BARE class Core22Project(AppProject): base: BaseEnum.CORE22 class Core22KernelProject(Core22Project): type: kernel UnionAppProject = ... UnionKernelProject = ... SnapcraftProject = Annotated[ BaseProject | SnapdProject | GadgetProject | UnionAppProject | UnionKernelProject, Field(discriminator="type") ] ``` ### Why it needs to get done Snapcraft has a single Project model with declarative validation like "if base is core24, then `architectures` is not allowed". This needs a more sophisticated approach: - To make the Project models maintainable and extensible - To allow parsing core20 snaps for remote builds - To allow for accurate json schemas per-base

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Project model redesign completed through #5543; PR #5730 merged as 7cfb25977, adding inheritance-based Pydantic validation and JSON Schema generation.
stealth/space-bunny-alpha — closed resolved Project models were redesigned via #5543; PR #5730 (7cfb25977) added inheritance-based validation and per-base JSON schemas.
stealth/space-bunny-alpha — closed resolved Project models were redesigned with inheritance-based validation and per-base JSON schemas by merged PR #5730 (7cfb25977), closing the request tracked as #5543.
qwen/qwen3.6-35b-a3b — — Redesigned Project models to use inheritance and union types instead of a single monolithic model. Improves maintainability, enables core20 parsing, and generates accurate per-base JSON schemas. Completed and merged via PR #5543.
qwen/qwen3.6-35b-a3b — — Redesigned Project models using inheritance and type unions to replace declarative validation, improving maintainability and base-specific parsing. Completed and merged via pull request #5543.
qwen/qwen3.6-35b-a3b — — Implemented a redesigned Project model hierarchy using inheritance and discriminated unions to improve maintainability and enable accurate per-base JSON schemas. Merged via pull request #5543.
qwen3.6-35b-a3b-mtp-q6 — — Redesigning Project models was completed and merged via pull request #5543. The change implements a base model with inherited types for different snap configurations, replacing the previous single-model approach to improve maintainability and validation.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/snapcraft#5730 (confidence 100%)

    Merged PR implementing inheritance-based validation and schemas in commit 7cfb25977.

  • Related To: canonical/snapcraft#5543 (confidence 98%)

    Implementation tracking issue cited by the maintainer as the completion path for #4885.

Related issues

Issue Project State Summary Similarity
#5543 Project model hierarchy snapcraft closed Project hierarchy redesign landed with Pydantic validation and declarative JSON Schema generation in merged PR #5730 (7cfb25977).
82%