test: add NIP-22 created_at integration coverage - #547
Merged
cameri merged 2 commits intoApr 22, 2026
Merged
Conversation
Collaborator
cameri
reviewed
Apr 20, 2026
cameri
reviewed
Apr 20, 2026
cameri
reviewed
Apr 20, 2026
There was a problem hiding this comment.
Pull request overview
Adds Cucumber integration coverage for NIP-22 created_at timestamp limit enforcement, ensuring events with implausible timestamps are accepted/rejected as configured.
Changes:
- Add new
@nip-22integration feature + step definitions to exercisecreatedAt.maxPositiveDelta/maxNegativeDelta. - Update
EventMessageHandler’s “too far in the future” reason prefix fromrejected:toinvalid:and align the corresponding unit test expectation. - Add a Changesets entry (currently marked as empty/tests-only).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/handlers/event-message-handler.spec.ts | Updates expectation to match the new invalid: prefix for future created_at rejection. |
| test/integration/features/nip-22/nip-22.feature.ts | Adds step defs to set created_at limits and draft/send events with relative timestamps. |
| test/integration/features/nip-22/nip-22.feature | Adds scenarios for accepted/rejected created_at timestamps around configured deltas. |
| src/handlers/event-message-handler.ts | Changes rejection reason prefix for future created_at limit from rejected: to invalid:. |
| .changeset/nip-22-created-at-tests-empty.md | Adds an “empty” changeset despite the PR also changing runtime behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Priyanshubhartistm
force-pushed
the
feat/integration-tests-nip-22-timestamp-limits
branch
from
April 20, 2026 13:41
5978029 to
cbec93c
Compare
Priyanshubhartistm
marked this pull request as draft
April 20, 2026 22:40
Priyanshubhartistm
marked this pull request as ready for review
April 21, 2026 21:17
Priyanshubhartistm
force-pushed
the
feat/integration-tests-nip-22-timestamp-limits
branch
from
April 21, 2026 23:43
62ef026 to
32ac52e
Compare
cameri
approved these changes
Apr 22, 2026
Collaborator
Author
|
@cameri thank you |
This was referenced Apr 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Added integration tests for NIP-22
created_attimestamp limits as requested in issue #505.These tests verify that the relay correctly enforces:
createdAt.maxPositiveDelta(default: 900 seconds)createdAt.maxNegativeDelta(default: 0 = unlimited)Related Issue
Closes #505
Motivation and Context
Currently, there were no integration tests covering the timestamp validation logic for event
created_atfield.This PR adds proper Cucumber integration tests to ensure events with implausible timestamps (too far in future or past) are rejected while valid ones are accepted.
How Has This Been Tested?
test/integration/features/nip-22/nip-22.featuretest/integration/features/nip-22/nip-22.feature.tsmaxNegativeDelta→ rejectedmaxNegativeDelta→ acceptedTypes of changes
Checklist: