Repository navigation
Make the board fast and honest, rebuild standup, and close every security hole - #88
Conversation
The team view ran a second query whose only consumer was the "hidden by filters" footer. It walked the cursor up to forty pages sequentially, so every filter change downloaded the whole team backlog: 27 requests and 1.98 MB against a 2,518 issue team, roughly nine seconds of continuous fetching at production latency. Every count on screen came from that one loaded page, so a board with 2,518 issues reported 100, and the assignee filter offered "9" for someone who had 267. Add getIssueSummary: one pass that returns the filtered total, the unfiltered scope total, per group totals and facet counts for every filterable property. The footer subtracts two integers, board badges read group totals, and the filter menu reads facets. Each board column now owns its cursor, so a column of 1,003 can be browsed to the end instead of pulling a shared page that mostly belongs to other columns. Drop organizationId, description, estimatePointId and stateEnteredAt from list rows: nothing renders them, and they cost 119 bytes on every issue. Fold the filter, group and display pipeline the team, standup and my issues views each rebuilt into one memoized useIssueViewModel. Two of the three ran it bare in the render body. Cross team views now merge states that share a name, so My Issues stops listing Triage once per team. Cold filtered board: 27 requests and 1.98 MB becomes 2 requests and 66 KB. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Standup was a saved view over every issue in the workspace with the ordinary filter and grouping controls bolted on. It had no date window, no per person structure and no notion of who was running the meeting, so it told you nothing a filtered issue list could not. Model the ceremony the team actually runs. A standup belongs to a team and a day, binds itself to the active sprint, and seats everyone from the team's rotation in a fixed order. A facilitator is chosen by rotating past the person who ran the last one. The facilitator walks the room one person at a time with the arrow keys, and each turn records attendance, notes, how long they spoke and any blockers raised. Absent people are skipped. Blockers outlive the meeting: they stay open against the team until somebody resolves them. Each speaker's panel is built for a shared screen: what they closed since yesterday, what they are working on today, what is up next, all queried per person rather than filtered out of whatever page happened to be loaded. Presenter mode widens the type for a video call. Four tables, a service with fifteen tests covering the walk, the skips, the rotation and the permissions, REST routes for every step, and a room that drives the whole thing from the keyboard. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Issues are visible per team: listIssues restricts a non admin to principal.teamIds. Attachments were only ever checked against the organization, on both the upload and the download path, so a guest, the lowest role that still holds issue:read, could read any file in the workspace including files on issues in teams they were never added to, and could attach files to those issues. Resolve an attachment's parent to the teams that own it: an issue carries its own team, a comment inherits its issue's team, a project uses its project_team rows. Apply the same membership rule the issue list uses. Docs stay organization scoped because they carry their own visibility and already gate on doc:read and the external share check. A project with no team rows stays workspace wide, which is what an unassigned project means today. Also add db:test-setup. CI creates six per package test databases that nothing created locally, so bun run verify failed on a clean checkout with connection errors rather than test failures. Gitignore .vercel, which vercel link writes and which fails the formatter on sight. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…bounce Every filter toggle went through router.replace(), so changing one checkbox was an App Router navigation that re-ran the route before the new state could paint. The URL is the right home for a view so it stays shareable, but it is the wrong thing to block an interaction on. Hold the change in local state, paint from it immediately, and push the URL 300ms later. A burst of toggles collapses into one navigation. If the browser navigates during the debounce, the pending push is cancelled and the URL wins, so back and forward still behave. Applying a second assignee filter to a 2,518 issue team now paints in 86ms, inside the 100ms budget. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Per column pagination gave the board seven issue queries where it used to have one, and the optimistic cache helpers were written when there was only ever a single list per team. patchIssueLists matched every key under ['issues'] and appended blindly, so a newly created issue appeared in Triage, Backlog, Todo, In Progress, In Review, Done and Canceled at once. The realtime path had the same hole: membershipOf only compared the team segment of the query key and ignored the search that follows it. Teach both paths the scope a list was fetched with. belongsInList reads teamId, stateId, assigneeId, projectId and cycleId back out of the query key's search string and decides whether an issue belongs. Writes now reconcile rather than append: an issue that no longer matches a list is removed from it and added to the one it moved into, which is what dragging a card between columns has always meant. Caught by the Playwright suite, which is why it exists. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…g one Two defects in the debounced URL sync, both found by review rather than by the suite, and the suite was certifying one of them. The reconciliation effect compared the arriving URL against the newest queued edit, so the arrival of write N cancelled the timer for write N+1: change a filter, and if a previous write was still in flight the new one silently reverted. Compare against what the URL was last asked to hold instead, so a URL we wrote is recognised as catching up and a URL we did not write is recognised as a real navigation. The unmount cleanup cleared the timer without writing, so applying a filter and leaving within 300ms lost it. Reloading, closing the tab or clicking a sidebar link all landed somewhere with the old filters and the URL you meant to share never existed. Flush on unmount and on pagehide, guarded on the pathname so leaving a page never rewrites the one you arrived at. Write through history.replaceState rather than router.replace: the point of the debounce was to stop paying for a navigation, and replaceState also makes flushing safe from a teardown. Refuse db:test-setup against a non local server. It creates six databases and pushes 71 tables into each, and README presents it as a first run step, so a developer whose DATABASE_URL points at Supabase would have done that to production. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…member listIssues restricts a non admin to principal.teamIds, but every one of the twenty three catch-up loaders filtered on organizationId alone. A single GET /api/sync?since=0 returned every issue row in the workspace, titles and descriptions included, to any authenticated member, including a guest on no teams. Comments, attachments with their storage keys, and pending invitations with invitee emails and target roles came with it. Filter the assembled actions by the scopes they already carry: an action that names any team is only visible to someone in one of those teams, and an admin still sees everything. Then give the models that carried no team scope one, so the filter can actually see them: a project inherits its project_team rows, a milestone inherits its project's, an issue relation inherits its issue's, and an attachment inherits the team of the issue, comment or project it hangs off. Invitations now require member:invite. Four tests cover it, including the one that matters: a member of one team asks for catch-up from zero and another team's issue title does not appear anywhere in the payload. This closes the catch-up half. The socket half is still open: the client subscribes to org: (delta-bridge.tsx:200), authorizeScope grants org: to any member (auth.ts:195), and issueScopes stamps org: on every issue, so live deltas still cross team boundaries. That is the next commit. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… member The client subscribes to org: and its own team scopes (delta-bridge.tsx:200), authorizeScope grants org: to any member of the organization (auth.ts:195), and issueScopes stamped org: on every issue. Together that meant every issue title, description and comment body in the workspace streamed live to every member, including a guest on no teams, no matter which teams they belonged to. The org scope is for genuinely organization wide models: the organization itself, members, invitations, teams, labels and saved views. Team owned models now fan out on their team and their own entity scope and nothing else: issues, comments, issue relations, cycles, workflow states and standups. A member subscribed to org: keeps receiving the workspace level models and stops receiving other teams' work. Two supporting changes so nobody loses access they should have. An admin may now hold any team scope in their organization, because listTeams already returns every team to an admin and the sidebar subscribes to what it lists. A project scope now requires membership of one of the project's teams rather than merely the organization, matching the attachment rule. Covered by a test that subscribes to the organization scope alone and asserts a team issue never arrives. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…teams Docs had three visibilities, workspace, link and public, and doc:read is a guest permission, so every member could read every doc. The sidebar grouped unfiled docs under a heading literally named Private while the service layer did nothing to make them private. Add private and team visibility and a doc_access table granting a doc to named users or whole teams. A doc is readable when it is workspace, link or public, or you wrote it, or somebody granted it to you or to a team you are on. Admins keep full reach. Existing rows default to workspace, so nothing that was readable stops being readable. listDocs filters in SQL rather than after the fact, so a private doc never reaches the list. Separately, cycles. cycle:manage is a member permission and updateCycle and deleteCycle never checked the team, so any member could rename, re-date or destroy another team's sprint while the read path refused them the same sprint. Both now assert team membership, matching completeCycle. An issue could also be written into another team's or another organization's cycle: collectIssueChanges applied cycleId with no validation at all, unlike stateId which has been guarded since the beginning. createIssue and updateIssue now reject a cycle, project or milestone that belongs somewhere else. Cycle analytics were org wide, so a guest could pull any team's burndown, churn and flow metrics, and teamVelocity took a raw team id and never checked it. Both are team scoped now. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe change adds standup workflows, server-backed issue summaries, centralized issue views, team-scoped authorization, document access grants, realtime filtering, attachment checks, isolated test database setup, and related UI and documentation updates. ChangesStandup workflow
Issue summaries and views
Team-scoped authorization
Platform setup
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 502acadd8e
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 17
Note
Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.
🟡 Minor comments (15)
packages/db/src/ensure-test-databases.ts-14-20 (1)
14-20: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winParse environment input with a Zod schema.
DATABASE_URLandORBIT_ALLOW_REMOTE_TEST_SETUPcome fromprocess.envand are read directly as strings. Parse both values with Zod before the local-server check, then keep the URL/host checks as semantic validation. This keeps external startup input covered by the project’s Zod validation practice.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/db/src/ensure-test-databases.ts` around lines 14 - 20, Create a Zod schema to parse and validate the DATABASE_URL and ORBIT_ALLOW_REMOTE_TEST_SETUP environment variables before passing them to assertLocalServer. Define the schema above the LOCAL_HOSTS constant to cover external startup input, parse process.env using the schema (preserving the existing fallback for DATABASE_URL), and then pass the validated parsed values into the function. Keep the existing URL/host checks in assertLocalServer as semantic validation of the parsed data rather than part of the schema itself.Source: Coding guidelines
apps/web/src/lib/realtime/url.test.ts-36-40 (1)
36-40: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winRestore an absent
NODE_ENVwithdeleteAssigning
savedMode === undefinedtoprocess.env['NODE_ENV']stores the string"undefined", so the following mode-dependent tests can see production behavior instead. Delete the key whensavedModeisundefined.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/lib/realtime/url.test.ts` around lines 36 - 40, Update the afterEach cleanup around savedMode to delete process.env['NODE_ENV'] when savedMode is undefined; otherwise restore the saved value unchanged, ensuring subsequent mode-dependent tests do not receive the string "undefined".packages/core/src/content/doc-service.ts-773-773 (1)
773-773: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winUse a sortable ID for the new grant row.
Line 773 calls
newId(), which resolves torandomUUID(). UserandomUUIDv7()from@orbit/shared/utilsfor this new primary key.As per coding guidelines, use
randomUUIDv7()from@orbit/shared/utilsfor sortable IDs.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/content/doc-service.ts` at line 773, Update the new grant row’s primary-key generation at the newId() call to use randomUUIDv7() from `@orbit/shared/utils` instead, ensuring the required sortable ID is created.Source: Coding guidelines
packages/core/src/work/standup-service.ts-565-592 (1)
565-592: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winPublish a sync action for a rotation change.
setRotationreplaces every rotation row for the team and returns without emitting aSyncAction. Every other mutation in this file returns actions throughsaveStandup. Thestandup_rotationtable also carries asyncIdcolumn, which shows the intent to synchronize these rows. Clients on theteam:<teamId>scope therefore keep a stale speaking order and a stale facilitator list until a manual refetch.Return actions from
setRotationand publish them inapps/web/src/app/api/standups/rotation/route.ts.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/work/standup-service.ts` around lines 565 - 592, Update setRotation to return the rotation mutation’s sync actions alongside the affected rows, using the existing saveStandup synchronization pattern and preserving the empty-members behavior. Then update the rotation route handler in apps/web/src/app/api/standups/rotation/route.ts to publish those returned actions for the team:<teamId> scope.packages/core/src/work/standup-service.ts-58-60 (1)
58-60: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winUse the team timezone when deriving
held_on.
toISOString().slice(0, 10)produces the UTC date, butteams.timezoneexists in the schema and can default the ceremony to the next day for teams west of UTC. Pass the team timezone intotoday()forheldOn, or derive the team day relative to that value before matchingteams.timezone.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/work/standup-service.ts` around lines 58 - 60, Update today() and its heldOn call site to derive the date using the team’s teams.timezone rather than UTC, passing the timezone through or calculating the team-local day before matching the timezone. Preserve the existing date format while ensuring ceremonies west of UTC are assigned to the correct team day.packages/shared/src/events/sync.ts-27-27 (1)
27-27: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winAdd the team filter to the
standupcatch-up query.
standupis registered underSYNC_CATCHUP_MODELS, but catch-up filters rows only org-wide and then later drops out-of-scope rows. Addeq(schema.standup.teamId, <request team id>)to thestanduploader so backfill does not load team-scoped rows by catch-up limit and skip them instead.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/shared/src/events/sync.ts` at line 27, Update the standup loader in SYNC_CATCHUP_MODELS to include an eq filter on schema.standup.teamId using the request team ID, alongside the existing organization filter. Ensure catch-up queries only fetch rows for the requested team before applying limits and scope filtering.packages/core/src/work/standup-service.ts-39-56 (1)
39-56: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winDo not hardcode the standup system actor.
standupActionusesactor: { type: 'system', id: 'standup' }for every sync action, including user-initiated mutations such asupdateTurnandaddBlocker. Update the applicable call sites to pass thePrincipaland build a user actor so activity attribution and optimistic client echoes use the true actor.♻️ Proposed change
function standupAction( row: StandupRow, + principal: Principal, syncId: number, action: 'insert' | 'update' | 'delete', data: Record<string, unknown>, model: SyncModel = 'standup', ): SyncAction { return buildSyncAction({ syncId, organizationId: row.organizationId, scopes: standupScopes(row), action, model, modelId: row.id, data, - actor: { type: 'system', id: 'standup' }, + actor: { type: 'user', id: principal.userId }, }); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/work/standup-service.ts` around lines 39 - 56, Update standupAction and its user-initiated call sites, including updateTurn and addBlocker, to accept a Principal and construct the sync action actor from that principal instead of the hardcoded standup system actor; preserve the system actor only for genuinely system-triggered mutations.packages/core/src/work/standup-service.ts-322-336 (1)
322-336: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winSet
spokeAtwhen the first turn starts speaking.The update at Line 326 sets
status: 'speaking'withoutspokeAt.closeSpeakingTurnreturnsnullfordurationSecondswhenspeaking.spokeAt === nullat Line 349. The first speaker therefore never records a duration, while every later speaker does, becauseadvanceStandupsetsspokeAtat Line 401.🐛 Proposed fix
return await db.transaction(async (tx) => { const turns = await turnsOf(tx, standupId); const first = turns.find((turn) => turn.attendance !== 'absent') ?? turns[0]; + const now = new Date(); if (first !== undefined) { await tx .update(schema.standupTurn) - .set({ status: 'speaking', updatedAt: new Date() }) + .set({ status: 'speaking', spokeAt: now, updatedAt: now }) .where(eq(schema.standupTurn.id, first.id)); } return await saveStandup(tx, principal, standupId, { status: 'running', - startedAt: current.startedAt ?? new Date(), + startedAt: current.startedAt ?? now, currentTurnId: first?.id ?? null, }); });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/work/standup-service.ts` around lines 322 - 336, In the transaction where the first turn's status is set to 'speaking', add `spokeAt: new Date()` to the `.set()` call alongside the existing `status: 'speaking'` and `updatedAt: new Date()` properties. This ensures the first speaker records a duration through the `closeSpeakingTurn` path, matching the behavior established by `advanceStandup` for subsequent speakers.packages/core/src/work/standup-service.test.ts-54-59 (1)
54-59: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAssert the standup cycle id instead of a type tautology.
detail.standup.cycleId === null || typeof detail.standup.cycleId === 'string'is always true. This case should set up an active cycle withcreateCycle(workspace.admin, { teamId: workspace.teamId, ...dates })and assertdetail.standup.cycleIdequals that cycle id.💚 Proposed fix
it('binds the standup to the active sprint when one is running', async () => { + const cycle = await createCycle(workspace.admin, { teamId: workspace.teamId, startsAt: today(), endsOn: today() }); const { detail } = await openStandup(workspace.admin, { teamId: workspace.teamId }); - expect(detail.standup.cycleId === null || typeof detail.standup.cycleId === 'string').toBe( - true, - ); + expect(detail.standup.cycleId).toBe(cycle.id); });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/work/standup-service.test.ts` around lines 54 - 59, The assertion in the test labeled 'binds the standup to the active sprint when one is running' uses a tautology that is always true. Before calling openStandup, create an active cycle using createCycle with workspace.admin and teamId, capturing the cycle id. Then replace the assertion that checks `detail.standup.cycleId === null || typeof detail.standup.cycleId === 'string'` with an assertion that validates detail.standup.cycleId equals the cycle id returned from createCycle.apps/web/src/lib/query/use-standup.ts-88-98 (1)
88-98: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winOnly mark turns done when advancing forward.
advanceStandupalways closescurrent.turnIdbefore moving, somarkDone: trueforpreviousflags the person the facilitator is moving away from as complete. SendmarkDoneonly fornextdirection.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/lib/query/use-standup.ts` around lines 88 - 98, Update useAdvanceStandup so the request body sets markDone based on direction: enable it only when direction is 'next' and disable it for 'previous'. Preserve the existing advance endpoint and direction behavior.apps/web/src/components/command-palette.tsx-28-28 (1)
28-28: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winInclude
Standupin bothSECTION_ORDERand the keyboard shortcuts overlay display.
Standupis a validHotkeySection, but it is not inSECTION_ORDER, so the palette and shortcut dialog omit the section even thoughStandupRoomregisterssection: 'Standup'hotkeys.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/components/command-palette.tsx` at line 28, Update the command palette’s SECTION_ORDER to include Standup and add the same section to the keyboard shortcuts overlay display, ensuring StandupRoom hotkeys registered under the Standup HotkeySection appear in both locations.apps/web/src/features/standup/turn-panel.tsx-203-229 (1)
203-229: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winGive the blocker input and the notes textarea accessible names.
Both controls rely on a placeholder or a nearby heading. Neither provides a programmatic accessible name, so screen readers announce an unlabeled text field. Add
aria-labelto each control, or associate the existing headings withidandaria-labelledby.♿ Proposed fix
<input value={blocker} onChange={(event) => setBlocker(event.target.value)} placeholder="What is in the way?" + aria-label="Blocker summary" data-testid="blocker-input"<textarea value={notes} onChange={(event) => setNotes(event.target.value)} + aria-label="Turn notes" onBlur={() => {As per coding guidelines: "Ensure keyboard operability, visible focus rings, and real semantics using Radix primitives."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/features/standup/turn-panel.tsx` around lines 203 - 229, Add programmatic accessible names to the blocker input and notes textarea in the turn panel: give the blocker input an aria-label describing the blocker field and the notes textarea an aria-label describing the notes field, while preserving their existing visible placeholders and behavior.Source: Coding guidelines
apps/web/src/features/standup/roster.tsx-24-32 (1)
24-32: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winAdd
role="img"to the labeled Lucide icons.These icons are rendered as
<svg>elements, so they need an explicitimgrole to reliably expose thearia-labelacross assistive technology. Use the same pattern as the speaking indicator.♿ Proposed fix
if (turn.attendance === 'absent') { - return <UserMinus className="size-3.5 text-faint" aria-label="Absent" />; + return <UserMinus className="size-3.5 text-faint" role="img" aria-label="Absent" />; } if (turn.status === 'done') { - return <CircleCheck className="size-3.5 text-success" aria-label="Spoken" />; + return <CircleCheck className="size-3.5 text-success" role="img" aria-label="Spoken" />; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/features/standup/roster.tsx` around lines 24 - 32, Add role="img" to the UserMinus and CircleCheck icon elements in the attendance/status rendering alongside their existing aria-label attributes, matching the role pattern already used by the speaking indicator.Source: Coding guidelines
apps/web/src/features/issues/my-issues-view.tsx-55-65 (1)
55-65: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winDo not request the summary before
workspace.userIdresolves.When
workspace.userIdis null,scopeis{}andscopeToTeamis false, so the summary request carries neitherassigneeIdnorteamId. The service then counts every issue the principal can read, and the My issues header shows a workspace-wide total untiluserIdresolves. The request is also wasted.Gate the model on a resolved user id, for example by passing the enabled condition through
useIssueViewModel.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/features/issues/my-issues-view.tsx` around lines 55 - 65, Update the My issues view’s useIssueViewModel call so summary fetching is disabled while workspace.userId is null, and enabled only after the user ID resolves. Pass the enabled condition through the model’s existing configuration mechanism, preserving the current assignee scope once the ID is available.packages/core/src/realtime/backfill.ts-460-483 (1)
460-483: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winEmit parent-specific attachment scopes.
teamsByAttachmentParentsupportscommentandprojectparents, but the attachment loader maps both toscopes.issue(row.parentId). A comment attachment hasparentType: 'comment'withparentIdset to the comment ID, and the helper resolves it viaschema.comment.issueId; a project attachment would need a project scope becauseparentIdis the project ID. Emit the matching parent scope for comment and project parents, and add assertions for unsupported attachment parent types.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/realtime/backfill.ts` around lines 460 - 483, Update the attachment scope mapping in the attachment loader to branch on each supported parentType: keep document scopes, use the resolved issue scope for comment parents, and use a project scope for project parents while retaining team scopes where applicable. Add assertions for unsupported attachment parent types, using the existing teamsByAttachmentParent results and scope helpers.
🧹 Nitpick comments (14)
packages/core/src/content/doc-service.test.ts (1)
441-457: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExercise the
teamvisibility value.This test grants a team access to a document with
visibility: 'private'. It does not execute the newteamrestriction path. Usevisibility: 'team'here and assertgetDocandlistDocsdeny access before the grant and allow access after it.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/content/doc-service.test.ts` around lines 441 - 457, Update the test “shares with a whole team when the grant names one” to create the document with visibility set to team, assert both getDoc and listDocs deny access before setDocAccess, and assert both allow the team member access after granting the team read permission.packages/core/src/work/standup-service.ts (1)
292-311: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winApply the finished-standup guard to
updateStandup.
startStanduprejects a standup withstatus === 'finished'at Line 320.updateStandupaccepts any value inSTANDUP_STATUSESand can move a finished standup back torunning, which bypasses that rule and leavesendedAtset while the ceremony runs again. Repeatingstatus: 'finished'also overwritesendedAteach time.Reject a transition out of
finished, and setendedAtonly on the first transition into it.♻️ Proposed change
const values: Partial<typeof schema.standup.$inferInsert> = {}; if (parsed.facilitatorId !== undefined) values.facilitatorId = parsed.facilitatorId; if (parsed.status !== undefined) { + if (current.status === 'finished' && parsed.status !== 'finished') { + throw conflict('That standup has already finished.'); + } values.status = parsed.status; if (parsed.status === 'running' && current.startedAt === null) values.startedAt = new Date(); - if (parsed.status === 'finished') values.endedAt = new Date(); + if (parsed.status === 'finished' && current.endedAt === null) values.endedAt = new Date(); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/work/standup-service.ts` around lines 292 - 311, Update updateStandup to reject any status change when current.status is already 'finished', preventing transitions back to 'running'. Only assign endedAt when parsed.status is 'finished' and current.status is not already 'finished'; preserve existing status and start-time behavior for other updates.packages/core/src/index.ts (1)
26-26: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider narrowing the generic
todayexport.
standup-service.tsexportstoday(). This barrel re-exports it as a package-level symbol. The name is generic for a package public API and can collide with a future date helper in another module. Consider renaming it tostandupDay()or keeping it internal and exporting a date helper from a shared date module.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/index.ts` at line 26, Update the package barrel around the today export so the generic today() symbol is not exposed as a package-level API; either rename the standup-specific function to standupDay() and export that name consistently, or keep today() internal and expose a shared date helper instead.packages/core/src/work/standup-service.test.ts (1)
152-208: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd negative coverage for the authorization gaps.
The suite covers the happy paths and two role checks. Three gaps flagged in
standup-service.tshave no test. Add cases for each after you fix them.
- Open a standup with a
participantIdsentry that is not a member of the team, and assert the roster excludes it.- Resolve a blocker that belongs to another team's standup, and assert the call rejects.
- Start a standup, then advance once, and assert the first turn records a non-null
durationSeconds.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/work/standup-service.test.ts` around lines 152 - 208, The standup service lacks negative and behavioral coverage for three authorization/data-integrity gaps. Extend the tests around openStandup, resolveBlocker, and standup advancement to verify non-members are excluded from participantIds, resolving a blocker from another team rejects, and the first turn gets a non-null durationSeconds after one advance; add the corresponding service fixes in standup-service.ts.apps/web/src/features/standup/turn-panel.tsx (1)
62-69: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value
nowinvalidates thefinishedmemo on every render.
Date.now()returns a new value on each render, souseMemonever reuses thefinishedresult. Move the timestamp inside the memo so the dependency list is stable.♻️ Proposed refactor
- const now = Date.now(); const owned = useTeamMemberIssues(teamId, turn.userId); const mine = useMemo(() => owned.data ?? [], [owned.data]); const finished = useMemo( - () => mine.filter((issue) => isRecent(issue.completedAt, now)), - [mine, now], + () => { + const now = Date.now(); + return mine.filter((issue) => isRecent(issue.completedAt, now)); + }, + [mine], );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/features/standup/turn-panel.tsx` around lines 62 - 69, Update the finished useMemo in the turn panel to compute the current timestamp inside its callback rather than storing Date.now() in the render scope. Remove now from the dependency list, retaining mine as the dependency so the memo remains reusable between issue-data changes.apps/web/src/lib/query/schemas.ts (1)
195-245: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDerive the facet shape from
FACET_PROPERTIESto remove the triplicated key list.The nine facet keys appear three times: in
FACET_PROPERTIES, in thefacetsobject schema, and inemptyFacets(). A new facet requires three synchronized edits, and a missed edit produces silently absent counts. Build the object shape and the empty map from the single constant.♻️ Proposed refactor
-export const issueSummarySchema = z.object({ - total: z.number(), - scopeTotal: z.number(), - byState: z.record(z.string(), z.number()).catch({}).default({}), - groupTotals: z.record(z.string(), z.number()).catch({}).default({}), - facets: z - .object({ - state: facetCounts, - assignee: facetCounts, - creator: facetCounts, - priority: facetCounts, - estimate: facetCounts, - label: facetCounts, - project: facetCounts, - cycle: facetCounts, - milestone: facetCounts, - }) - .catch(() => emptyFacets()), -}) +const facetShape = Object.fromEntries( + FACET_PROPERTIES.map((property) => [property, facetCounts]), +) as Record<FacetProperty, typeof facetCounts>; + +export const issueSummarySchema = z.object({ + total: z.number(), + scopeTotal: z.number(), + byState: z.record(z.string(), z.number()).catch({}).default({}), + groupTotals: z.record(z.string(), z.number()).catch({}).default({}), + facets: z.object(facetShape).catch(() => emptyFacets()), +});🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/lib/query/schemas.ts` around lines 195 - 245, Derive both the `issueSummarySchema` facets shape and `emptyFacets()` result from `FACET_PROPERTIES` instead of repeating the nine keys manually. Reuse the existing `facetCounts` schema for each generated property and ensure every constant entry receives an empty object, so adding a facet only requires updating `FACET_PROPERTIES`.apps/web/src/features/standup/roster.tsx (1)
57-67: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winStandup components write raw hover and transition classes instead of the shared interaction helpers. Both new components duplicate
transition-colors duration-[var(--duration-fast)] ease-[var(--ease-standard)] motion-reduce:transition-nonetogether with ahover:*color class. The shared helpers inapps/web/src/lib/interaction.tsalready encode this behavior, so the duplication can drift from the design tokens. Each site also conveys the selected item through color alone.
apps/web/src/features/standup/roster.tsx#L57-L67: replace the transition andhover:bg-surface-2classes withrowHover, and addaria-currentto the active roster row.apps/web/src/features/standup/standup-page.tsx#L36-L49: replace the transition andhover:text-mutedclasses withtabHover, and addaria-currentto the selected team button.Based on learnings: prefer the shared hover and focus transition helpers from
apps/web/src/lib/interaction.tsinstead of raw Tailwindtransition-colorsorhover:*classes, and usetabHoverfor tab-like controls.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/features/standup/roster.tsx` around lines 57 - 67, Replace the roster button’s raw transition and hover classes with the shared rowHover helper, and add aria-current to the active row. In apps/web/src/features/standup/standup-page.tsx lines 36-49, replace the equivalent transition and hover classes with tabHover and add aria-current to the selected team button.Source: Learnings
packages/core/src/work/issue-service.ts (2)
1241-1250: 🚀 Performance & Scalability | 🔵 TrivialPlan for the aggregate fan-out of
getIssueSummary.Each call runs about 13 aggregate queries over
issue: matched state counts, the scope total, the selected group total, and nine scope facets, withlabelFacetadding a second query. The nine scope facets do not depend on the active filter, so they repeat on every filter change while the query key changes.Two follow-ups are worth planning:
- Add composite indexes that support the scope predicate plus each grouped column, for example
(organization_id, team_id, archived_at, state_id)and the equivalent forassignee_id,project_id, andcycle_id.- Cache or separately key the scope-wide facets so filter edits refetch only the matched counts and the selected group totals.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/work/issue-service.ts` around lines 1241 - 1250, Plan performance improvements around getIssueSummary: add composite indexes covering the scope predicate with each grouped column (stateId, assigneeId, projectId, and cycleId), and separate or cache the scope-wide FACET_PROPERTIES results so filter changes refetch only matched counts and selected group totals.
601-601: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winHoist the assignment validation out of the per-issue loop.
valuesfor every issue derive from one parsed patch, socycleId,projectId, andmilestoneIdare identical across the loop.assertAssignableToTeamruns up to three extra queries per issue. A bulk update of many issues multiplies those queries without adding coverage.Validate once per distinct
teamIdand reuse the result.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/work/issue-service.ts` at line 601, Update the issue update flow around assertAssignableToTeam so assignment validation is performed once per distinct teamId rather than inside the per-issue loop. Reuse the parsed patch values for cycleId, projectId, and milestoneId, cache each team’s validation result, and invoke assertAssignableToTeam only when a team has not yet been validated.apps/web/src/app/api/issues/summary/route.ts (1)
7-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReuse the core facet list instead of redeclaring it.
FACET_GROUPSduplicatesFACET_PROPERTIES, whichpackages/core/src/work/issue-service.tsalready exports. The core service also defines its owngroupBydefault. Two copies of the same allowlist can drift when a facet is added or removed.Import
FACET_PROPERTIESfrom@orbit/core, or export the summary query schema from the service and use it here.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/app/api/issues/summary/route.ts` around lines 7 - 24, Replace the locally declared FACET_GROUPS allowlist in summaryQuerySchema with the exported FACET_PROPERTIES from `@orbit/core`, and retain the existing fallback to 'state'. Remove the duplicate set so facet membership and grouping defaults remain governed by the core issue service.apps/web/src/features/filters/filter-menu.tsx (1)
185-194: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winHoist
countValuesabove the option loop.
countValuesallocates a newMapfrom the whole facet record on each call. Here it runs once per option, so a field with N options and a facet of M entries costs O(N*M) per render.FieldPickerre-renders on every keystroke in the search input, andValuePickerat line 232 already computes the map once.Compute the map once per definition.
♻️ Proposed refactor for the option loop
- ? fields.map((definition) => ( + ? fields.map((definition) => { + const counts = countValues(definition, facets); + return ( <Command.Group key={definition.property} heading={definition.label} className={groupClassName} > {definition.options.map((option) => ( <Command.Item key={`${definition.property}-${option.value}`} value={`value ${definition.label} ${option.label} ${option.value}`} className={itemClassName} onSelect={() => onPickValue(definition.property, option.value)} > {option.icon} <span className="flex-1 truncate">{option.label}</span> - <ValueCount count={countValues(definition, facets).get(option.value)} /> + <ValueCount count={counts.get(option.value)} /> <Selected on={selectedValues(filter, definition.property).includes(option.value)} /> </Command.Item> ))} </Command.Group> - )) + ); + }) : null}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/features/filters/filter-menu.tsx` around lines 185 - 194, In the option-rendering path of FieldPicker, compute countValues(definition, facets) once before definition.options.map and reuse the resulting Map for every ValueCount. Remove the per-option countValues call while preserving each option’s existing count lookup and rendering behavior.apps/web/src/lib/query/issue-search.ts (1)
43-54: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueDrop
limitandorderByfrom the summary search string.
summarySearchreusessearchParams, so every summary URL carrieslimitandorderBy. Neither value changes an aggregate count, but both are part of the search string that keys the summary query. A sort-order change then refetches an identical summary.Build the summary parameters from the filter alone.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/lib/query/issue-search.ts` around lines 43 - 54, Update summarySearch to build its parameters from filter-only values instead of reusing searchParams, excluding limit and orderBy while preserving teamId, scope, and groupBy handling. Ensure the returned summary query string is unchanged by pagination or sort-order settings.packages/core/src/realtime/backfill.test.ts (1)
198-229: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert denied resource identifiers, not only titles.
The text checks pass if a future redaction removes the title but still returns an unauthorized action or team record. The first test does not assert that
outsider.team.idis absent. Keep the issue references and assert that no action has either deniedmodelId. Store the guest issue result and assert that itsmodelIdis absent too.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/realtime/backfill.test.ts` around lines 198 - 229, Strengthen the access-control assertions in the affected realtime backfill tests: in the first test, assert that neither the denied issue nor outsider team identifiers appears in any action modelId while preserving the existing issue references; in the guest test, store the created issue and catch-up result, then assert its modelId is absent instead of checking only serialized titles.apps/realtime/src/server.test.ts (1)
386-392: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the emitted issue scope set in this fan-out test.
The fixture omits
scopes.organization(orgA). The catch-up issue action includes organization, team, and issue scopes. If live fan-out accepts any matching scope, this test has no matching scope and cannot detect an organization-only leak. Verify the live issue-action contract, then publish that same scope set here.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/realtime/src/server.test.ts` around lines 386 - 392, Update the fan-out test’s syncAction published at syncId 9100 to use the complete emitted issue scope set, including scopes.organization(orgA) alongside the existing team and issue scopes. Match the live issue-action contract so the test can detect organization-only leakage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/web/src/app/api/files/`[...key]/route.ts:
- Line 24: Validate and parse context.params.key with a Zod schema requiring a
string array before constructing storageKey or performing the
assertAttachmentVisible/query lookup. Reject invalid route segments through the
route’s existing validation response path, and export the schema from
`@orbit/shared` validators only if it is reused; otherwise define it locally in
the route.
- Line 24: Update the download redirect flow after assertAttachmentVisible in
the route handler to send Cache-Control: no-store on the signed 302 response.
Ensure authorization-dependent redirects are never browser-cached, while
preserving the existing visibility check and redirect behavior.
In `@apps/web/src/app/api/standups/blockers/`[blockerId]/route.ts:
- Around line 11-15: Update resolveBlocker to include standupTurn.standupId =
standupId in the blocker update predicate while retaining the existing
organizationId condition, so the blocker must belong to the selected standup.
In `@apps/web/src/app/api/standups/route.ts`:
- Around line 24-26: Restore Zod boundary validation across all listed standup
routes: in apps/web/src/app/api/standups/route.ts lines 24-26, parse the
open-standup body inside handle before openStandup; in lines 6-19, parse
branch-specific query input before lookup, workload, or list services; in
apps/web/src/app/api/standups/[id]/route.ts lines 8-18, parse id for both
methods and the PATCH body; in apps/web/src/app/api/standups/[id]/start/route.ts
lines 8-11, parse the standup parameter; in
apps/web/src/app/api/standups/[id]/advance/route.ts lines 8-12, parse the
standup parameter and transition body; in
apps/web/src/app/api/standups/[id]/focus/route.ts lines 8-12, parse the standup
parameter and focus body; in
apps/web/src/app/api/standups/[id]/turns/[turnId]/route.ts lines 8-12, parse
both parameters and the turn body; in
apps/web/src/app/api/standups/[id]/turns/[turnId]/blockers/route.ts lines 8-12,
parse both parameters and blocker body; in
apps/web/src/app/api/standups/blockers/[blockerId]/route.ts lines 9-15, parse
blockerId, standupId, and body; and in
apps/web/src/app/api/standups/rotation/route.ts lines 5-15, parse GET query and
PUT body, using shared Zod schemas from `@orbit/shared` before service calls while
retaining service validation for non-HTTP callers.
In `@apps/web/src/features/filters/grouping.ts`:
- Around line 228-229: Update the empty-group condition in the grouping logic to
return an empty result only when both the server total and loaded rows indicate
no issues: preserve a group whenever rows.length is greater than zero, even if
options.totals[definition.id] is zero. Keep the existing showEmptyGroups
behavior for groups with neither a server total nor loaded rows.
In `@apps/web/src/features/issues/board.tsx`:
- Around line 304-313: Synchronize board interaction state with column-owned
issues: when columnSource is defined, ensure the collection used to derive
activeIssue, peekIssue, and planDrop includes owned.data rather than only
groups. Update the relevant board-level data flow around useColumnIssues and the
peek/drop handlers, preserving group-backed behavior when no column is selected,
and add a regression test covering an issue loaded only by its column.
In `@apps/web/src/features/standup/standup-room.tsx`:
- Around line 110-116: Add a guard in the move callback to prevent concurrent
advance mutations by checking advance.isPending before calling advance.mutate,
similar to the existing running check. Update the useCallback dependency array
to include advance.isPending. Additionally, pass the disabled prop set to
advance.isPending when rendering the RoomControls component that receives the
onNext and onPrevious callbacks, matching the pattern used for start.isPending
and open.isPending guards on sibling controls.
In `@apps/web/src/features/standup/turn-panel.tsx`:
- Around line 54-60: Update the useEffect that resets notes and blocker to
depend on turn.id as well as turn.notes, so local drafts reset whenever the
facilitator switches turns even when note text is unchanged. Keep the existing
setNotes(turn.notes) and setBlocker('') behavior.
In `@apps/web/src/lib/query/sync.test.ts`:
- Around line 389-417: Add membership tests in the belongsInList suite for a
filter outside SCOPED_PARAMS and for a compound filter that includes team or
state scope. Verify issues matching the team/state still belong when the active
server filter also matches, and reject issues that fail that filter; keep the
existing direct-scope cases unchanged.
In `@apps/web/src/lib/query/sync.ts`:
- Around line 54-70: Update belongsInList and its filter metadata to evaluate
every supported active query filter, not only the five SCOPED_PARAMS fields. For
any filter condition the client cannot compare exactly, return a result that
causes the cached query to be invalidated rather than locally reconciled;
preserve matching behavior only when all active filters are verified.
In `@apps/web/src/lib/query/use-issues.ts`:
- Around line 227-270: Update reconcile and placeIssues to order cached issues
using the comparator derived from each query’s search, rather than sortIssues’s
manual-only ordering; re-sort after replacing an existing issue so changed
ordering fields take effect. For non-manual queries where an exact client-side
comparator is unavailable, invalidate the query instead of patching its cached
ordering.
- Line 376: Invalidate the cached issue-summary queries after each confirmed
local mutation: in apps/web/src/lib/query/use-issues.ts at lines 376-376 after
placeIssues applies moved and rebalanced issues, at lines 331-331 after the
confirmed update, and at lines 417-417 after the confirmed create. Reuse the
existing query-client invalidation pattern and preserve the current issue-page
reconciliation behavior.
In `@packages/core/src/realtime/backfill.ts`:
- Line 659: Update the backfill loading flow around visibleToPrincipal so
inaccessible rows are excluded before applying the per-model limit, or continue
loading until the visible page is filled; ensure hidden rows do not cause
truncated progress to stall and later visible rows are returned. Add a
regression covering an inaccessible earlier row followed by an accessible row
with limit 1.
In `@packages/core/src/work/issue-service.ts`:
- Around line 450-463: Update the milestone validation branch around requireRow
to resolve found.projectId and apply the same project-team membership check used
by the direct projectId validation before assignment. Preserve the existing
organization ownership check, and reject milestones whose project is not
associated with the issue’s team through projectTeam.
In `@packages/core/src/work/standup-service.ts`:
- Around line 386-410: The three ceremony mutation paths in
packages/core/src/work/standup-service.ts at lines 386-410, 413-446, and 448-479
use a stale standup read outside the transaction. Add and reuse one shared
transaction helper that loads the standup row with a row lock, then use its
currentTurnId inside the transaction before computing the next turn, closing the
previous speaker, or clearing the current turn for an absent participant.
- Around line 174-204: The standup lookup and insert in the transaction are not
concurrency-safe. Update the insert in the open path around
`tx.insert(schema.standup)` to use the `standup_team_day_unique` conflict target
and do nothing on conflict; when the insert returns no row, reload the existing
standup for the same `teamId` and `heldOn`, then return its `detailOf` with
empty actions instead of calling `requireRow`.
In `@packages/db/src/ensure-test-databases.ts`:
- Line 20: Replace the early return for `ORBIT_ALLOW_REMOTE_TEST_SETUP=1` with
validation logic that checks the DATABASE_URL and enforces certificate-verified
TLS connections for remote targets. The validation should reject non-TLS URLs or
URLs without explicit certificate verification, and ensure that both the
postgres client configuration and drizzle.config are set to require verified TLS
(such as ssl: 'verify-full') when remote setup is enabled.
---
Minor comments:
In `@apps/web/src/components/command-palette.tsx`:
- Line 28: Update the command palette’s SECTION_ORDER to include Standup and add
the same section to the keyboard shortcuts overlay display, ensuring StandupRoom
hotkeys registered under the Standup HotkeySection appear in both locations.
In `@apps/web/src/features/issues/my-issues-view.tsx`:
- Around line 55-65: Update the My issues view’s useIssueViewModel call so
summary fetching is disabled while workspace.userId is null, and enabled only
after the user ID resolves. Pass the enabled condition through the model’s
existing configuration mechanism, preserving the current assignee scope once the
ID is available.
In `@apps/web/src/features/standup/roster.tsx`:
- Around line 24-32: Add role="img" to the UserMinus and CircleCheck icon
elements in the attendance/status rendering alongside their existing aria-label
attributes, matching the role pattern already used by the speaking indicator.
In `@apps/web/src/features/standup/turn-panel.tsx`:
- Around line 203-229: Add programmatic accessible names to the blocker input
and notes textarea in the turn panel: give the blocker input an aria-label
describing the blocker field and the notes textarea an aria-label describing the
notes field, while preserving their existing visible placeholders and behavior.
In `@apps/web/src/lib/query/use-standup.ts`:
- Around line 88-98: Update useAdvanceStandup so the request body sets markDone
based on direction: enable it only when direction is 'next' and disable it for
'previous'. Preserve the existing advance endpoint and direction behavior.
In `@apps/web/src/lib/realtime/url.test.ts`:
- Around line 36-40: Update the afterEach cleanup around savedMode to delete
process.env['NODE_ENV'] when savedMode is undefined; otherwise restore the saved
value unchanged, ensuring subsequent mode-dependent tests do not receive the
string "undefined".
In `@packages/core/src/content/doc-service.ts`:
- Line 773: Update the new grant row’s primary-key generation at the newId()
call to use randomUUIDv7() from `@orbit/shared/utils` instead, ensuring the
required sortable ID is created.
In `@packages/core/src/realtime/backfill.ts`:
- Around line 460-483: Update the attachment scope mapping in the attachment
loader to branch on each supported parentType: keep document scopes, use the
resolved issue scope for comment parents, and use a project scope for project
parents while retaining team scopes where applicable. Add assertions for
unsupported attachment parent types, using the existing teamsByAttachmentParent
results and scope helpers.
In `@packages/core/src/work/standup-service.test.ts`:
- Around line 54-59: The assertion in the test labeled 'binds the standup to the
active sprint when one is running' uses a tautology that is always true. Before
calling openStandup, create an active cycle using createCycle with
workspace.admin and teamId, capturing the cycle id. Then replace the assertion
that checks `detail.standup.cycleId === null || typeof detail.standup.cycleId
=== 'string'` with an assertion that validates detail.standup.cycleId equals the
cycle id returned from createCycle.
In `@packages/core/src/work/standup-service.ts`:
- Around line 565-592: Update setRotation to return the rotation mutation’s sync
actions alongside the affected rows, using the existing saveStandup
synchronization pattern and preserving the empty-members behavior. Then update
the rotation route handler in apps/web/src/app/api/standups/rotation/route.ts to
publish those returned actions for the team:<teamId> scope.
- Around line 58-60: Update today() and its heldOn call site to derive the date
using the team’s teams.timezone rather than UTC, passing the timezone through or
calculating the team-local day before matching the timezone. Preserve the
existing date format while ensuring ceremonies west of UTC are assigned to the
correct team day.
- Around line 39-56: Update standupAction and its user-initiated call sites,
including updateTurn and addBlocker, to accept a Principal and construct the
sync action actor from that principal instead of the hardcoded standup system
actor; preserve the system actor only for genuinely system-triggered mutations.
- Around line 322-336: In the transaction where the first turn's status is set
to 'speaking', add `spokeAt: new Date()` to the `.set()` call alongside the
existing `status: 'speaking'` and `updatedAt: new Date()` properties. This
ensures the first speaker records a duration through the `closeSpeakingTurn`
path, matching the behavior established by `advanceStandup` for subsequent
speakers.
In `@packages/db/src/ensure-test-databases.ts`:
- Around line 14-20: Create a Zod schema to parse and validate the DATABASE_URL
and ORBIT_ALLOW_REMOTE_TEST_SETUP environment variables before passing them to
assertLocalServer. Define the schema above the LOCAL_HOSTS constant to cover
external startup input, parse process.env using the schema (preserving the
existing fallback for DATABASE_URL), and then pass the validated parsed values
into the function. Keep the existing URL/host checks in assertLocalServer as
semantic validation of the parsed data rather than part of the schema itself.
In `@packages/shared/src/events/sync.ts`:
- Line 27: Update the standup loader in SYNC_CATCHUP_MODELS to include an eq
filter on schema.standup.teamId using the request team ID, alongside the
existing organization filter. Ensure catch-up queries only fetch rows for the
requested team before applying limits and scope filtering.
---
Nitpick comments:
In `@apps/realtime/src/server.test.ts`:
- Around line 386-392: Update the fan-out test’s syncAction published at syncId
9100 to use the complete emitted issue scope set, including
scopes.organization(orgA) alongside the existing team and issue scopes. Match
the live issue-action contract so the test can detect organization-only leakage.
In `@apps/web/src/app/api/issues/summary/route.ts`:
- Around line 7-24: Replace the locally declared FACET_GROUPS allowlist in
summaryQuerySchema with the exported FACET_PROPERTIES from `@orbit/core`, and
retain the existing fallback to 'state'. Remove the duplicate set so facet
membership and grouping defaults remain governed by the core issue service.
In `@apps/web/src/features/filters/filter-menu.tsx`:
- Around line 185-194: In the option-rendering path of FieldPicker, compute
countValues(definition, facets) once before definition.options.map and reuse the
resulting Map for every ValueCount. Remove the per-option countValues call while
preserving each option’s existing count lookup and rendering behavior.
In `@apps/web/src/features/standup/roster.tsx`:
- Around line 57-67: Replace the roster button’s raw transition and hover
classes with the shared rowHover helper, and add aria-current to the active row.
In apps/web/src/features/standup/standup-page.tsx lines 36-49, replace the
equivalent transition and hover classes with tabHover and add aria-current to
the selected team button.
In `@apps/web/src/features/standup/turn-panel.tsx`:
- Around line 62-69: Update the finished useMemo in the turn panel to compute
the current timestamp inside its callback rather than storing Date.now() in the
render scope. Remove now from the dependency list, retaining mine as the
dependency so the memo remains reusable between issue-data changes.
In `@apps/web/src/lib/query/issue-search.ts`:
- Around line 43-54: Update summarySearch to build its parameters from
filter-only values instead of reusing searchParams, excluding limit and orderBy
while preserving teamId, scope, and groupBy handling. Ensure the returned
summary query string is unchanged by pagination or sort-order settings.
In `@apps/web/src/lib/query/schemas.ts`:
- Around line 195-245: Derive both the `issueSummarySchema` facets shape and
`emptyFacets()` result from `FACET_PROPERTIES` instead of repeating the nine
keys manually. Reuse the existing `facetCounts` schema for each generated
property and ensure every constant entry receives an empty object, so adding a
facet only requires updating `FACET_PROPERTIES`.
In `@packages/core/src/content/doc-service.test.ts`:
- Around line 441-457: Update the test “shares with a whole team when the grant
names one” to create the document with visibility set to team, assert both
getDoc and listDocs deny access before setDocAccess, and assert both allow the
team member access after granting the team read permission.
In `@packages/core/src/index.ts`:
- Line 26: Update the package barrel around the today export so the generic
today() symbol is not exposed as a package-level API; either rename the
standup-specific function to standupDay() and export that name consistently, or
keep today() internal and expose a shared date helper instead.
In `@packages/core/src/realtime/backfill.test.ts`:
- Around line 198-229: Strengthen the access-control assertions in the affected
realtime backfill tests: in the first test, assert that neither the denied issue
nor outsider team identifiers appears in any action modelId while preserving the
existing issue references; in the guest test, store the created issue and
catch-up result, then assert its modelId is absent instead of checking only
serialized titles.
In `@packages/core/src/work/issue-service.ts`:
- Around line 1241-1250: Plan performance improvements around getIssueSummary:
add composite indexes covering the scope predicate with each grouped column
(stateId, assigneeId, projectId, and cycleId), and separate or cache the
scope-wide FACET_PROPERTIES results so filter changes refetch only matched
counts and selected group totals.
- Line 601: Update the issue update flow around assertAssignableToTeam so
assignment validation is performed once per distinct teamId rather than inside
the per-issue loop. Reuse the parsed patch values for cycleId, projectId, and
milestoneId, cache each team’s validation result, and invoke
assertAssignableToTeam only when a team has not yet been validated.
In `@packages/core/src/work/standup-service.test.ts`:
- Around line 152-208: The standup service lacks negative and behavioral
coverage for three authorization/data-integrity gaps. Extend the tests around
openStandup, resolveBlocker, and standup advancement to verify non-members are
excluded from participantIds, resolving a blocker from another team rejects, and
the first turn gets a non-null durationSeconds after one advance; add the
corresponding service fixes in standup-service.ts.
In `@packages/core/src/work/standup-service.ts`:
- Around line 292-311: Update updateStandup to reject any status change when
current.status is already 'finished', preventing transitions back to 'running'.
Only assign endedAt when parsed.status is 'finished' and current.status is not
already 'finished'; preserve existing status and start-time behavior for other
updates.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Twenty four findings were raised against the branch and seventeen survived an attempt to refute each one. These are the ones that mattered. Doc access control was bypassed by three paths that never saw it. The catch-up loader returned every doc row in the organization with its full body, so GET /api/sync handed a private doc to any member and to guests, and delta-bridge fires that request automatically on reconnect. Doc deltas still carried the organization scope, so private content was also broadcast live to every open tab. Doc attachments authorized on doc:read alone, and the storage key needed to fetch them came down in the same payload. All three now run the doc read rule. Making a published doc private also left its public link working: tokenFor only cleared the token for 'workspace', and getPublishedDoc only rejected 'workspace', so the new private and team visibilities kept a live anonymous URL. Both now key off isExternallyShared. The milestone half of assertAssignableToTeam checked only the organization, so a milestone from another team was still assignable. Standup had five. Finishing left the current speaker marked speaking forever. Marking the current speaker absent nulled the pointer, so the next advance rewound the room to the first person. resolveBlocker authorized against the standup id in the URL but updated any blocker in the organization. openStandup did check-then-insert with no lock, so two facilitators opening the room raced into a unique violation surfaced as a 500. participantIds seated anyone, including users from another team. On the client, nothing invalidated the issue summary, so header and column counts drifted from the rows they label after any create, move or delete. reconcile could insert an issue into a list whose encoded filter it had never evaluated, so it now only removes and replaces, and admits a new issue solely on the create path. The filter debounce kept a queued write armed when an edit was reverted, which wrote the stale URL and reverted the UI, and it could write to a page the user had already left. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ed work Against the Linear reference the card showed six properties to Linear's ten, and nothing on it was a control. The property menu component existed and was wired to nothing. Priority, status and assignee are now buttons that open that menu in place, so a card can be triaged without opening it. Dragging falls back to the plain glyphs so nothing is clickable mid-drag. Project and created join the default properties, which is what made the reference cards feel denser: the pieces were already supported and simply switched off. Separately, project scope. projectProgress added every workflow state category into scope, cancelled included, so a project with three cancelled issues out of ten reported a scope of ten and could never reach a hundred percent. Cancelled work is now counted and reported on its own and kept out of scope, and the page shows it as a fourth tile. Progress was also organization scoped, so any member could read any project's numbers; it now requires membership of one of the project's teams. Verified on a 2,520 issue board: changing status from a card moves it between columns and both badges settle to the right numbers, which also exercises the summary invalidation added in the previous commit. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ver the socket
Two silent losses on the first keystroke, both reproduced before fixing.
Blank lines inside a code fence collapsed. docToMarkdown applied a
document wide `\n{3,}` collapse after serialising, so
`const a = 1;` followed by three blank lines and `const b = 2;` came back
with one. Inside a fence those blank lines are code. The collapse now
skips fenced blocks and still tidies prose.
Headings five and six became paragraphs. StarterKit was configured with
`levels: [1, 2, 3, 4]` while the sanitizer allows h1 to h6 and the
serialiser writes up to six, so the ProseMirror schema had nowhere to put
an h5 and silently demoted it. The editor now carries all six.
Separately, document bodies were broadcast in full on every autosave: the
doc sync action carried the whole row, and the catch-up loader returned
every readable doc with its content. A socket is terminated once it has
buffered a megabyte (hub.ts:37), so a large doc being edited could drop
other people's connections, and the same bodies were paid for again on
every reconnect. A doc delta now announces the change without the body,
which is all the client ever used it for: it invalidates and refetches.
That makes the size cap safe to raise. Docs had been sharing the 100 KB
markdownSchema with issue descriptions and comments, failing with a
generic toast and no explanation. They now have their own 500 KB budget
with a message that says what to do about it.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
bun run verify failed intermittently with a different test each run, all of them at just over five seconds and all of them passing in isolation. That is Bun's default per test timeout, reached because thirty one test files share one Postgres and the suite has grown. Raise the core package's timeout to twenty seconds so a slow query under load reports as slow rather than as a failure. Three consecutive full runs are clean. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (1)
packages/core/src/realtime/backfill.ts (1)
687-687: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy liftDo not cap rows before visibility filtering.
Each loader receives
perModel + 1rows, but the catch-up loop slices the firstperModelrows beforevisibleToPrincipalremoves inaccessible rows. Withlimit = 1, an earlier Team B row can hide a later Team A row. The result has no actions, keepssyncIdatsince, and repeats the same hidden row on every retry.Filter in each loader or continue scanning until each model has
perModelvisible rows. Add the hidden-row then visible-row regression.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/realtime/backfill.ts` at line 687, Update the catch-up loading flow around visibleToPrincipal so row limits are applied after visibility filtering: either filter rows within each loader or continue scanning until each model has perModel visible rows. Preserve syncId advancement and ensure hidden rows cannot displace later visible rows; add a regression covering a hidden row followed by a visible row with limit 1.
🧹 Nitpick comments (1)
apps/web/src/features/issues/card-controls.tsx (1)
19-20: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the shared surface interaction token.
Replace the raw
transition-colorsandhover:bg-surface-3classes withsurfaceHover. This keeps hover color behavior under the shared interaction policy.As per coding guidelines,
apps/webanimations must use shared interaction tokens and respect reduced motion. Based on learnings, usesurfaceHoverinstead of raw color-transition classes.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/features/issues/card-controls.tsx` around lines 19 - 20, Update the TRIGGER class definition to replace the raw transition-colors and hover:bg-surface-3 utilities with the shared surfaceHover interaction token, while preserving the remaining layout, focus, and reduced-motion classes.Sources: Coding guidelines, Learnings
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/web/src/features/docs/editor/markdown.ts`:
- Around line 201-207: The fence parsing in collapseOutsideFences incorrectly
terminates when code contains an embedded triple-backtick line. Update the fence
detection and splitting logic to choose a delimiter longer than the longest
backtick run in the code, and make FENCE recognize that delimiter length. Add a
regression test covering an embedded triple-backtick line while preserving blank
lines inside the fenced code.
In `@packages/core/src/work/standup-service.ts`:
- Around line 327-335: Load and lock the current standup within the transaction
at packages/core/src/work/standup-service.ts lines 327-335, then use its locked
currentTurnId when closing the speaking turn; apply the same transaction-scoped
locking helper at lines 498-519 before advancing an absent speaker, replacing
decisions based on the pre-transaction current value.
- Around line 510-514: Update the target turn activation in the standup start
flow around the standupTurn status update to set only the speaking status and
updatedAt, leaving spokeAt unset when the participant begins. Add coverage
confirming spokeAt remains null until the turn-closing logic records it.
---
Duplicate comments:
In `@packages/core/src/realtime/backfill.ts`:
- Line 687: Update the catch-up loading flow around visibleToPrincipal so row
limits are applied after visibility filtering: either filter rows within each
loader or continue scanning until each model has perModel visible rows. Preserve
syncId advancement and ensure hidden rows cannot displace later visible rows;
add a regression covering a hidden row followed by a visible row with limit 1.
---
Nitpick comments:
In `@apps/web/src/features/issues/card-controls.tsx`:
- Around line 19-20: Update the TRIGGER class definition to replace the raw
transition-colors and hover:bg-surface-3 utilities with the shared surfaceHover
interaction token, while preserving the remaining layout, focus, and
reduced-motion classes.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 450f46d5-d485-47d2-a351-1e629e883281
📒 Files selected for processing (23)
apps/web/src/app/(app)/projects/[slug]/page.tsxapps/web/src/features/docs/editor/extensions.tsapps/web/src/features/docs/editor/markdown.test.tsapps/web/src/features/docs/editor/markdown.tsapps/web/src/features/filters/use-view-config.tsapps/web/src/features/issues/card-controls.tsxapps/web/src/features/issues/issue-card.test.tsxapps/web/src/features/issues/issue-card.tsxapps/web/src/lib/query/use-issues.tsapps/web/src/lib/realtime/delta-bridge.test.tsxapps/web/src/lib/realtime/delta-bridge.tsxpackages/core/src/content/doc-service.test.tspackages/core/src/content/doc-service.tspackages/core/src/realtime/backfill.test.tspackages/core/src/realtime/backfill.tspackages/core/src/work/issue-service.tspackages/core/src/work/project-service.test.tspackages/core/src/work/project-service.tspackages/core/src/work/standup-service.test.tspackages/core/src/work/standup-service.tspackages/services/src/storage/parent.tspackages/shared/src/filters/index.tspackages/shared/src/validators/doc.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- apps/web/src/features/filters/use-view-config.ts
- packages/services/src/storage/parent.ts
- apps/web/src/lib/query/use-issues.ts
A read grant let somebody edit. The access model stores read or write, but every write path checked the global doc:write permission and then loaded the doc, which a read grant satisfies. In a workspace where ordinary members hold doc:write, anyone granted read on a private doc could edit, archive, restore or reshare it. Update, archive, restore and share now require the author, an admin, or an explicit write grant. Standup was not live. delta-bridge routed issues, comments, reactions, doc comments, subscriptions, docs and views, but had no case for standup, so a facilitator advancing the room changed nothing on anyone else's screen until they reloaded. That is the whole shared screen premise, so it is now wired to invalidate the room. The turn panel reset its notes whenever the note text changed rather than when the speaker did, so an incoming save could wipe what somebody was typing. The panel is now keyed by turn, which removes the effect altogether. Holding the arrow key queued several advances at once; move is now inert while one is in flight. The markdown serialiser collapsed blank lines with a document wide regex that treated a fence as a delimiter, which is fragile once a code block contains its own backticks. Collapsing is now per block and skips code, and a code block picks a fence longer than the longest backtick run inside it. A group holding loaded rows no longer disappears when the server total says zero, and the standup routes validate their path ids. Two findings I am not acting on, with reasons on the threads: the milestone facet collapses to "any" deliberately, because the filter offers exactly "Has a milestone" and "No milestone"; and the three earlier P1s about catch-up, doc attachments and blocker scoping were already fixed in 301e1e5, before the bots ran. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…direct The download route joined the raw path segments straight into a storage key lookup, and cached every redirect for 280 seconds. A presigned URL to a private doc's attachment therefore stayed replayable from the browser cache after access was revoked. Segments are now parsed before use, and only an externally shared file keeps a cacheable redirect. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
commented
Aug 4, 2026
|
Want your agent to iterate on Greptile's feedback? Start a greploop in Claude Code and it will work through the open comments and keep going until this PR reviews clean. |
…ation holes An adversarial review of the branch reproduced twelve holes against the real database. The worst let any member, including a guest, read and post comments on a doc marked private: the comment service looked the doc up by organization alone and never consulted visibility or the access grants, so a doc the owner believed was private was readable through its thread. Doc comments now load through the same read gate every other doc entry point uses, and a comment on a restricted doc is announced only on that doc's channel rather than to the whole workspace. Backlinks apply the read filter, so a private doc that links to one you can read no longer leaks its title. The realtime socket checks visibility and grants before it will subscribe a connection to a doc, and an attachment upload now requires write access to its parent doc. Projects were readable and writable across the team boundary through their org-only checks, and the workspace project list ignored teams entirely. Analytics answered for every team in the workspace no matter who asked. Both now filter to the teams the caller is on. Moving an issue between teams kept its sprint and project links, which belonged to the team it left; those are cleared unless the project spans the destination team. A standup rotation and a facilitator can only name people who are on the team.
left a comment
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
apps/web/src/lib/query/sync.ts (1)
97-118: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winResort existing rows after a delta update.
sortForSearch()runs only when a missing row is inserted. If a realtime update changessortOrder,priority,title,dueDate,estimate,createdAt, orupdatedAt, the existing row remains at its old index. The affected list stays out of order until a later fetch.Proposed fix
const next = [...issues]; next[index] = merged; - return next; + return sortForSearch(search, next); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/lib/query/sync.ts` around lines 97 - 118, Update applyIssueDelta so that after applying a non-delete/archive update to an existing issue, it rebuilds the updated list and passes it through sortForSearch(search, ...), ensuring changes to ordering fields reposition the row immediately while preserving the existing insertion and filtering behavior.packages/core/src/content/doc-service.ts (1)
825-844: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftReturn a sync action for
setDocAccess.
setDocAccessmodifiesdocAccessrows but returns only the inserted access rows. An empty grant list deletes the revocation before allocatingsyncId, and nonempty grants allocatesyncIdfor the inserted rows but do not expose aSyncAction. Change the contract to returnactionslike the other write paths, allocate the sync ID before deletion, and publish an update for both grant assignments and revocations so real-time clients and catch-up can observe access changes.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/content/doc-service.ts` around lines 825 - 844, Update setDocAccess to return the established actions contract instead of inserted access rows. Allocate syncId before deleting existing docAccess rows, then create and publish a SyncAction covering both grant assignments and empty-grant revocations, while preserving the transaction and returning the action consistently.Source: Coding guidelines
apps/web/src/features/issues/board.tsx (1)
328-339: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winMemoize
flattenIssuePagesin the select callback.
useColumnIssuespassesflattenIssuePagesdirectly to TanStack Query’sselect; with multiple pages, that returns a newflatMap(...)result on each render.BoardColumnthen callsonRows(group.id, issues)wheneverissueschanges,publishRowsupdatescolumnRows, andBoardColumnre-renders through the derivedloadedGroups. Memoize the flattened result by page-key/counts or otherwise avoid passing an unstableselectoutput intouseEffect;flattenIssuePagesalready only guarantees the flat identity for a single page.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/features/issues/board.tsx` around lines 328 - 339, The useColumnIssues select output is unstable for multiple pages, causing BoardColumn’s onRows effect to repeatedly update columnRows and rerender. Memoize flattenIssuePages within useColumnIssues using the page key/counts, or otherwise provide a stable select result for multi-page data while preserving the existing single-page behavior.
🧹 Nitpick comments (2)
packages/core/src/work/standup-service.test.ts (1)
356-364: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winThe accumulation assertion is vacuous at this time resolution.
durationSecondsis measured in whole seconds. The test advances the room within milliseconds, sobankedandtotalare both0, andtoBeGreaterThanOrEqualpasses even if the service overwrites the accumulated time instead of adding to it. The stated regression is not covered.Inject or control the clock, or assert the stored value directly against a seeded
spokeAt.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/work/standup-service.test.ts` around lines 356 - 364, Make the accumulation test around advanceStandup deterministic at whole-second resolution by injecting or controlling the clock, or by seeding and asserting against a known spokeAt value. Ensure banked and total are nonzero and the assertion verifies accumulated duration rather than allowing both values to remain zero; preserve the existing previous/next and markDone flow.packages/db/src/index.ts (1)
18-18: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse this re-export consistently.
apps/web/src/features/analytics/data.tsimportstype SQLfrom@orbit/db, butpackages/core/src/work/project-service.ts(Line 13) andpackages/services/src/storage/parent.ts(Line 5) import it fromdrizzle-ormdirectly. Route both through@orbit/dbso the driver stays behind the package boundary.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/db/src/index.ts` at line 18, Update the import statements in both project-service.ts (line 13) and parent.ts (line 5) to import type SQL from `@orbit/db` instead of directly from drizzle-orm. This ensures consistent use of the package's re-export and maintains the driver abstraction behind the package boundary, matching the pattern already established in analytics/data.ts.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/web/src/app/api/standups/`[id]/turns/[turnId]/route.ts:
- Around line 8-12: Move the context parameter resolution using routeId and the
request JSON parsing into the callback passed to handleRoute in PATCH. Ensure
both standup and turn ID validation errors, along with parsing errors, are
caught by the existing handler mapping while preserving the current successful
request flow.
In `@apps/web/src/lib/query/sync.ts`:
- Around line 316-319: The orderingOf URL boundary currently accepts inherited
ORDER_READERS names and bypasses required Zod validation. Add a Zod schema to
validate the external orderBy value against the supported IssueOrdering values,
and update orderingOf to require an own ORDER_READERS key rather than using the
inherited-key-permissive in check; return 'manual' for invalid or missing
values.
In `@apps/web/src/lib/realtime/delta-bridge.tsx`:
- Around line 179-182: Update the standup branch in the realtime action handler
to patch valid STANDUP_ROOT/today standup cache entries from action.data before
setting roots.standup. Reuse the existing query-cache update utilities and
preserve the current invalidation behavior as a fallback when the payload cannot
be applied.
In `@packages/core/src/content/doc-comment-service.ts`:
- Around line 31-33: Update docCommentScopes so restricted documents include the
document scope for every reader subscription, including direct-granted readers,
while preserving the existing author, organization, and document scopes required
for each access path.
In `@packages/core/src/work/standup-service.test.ts`:
- Around line 332-343: Update the test around the initial turn lookup and the
subsequent closed-turn lookup to assert each result exists before checking its
fields. Replace optional property access in the assertions following find with
direct property reads after explicit existence assertions, ensuring missing
turns fail the test.
---
Outside diff comments:
In `@apps/web/src/features/issues/board.tsx`:
- Around line 328-339: The useColumnIssues select output is unstable for
multiple pages, causing BoardColumn’s onRows effect to repeatedly update
columnRows and rerender. Memoize flattenIssuePages within useColumnIssues using
the page key/counts, or otherwise provide a stable select result for multi-page
data while preserving the existing single-page behavior.
In `@apps/web/src/lib/query/sync.ts`:
- Around line 97-118: Update applyIssueDelta so that after applying a
non-delete/archive update to an existing issue, it rebuilds the updated list and
passes it through sortForSearch(search, ...), ensuring changes to ordering
fields reposition the row immediately while preserving the existing insertion
and filtering behavior.
In `@packages/core/src/content/doc-service.ts`:
- Around line 825-844: Update setDocAccess to return the established actions
contract instead of inserted access rows. Allocate syncId before deleting
existing docAccess rows, then create and publish a SyncAction covering both
grant assignments and empty-grant revocations, while preserving the transaction
and returning the action consistently.
---
Nitpick comments:
In `@packages/core/src/work/standup-service.test.ts`:
- Around line 356-364: Make the accumulation test around advanceStandup
deterministic at whole-second resolution by injecting or controlling the clock,
or by seeding and asserting against a known spokeAt value. Ensure banked and
total are nonzero and the assertion verifies accumulated duration rather than
allowing both values to remain zero; preserve the existing previous/next and
markDone flow.
In `@packages/db/src/index.ts`:
- Line 18: Update the import statements in both project-service.ts (line 13) and
parent.ts (line 5) to import type SQL from `@orbit/db` instead of directly from
drizzle-orm. This ensures consistent use of the package's re-export and
maintains the driver abstraction behind the package boundary, matching the
pattern already established in analytics/data.ts.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 208d1b5c-bb64-472e-bab8-e40bb674de82
📒 Files selected for processing (38)
apps/web/src/app/api/files/[...key]/route.tsapps/web/src/app/api/standups/[id]/advance/route.tsapps/web/src/app/api/standups/[id]/focus/route.tsapps/web/src/app/api/standups/[id]/route.tsapps/web/src/app/api/standups/[id]/start/route.tsapps/web/src/app/api/standups/[id]/turns/[turnId]/blockers/route.tsapps/web/src/app/api/standups/[id]/turns/[turnId]/route.tsapps/web/src/app/api/standups/blockers/[blockerId]/route.tsapps/web/src/features/analytics/data.tsapps/web/src/features/docs/editor/markdown.test.tsapps/web/src/features/docs/editor/markdown.tsapps/web/src/features/filters/grouping.tsapps/web/src/features/issues/board.tsxapps/web/src/features/standup/standup-room.tsxapps/web/src/features/standup/turn-panel.tsxapps/web/src/lib/api/handler.tsapps/web/src/lib/query/sync.test.tsapps/web/src/lib/query/sync.tsapps/web/src/lib/query/use-issues.tsapps/web/src/lib/realtime/delta-bridge.test.tsxapps/web/src/lib/realtime/delta-bridge.tsxpackages/core/bunfig.tomlpackages/core/src/analytics/distribution.test.tspackages/core/src/analytics/distribution.tspackages/core/src/content/doc-comment-service.test.tspackages/core/src/content/doc-comment-service.tspackages/core/src/content/doc-service.test.tspackages/core/src/content/doc-service.tspackages/core/src/work/issue-service.test.tspackages/core/src/work/issue-service.tspackages/core/src/work/project-service.test.tspackages/core/src/work/project-service.tspackages/core/src/work/standup-service.test.tspackages/core/src/work/standup-service.tspackages/db/src/ensure-test-databases.tspackages/db/src/index.tspackages/realtime-server/src/auth.tspackages/services/src/storage/parent.ts
🚧 Files skipped from review as they are similar to previous changes (17)
- apps/web/src/app/api/standups/blockers/[blockerId]/route.ts
- packages/db/src/ensure-test-databases.ts
- apps/web/src/app/api/standups/[id]/start/route.ts
- apps/web/src/app/api/standups/[id]/focus/route.ts
- apps/web/src/features/filters/grouping.ts
- apps/web/src/app/api/standups/[id]/turns/[turnId]/blockers/route.ts
- apps/web/src/app/api/standups/[id]/advance/route.ts
- apps/web/src/lib/realtime/delta-bridge.test.tsx
- apps/web/src/lib/query/use-issues.ts
- packages/core/src/work/issue-service.ts
- apps/web/src/features/standup/standup-room.tsx
- packages/core/src/work/standup-service.ts
- apps/web/src/features/docs/editor/markdown.ts
- apps/web/src/app/api/standups/[id]/route.ts
- apps/web/src/app/api/files/[...key]/route.ts
- apps/web/src/features/docs/editor/markdown.test.ts
- apps/web/src/features/standup/turn-panel.tsx
…rors focusTurn was the one standup mutation still reading the current turn from outside its transaction. Two facilitators jumping to different speakers could both commit, leaving two turns marked speaking while currentTurnId pointed at whichever landed last, and the orphan was never closed because closeSpeakingTurn only looks at the current turn. An orderBy name taken from the URL was checked with `in`, which is true for inherited names such as toString and __proto__, so the cast handed sortForSearch an entry with no read function and the view crashed. It now requires an own key. The standup routes resolved their path parameters and parsed their bodies before entering handle, so a malformed id produced an unhandled 500 rather than the 404 the domain error maps to. Both now happen inside the callback. Narrowing the comment scopes left a reader with a direct grant, rather than a team grant, receiving nothing live on a restricted doc: the bridge subscribes org and team scopes only. The doc surface now subscribes to its own doc scope.
Fixes the board's speed, the filters, realtime, the standup, and a set of authorization holes found while auditing the surfaces this branch touches.
Speed
The board used to crawl every page of a team's issues to render a header count. On a 2,518 issue team a cold filtered board made 27 requests for 1,982 KB. It now makes 2 requests for 66 KB.
Second filter paint measured at 86ms.
Filters and lists
sortOrdereven when the query ordered byupdated.Realtime
NEXT_PUBLIC_REALTIME_URLno longer reaches production, where it pointed the browser at the retired standalone host and produced an endless "Reconnecting to live updates" banner. Verified against the preview deploy:/api/wsreturns 101 and the bundle carries no hardcoded host.Standup
Rebuilt as a real scrum ceremony: a facilitator walks the room one person at a time, each turn records notes, blockers and attendance, and the rotation decides both the speaking order and who runs the meeting.
Documents
Per-document permissions:
private,team,workspace,linkandpublic, with named user and team grants at read or write level.Security
An adversarial review reproduced twelve holes against the real database. All are closed, each with a regression test:
/api/docs/{id}/commentsdirectly, because the comment service looked the doc up by organization alone. Comments now load through the same gate every other doc entry point uses.Housekeeping
bun run db:test-setupcreates the six per-package test databases, and refuses a non-local host unlessORBIT_ALLOW_REMOTE_TEST_SETUP=1, in which case it requires verified TLS.Verification
bun run verifyis green: lint, comment policy, typecheck and roughly 1,450 tests. Realtime confirmed working against the preview deploy.Not in this PR
Tracked for follow-ups: renaming cycles to sprints, sprint history, MCP planning coverage and the MCP OAuth consent flow, the docs tree and export, the inbox reading pane, moving tests into a dedicated test tree, and the project page tabs.
Greptile Summary
This PR is a large, multi-domain security and feature overhaul closing twelve confirmed authorization holes, rebuilding the standup ceremony, and dramatically cutting board load (27→2 requests on a 2,518-issue team). Every security fix has a corresponding regression test, and
bun run verifyis reported green.summaryquery instead of a full client-side crawl; each board column paginates independently with its ownstateId-scoped query.standup-service.tswith advisory lock on open, row-level lock on every mutation (lockStandup), accumulating speaker durations, and a rotation-based facilitator picker. The full standup detail (turns + blockers) is embedded in every realtime sync event so subscribers stay current.Confidence Score: 4/5
Safe to merge after the open thread on milestone facet grouping is resolved; all security fixes and the standup rebuild look correct.
The twelve security holes are all closed with tests and the logic reads correctly. The standup service is well-locked and the realtime catchup now applies team-membership filtering to every model. One existing open thread — the milestoneFacet function in issue-service.ts grouping every milestoned issue into a single 'any' bucket instead of the actual milestone ID — remains unresolved, causing milestone-based board columns and group totals to be incorrect.
Files Needing Attention: packages/core/src/work/issue-service.ts — the milestoneFacet function (open thread at line 1255) needs a fix before milestone-grouped board views produce correct counts.
Important Files Changed
Sequence Diagram
sequenceDiagram participant F as Facilitator participant API as Next.js API participant DB as Postgres participant Redis as Redis Pub/Sub participant C as Other Clients F->>API: POST /standups (teamId, heldOn) API->>DB: pg_advisory_xact_lock(standup:team:date) API->>DB: SELECT standup WHERE team+date (check existing) API->>DB: rosterFor(teamId, participantIds) API->>DB: assertOnTeam(teamId, facilitatorId) API->>DB: INSERT standup + standupTurn rows API->>Redis: "publish SyncAction{model:standup, data:{standup,turns,blockers}}" Redis-->>C: invalidate STANDUP_ROOT cache F->>API: POST /standups/:id/start API->>DB: SELECT standup FOR UPDATE (lockStandup) API->>DB: activateTurn(first non-absent turn, now) API->>DB: "UPDATE standup SET status=running, currentTurnId" API->>Redis: "publish SyncAction{model:standup}" Redis-->>C: invalidate STANDUP_ROOT cache F->>API: "POST /standups/:id/advance {markDone, direction}" API->>DB: SELECT standup FOR UPDATE (lockStandup) API->>DB: closeSpeakingTurn(currentTurnId, now) API->>DB: activateTurn(nextTurn, now) API->>DB: "UPDATE standup SET currentTurnId=nextTurn" API->>Redis: "publish SyncAction{model:standup}" Redis-->>C: invalidate STANDUP_ROOT cacheReviews (6): Last reviewed commit: "fix(review): lock focusTurn, guard the o..." | Re-trigger Greptile
Context used: