← Back to issue list

edit-validation-sets refuses to create a new validation set at sequence 1 ("sequence number was not incremented")

View original Github issue

Metadata

Project
snapcraft
Number
#6412
Type
issue
State
open
Author
bugraaydogar
Labels
Status: Triaged Type: Bug
Created
Updated
Closed
—

Current evaluation

edit-validation-sets rejects creating a brand-new validation set at sequence 1 because the sequence-increment check runs even when no existing set exists; confirmed by maintainer, tracked as SNAPCRAFT-1379.

Suggested action: close resolved

Reason: Maintainer mr-cal confirmed 'Snapcraft shouldn't use the sequence-incrementing code for new validation sets', and the related fix PR #6423 ('fix(validation-sets): don't validate new sets') was merged as commit e7b47adb7, which specifically unblocks creating a new validation set at sequence 1 on top of PR #6420 (for the sibling issue #6413). The report includes a precise root cause (validationsets.py::_validate_assertion comparing new_sequence <= old_sequence even when the GET returned 'Could not find an existing validation-set'), full logs and a workaround. Confidence is capped because repository inspection tools returned 'No pinned SHA available for project snapcraft', so I could not independently verify e7b47adb7 in the tree.

Evaluated by: mr-cal-bot

Impact: 45 Quick Win: 30 Complexity: 25 Confidence: 75 Actionability: 88

Issue body

