Skip to content

feat: raise note content limit from 300 to 4000 characters#252

Open
leon-wbr wants to merge 1 commit into
mainfrom
feat/249-raise-content-length-limit
Open

feat: raise note content limit from 300 to 4000 characters#252
leon-wbr wants to merge 1 commit into
mainfrom
feat/249-raise-content-length-limit

Conversation

@leon-wbr

Copy link
Copy Markdown
Contributor

Closes #249

⚠️ Deploy order matters — read before merging

CONTENT_MAXIMUM_LENGTH lives in nr-common/constants.ts and is enforced by contentSchema, which nr-server also uses to decide whether to repost a kind 30397 as a verified kind 30398.

If clients ship this before nr-server is redeployed, a long note will validate happily in the app, publish to the relay, and then be silently dropped server-side — never reposted, so it never appears on the Trustroots layer. The user watches their note vanish with no error.

Deploy nr-server first, then the clients.

Why 4000, and why a limit at all

There is no protocol limit to honour here — I checked:

  • NIP-01 defines no maximum content length.
  • relay.trustroots.org's own NIP-11 document advertises no max_content_length. Its only ceiling is max_message_length = 131072 bytes, for the entire JSON message.

So the 300 was a Nostroots invention, not a protocol constraint, and it was truncating legitimate notes (see the squat/bridge listing in the issue).

I kept a bound rather than removing it outright, purely so nr-server retains an upper limit on what it will accept and repost — an unbounded content field on the relay is an abuse vector. 4000 is ~2% of the relay's real ceiling and generous for the use case in the issue.

Removing the bound entirely is also defensible — that's literally what the issue title asks for. I didn't do it unilaterally because it's a judgement call about relay abuse. Happy to change it.

Also

AddNoteForm had no maxLength and no counter, so exceeding the cap failed silently at publish time. It now caps the input and shows a remaining-character count as you approach the limit.

Tests

  • nr-common: deno task test — 9 passing, 4 new (content at/above/below the bound, and well past the old 300).
  • nr-app: pnpm test — 85 passing.

The 300 char cap was a Nostroots invention, not a protocol constraint:
NIP-01 defines no content limit, and relay.trustroots.org's NIP-11
document advertises no max_content_length (its only ceiling is
max_message_length, 131072 bytes for the entire JSON message). It was
truncating legitimate notes.

Keep a bound so nr-server retains an upper limit on what it will accept
and repost, and surface the remaining count in AddNoteForm so the cap
is visible instead of failing silently at publish time.

DEPLOY ORDER: nr-server validates against this same schema, so it must
be redeployed before clients ship, or long notes will validate in-app
and then be dropped server-side and never reposted as kind 30398.

Closes #249
@leon-wbr
leon-wbr requested review from awongh and chmac July 13, 2026 10:10
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.

plz ditch 300 char limit

1 participant