Skip to content

PM-6594: Apply forum watch inheritance and persist topic opt-outs - #20

Merged
jmgasper merged 1 commit into
developfrom
PM-6594-1
Oct 20, 2026
Merged

jmgasper merged 1 commit into
developfrom
PM-6594-1

Conversation

@jmgasper

@jmgasper jmgasper commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What was broken

The previous PM-6594 fix (PR #19) added default challenge forum watches and new-topic emails. QA found that forum opt-out did not update topic/announcement watch states, and individually unwatched topics could still receive forum notifications.

Root cause

Topic reads treated any TopicWatch row as watched and ignored the forum preference. Topic unwatch deleted the row, losing the opt-out required to override forum defaults. New challenge topics also automatically watched their author independently of the forum preference.

What was changed

  • Resolve topic list/detail watch state from the explicit topic choice, falling back to the effective challenge forum preference.
  • Persist challenge-topic opt-outs and exclude them from notification recipients, including members watching through the forum or an ancestor.
  • Preserve individual topic watches across forum opt-out and individual opt-outs across forum re-watch. Announcements follow the same rules.
  • Let newly created challenge topics inherit the author's forum preference. Preserve general forum author watches and unwatch behavior.
  • Add the TopicWatch.watching column, regenerate Prisma exports, and update documentation. Existing watch rows are preserved as opt-ins because historical rows do not distinguish manual from automatic author watches.

Deploy migration 20261020000000_topic_watch_preferences before this API, then Platform UI PR #2527. The previous challenge-watch migration remains required. No dependency changes.

Any added/updated tests

  • HTTP regressions for registrants and copilots: list/detail/email consistency through watch → unwatch → re-watch, individual opt-ins/opt-outs, announcements, newly authored topics while unwatched, and explicit topic re-watch.
  • PostgreSQL tests for inherited/null versus explicit true/false projections, default preservation, and idempotent preference updates.
  • Command and recipient filtering regressions, including a topic opt-out overriding forum and ancestor watches.

Validation after nvm use:

  • pnpm lint and pnpm build: passed; changed service/test files also checked directly with ESLint.
  • pnpm exec prisma migrate deploy: all six migrations passed on disposable local PostgreSQL.
  • pnpm test --runInBand with PostgreSQL schema checks: 193 passed, eight optional public-forum database tests skipped.
  • All database suites enabled: 200 passed, one failed. The public-import category-topic:99001 provenance failure also reproduces on unchanged origin/develop (seven passed, one failed). No unrelated importer changes were made.

What was broken
The previous fix added resource-based forum defaults and new-topic emails, but
QA found that unwatching the forum left topic and announcement watch states
unchanged and individual topic opt-outs did not survive forum re-watching.

Root cause
Topic reads only checked whether a TopicWatch row existed. Unwatching deleted
that row, leaving no explicit opt-out to override forum notification defaults.
Challenge authors also received automatic topic watches on creation.

What was changed
Resolve inherited topic watches from the effective forum preference. Persist
challenge-topic opt-outs and exclude them from notification recipients. Preserve
individual opt-ins across forum toggles and let new challenge topics inherit
without an automatic author watch. Add the TopicWatch.watching migration,
regenerate Prisma exports, and update API and deployment documentation.
Existing watch rows remain opt-ins because historical manual/author provenance
was not recorded. General-topic author watches and unwatch behavior remain intact.

Any added/updated tests
Add registrant/copilot HTTP regressions for list/detail/email consistency through
forum toggles, announcements, individual overrides, and new authored topics.
Add real PostgreSQL preference/projection tests and command/recipient regressions.
Lint and build pass. The normal suite with database checks passes 193 tests.
Enabling all database suites passes 200 tests and reproduces one pre-existing
public-import provenance failure on unchanged origin/develop.
@jmgasper
jmgasper merged commit 9aa0df8 into develop Oct 20, 2026
2 checks passed
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.

1 participant