Skip to content

feat: support uppercase tag filters (#A-Z) in filter schema#548

Merged
cameri merged 6 commits intocameri:mainfrom
CKodidela:feat/uppercase-tag-filters
Apr 21, 2026
Merged

feat: support uppercase tag filters (#A-Z) in filter schema#548
cameri merged 6 commits intocameri:mainfrom
CKodidela:feat/uppercase-tag-filters

Conversation

@CKodidela
Copy link
Copy Markdown
Collaborator

Description

Updates the filter schema validation regex in filter-schema.ts from /^#[a-z]$/ to /^#[a-zA-Z]$/ so uppercase tag filters pass Zod validation. Also adds a unit test asserting uppercase filters are accepted.

Related Issue

Closes #530

Motivation and Context

NIP-22 comment threading (kind 1111) requires uppercase tag filters such as #I (root identifier), #K (root kind), #E (event ref), and #A (addressable event ref). Before this fix, any subscription filter using an uppercase tag key was rejected with Unknown key: #I before it could be processed — even though isGenericTagQuery() in src/utils/filter.ts already correctly matched both cases with /^#[a-zA-Z]$/. This aligns the schema validation with the existing utility behavior.

How Has This Been Tested?

  • Added unit test in test/unit/schemas/filter-schema.spec.ts asserting that a filter containing #I, #K, #E, and #A keys passes schema validation without errors.
  • Verified the existing NIP-01 filter schema test suite continues to pass.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have added tests to cover my code changes.
  • All new and existing tests passed.

Updates filter-schema.ts validation regex from /^#[a-z]$/ to /^#[a-zA-Z]$/
so uppercase tag filters like #I, #K, #E, #A (used by NIP-22 comment
threading) pass validation. Adds unit test covering NIP-22 uppercase
tag filter acceptance.
Copilot AI review requested due to automatic review settings April 20, 2026 02:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates NIP-01 subscription filter validation to accept uppercase generic tag keys (#A#Z), aligning schema validation with existing filter utility behavior and enabling NIP-22-related filters.

Changes:

  • Expand filterSchema generic tag-key validation from ^#[a-z]$ to ^#[a-zA-Z]$.
  • Add a unit test ensuring filters containing #I/#K/#E/#A pass validation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/schemas/filter-schema.ts Loosens generic tag-key regex to accept uppercase tag filters.
test/unit/schemas/filter-schema.spec.ts Adds coverage to ensure uppercase tag keys validate successfully.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/schemas/filter-schema.ts
@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Apr 20, 2026

Coverage Status

coverage: 73.759% (+0.02%) from 73.738% — CKodidela:feat/uppercase-tag-filters into cameri:main

@CKodidela
Copy link
Copy Markdown
Collaborator Author

@cameri this PR is ready to be merged, made the necessary changes and updated the tests

@cameri cameri merged commit 00240a9 into cameri:main Apr 21, 2026
13 checks passed
@CKodidela CKodidela deleted the feat/uppercase-tag-filters branch April 21, 2026 01:40
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.

Support uppercase tag filters for NIP-22 and other NIPs (#A-Z)

4 participants