Skip to content

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

Merged
cameri merged 6 commits into
cameri: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 into
cameri:mainfrom
CKodidela:feat/uppercase-tag-filters

Conversation

@CKodidela

Copy link
Copy Markdown
Contributor

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.
CopilotAI review requested due to automatic review settings April 20, 2026 02:44

CopilotAI left a comment

Copy link
Copy Markdown

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.

FileDescription
src/schemas/filter-schema.tsLoosens generic tag-key regex to accept uppercase tag filters.
test/unit/schemas/filter-schema.spec.tsAdds coverage to ensure uppercase tag keys validate successfully.

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

Comment threadsrc/schemas/filter-schema.ts
@coveralls

coveralls commented Apr 20, 2026

Copy link
Copy Markdown
Collaborator

Coverage Status

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

@CKodidela

Copy link
Copy Markdown
ContributorAuthor

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

@cameri
cameri merged commit 00240a9 into cameri:mainApr 21, 2026
13 checks passed
@CKodidela
CKodidela deleted the feat/uppercase-tag-filters branch April 21, 2026 01:40
@camericameri mentioned this pull request Apr 22, 2026
Sign up for freeto 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

@CKodidela@coveralls@cameri