### Check existing issues - [x] I've verified that this bug isn't described by any existing issues. ### Bug description Creating a brand-new validation set at sequence 1 with `snapcraft edit-validation-sets <account-id> <name> 1 --key-name <key-name>` is rejected by snapcraft's sequence-increment check: Sequence updated from 1 to 1 → warning → infinite amend loop → "operation aborted". The check new_sequence <= old_sequence in snapcraft/services/validationsets.py::_validate_assertion compares the edited sequence against the CLI argument even when no validation set exists yet, so there is nothing to "increment" from. Please see logs for details. ### Steps to reproduce 1. `snapcraft edit-validation-sets <account-id> <name> 1 --key-name <key>` 2. Provide a validation-set details. E.g. ``` account-id: <your-account-id> name: <name> sequence: 1 snaps: - name: snapd id: PMrrV4ml8uWuEUDBT8dSGnKUYbevVhc4 presence: required revision: 27710 ``` ### Environment Native Ubuntu 24.04 ### snapcraft.yaml ```yaml ``` ### Log output ```shell 2026-09-03 17:50:50.429 Starting snapcraft, version 9.1.0.post7 2026-09-03 17:50:50.429 Log verbosity level set to BRIEF 2026-09-03 17:50:50.430 Setting up Project 2026-09-03 17:50:50.430 Project file found at '/home/bugra.aydogar@canonical.com/work/small-test-snaps/xdp-tools-snap/snap/snapcraft.yaml' 2026-09-03 17:50:50.430 Loading project file 'snap/snapcraft.yaml 2026-09-03 17:50:50.436 Setting up BuildPlan 2026-09-03 17:50:50.437 Build plan contains 2 build(s). 2026-09-03 17:50:50.446 Preparing application... 2026-09-03 17:50:50.447 Setting up ConfigService 2026-09-03 17:50:50.463 Merging commands for group 'Lifecycle': 2026-09-03 17:50:50.463 - using application command for 'clean'. 2026-09-03 17:50:50.463 - using application command for 'pull'. 2026-09-03 17:50:50.463 - using application command for 'build'. 2026-09-03 17:50:50.464 - using application command for 'stage'. 2026-09-03 17:50:50.464 - using application command for 'prime'. 2026-09-03 17:50:50.464 - using application command for 'pack'. 2026-09-03 17:50:50.464 Merging commands for group 'Other': 2026-09-03 17:50:50.464 Configuring application... 2026-09-03 17:50:50.502 Build plan: platform=None, build_for=None 2026-09-03 17:50:50.503 Running 'snapcraft edit-validation-sets'. 2026-09-03 17:50:50.673 Setting up ValidationSets 2026-09-03 17:50:50.673 Requesting validation-set 'renesas-rz2th-key-vs' from the store. 2026-09-03 17:50:50.674 Retrieving credentials for 'snapcraft' on 'dashboard.snapcraft.io' from keyring 'SecretService Keyring'. 2026-09-03 17:50:50.724 HTTP 'GET' for 'https://dashboard.snapcraft.io/api/v2/validation-sets/renesas-rz2th-key-vs' with params {'sequence': 1} and headers {'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': '<macaroon>', 'User-Agent': 'snapcraft/9.1.0.post7 ubuntu/24.04 (x86_64)'} 2026-09-03 17:50:51.175 Could not find an existing validation-set named 'renesas-rz2th-key-vs'. 2026-09-03 17:50:51.178 Editing validation-set. 2026-09-03 17:50:51.178 Using vi to edit file. 2026-09-03 17:50:51.178 Emitter: Pausing control of the terminal 2026-09-03 17:52:26.832 Emitter: Resuming control of the terminal 2026-09-03 17:52:26.835 Edited validation-set. 2026-09-03 17:52:26.835 Building validation-set. 2026-09-03 17:52:26.835 Retrieving credentials for 'snapcraft' on 'dashboard.snapcraft.io' from keyring 'SecretService Keyring'. 2026-09-03 17:52:26.878 HTTP 'POST' for 'https://dashboard.snapcraft.io/api/v2/validation-sets/build-assertion' with params None and headers {'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': '<macaroon>', 'User-Agent': 'snapcraft/9.1.0.post7 ubuntu/24.04 (x86_64)'} 2026-09-03 17:52:27.313 Built validation set: {"account_id":"2slG1X4aOvtiLTWKfiv1orE02U6VhMtT","name":"renesas-rz2th-key-vs","revision":"0","sequence":1,"snaps":[{"name":"snapd","id":"PMrrV4ml8uWuEUDBT8dSGnKUYbevVhc4","presence":"required","revision":27710,"components":null}],"authority_id":"2slG1X4aOvtiLTWKfiv1orE02U6VhMtT","series":"16","sign_key_sha3_384":null,"timestamp":"2026-09-03T14:52:27Z","type":"validation-set"} 2026-09-03 17:52:27.313 Built validation-set. 2026-09-03 17:52:27.313 Sequence updated from 1 to 1 2026-09-03 17:52:27.313 Warning: The sequence number was not incremented. This prevents automatic reversions to a valid state in the case of invalid changes or snap refresh failures. 2026-09-03 17:52:27.313 Emitter: Pausing control of the terminal 2026-09-03 17:52:37.687 Emitter: Resuming control of the terminal 2026-09-03 17:52:37.688 operation aborted 2026-09-03 17:52:37.689 Traceback (most recent call last): 2026-09-03 17:52:37.689 File "/snap/snapcraft/19056/lib/python3.12/site-packages/snapcraft/services/assertions.py", line 313, in edit_assertion 2026-09-03 17:52:37.689 self._validate_assertion(built_assertion, **kwargs) 2026-09-03 17:52:37.689 File "/snap/snapcraft/19056/lib/python3.12/site-packages/snapcraft/services/validationsets.py", line 171, in _validate_assertion 2026-09-03 17:52:37.689 raise errors.SnapcraftAssertionWarning( 2026-09-03 17:52:37.689 snapcraft.errors.SnapcraftAssertionWarning: Warning: The sequence number was not incremented. This prevents automatic reversions to a valid state in the case of invalid changes or snap refresh failures. ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 45
Quick Win: 30
Complexity: 25
Confidence: 75
Actionability: 88
close resolved edit-validation-sets rejects creating a brand-new validation set at sequence 1 because the sequence-increment check runs even when no existing set exists; confirmed by maintainer, tracked as SNAPCRAFT-1379.
stealth/space-bunny-alpha
Impact: 55
Quick Win: 32
Complexity: 37
Confidence: 95
Actionability: 92
keep open A confirmed bug blocks edit-validation-sets from creating a first validation set at sequence 1 by applying the existing-set increment check to new sets. Triaged under SNAPCRAFT-1379.
qwen/qwen3.6-35b-a3b
Impact: 50
Quick Win: 35
Staleness: 25
Complexity: 30
Confidence: 80
Support Request: 0
keep open edit-validation-sets rejects creating new validation sets at sequence 1 due to incorrect sequence-increment validation. Triaged and confirmed by maintainer.
qwen3.6-35b-a3b-mtp-q6
Impact: 65
Quick Win: 42
Staleness: 5
Complexity: 35
Confidence: 85
Support Request: 5
keep open edit-validation-sets rejects creating new validation sets at sequence 1 due to a sequence-increment check that fires even when no prior set exists. Maintainer confirmed as bug.

Update history

Date Change
updated
updated
created

Related work

  • Likely Fixed By: canonical/snapcraft#6423 (confidence 82%)

    PR titled 'fix(validation-sets): don't validate new sets' landed as commit e7b47adb7 and is described as allowing new validation sets at sequence 1.

  • Related To: canonical/snapcraft#6413 (confidence 80%)

    Same validation-set sequence warning behaviour; fixed by merged PR #6420 which made the warning non-blocking, and #6423 builds on it.

  • Caused By: canonical/snapcraft#5535 (confidence 55%)

    PR #5535 introduced the non-incremented sequence warning that now fires incorrectly for newly created validation sets.

Related issues

Issue Project State Summary Similarity
#6423 fix(validation-sets): don't validate new sets snapcraft closed PR #6423 (SNAPCRAFT-1379) fixed edit-validation-sets rejecting brand-new validation sets at sequence 1; approved with no unresolved comments and landed as commit e7b47adb7, stacking on merged PR #6420.
75%
#6413 edit-validation-sets makes it impossible to publish a new revision of an existing sequence (no override) snapcraft closed Regression where edit-validation-sets hard-blocked same-sequence revisions was fixed by merged PR #6420 (commit 2989b5f8b), restoring the non-blocking sequence warning from PR #5545 lost in the #6050 refactor.
72%