← Back to issue list

Format partition warnings and errors inside the error class

View original Github issue

Metadata

Project
craft-parts
Number
#670
Type
issue
State
open
Author
mr-cal
Labels
—
Created
Updated
Closed
—

Current evaluation

Maintainer-authored refactor: pass unformatted partition warning/error data to PartitionUsageError/Warning and let the error classes do the indenting, instead of building pre-indented strings in parts.py. Still open, unlabelled, only a Jira sync bot comment.

Suggested action: needs triage

Reason: The requested change is not present at HEAD: craft_parts/parts.py still builds pre-indented strings (e.g. line 1228 `f" misused partition {partition!r} in {filepath!r}"`, plus `error_list.insert(0, f" parts.{self.name}.{fileset_name}")`) and helpers `_get_build_partition_usage_error`/`_get_missing_partition_inner_path_error` (lines 803-826) return indented strings consumed by `PartitionUsageError(error_list=...)`/`PartitionUsageWarning(warning_list=...)` in errors.py (lines 822-865). No commit in git log for errors.py/parts.py implements it, so the issue is valid but purely internal code-quality work (no user-facing behaviour change) with no labels, assignee, or maintainer reply — the only comment is the Jira sync bot (CRAFT-2939) — so it still needs triage/prioritisation.

Evaluated by: mr-cal-bot

Impact: 20 Quick Win: 11 Complexity: 30 Confidence: 85 Actionability: 80

Issue body

### What needs to get done Partition-related warnings are collated and presented as a nested list: ``` Possible misuse of partitions The following entries begin with a valid partition name but are not wrapped in parentheses. These entries will go into the default partition. parts.hello.organize misused partition 'default' in 'default/A1' misused partition 'kernel' in 'kernel/B' parts.hello.stage misused partition 'default' in 'default/' Wrap the partition name in parentheses, for example 'default/file' should be written as '(default)/file' ``` And the same for errors: ``` Invalid usage of partitions parts.hello.stage unknown partition 'bogus' in '(bogus)/C' no path specified after partition in '(kernel)' parts.hello.prime unknown partition 'extra/bogus' in '(extra/bogus)/C' no path specified after partition in '(kernel)/' Valid partitions: default, kernel, component/bar-baz Correct the invalid partition name(s) and try again. ``` Currently, the code that raises warnings and errors pass a list of indented strings to the error. Instead, the code should pass an unformatted data structure to the error. The error will handle the indenting. ### Why it needs to get done To reduce technical debt and improve code quality.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 20
Quick Win: 11
Complexity: 30
Confidence: 85
Actionability: 80
needs triage Maintainer-authored refactor: pass unformatted partition warning/error data to PartitionUsageError/Warning and let the error classes do the indenting, instead of building pre-indented strings in parts.py. Still open, unlabelled, only a Jira sync bot comment.
qwen/qwen3.6-35b-a3b
Impact: 20
Quick Win: 10
Complexity: 30
Confidence: 70
Actionability: 70
needs triage Refactor partition error/warning formatting to pass unformatted data structures instead of pre-indented strings.
qwen/qwen3.8-27b
Impact: 15
Quick Win: 9
Staleness: 72
Complexity: 40
Confidence: 85
Support Request: 0
needs triage Refactor task: partition warning/error classes should format indented messages internally instead of callers passing pre-indented strings. Unlabeled, no maintainer activity since 2024-05-17; code at HEAD still passes indented strings, so the work remains unaddressed.
qwen/qwen3.6-35b-a3b
Staleness: 85
Complexity: 15
Confidence: 80
Support Request: 0
needs triage Refactor partition warning and error formatting to pass unstructured data to the error class instead of pre-formatted strings. Currently unlabelled and inactive for over two years.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 20
Confidence: 70
Support Request: 0
needs triage Refactor partition warnings and errors to pass unformatted data structures to the error class instead of pre-formatted strings. Currently untriaged and inactive for over two years.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1714 refactor: format partition errors inside error class craft-parts open Maintainer-authored refactor (canonical/craft-parts#1714, fixes #670) moving partition error/warning message formatting from parts.py into PartitionUsageError/PartitionWarning classes so they receive unformatted data. +138/-42 across 5 files; all completed CI checks green, several slow suites pending, 2 unresolved review comments.
81%