← Back to issue list

Test must only pack if necessary

View original Github issue

Metadata

Project
craft-application
Number
#800
Type
issue
State
open
Author
cmatsuoka
Labels
Status: Triaged Type: Enhancement
Created
Updated
Closed
—

Current evaluation

Enhancement: `*craft test` should only repack artifacts when necessary. Core mechanism landed in 7.1.0 (PR #1111, metadata mediator API); open questions remain about passing a pre-built artifact to test.

Suggested action: keep open

Reason: The requested mechanism is implemented and shipped: changelog 7.1.0 states "Add the metadata mediator API to the package service to only repack artifacts when the lifecycle or metadata files changed", `PackageService.needs_packing()` consults `always_repack`/`lifecycle.requires_repack`/state and skips repacking, and `PackCommand._run_real` branches to that path when `supports_conditional_repack`. TestCommand inherits PackCommand, so the original ask is substantially delivered and lengau noted "#1111 makes progress towards this." However, the thread is not resolved: astrojuanlu's 2026-07-22 comment requests an explicit way to hand a pre-built artifact to `*craft test` (e.g. `--use-artifact=$(pwd)/thing.craft`), asking whether ST160 permits it; no such CLI option exists in the codebase (grep for use-artifact/artifact-path returns nothing). The issue is triaged with an internal ticket (CRAFT-4642) and the remaining scope is a design decision, not a pinpointed fix, so it should stay open rather than be closed as resolved.

Evaluated by: mr-cal-bot

Impact: 45 Quick Win: 10 Complexity: 55 Confidence: 78 Actionability: 50

Issue body

### Bug Description Running the test command shouldn't repack the artifact unless it's necessary. Keep a packed file state and use the state service to verify if the file needs to be repacked. ### To Reproduce Run `snapcraft test` on a project that uses craft testing and see the artifact being packed even if it's not necessary to repack. ### part yaml ```shell N/A ``` ### Relevant log output ```shell N/A ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 45
Quick Win: 10
Complexity: 55
Confidence: 78
Actionability: 50
keep open Enhancement: `*craft test` should only repack artifacts when necessary. Core mechanism landed in 7.1.0 (PR #1111, metadata mediator API); open questions remain about passing a pre-built artifact to test.
qwen/qwen3.6-35b-a3b
Impact: 40
Quick Win: 20
Complexity: 30
Confidence: 80
Actionability: 70
close resolved Issue requesting that `*craft test` only repacks artifacts when necessary, avoiding unnecessary repacking. Progress made via merged PR #1111 in craft-application.
qwen/qwen3.8-27b
Impact: 50
Quick Win: 22
Staleness: 15
Complexity: 55
Confidence: 75
Support Request: 10
keep open Enhancement: make `snapcraft test` skip repacking the artifact when unnecessary, using packed-file state. Triaged; PR #1111 added conditional repacking (ST160 metadata mediator) and a maintainer is still discussing scope (e.g. a `--use-artifact` option) in recent comments.
qwen/qwen3.6-35b-a3b
Staleness: 15
Complexity: 45
Confidence: 90
Support Request: 10
keep open Enhancement to prevent unnecessary artifact repacking during snapcraft test by tracking file state. Currently under discussion regarding DX benefits and potential CLI parameters, with PR 1111 noted as making progress.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 20
Confidence: 85
Support Request: 10
close stale Requests optimizing snapcraft test to only repack artifacts when necessary using a state service. Labeled triaged but has been completely inactive for over a year with no maintainer follow-up or implementation progress.

Update history

Date Change
updated

Related work

  • Likely Fixed By: canonical/craft-application#1111 (confidence 85%)

    Merged PR (commit 1dfae607) adding conditional repacking under ST160, released in 7.1.0; changelog confirms the metadata mediator API that skips unnecessary repacks. lengau explicitly linked it to this issue.

Related issues

No related issues found above the similarity threshold.