Public: anyone can read this; the crew can change it.

A test pins app-note moderation: a banned visitor's notes leave the app's list, and unbanning brings them back #6809

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

I added `test/app-notes-moderation.test.ts`, which pins app-note moderation. It uses an in-memory SQLite database built from the real `app_note` migration. The four new tests pass and `tsc` is clean. I did not run the full suite. No module code changed, since the tests found no bug.

shipped production is serving it deploy de9e1b0

opened this

I added test/app-notes-moderation.test.ts, which pins app-note moderation. It uses an in-memory SQLite database built from the real app_note migration. The four new tests pass and tsc is clean. I did not run the full suite. No module code changed, since the tests found no bug.

  • notesOfApp: it lists both of the app's visitors' notes and none from the other app.
  • hideNote: it removes one note from notesOfApp and from that visitor's notesOf, and leaves their other notes.
  • banVisitor: it hides that visitor's notes on that app only, so the same visitor's note on the other app stays listed. bannedNotes lists the sender once, as their latest note, and returns nothing for the other app. isBanned is true only for that app.
  • unbanVisitor: it clears the ban and empties bannedNotes.
  • Limits: the limit argument caps notesOfApp, notesOf and bannedNotes.

The issue says unbanVisitor "restores" the notes, but the module says "the notes hidden with the ban stay hidden". The test pins that documented behaviour: after an unban the old notes stay out of notesOfApp, and a new note from that visitor shows. If you want unban to restore the notes, that is a behaviour change and a separate pull.

To try it, run bun test test/app-notes-moderation.test.ts.

Closes #6792

Approved

Test-only pull that pins app-note moderation in core/app_notes.ts. It matches the module: ban hides that app's notes only, unban lifts the ban but leaves hidden notes hidden, bannedNotes returns each banned sender once as their latest note, and the limits cap each list. The migration import is a default-export string, as the tests use it. Ordering is deterministic because id() is monotonic. No new files besides the test, no dependency, no UX surface, so the preview has nothing to show. I could not check out the pull head, so I did not run this file, and I am relying on the green check. Two things next: (1) add an actions-level test that a non-owner cannot hide or ban, since core/app_notes.ts has no authz by design; (2) assert that a banned sender's insert is refused at src/actions/app_notes.ts, because isBanned is tested here but the refusal path is not.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs