New rust plugin fails to validate with a `rust-deps` part dependency
Metadata
Current evaluation
Fixed by merged PR canonical/craft-parts#560 (commit fbefe6b8), correcting Rust plugin validation when a rust-deps part dependency is present.
Resolution: closed resolved
Reason: PR canonical/craft-parts#560 was merged and explicitly fixed #559. Commit fbefe6b8 corrected the rust_channel typing and validation path that attempted to mutate an immutable properties object.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
We allow a `rust-deps` part dependency in the rust plugin so the user may install rust in the manner they choose.
The updated rust plugin, however, fails to validate when this occurs.
### To Reproduce
Modify the `test_get_pull_commands_compat` test in `test_rust_plugin.py` as follows:
```python
def test_get_pull_commands_compat(part_info):
properties = RustPlugin.properties_class.unmarshal(
{"source": ".", "after": ["rust-deps"]}
)
plugin = RustPlugin(properties=properties, part_info=part_info)
plugin.validator_class(
part_name="project",
env="",
properties=properties
).validate_environment(part_dependencies=["rust-deps"])
plugin._check_rustup = lambda: False
commands = plugin.get_build_commands()
assert plugin.get_pull_commands() == []
assert 'cargo install -f --locked --path "."' in commands[0]
```
### part yaml
```shell
parts:
rust-deps:
plugin: nil
project:
source: .
after: ["rust-deps"]
```
### Relevant log output
```shell
FAILED [100%]
tests/unit/plugins/test_rust_plugin.py:184 (test_get_pull_commands_compat)
part_info = <craft_parts.infos.PartInfo object at 0x7fdbcf9c8850>
def test_get_pull_commands_compat(part_info):
properties = RustPlugin.properties_class.unmarshal(
{"source": ".", "after": ["rust-deps"]}
)
plugin = RustPlugin(properties=properties, part_info=part_info)
> plugin.validator_class(
part_name="project",
env="",
properties=properties
).validate_environment(part_dependencies=["rust-deps"])
/home/lengau/Work/Code/craft-parts/tests/unit/plugins/test_rust_plugin.py:190:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/lengau/Work/Code/craft-parts/craft_parts/plugins/rust_plugin.py:103: in validate_environment
options.rust_channel = "none" # type: ignore[misc]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E TypeError: "RustPluginProperties" is immutable and does not support item assignment
pydantic/main.py:359: TypeError
```
### Other information
When fixing this bug, remove the type linter ignore comment in `rust_plugin.py` that mentions this bug.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR canonical/craft-parts#560 (commit fbefe6b8), correcting Rust plugin validation when a rust-deps part dependency is present. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed Rust plugin validation for the rust-deps part dependency in merged PR #560 (fbefe6b8), resolving the immutable-properties TypeError. | |
| qwen/qwen3.6-35b-a3b | — | — | Resolved in PR #560. The rust plugin validation failed with a rust-deps dependency due to an immutable Pydantic properties object. The fix addresses the TypeError and removes the related type linter ignore comment. | |
| qwen/qwen3.6-35b-a3b | — | — | The rust plugin validation failure when using a rust-deps dependency was fixed in PR #560. The bug occurred because the validator attempted to assign to an immutable RustPluginProperties object. The fix was merged and the issue closed. | |
| qwen/qwen3.6-35b-a3b | — | — | Resolved in PR #560. The rust plugin validation failure triggered by a rust-deps dependency was fixed by addressing the immutable properties object assignment, and the pull request was merged. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed in PR #560. The Rust plugin validation error when depending on a rust-deps part was resolved by correcting property assignment logic, and the related type linter ignore comment was removed. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/craft-parts#560
(confidence 100%)
Merged PR resolving the reported rust-deps validation failure.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #912 Rust documentation is outdated | craft-parts | closed | Rust plugin docs were corrected by merged PR #1681 (commit e66bea2f), removing obsolete rust-deps guidance and documenting the validation behavior from #903. | |
| #198 plugins: rust | craft-parts | merged | Merged PR #198 (bb92a132) ported Snapcraft’s Rust plugin into craft-parts for CRAFT-955 after prerequisite test refactor #199. | |
| #903 fix(rust_plugin): fix dependency validation logic | craft-parts | merged | Merged PR #903 fixed Rust dependency validation for rustup shims exiting 1 without a default toolchain, added two tests, and landed as dc79714c; fixes #890. |