Prime command always fails
Metadata
Current evaluation
Managed-mode prime failures were fixed in craft-application#727 (commit 9b277bab) by running post-prime steps only in the process that executed the lifecycle.
Resolution: closed resolved
Reason: Commit 9b277bab, merged through PR #727, ensures post-prime processing occurs only in the lifecycle process, preventing the managed-mode prime command from trying to consume the version variable after lifecycle execution.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
In craft-app 5, the `prime` command will always fail with the following message: `RuntimeError: cannot consume variable 'version' during lifecycle execution`. Other lifecycle commands may face the same error and should be checked as well.
### To Reproduce
Run this spread test:
```yaml
summary: test testcraft prime
execute: |
testcraft prime
restore: |
testcraft clean
```
With the following testcraft.yaml:
```yaml
name: test-prime
version: "0.1"
base: ubuntu@24.04
platforms:
amd64:
parts:
my-test:
plugin: nil
stage-packages:
- hello
```
### part yaml
```shell
```
### Relevant log output
```shell
testcraft internal error: RuntimeError("cannot consume variable 'version' during lifecycle execution")
Full execution log: '/root/.local/state/testcraft/log/testcraft-20250331-095502.875112.log'
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/snap/testcraft/x1/lib/python3.12/site-packages/testcraft/__main__.py", line 22, in <module>
sys.exit(cli.create_app().run())
^^^^^^^^^^^^^^^^^^^^^^
File "/snap/testcraft/x1/lib/python3.12/site-packages/craft_application/application.py", line 613, in run
return_code = self._run_inner()
^^^^^^^^^^^^^^^^^
File "/snap/testcraft/x1/lib/python3.12/site-packages/craft_application/application.py", line 592, in _run_inner
return_code = dispatcher.run() or os.EX_OK
^^^^^^^^^^^^^^^^
File "/snap/testcraft/x1/lib/python3.12/site-packages/craft_cli/dispatcher.py", line 528, in run
return self._loaded_command.run(self._parsed_command_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/snap/testcraft/x1/lib/python3.12/site-packages/craft_application/commands/base.py", line 199, in run
result = self._run(parsed_args, **kwargs) or result
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/snap/testcraft/x1/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 317, in _run
self._run_post_prime_steps()
File "/snap/testcraft/x1/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 205, in _run_post_prime_steps
self._services.package.update_project()
File "/snap/testcraft/x1/lib/python3.12/site-packages/craft_application/services/package.py", line 56, in update_project
update_vars[var] = project_info.get_project_var(var)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/snap/testcraft/x1/lib/python3.12/site-packages/craft_parts/infos.py", line 340, in get_project_var
raise RuntimeError(
RuntimeError: cannot consume variable 'version' during lifecycle execution
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Managed-mode prime failures were fixed in craft-application#727 (commit 9b277bab) by running post-prime steps only in the process that executed the lifecycle. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed in craft-application#727 (9b277bab): post-prime steps now run only in the lifecycle process, preventing managed-mode prime failures when reading project variables. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed after confirming the prime command fails in managed mode. A Jira ticket (CRAFT-4425) was created for tracking. No code fix or merge was provided. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without a fix after confirming the prime command fails in managed mode due to a lifecycle variable consumption error. The bug was logged internally. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed after the bug was confirmed in managed mode. No fix, resolution, or follow-up pull request was documented in the thread. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/craft-application#727
(confidence 100%)
PR #727 contains the resolving commit 9b277bab titled "fix: only run post prime in the process that ran the lifecycle".
Related issues
No related issues found above the similarity threshold.