Skip to content

fix(permissions): keep board-access reads behind confirmed writes - #3330

Open
Chris0Jeky wants to merge 15 commits into
mainfrom
audit/3328-permission-read-ownership
Open

Chris0Jeky wants to merge 15 commits into
mainfrom
audit/3328-permission-read-ownership

Conversation

@Chris0Jeky

@Chris0Jeky Chris0Jeky commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Closes #3328. Related residual: #3352.

Summary

Makes board-access cache writes, messaging and loading explicitly owned by the initiating read/mutation and session lifetime:

  • one read owner exists per board; unrelated boards remain concurrent;
  • confirmed grant/update/revoke advances that board's mutation generation and retires older reads;
  • identity/auth/demo replacement clears cached access and retires operations;
  • same-user token rotation preserves settled board caches and suppresses old-token settlement;
  • active boards without any cache entry restart under the new token with the exact board ID;
  • an authoritative empty array is considered settled and is not retried;
  • grant/update/revoke mutations are never replayed;
  • stable-ID grant settlement remains deduplicated.

Server authorization remains authoritative. Same-entry mutation serialization remains in stacked PR #3335.

Test-first evidence

The original suite covers read-versus-grant/update/revoke races, reverse reads, independent loading, same-user relogin, stale mutation settlement and grant deduplication. Review-regression head 6bbf8d04139bef2dca91d290b910e1c07a8e76aa ran canonical Ubuntu/Windows frontend qualification; Ubuntu JUnit recorded 7,161 tests, exactly 2 failures, 0 errors, both loaded-cache preservation cases.

Issue #3352 added test-only head d28697ede737ec42ae3e696c7a7cedcb753de347, covering token rotation while a board has no cache entry and its first read is pending. A dependency-free actual-module runner changed from one getAccess call with loading false to two calls for the same board with old settlement suppressed and the fresh result installed.

Supplemental execution does not replace hosted qualification.

Current head and remaining gates

Exact final head: 72d71c8500f534c10e8bb70c025922f9381f0103

Keep draft until this exact head passes Smart CI, Extended and the complete Required CI matrix on Ubuntu and Windows, followed by repeat independent review. Stacked PR #3335 must then be reconciled to this corrected parent and requalified.

Green CI is qualification evidence, not merge authorization.

Copy link
Copy Markdown
Owner Author

Fresh source-backed verification for exact head c43a5ace7f403f773153cf91a7d62e312aab1b9c:

  • Actual production modules, unchanged uploaded-main source: 0/12 combined integration/permission ownership schedules passed.
  • Actual production modules, corrected source: 12/12 passed.
  • All five changed TypeScript production/test files transpile under TypeScript 5.8.3 with zero diagnostics.
  • Smart CI Self-Test 35597759420: success.
  • CI Extended 35597759705 and Required CI 35597759871: queued at this checkpoint.

The permissions cases cover read→revoke/update, reverse reads, independent-board loading, same-user logout/login, old-session mutation and stale failure. The canonical suite additionally covers grant. The test-only Required run was superseded/cancelled, so no hosted canonical-red claim is made.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-09-21T22:15:26.684706Z 63fb0f5 Manual request
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71a20bc8ad

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread frontend/taskdeck-web/src/store/permissionsStore.ts
@Chris0Jeky
Chris0Jeky marked this pull request as draft September 21, 2026 14:13
@Chris0Jeky
Chris0Jeky marked this pull request as ready for review September 21, 2026 18:53

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 72d71c8500

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

error.value = null
session.requireUserId('board access management')
const access = await boardAccessApi.grantAccess(boardId, dto)
if (!ownsSession(owner)) return access

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reconcile successful mutations after token rotation

When a same-user token refresh occurs while a grant is awaiting its response, this branch resolves the mutation successfully but discards its cache update and success receipt; BoardAccessView.handleGrant consequently clears and closes the form even though the newly granted entry remains absent. Update and revoke have the same behavior, and the token watcher only retries unresolved reads, so no automatic reconciliation occurs. Re-fetch the affected board under the replacement token after a stale mutation settles rather than silently returning its result.

Useful? React with 👍 / 👎.

@Chris0Jeky
Chris0Jeky force-pushed the audit/3328-permission-read-ownership branch 2 times, most recently from 1b69685 to 6f88600 Compare September 21, 2026 20:16
@Chris0Jeky

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact current head 6f88600 against base fb830ed. This is the one current-head review request after the main-base requalification. Focus on the PR's changed ownership and stale-settlement behavior, and report only merge-blocking correctness or security defects.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 6f88600047

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Chris0Jeky

Copy link
Copy Markdown
Owner Author

@codex review Please review the exact current head 9882632, including stale-mutation reconciliation after same-user token rotation and its regression test. Treat prior review threads as triaged; report only merge-blocking correctness or security defects at this exact head.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9882632580

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return
}

if (activeReadByBoard.has(boardId)) return

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reconcile after an in-flight post-rotation read

When a token rotates while a mutation is pending, the retired operation drops loading, allowing a new same-board refresh before the mutation commits. That GET can snapshot the pre-mutation access list yet remain active until the mutation response arrives; this early return then treats it as reconciliation, and the stale response becomes the final cache state with no follow-up read. Fresh evidence at exact head 988263258 is this new active-read short circuit; the regression test covers only the case with no active read. Await or supersede the active read and ensure a read started after mutation settlement reconciles the committed grant, update, or revoke.

Useful? React with 👍 / 👎.

@Chris0Jeky

Copy link
Copy Markdown
Owner Author

@codex review

@Chris0Jeky
Chris0Jeky force-pushed the audit/3328-permission-read-ownership branch from 3447837 to c9abfd0 Compare September 21, 2026 22:06
@Chris0Jeky

Copy link
Copy Markdown
Owner Author

@codex review

@Chris0Jeky

Copy link
Copy Markdown
Owner Author

@codex review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pending

Development

Successfully merging this pull request may close these issues.

Stale board-access reads can undo confirmed permission mutations

1 participant