Skip to content

feat(bedside): invitation expiry and fail-closed replays (BA-W01 L3) - #11786

Merged
dezren39 merged 1 commit into
mainfrom
feat/ba-w01-l3-invites
Nov 18, 2026
Merged

dezren39 merged 1 commit into
mainfrom
feat/ba-w01-l3-invites

Conversation

@dezren39

@dezren39 dezren39 commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Before: a store invitation never expired, and answering one that was already accepted, declined or revoked returned 200 with its status, so a replay looked like success.

After: an invitation expires 14 days after it is made. The invitee's list drops it, the access view shows it as expired with its expiresAt, and accepting it fails with 409. Any response to an invitation that is no longer pending fails closed with 409 and its status. A new invitation to the same email replaces an expired one. Only the signed-in account the invitation names can answer it, as before.

How: expiry is derived from created_at (INVITE_TTL_MS in worker/api.mjs), not stored, because the invitations.status CHECK predates expired; no migration is needed. The accept/decline compare-and-set now also requires created_at inside the window. tests/backend.mjs covers replays after acceptance, expiry, the expired listing and re-inviting; tests/admin-races.mjs still passes (its revoked race now reads 409 with status: revoked). design/identity-access.md records the lifecycle. All 19 test files pass.

Closes #11752.


Generated by Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Invitations expire 14 days after they are made. Expiry is derived
from created_at (the status CHECK predates 'expired', so no
migration): the API reports 'expired' and expiresAt, the invitee list
drops expired invitations, and the accept/decline compare-and-set
also requires an unexpired invitation. Responding to an invitation
that is no longer pending now fails closed with 409 and its status
instead of answering 200. A new invitation to the same email replaces
an expired one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dezren39
dezren39 marked this pull request as ready for review November 18, 2026 11:40
@dezren39
dezren39 requested a review from a team as a code owner November 18, 2026 11:40
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T11:42:45.979517Z 3dc0d73 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit f72f822 into main Nov 18, 2026
@dezren39
dezren39 deleted the feat/ba-w01-l3-invites branch November 18, 2026 11:41
@dezren39 dezren39 added the app/bedside-and-away Package/app: bedside-and-away (pkgs/ or apps/ in this repo) label Nov 18, 2026 — with Claude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app/bedside-and-away Package/app: bedside-and-away (pkgs/ or apps/ in this repo)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BA-W01 L3: invitation lifecycle

2 participants