← Back to issue list

Improve parts features registration

View original Github issue

Metadata

Project
craft-application
Number
#1187
Type
issue
State
open
Author
bepri
Labels
Status: Triaged Type: Enhancement
Created
Updated
Closed
—

Current evaluation

Maintainer-authored enhancement: make parts feature registration opinionated via a PartsFeature enum, default/requested sets, public enable/disable methods, and a final _enable_craft_parts_features hook. Triaged, not yet implemented.

Suggested action: keep open

Reason: The issue is labeled 'Status: Triaged, Type: Enhancement' by maintainer bepri and ships a concrete design spec (PartsFeature enum, _default_parts_feats/_requested_parts_feats sets, enable/disable_parts_feature methods, final hook). Code inspection confirms it is not implemented: grep for 'PartsFeature' returns no matches, and `_enable_craft_parts_features` is still an overridable hook (application.py:638 with a docstring telling overriders to call super()), overridden in partitioncraft/application.py:37 and witchcraft/application.py:46 and documented in docs/how-to/partitions.rst. The stated motivation — downstream consumers overriding without super() silently clobbering features — is a real correctness risk, so it should stay open; the only cost is that making the hook final is a breaking change for downstream apps.

Evaluated by: mr-cal-bot

Impact: 48 Quick Win: 19 Complexity: 55 Confidence: 90 Actionability: 90

Issue body

### What needs to get done The parts feature registration method needs to be more opinionated on _how_ features are registered. A proposed solution would be the following: - Create an enum, like `PartsFeature` - Populate it with the possible parts features, like `PartsFeature.PARTITIONS`, `PartsFeature.OVERLAY`, etc. - Keep two `set[PartsFeature]` attached to the application: `_default_parts_feats` and `_requested_parts_feats` - Add two public final methods: - `enable_parts_feature(feature: PartsFeature) -> None` will add `feature` into the set of requested features - `disable_parts_feature(feature: PartsFeature) -> None` will remove `feature` from _both_ the default features and the requested features sets - Make `_enable_craft_parts_features()` final and have it enable the set of `_default_parts_feats & _requested_parts_feats` ### Why it needs to get done Currently, it is done in a hook where the implementers of the hook can decide the order features are enabled. We didn't design the API to be tight or opinionated enough, and now any changes may end up being overridden by a downstream consumer that didn't call `super()`.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 48
Quick Win: 19
Complexity: 55
Confidence: 90
Actionability: 90
keep open Maintainer-authored enhancement: make parts feature registration opinionated via a PartsFeature enum, default/requested sets, public enable/disable methods, and a final _enable_craft_parts_features hook. Triaged, not yet implemented.
qwen/qwen3.6-35b-a3b
Impact: 45
Quick Win: 23
Complexity: 40
Confidence: 80
Actionability: 85
keep open Enhancement to make parts feature registration more opinionated via a PartsFeature enum and controlled enable/disable methods to prevent downstream override bugs.

Update history

Date Change
updated
created

Related issues

No related issues found above the similarity threshold.