← Back to issue list

Configuration models need some typing cleanup

View original Github issue

Metadata

Project
charmcraft
Number
#1118
Type
issue
State
open
Author
lengau
Labels
Status: Triaged Type: Bug
Created
Updated
Closed
—

Current evaluation

Maintainer-tracked code-quality task: replace pydantic.StrictStr and similar patterns in charmcraft's config/metadata models with better typing (abstract classes, @override). Still present at HEAD; only a Jira bot comment (CHARMCRAFT-715).

Suggested action: keep open

Reason: The work is not done: pydantic.StrictStr is still used at HEAD in charmcraft/models/charmcraft.py (Base.name/channel/architectures, Links.contact) and charmcraft/models/metadata.py (summary, description, maintainers, terms, plus legacy subclass overrides carrying '# type: ignore[assignment]' at metadata.py:110-113), and models/basic.py still carries a 'TODO: Turn this into a StrEnum'. The issue is labelled 'Status: Triaged' by its maintainer author (lengau) and tracked as CHARMCRAFT-715, so it is a valid acknowledged task rather than untriaged. Actionability is only moderate because the actual requirements live in a GitHub review comment (PR #1117 review r1213462775) that is not reproducible from the issue text, leaving design decisions (type alias vs StrEnum vs annotated strict str, and how to handle pydantic field overriding without type-ignores) to the implementer; impact is low since it is explicitly framed as 'Code quality!' with no reported functional defect.

Evaluated by: mr-cal-bot

Impact: 18 Quick Win: 4 Complexity: 45 Confidence: 68 Actionability: 40

Issue body

### What needs to get done The strict strings and similar that we have should use best practices around abstract classes, overrides, etc. https://github.com/canonical/charmcraft/pull/1117/files#r1213462775 ### Why it needs to get done Code quality! Or more specifically, matching industry standards so our code is accessible to developers outside the team

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 18
Quick Win: 4
Complexity: 45
Confidence: 68
Actionability: 40
keep open Maintainer-tracked code-quality task: replace pydantic.StrictStr and similar patterns in charmcraft's config/metadata models with better typing (abstract classes, @override). Still present at HEAD; only a Jira bot comment (CHARMCRAFT-715).
qwen/qwen3.6-35b-a3b
Impact: 25
Quick Win: 4
Complexity: 45
Confidence: 70
Actionability: 30
keep open Code quality issue requesting typing best practices (abstract classes, overrides) for StrictStr usage in pydantic models. Triaged but vague on specifics.
qwen/qwen3.8-27b
Impact: 15
Quick Win: 8
Staleness: 65
Complexity: 45
Confidence: 80
Support Request: 0
keep open Code-quality task to clean up typing in charmcraft configuration models (pydantic StrictStr usage, overrides, abstract classes), per a PR #1117 review comment. Triaged and synced to internal Jira; the criticized pattern still exists in the models.
qwen/qwen3.6-35b-a3b
Staleness: 70
Complexity: 20
Confidence: 85
Support Request: 0
keep open Maintenance task to improve typing practices in configuration models using abstract classes and overrides. Triaged and awaiting implementation.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 25
Confidence: 85
Support Request: 0
needs triage Unaddressed request to refactor configuration model typing to follow Python best practices like abstract classes and overrides. Open for ~3 years with no maintainer response or labels.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 15
Confidence: 80
Support Request: 0
close stale Requests refactoring configuration model typing to follow Python best practices like abstract classes and overrides. No maintainer response or activity in over 3 years.

Update history

No update history recorded yet.

Related work

  • Caused By: canonical/charmcraft#1117 (confidence 80%)

    The issue points at review comment r1213462775 on PR #1117, matching commit 42722834 'refactor: move some pydantic models and metafiles (#1117)' which introduced the models the cleanup targets.

Related issues

No related issues found above the similarity threshold.