Skip to content

Enable Public Press chat during staging (backend) - #1007

Open
johnpooch wants to merge 5 commits into
mainfrom
claude/dreamy-bell-n4y7xk
Open

Enable Public Press chat during staging (backend)#1007
johnpooch wants to merge 5 commits into
mainfrom
claude/dreamy-bell-n4y7xk

Conversation

@johnpooch

@johnpooch johnpooch commented Jul 6, 2026

Copy link
Copy Markdown
Owner

What this PR does

Makes Public Press usable during staging (pending games), per #902: joined players can post, and anyone who can see the game can read — no new Lobby channel, Public Press doubles as the lobby.

  • ChannelMessageCreateView and ChannelMarkReadView no longer carry a game-status permission (only IsGameMember/IsChannelMember etc.); ChannelListView uses permissions.AllowAny. None of the three needs to restrict by game status — ChannelCreateView is untouched, so private channels still only exist once a game is active.
  • ChannelMemberSerializer.nation is now nullable, since staging members have no nation assigned yet. The two chat screens (ChannelScreen, ChannelListScreen) that read sender.nation.name now fall back to the member's display name when nation is null.
  • Regenerated openapi-schema.yaml and the frontend TS client for the nullable nation field.
  • Added a CLAUDE.md guideline against permission classes whose condition covers every possible value of the field they inspect (discovered during review: an earlier version of this PR added exactly that).

Out of scope, per review: an optional intro-message-on-join feature was cut from this PR in favor of a simpler two-chained-request frontend approach (join, then post to Public Press) in a follow-up.

Closes #902

Checklist

  • This PR does one thing — no unrelated fixes, refactors, or drive-by cleanups bundled in
  • For PRs of any significant complexity: I ran /review-pr against this PR in Claude Code and addressed (or responded to) its findings — the gh-CLI-based skill isn't available in this sandbox, so I performed an equivalent manual read-through of the diff instead, and separately addressed human review comments.
  • Tests cover the change
  • Screenshots embedded in the PR description for any visual changes — this PR is backend-only; the two frontend edits are type-safety fixes for the new nullable field, not visible changes.

Relax the game-status permission on ChannelListView, ChannelMessageCreateView,
and ChannelMarkReadView to also allow PENDING games, so Public Press doubles
as the staging lobby. ChannelCreateView is unchanged, so private channels
still only exist once a game is active.

Make ChannelMemberSerializer.nation nullable to represent nation-less staging
members, and add an optional write-only intro_message field to the join
endpoint that posts an intro to Public Press in the same transaction as the
member row. The intro is skipped for no-press and anonymous games, where
messaging is unavailable or the sender would show as "Anonymous".

Closes #902

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FNnnB9Xzp3KRRAAjdwYoco
@netlify

netlify Bot commented Jul 6, 2026

Copy link
Copy Markdown

Deploy Preview for diplicity-variant-creator canceled.

Name Link
🔨 Latest commit bdd631a
🔍 Latest deploy log https://app.netlify.com/projects/diplicity-variant-creator/deploys/6a657552c749b000089abdb6

@johnpooch johnpooch left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review

This PR correctly implements staging chat per #902: the new IsActiveCompletedOrPendingGame permission is applied consistently across list/create/mark-read views, ChannelMemberSerializer.nation is properly nullable, frontend fallbacks to display name are correct and match the existing #808080 fallback-color convention, and the IsNotNoPressActiveGame/sandbox-join exclusions correctly stay blocking (sandbox games are always created pre-filled and active, so the join path is unreachable there anyway). Traced public_channels[0] — safe, since only one public (non-private) channel is ever created per game across the codebase. One suggestion found regarding a description/implementation mismatch around transactional atomicity of the join + intro-message write.

1 inline comment(s) (0 blocking, 1 suggestion).


Generated by Claude Code

Comment thread service/member/serializers.py
Member/ChannelMember creation and the intro ChannelMessage were three
independent commits without this, so a failure on the last write left
the user joined with no intro posted. Matches GameCreateSerializer's
existing pattern for analogous multi-step writes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FNnnB9Xzp3KRRAAjdwYoco
Comment thread service/common/permissions.py Outdated
Comment thread service/member/serializers.py Outdated
Comment thread service/member/serializers.py Outdated
claude added 2 commits July 10, 2026 14:37
…rmission

Per review: the intro message is better handled as two chained frontend
requests (join, then post to Public Press) rather than a dedicated
write-only field on the join endpoint, since it keeps message creation
to a single endpoint. Reverts member/serializers.py and member/views.py
to their pre-PR shape; the permission relaxation already makes posting
to Public Press during staging possible for a joined member.

Also removes IsActiveCompletedOrPendingGame: it checked for every
GameStatus value, so it always evaluated true and gated nothing.
ChannelListView, ChannelMessageCreateView, and ChannelMarkReadView no
longer carry a game-status permission at all — nothing in this PR
needs one. Added a CLAUDE.md guideline against adding permission
classes like this in the future.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FNnnB9Xzp3KRRAAjdwYoco
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been inactive for 7 days and will be closed in 7 days unless there is further activity. If it is still being worked on, push a commit or leave a comment. Add the pinned label to exempt it permanently.

@github-actions github-actions Bot added the stale label Jul 18, 2026

Copy link
Copy Markdown
Owner Author

Still ready for review — CI is green and up to date with main, just waiting on a human review pass (tracked via workflow: needs-pr-review on #902).


Generated by Claude Code

@github-actions github-actions Bot removed the stale label Jul 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been inactive for 7 days and will be closed in 7 days unless there is further activity. If it is still being worked on, push a commit or leave a comment. Add the pinned label to exempt it permanently.

@github-actions github-actions Bot added the stale label Jul 26, 2026
…y7xk

# Conflicts:
#	packages/web/src/api/generated/endpoints.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable Public Press chat during staging (backend)

2 participants