Skip to content

Enable Public Press chat during staging - #1009

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

Enable Public Press chat during staging#1009
johnpooch wants to merge 4 commits into
mainfrom
claude/dreamy-bell-5u5moi

Conversation

@johnpooch

Copy link
Copy Markdown
Owner

What this PR does

Makes Public Press usable before a game starts: joined members can post, anyone who can see the game can read, and an optional intro message is collected on join. Public Press doubles as the staging lobby — no new channel type, per the decision recorded on the issue.

  • ChannelListView, ChannelMessageCreateView, and ChannelMarkReadView no longer require an active/completed game — a member of a pending game can now list, post to, and mark read the game's channels. ChannelCreateView is untouched (private channels stay active-game-only, since naming them requires assigned nations).
  • ChannelMemberSerializer.nation is now nullable, since staging members have no nation yet.
  • MemberSerializer (the join endpoint) gains an optional, write-only intro_message field. When provided, it's posted to Public Press in the same transaction as the member row — skipped for no-press and anonymous games (chat is unavailable or the sender would show as "Anonymous"). Making this required is deliberately deferred to a follow-up PR so it can be verified and reverted independently.
  • Two frontend components (ChannelListScreen, ChannelScreen) fall back to the sender's name/a neutral color when nation is null, so existing chat rendering doesn't break once the schema changes.

One incidental fix: enabling staging chat means a human message in a pending game with a bot member (bots can be added to a game before it starts via BotMemberCreateView) now reaches the bot's reply signal, which always failed its order-options fetch (403 — game isn't active) and logged an error for every message. Added a guard so the bot only attempts a reply in active games, plus a regression test.

Screenshots aren't included — the changed rendering path (a staging-chat message with no nation yet) isn't reachable through the app's current navigation, since pending games don't route to the chat screen until #903/#906 land. It's covered by component tests instead.

Closes #902


Generated by Claude Code

claude added 2 commits July 6, 2026 08:18
Relax the game-status permission on ChannelListView, ChannelMessageCreateView,
and ChannelMarkReadView so pending games behave like active ones: joined
members can post, and anyone who can see the game can read. Public Press
doubles as the staging lobby, per the issue discussion - no new channel type.

Make ChannelMemberSerializer.nation nullable so messages from staging members
(who have no nation yet) serialize correctly, and add an optional intro_message
field to the join endpoint that posts to Public Press in the same transaction
as the member row, when the game supports chat (not sandbox/no-press/anonymous).

Closes #902

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016a4jiSeAknweYjEUy7Es4p
- Skip the bot-reply signal for non-active games: enabling staging chat
  means a human message in a pending game with a bot member (added via
  BotMemberCreateView) now reaches bot.signals.reply, which always failed
  its order-options fetch (403, game not active) and logged noise for
  every message. Regression test added.
- Simplify MemberSerializer.create(): drop the unreachable "not
  game.sandbox" guard (sandbox games are never PENDING, so this endpoint
  never sees one) and match the public channel by the private=False
  filter alone instead of a hardcoded "Public Press" name lookup.
- Extract getSenderDisplayName/DEFAULT_NATION_COLOR into channelUtils so
  the null-nation fallback isn't copy-pasted across ChannelScreen and
  ChannelListScreen.
- Add test coverage the null-nation rendering path and the intro-message
  bot cap/whitespace edge cases were missing.

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

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Warning

WIP limit exceeded. There are now 7 open pull requests — the project target is 5 or fewer.

Please close or merge an existing PR before continuing with this one.

@netlify

netlify Bot commented Jul 6, 2026

Copy link
Copy Markdown

Deploy Preview for diplicity-variant-creator canceled.

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

@johnpooch johnpooch added the deploy-to-staging Trigger staging environment deployment label Jul 7, 2026
@github-actions github-actions Bot removed the deploy-to-staging Trigger staging environment deployment label Jul 7, 2026
@johnpooch johnpooch added the deploy-to-staging Trigger staging environment deployment label Jul 7, 2026 — with Claude
@github-actions github-actions Bot removed the deploy-to-staging Trigger staging environment deployment label Jul 7, 2026
@railway-app
railway-app Bot temporarily deployed to devoted-rejoicing / staging-pr-1009 July 7, 2026 20:53 Inactive
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Staging Environment Deployed

Frontend preview: https://deploy-preview-1009--diplicity-react.netlify.app
Staging backend: https://diplicity-react-staging-pr-1009.up.railway.app

The staging backend has a copy of the production database from the daily snapshot taken at Tue, 07 Jul 2026 06:04:12 GMT, with migrations from this PR applied.
Use email/password login to test (Google OAuth is not configured for staging).

The frontend preview derives its backend URL from the PR number at build time.
Refresh the preview page once the staging backend is ready.
To redeploy, add the deploy-to-staging label again.

@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 15, 2026

Copy link
Copy Markdown
Owner Author

Still active — CI is green (test/build/lint all pass) and this is labeled workflow: needs-pr-review, awaiting human review.


Generated by Claude Code

@github-actions github-actions Bot removed the stale label Jul 16, 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 23, 2026
@johnpooch johnpooch added pinned and removed stale labels Jul 23, 2026 — with Claude
claude added 2 commits July 23, 2026 02:57
Resolves conflicts from the bot-app split (#1045): service/bot/tests.py
was deleted upstream in favor of service/agent/tests.py, so the new
pending-game reply-guard test moved there. member/tests.py had a plain
import-path conflict (bot.models -> bot_profile.models). Git's
rename-aware merge already carried the game-status guard from
bot/decorators.py onto the new agent/decorators.py without a conflict.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016a4jiSeAknweYjEUy7Es4p
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