Skip to content

Fix Aid::category and length validation in constructors and release v0.2.1 - #35

Merged
robin-nitrokey merged 2 commits into
mainfrom
category-len
Sep 21, 2026
Merged

robin-nitrokey merged 2 commits into
mainfrom
category-len

Conversation

@robin-nitrokey

@robin-nitrokey robin-nitrokey commented Sep 20, 2026 •

Copy link
Copy Markdown
Member

This PR fixes two connected bugs:

  • Aid::category checked for ASCII characters instead of raw bytes, classifying almost all AIDs as Category::Other.
  • Aid::try_new_truncatable (also called by all other constructors) enforced a maximum length instead of a minimum length for national and international AIDs. Due to the bug in Aid::category, this had virtually no effect though.

This first bug was already present in the first release. The second bug was introduced when inverting a condition in 4b73fa5.

This PR fixes both issues and adds tests using some well-known AIDs and the AIDs used on the NK3. Technically this is a breaking change but as the previous behavior was obviously wrong, I think it is semver-compliant to publish these fixes in a patch release.

This patch fixes two connected bugs:

- Aid::category checked for ASCII characters instead of raw bytes,
  classifying almost all AIDs a Category::Other.
- Aid::try_new_truncatable (also called by all other constructors)
  enforced a maximum length instead of a minimum length for national
  and international AIDs. Due to the bug in Aid::category, this had
  virtually no effect though.
@robin-nitrokey
robin-nitrokey merged commit c7154b0 into main Sep 21, 2026
3 checks passed
@robin-nitrokey
robin-nitrokey deleted the category-len branch September 21, 2026 09:55

This branch was successfully deployed

1 active deployment
crates.io — c7154b03 Deployed Sep 21, 2026 by robin-nitrokey via publish #2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants