← Back to issue list

Improve craft tool dev experience with destructive mode

View original Github issue

Metadata

Project
craft-application
Number
#1015
Type
issue
State
open
Author
bepri
Labels
—
Created
Updated
Closed
—

Current evaluation

Root-run destructive packing leaves root-owned lifecycle directories, blocking later non-root packing; the UX request remains untriaged with no selected solution.

Suggested action: needs triage

Reason: The report gives an exact root-then-user reproduction ending in PermissionError at prime/meta/snap.yaml, confirming a real developer workflow failure. However, the issue has no labels, assignee, or maintainer response and offers three alternative outcomes rather than a chosen design; craft-application#974 added only a generic non-root warning.

Evaluated by: mr-cal-bot

Impact: 38 Quick Win: 10 Complexity: 61 Confidence: 93 Actionability: 65

Issue body

### What needs to get done The development iteration process should be made easier for creating craft tools. Recent changes like #974 encourage avoiding this behavior, which is good for end-users, but something to ease this rough edge for development of the craft tools could be helpful. Some proposed solutions could be: - Caches scoped by UID when using destructive mode - A better error message when attempting to run `craft clean --destructive-mode` in this state - A better error message when attempting to access any of these directories with "bad" permissions ### Why it needs to get done For local development, packing in destructive mode can sometimes be useful. Packing as non-root may, at times, be the easiest (and safest) way to test certain features in development. The following is the result of `snapcraft init` followed by `sudo snapcraft pack --destructive-mode`: ``` $ ls -la total 72 drwxr-xr-x 10 testing root 4096 Feb 17 20:12 . drwxr-xr-x 4 root root 4096 Feb 17 19:52 .. drwxrwxr-x 3 testing testing 4096 Feb 17 19:53 .cache drwxr-xr-x 2 root root 4096 Feb 17 19:55 .craft drwxrwxr-x 3 testing testing 4096 Feb 17 19:53 .local -rw-r--r-- 1 testing testing 0 Feb 17 19:55 .sudo_as_admin_successful -rw------- 1 testing testing 874 Feb 17 19:54 .viminfo drwxr-xr-x 2 root root 4096 Feb 17 20:12 overlay drwxr-xr-x 3 root root 4096 Feb 17 20:12 parts drwxr-xr-x 4 root root 4096 Feb 17 20:12 prime drwx------ 4 testing testing 4096 Feb 17 19:56 snap drwxr-xr-x 3 root root 4096 Feb 17 20:12 stage -rw-r--r-- 1 root root 28672 Feb 17 20:12 testing_0.1_amd64.snap ``` If the tool is then used like `snapcraft pack --destructive-mode`, then I get: ``` 2026-02-17 20:12:41.824 snapcraft internal error: PermissionError(13, 'Permission denied') 2026-02-17 20:12:41.825 Traceback (most recent call last): 2026-02-17 20:12:41.825 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_application/application.py", line 663, in run 2026-02-17 20:12:41.825 return_code = self._run_inner() 2026-02-17 20:12:41.825 ^^^^^^^^^^^^^^^^^ 2026-02-17 20:12:41.825 File "/snap/snapcraft/16570/lib/python3.12/site-packages/snapcraft/application.py", line 183, in _run_inner 2026-02-17 20:12:41.825 return_code = super()._run_inner() 2026-02-17 20:12:41.825 ^^^^^^^^^^^^^^^^^^^^ 2026-02-17 20:12:41.825 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_application/application.py", line 640, in _run_inner 2026-02-17 20:12:41.825 return_code = dispatcher.run() or os.EX_OK 2026-02-17 20:12:41.825 ^^^^^^^^^^^^^^^^ 2026-02-17 20:12:41.825 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_cli/dispatcher.py", line 564, in run 2026-02-17 20:12:41.825 return self._loaded_command.run(self._parsed_command_args) 2026-02-17 20:12:41.825 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2026-02-17 20:12:41.825 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_application/commands/base.py", line 222, in run 2026-02-17 20:12:41.825 result = self._run(parsed_args, **kwargs) or result 2026-02-17 20:12:41.825 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2026-02-17 20:12:41.825 File "/snap/snapcraft/16570/lib/python3.12/site-packages/snapcraft/commands/lifecycle.py", line 74, in _run 2026-02-17 20:12:41.825 super()._run(parsed_args) 2026-02-17 20:12:41.825 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 620, in _run 2026-02-17 20:12:41.825 return self._run_real(parsed_args=parsed_args, step_name=step_name) 2026-02-17 20:12:41.825 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2026-02-17 20:12:41.825 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 439, in _run_real 2026-02-17 20:12:41.825 self._run_post_prime_steps() 2026-02-17 20:12:41.825 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 270, in _run_post_prime_steps 2026-02-17 20:12:41.825 self._services.package.write_metadata(self.services.get("lifecycle").prime_dir) 2026-02-17 20:12:41.825 File "/snap/snapcraft/16570/lib/python3.12/site-packages/snapcraft/services/package.py", line 153, in write_metadata 2026-02-17 20:12:41.825 self.metadata.to_yaml_file(meta_dir / "snap.yaml") 2026-02-17 20:12:41.825 File "/snap/snapcraft/16570/lib/python3.12/site-packages/craft_application/models/base.py", line 93, in to_yaml_file 2026-02-17 20:12:41.825 with path.open("wt") as file: 2026-02-17 20:12:41.825 ^^^^^^^^^^^^^^^ 2026-02-17 20:12:41.825 File "/snap/snapcraft/current/usr/lib/python3.12/pathlib.py", line 1015, in open 2026-02-17 20:12:41.825 return io.open(self, mode, buffering, encoding, errors, newline) 2026-02-17 20:12:41.825 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2026-02-17 20:12:41.825 PermissionError: [Errno 13] Permission denied: '/home/testing/prime/meta/snap.yaml' ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 38
Quick Win: 10
Complexity: 61
Confidence: 93
Actionability: 65
needs triage Root-run destructive packing leaves root-owned lifecycle directories, blocking later non-root packing; the UX request remains untriaged with no selected solution.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 13
Complexity: 40
Confidence: 70
Actionability: 70
needs triage Feature request to improve dev experience with destructive mode: UID-scoped caches and better error messages. Untriaged, no maintainer engagement.
qwen/qwen3.8-27b
Impact: 40
Quick Win: 18
Staleness: 55
Complexity: 55
Confidence: 75
Support Request: 10
needs triage Feature request from maintainer bepri to smooth destructive-mode dev workflow: after sudo pack leaves root-owned dirs, non-root pack crashes with raw PermissionError. Proposes UID-scoped caches or better permission error messages. Open 195 days, no labels, no comments.
qwen/qwen3.6-35b-a3b
Staleness: 85
Complexity: 40
Confidence: 90
Support Request: 10
needs triage Proposal to improve developer experience for craft tools using destructive mode by addressing permission errors and suggesting UID-scoped caches or better error messages. Currently unlabelled and inactive for 154 days.
qwen3.6-35b-a3b-mtp-q6
Staleness: 65
Complexity: 45
Confidence: 90
Support Request: 10
needs triage Feature request to improve developer experience when using destructive mode in craft tools, addressing permission errors and cache scoping. Currently unlabelled and awaiting maintainer review after 141 days of inactivity.

Update history

No update history recorded yet.

Related work

  • Related To: craft-application#974 (confidence 99%)

    Merged PR 4b213f68 warns when destructive commands run as non-root, but does not prevent root-owned artifacts or diagnose the reported permission failure.

Related issues

No related issues found above the similarity threshold.