Repository navigation
Create views on the views page, and stop workspace views landing in a random team - #133
Conversation
A new workspace now starts with two triage views alongside the four it already had: Unassigned finds open issues nobody owns, Overdue finds open issues whose due date has passed, ordered by due date. Both hide finished work so they stay actionable. Every built-in also carries a one-line description now, so the views list can say what each one does. The named date vocabulary moves to @orbit/shared so the predicate compiler and the filter UI share one list instead of two copies.
A view with no team filter used to fall through find() and land on workspace.teams[0], so clicking All issues dropped you into whichever team sorted first. viewHref now only routes to a team when the view names one that still exists, and sends everything else to /views/<id>. That route is new. It reads the view server side, hydrates the views query, and renders the issues the view describes across the whole workspace, honouring its filter, ordering, grouping, layout and display options. A view scoped to a project narrows to that project, and the scope shows in the header so nobody has to guess what they are looking at. The saved view page reuses the same filter bar and display menu as the team list, so tweaking and saving works exactly as it does there. useAllIssues takes an optional scope so the same hook can serve the whole workspace, one team or one project.
The page had no way to make a view. The empty state pointed at Alt+V on another screen, and it sat in a blank area far below the built in section header. Both are fixed here. A New view button in the page header opens a dialog that names the view, picks its scope (the workspace, a team or a project), its layout, and then reuses the existing filter builder and display menu for the filters, grouping, ordering and display properties. Alt+V opens the same dialog, so the old keystroke still means what it meant. The sections now carry a line each saying what they hold, and the empty state for your own views sits inside that section with its own button rather than floating below everything. Built in rows say their visibility is Everyone instead of Only me, which was never true of a view every member gets, and each one describes what it collects.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 32 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (30)
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 |
A saved view could only record shared true or false, so the "My teams" option in both view dialogs published the view at organization scope: listViews, the realtime scopes and the reconnect backfill all authorised any non private view for the whole workspace. The view table now carries visibility and team_id. viewScopes publishes a team view to that team alone, listViews and the catch up backfill share one viewReadFilter, and getView and setViewFavorite go through canReadView in the shared policy. Creating or updating a team view asserts the team is in this workspace and that the author belongs to it. Narrowing an audience deletes on exactly the scopes that lost access. Both dialogs bind the team option to the team the view covers, name it, and fall back to private when the scope moves off that team. packages/db/catchup/view-team-visibility.sql must be applied to the target database before this ships.
savedViewPath encodes the id, so virtual:all becomes /views/virtual%3Aall, and Next hands the page component the raw segment while giving generateMetadata the decoded one. The lookup therefore missed on every built in view and all six rendered "No such view", while the tab title read the right name from the decoded copy. Dropping the encoding does not help: Next re-encodes a colon in a path segment either way, so the fix belongs on the read side. The suite missed it because saved-view-page.test.tsx renders the component directly with a literal id, and view-href.test.ts asserts only the encoding. Nothing crossed the route boundary. The new test asserts the round trip, so encoding and decoding can no longer disagree, and it covers a segment that is not valid percent encoding.
WorkspaceData gained a required role on this branch while #133 added these three fixtures on main. Neither side is wrong on its own; the merge is where they meet.
* fix(issues): announce the children a deleted parent frees deleteIssue already re-parented sub issues to the top level, but it did it silently: no sync id bump and no action, so every other tab kept a cached child pointing at a row that no longer exists. Each freed child now gets the transaction's sync id and its own update action alongside the delete. The DELETE route resolves the issue first, so it accepts an identifier like the GET and PATCH beside it, validates the path with a shared Zod schema, and answers with the id and identifier that went. The MCP tool now parses its issue reference with the same schema. * feat(issues): remove a deleted issue from every cache, here and in other tabs useDeleteIssues replaces the unused single issue hook. It snapshots every issues query, drops the rows optimistically, and restores the snapshot verbatim when the server refuses. A bulk delete that fails half way keeps the issues that really went rather than resurrecting them. The delta bridge dropped a deleted row from lists but left the detail cache alone, so a tab sitting on the deleted issue kept painting it. It now forgets that detail and trims the row out of any parent's sub issue list. Deleting a parent also clears parentId on cached children so nothing points at a row that is gone. * feat(keyboard): let a surface hotkey stand down while a layer owns the key ownsKeyboardLayer reports whether the focused element sits inside an open menu, dialog or listbox, so a destructive surface shortcut can refuse to fire while one of those is holding the keyboard. revealOnCardHover is a named group variant of revealOnHover, for a control that must appear on its own card rather than on every card in the column that wraps it. * feat(issues): delete an issue from every surface that shows one Deleting was reachable from the core service, the REST route and the MCP tool, and from nowhere in the product. It is now on the row overflow menu in every list, the board card menu, the issue detail header, the peek, the multi select bar, and mod+shift+backspace. Every path confirms first through the shared dialog. A single delete names the issue by identifier and title, a bulk delete names the count, and the copy says the loss is permanent instead of leaving people to guess. The shortcut stands down while a menu or the peek holds the keyboard, and it is listed in the shortcuts sheet. The affordance reads the same policy the server enforces, through permissionsFor, so a contributor or guest never sees it and is still refused if they reach the endpoint another way. * refactor(issues): read the delete permission through one optional chain Biome wanted an optional chain at each site that asked whether deletion is both provided and allowed. The route test also resets the database once rather than before every case, which keeps a truncate off the critical path of five tests that only need their own workspace. * fix(issues): stop a tab painting an issue somebody else deleted Both purge paths used removeQueries, which empties the cache entry but leaves a mounted observer holding its last result, so a tab sitting on the deleted issue kept rendering it in full, interactive, and never refetched. Only a manual reload showed it was gone. resetQueries clears the observer too. The two tests that claimed to cover this called setQueryData with no observer mounted, so getQueryData returning undefined passed whether the feature worked or not. The new test mounts a real useQuery, and its second case pins the distinction directly: after removeQueries the component still paints the old row, which is the bug. * refactor(web): keep hover state in the shared interaction tokens The bulk edit bar hand rolled hover:text-danger at the call site, which puts a hover colour change outside the one module the project audits for motion and interaction. Add dangerAction and dangerMenuAction there and spend them instead. Every transition token now also carries motion-reduce:transition-none. The global reduced motion block in globals.css already collapses every transition-duration to 0.01ms with !important, so no viewer was actually receiving the fade, but the tokens are the auditable set and every other motion site in the app states the guard for itself. The new test walks the module's exports rather than restating a literal, so a token added later without the guard, off the duration scale, or transitioning a property that reflows fails by name. * fix(issues): finish a delete only once the server has agreed confirm called onDeleted immediately after remove.mutate, which returns before the request does. A refused delete still navigated the detail page away, still closed the peek, and still cleared the list selection, so the person was told work was destroyed that in fact still existed, or lost their place for nothing. Moving the callback into the mutation's success path also leaves a partly failed bulk delete with its selection intact, which is what the surviving issues need. The optimistic cache already rolled back on error, so this is purely the callback ordering. The tests make the server refuse and assert the caller stayed put: the detail does not navigate, the peek does not close, the selection bar still counts two. They wait on the mutation reaching an error state on the client the test owns, not on the error toast, because other suites leave @/components/ui/toast.tsx mocked process wide and that made the same assertions pass alone and fail in a full run. * fix(issues): let the delete shortcut stand down when it cannot act The detail surface bound the shortcut without asking whether another keyboard layer owned the key, so a menu or dialog holding focus could still raise the delete confirmation behind it. The list already checked ownsKeyboardLayer; the detail now matches it. The list binding also stayed registered when it had nothing to delete. HotkeyProvider calls preventDefault on a match before it runs the handler, so an empty list swallowed the keystroke to reach a handler that could only return. Requiring a target in enabled hands the key back and drops the entry from the shortcuts sheet while the action is out of reach, which is how the peek already gates the same binding. * test(web): import through the @ alias in the tests this branch adds CLAUDE.md asks for @/ inside apps/web, and the new files reached into ../../../src instead. mock.module keys on the resolved path, so the alias intercepts the relative import a component makes of its own neighbour just as the relative specifier did. * test(views): give the views workspace fixtures the role they now need WorkspaceData gained a required role on this branch while #133 added these three fixtures on main. Neither side is wrong on its own; the merge is where they meet.
Three problems reported from
/views: no way to create a view, "All issues" landing in an arbitrary team, and a built-in set that read oddly. All three are fixed here.1. A workspace wide view no longer lands in a random team
views-page.tsxresolved a view's team withA built-in such as "All issues" carries no
filter.teamId, sofind()missed and the fallback sent you to whichever team sorted first. The href builder is now a pure, tested function (features/views/view-href.ts) that routes to a team only when the view names one that still exists, and sends everything else to/views/<id>./views/<id>is a new route. It loads the view server side, hydrates the views query, and renders the issues the view describes across the whole workspace, honouring the view's own filter, ordering, grouping, layout and display options. A project scoped view narrows to that project; the scope is shown in the header. The page reuses the sameFilterBarandDisplayMenuas the team list, so tweaking and saving behaves exactly as it does there.useAllIssues(previously unused) now takes an optional scope, so one hook serves the workspace, a team or a project.2. A real "New view" affordance
A primary New view button sits in the page header, and
Alt+Vopens the same dialog so the old keystroke still means what it meant. The dialog names the view, picks its scope (workspace, a team, or a project), its layout, and then reuses the existing filter builder, grouping, ordering and display property controls rather than reimplementing them. Visibility and sharing go through the existingcreateViewservice; nothing new was added server side, and the private-view scoping introduced recently is untouched.3. The built-in set
Two additions, chosen because a new workspace has nothing saved and both answer a question people ask on day one:
Both hide finished work so they stay actionable. Every built-in now carries a one-line description, shown in the list, so a built-in row is legible without the Owner and Visibility columns (which are hidden on narrow screens).
The Visibility column said "Only me" for built-ins, which was never true of a view every member gets. It now says "Everyone" for built-ins and keeps the stored label for saved views.
4. A team view is now a real thing, not a label on a workspace view
Greptile caught a P1 on the first round and it was right. The dialog offered "My teams", but a
saved view could only record
shared: trueorfalse, so choosing it published the view to thewhole workspace:
listViews, the realtime scopes and the reconnect backfill all authorised anynon-private view at organization scope. The same option was already live in the older
save-view-dialog, so this was not new to this branch.The model can express it now.
viewcarriesvisibility(private,team,workspace) andteam_id, the team a team view belongs to.sharedstays and is derived fromvisibilityin oneplace so the two cannot drift, but nothing authorises on it any more.
viewScopespublishes a team view toteam:<id>and the owner, never to the org.listViewsand the/api/wscatch up backfill share oneviewReadFilter: mine, or workspacewide, or a team view whose team is one of
principal.teamIds.getViewandsetViewFavoritego throughcanReadViewinpackages/shared/src/policy.nobody publishes into a team they are not on, and
teamwith no team is rejected rather thanquietly widened.
A to team B tells team A it is gone. Widening to the workspace deletes nothing.
In the dialogs the option is bound to the team the view covers and reads "Everyone on Engineering".
It only appears when a team is in scope, and if the scope moves off that team the audience falls
back to private, never to the workspace.
Schema change, applied by hand before this ships
packages/db/catchup/view-team-visibility.sqladds the two columns, the foreign key and the index,and backfills them from
sharedand the stored filter. Apply it to production before this codeships, otherwise every saved view query fails on the missing column. It is idempotent, and it was
run twice against a database seeded with legacy rows to prove it. A stored
teamvisibility naminga team that no longer exists, or a team in another workspace, lands on
privaterather thanworkspace: the narrower reading is the safe one.Page layout
The page had a "BUILT IN" header with the saved-views empty state floating in blank space far below it. Each section now carries a one-line description, and the empty state for your own views sits inside that section with its own button.
Tests
Every test below was watched fail first, then the production code was deliberately broken to confirm it bites.
view-href.test.ts, four cases under "a view that covers the whole workspace"?? teams[0]inviewHrefviews-page.test.tsx"sends a workspace wide built-in to a workspace destination"views-page.test.tsx"does not tell people a built-in view is visible only to them"view.virtualbranch fromvisibilityLabelviews-page.test.tsx"creates a view from the dialog and lists it straight away"submit()return beforecreate.mutateviews-page.test.tsx"opens the same dialog from Alt+V"alt+shift+ncreate-view-dialog.test.tsxfilter, layout, grouping and visibility casesdefaultViewConfig('list')instead of the dialog's own configcreate-view-dialog.test.tsxscope casesparseViewScopealways return the workspace scopesaved-view-page.test.tsx"asks the server for exactly the issues the view describes"manualordering touseAllIssuessaved-view-page.test.tsxteam and project scope casesscopeRecordreturn{}saved-view-page.test.tsx"honours the display options it stored"showCompleted: 'all'view-service.test.ts"keeps only issues whose due date has passed"due is setview-service.test.ts"publishes a team view to that team alone", "never carries the filter of a team view in a delta another team receives", "keeps every later delta of a team view off the workspace scope"viewScopes, which returned the org scope for anything sharedview-service.test.ts"lists a team view for the team and hides it from everyone else"or(ownerId = me, shared = 'true')inlistViewsview-service.test.ts"refuses to open a team view from another team"view.shared !== 'true'check inloadReadableViewview-service.test.ts"refuses to publish a view to a team the author is not on", "refuses a team view that names no team"assertAudienceReachablefromcreateViewview-service.test.ts"tells the workspace a view is gone when its owner narrows it to one team", "drops the old team when a view moves to another one"view-service.test.ts"takes nothing away when a team view opens up to the whole workspace"droppedScopesbackfill.test.ts"never replays a team view to somebody on another team"or(ownerId = me, shared = 'true')in the view loaderbackfill.test.ts"still replays a workspace view to everyone"viewReadFilterat a visibility nothing usescreate-view-dialog.test.tsx"offers a team audience only once the view covers a team"visibilityChoicescreate-view-dialog.test.tsx"keeps a team view on the team that owns it"visibility: 'workspace'instead of the chosen audiencecreate-view-dialog.test.tsx"never leaves a team audience on a view that stopped covering a team"allowedVisibilityreturn whatever was chosenfilter-bar.test.tsx"names the team a view on a team page would go to", "offers no team audience where no team is in scope"views-page.test.tsx"names the team a team view is shared with"visibilityLabelThe team scoping tests build two teams and three people against real Postgres, then assert what each of them can list, open, favourite and receive, so the invariant is proven against the database rather than against a mock.
The saved view page tests drive the real query layer through a stubbed
fetch, so the request the page builds is asserted rather than assumed. The core tests run the built-in filters throughlistIssuesagainst Postgres, so "the built-ins work" is proven end to end rather than by inspecting a literal.bun run verifyis green, andbun run buildinapps/webregisters/views/[id]as a dynamic node route.Greptile Summary
This PR adds workspace-wide saved-view pages and view creation while introducing explicit private, team, and workspace visibility throughout persistence, policy checks, listing, and realtime delivery.
/views/<id>and renders their stored filters, scope, layout, grouping, ordering, and display settings.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR UI[Create or update view] --> V[Validate visibility and team] V --> DB[(Persist visibility and team_id)] DB --> P{Audience} P -->|Private| U[Owner scope] P -->|Team| T[Team and owner scopes] P -->|Workspace| O[Organization and owner scopes] DB --> R[Shared read policy] R --> L[List and direct reads] R --> B[Realtime catch-up]Reviews (3): Last reviewed commit: "fix(views): decode the route segment, so..." | Re-trigger Greptile