← 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 new validation sets at sequence 1 due to incorrect sequence-increment validation. Triaged and confirmed by maintainer.

Suggested action: keep open

Reason: The issue is triaged (Status: Triaged label), confirmed by maintainer @mr-cal who stated 'Snapcraft shouldn't use the sequence-incrementing code for new validation sets', and has a clear reproduction path. The bug is in _validate_assertion in snapcraft/services/validationsets.py which compares the edited sequence against the CLI argument even when no validation set exists yet.

Impact: 50 Quick Win: 35.0 Staleness: 25 Complexity: 30 Confidence: 80 Support Request: 0

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
qwen/qwen3.6-35b-a3b
Impact: 50
Quick Win: 35.0
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.25
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

  • Related To: snapcraft#6413 (confidence 85%)

    Same validation logic issue blocking same-sequence revisions for existing validation sets; both stem from the same sequence-increment check in _validate_assertion.

Related issues

No related issues found above the similarity threshold.