← Back to issue list

Loading the instance config should be more robust

View original Github issue

Metadata

Project
craft-providers
Number
#399
Type
issue
State
open
Author
mr-cal
Labels
Type: Enhancement
Created
Updated
Closed
—

Current evaluation

InstanceConfiguration still rejects unknown YAML fields, preventing compatibility-tag cleanup when a config was written by a newer Charmcraft version; no final design has been chosen.

Suggested action: keep open

Reason: The problem remains reproducible from the implementation: InstanceConfiguration uses extra="forbid", and test_load_with_invalid_config_raises_error explicitly expects an unknown field to fail validation before compatibility checks. This is a valid maintainer-filed enhancement with a concrete config example, but the choice between ignoring or preserving unknown fields and automatic cleanup still needs confirmation.

Evaluated by: mr-cal-bot

Impact: 48 Quick Win: 22 Complexity: 32 Confidence: 94 Actionability: 68

Issue body

### What needs to get done Extra fields should probably be allowed in the [instance config](https://github.com/canonical/craft-providers/blob/c9ba62bd8f551c6486b1beaa46b1cf024018b005/craft_providers/instance_config.py#L52C11-L52C11). Or if the pydantic model fails, then the instance should be automatically cleaned. ### Why it needs to get done If a user creates a charm with charmcraft 2.4.1, the instance config will look like this: ``` compatibility-tag: charmcraft-buildd-base-v1.0 setup: true snaps: charmcraft: revision: "100" ``` If the user switches to charmcraft 2.2, config loading will fail because the `setup` tag is not in the pydantic model of the older version of craft-providers. Ironically, if craft-providers had been able to load the config, it would have seen the compatibility tag did not match and would have triggered an automatic cleaning. source: https://github.com/canonical/charmcraft/issues/1258

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 48
Quick Win: 22
Complexity: 32
Confidence: 94
Actionability: 68
keep open InstanceConfiguration still rejects unknown YAML fields, preventing compatibility-tag cleanup when a config was written by a newer Charmcraft version; no final design has been chosen.
stealth/space-bunny-alpha
Impact: 52
Quick Win: 17
Complexity: 43
Confidence: 92
Actionability: 57
needs triage InstanceConfiguration still rejects unknown YAML fields, which can cause cross-version build failures before compatibility-tag cleanup runs. The proposed permissive parsing or automatic cleaning has no recorded design decision.
stealth/space-bunny-alpha
Impact: 45
Quick Win: 14
Complexity: 53
Confidence: 93
Actionability: 68
needs triage Instance config loading rejects fields introduced by newer tools, breaking version downgrades; allowing extras or cleaning after validation failure needs a maintainer decision.
qwen3.6-35b-a3b-mtp-q6
Impact: 30
Quick Win: 22
Staleness: 75
Complexity: 25
Confidence: 65
Support Request: 0
needs triage Enhancement to make InstanceConfiguration loading more robust by allowing extra fields or handling validation failures gracefully. Untriaged, 1085 days old, 0 comments.
qwen/qwen3.6-35b-a3b
Staleness: 80
Complexity: 20
Confidence: 80
Support Request: 5
close stale Enhancement to make instance config loading more robust by allowing extra fields or auto-cleaning on pydantic failure. Open for over two years with no maintainer comments or progress.
qwen3.6-35b-a3b-mtp-q6
Staleness: 65
Complexity: 40
Confidence: 75
Support Request: 10
keep open Enhancement to make instance config loading more robust by allowing extra fields or auto-cleaning on pydantic validation failure, preventing version mismatch crashes.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/charmcraft#1258 (confidence 100%)

    The issue explicitly cites this cross-version Charmcraft failure as its source; that report was closed after upgrading to Charmcraft 2.4.1+.

Related issues

No related issues found above the similarity threshold.