project loader: advanced grammar support for lists
Metadata
Current evaluation
Merged after approval and passing CI. The update refactors the project loader to process lists instead of sets, preserving ordering and supporting non-string primitives. Changes include GrammarProcessor updates, part grammar adjustments, and corresponding test modifications.
Suggested action: —
No scores available.
Issue body
The grammar expects that it always works with a list of strings,
and treats those string primitives as a set.
This works for all of the current grammar usage which acts on
lists that are intended to work as sets. But it will fail when
expanded to work on other cases where ordering matters (e.g.
build-environment), or when primtives are not a string (e.g.
build-environment objects).
This is addressed by:
- Converting all grammars' set usage into lists.
- Updating GrammarProcessor to allow it to parse dictionaries
and treat unhandled section dictionaries as primitives.
- Update the part grammar to convert the returned lists into
sets for the currently used properties.
- Immediately process finalized statements to ensure ordering
is consistent (rather than processing all statements at the
end). Remove StatementCollection.process_all() now that it
is unused.
Update tests accordingly.
Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged after approval and passing CI. The update refactors the project loader to process lists instead of sets, preserving ordering and supporting non-string primitives. Changes include GrammarProcessor updates, part grammar adjustments, and corresponding test modifications. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into master. Updates project loader grammar to handle lists instead of string sets, preserving ordering for build-environment. Refactors GrammarProcessor to parse dictionaries, processes statements immediately, and updates tests. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into master. Updated the project loader to process lists instead of sets, enabling ordered sequences and non-string primitives. Modified GrammarProcessor, part grammar, and statement processing logic, with corresponding test updates. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3350 project loader, schema: add advanced grammar support for build-environment | snapcraft | merged | Merged into master. Adds advanced grammar support for build-environment to the project loader and schema. Approved by one reviewer with 90.9% diff coverage. A minor plainbox unit test failure was noted but did not block the merge. | |
| #1500 grammar: move into project_loader | snapcraft | merged | Merged the stage package grammar extraction from pluginhandler into the refactored project_loader package. This structural change improves separation of concerns and establishes a generic foundation for broader YAML grammar usage. | |
| #1509 project_loader: process stage package grammar | snapcraft | merged | Merged. Moved stage package grammar processing to project_loader, creating a dedicated processor for part properties. Raw YAML is preserved for state tracking. Approved by one reviewer, passed CI, and modified 26 files. | |
| #1511 project_loader: support grammar on build-packages | snapcraft | merged | Merged: Added grammar support for build-packages at part and global levels. Approved by one reviewer, passed CI, and modified 19 files. Builds on issue #1492 and depends on PR #1509. |