Unexpected behavior for multiple `to` statements
Metadata
Current evaluation
Multiple to clauses followed by else are processed inconsistently: armhf includes the fallback while riscv64 omits it. The acknowledged enhancement remains open.
Suggested action: keep open
Reason: The reproducer is deterministic, and GrammarProcessor still attaches each else body only to the latest active to statement, matching the reported inconsistent output. Simondeziel explicitly said supporting multiple to directives would be useful, so the behavior is valid and acknowledged, though the exact fallback semantics still need design.
Evaluated by: mr-cal-bot
Impact:
50
Quick Win:
16
Complexity:
57
Confidence:
93
Actionability:
74
Issue body
Given the following:
```yaml
parts:
my-part:
build-packages:
- to armhf:
- foo
- to riscv64:
- bar
- else:
- baz
```
Building for armhf will evaluate to `["foo", "baz"]` and building for riscv64 will evaluate to `["bar"]`.
This is an unexpected UX and there are no warnings or errors to explain the behavior. Either craft-grammar should error when given multiple `to` statements with an `else` or it should properly handle this scenario.
A reproducer in the unit test suite can be seen here: https://github.com/canonical/craft-grammar/commit/12c031a207eaec4e1c345ad8a9ad2444ec4429ae
Source: https://github.com/canonical/snapcraft/issues/5255
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha |
Impact:
50
Quick Win:
16
Complexity:
57
Confidence:
93
Actionability:
74
|
keep open | Multiple to clauses followed by else are processed inconsistently: armhf includes the fallback while riscv64 omits it. The acknowledged enhancement remains open. | |
| qwen/qwen3.6-35b-a3b |
Impact:
40
Quick Win:
22
Complexity:
30
Confidence:
80
Actionability:
80
|
keep open | Grammar processor silently merges or drops packages when multiple 'to' statements are used with an 'else' clause, causing unexpected build results. | |
| qwen/qwen3.8-27b |
Impact:
50
Quick Win:
18
Staleness:
55
Complexity:
65
Confidence:
70
Support Request:
5
|
keep open | craft-grammar silently mishandles multiple `to` statements combined with `else`: armhf build yields [foo, baz] while riscv64 yields [bar], with no error or warning. Maintainer comment (2025-06-11) suggests supporting multiple `to` directives since `to` matches on AND criteria. No fix found in code or history; issue open, unlabelled. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
90
Complexity:
65
Confidence:
80
Support Request:
10
|
keep open | Grammar parser produces unexpected results with multiple to statements and else. Inactive for over a year, lacks labels, but has maintainer input. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
85
Complexity:
55
Confidence:
70
Support Request:
15
|
needs triage | Unexpected behavior when using multiple to statements with an else clause in craft-grammar YAML. Currently evaluates incorrectly without warnings. Awaiting triage and resolution. |
Update history
No update history recorded yet.
Related work
-
Related To:
canonical/snapcraft#5255
(confidence 100%)
The issue body identifies this as its source issue.
Related issues
No related issues found above the similarity threshold.