Skip to content

Make docs folders real, let cards be dragged on every board, and load a board in one round trip - #165

Merged
imshashank merged 24 commits into
mainfrom
claude/docs-area-redesign-2a2395
Aug 8, 2026
Merged

imshashank merged 24 commits into
mainfrom
claude/docs-area-redesign-2a2395

Conversation

@imshashank

@imshashank imshashank commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Docs organisation was unusable: collections existed but nothing let you put a doc in one, so everything piled into "Project docs" while every folder read "Nothing here yet". Cards could not be dragged on saved views or project boards at all. Boards took upward of ten seconds to appear. This fixes all three, and makes the project header editable.

Docs

Folders are folders. A collection is only ever a container now: folder glyph, icon, count, and nothing opens one as a page. Every doc has exactly one home, enforced in updateDoc rather than trusted from the client, so nesting a page under a parent inherits the parent's folder and carries the whole subtree with it.

Docs can be moved. Drag a page onto a folder to file it, between rows to reorder, onto a page to nest it, with a drop line for a reorder and a folder highlight for a move. The rules live in a pure planDocDrop planner so a drop into a doc's own subtree is refused before any request goes out. Every row also has a menu with rename in place, a move-to submenu, duplicate, copy link, archive and delete.

Search moves to ranked Postgres full text over a weighted vector, title above body, with the matching passage returned by ts_headline and marked in a results panel grouped into title and body hits. Trigram stays for short and partial terms, so billin still finds "Billing reconciliation". The generated search_vector is excluded from every payload, with a test that fails if it ever leaks.

Archive and delete. An Archived section with restore and delete forever, and an undo on the archive toast.

Sharing. Copy link is now always present, at every visibility, which is the headline complaint: you could not hand a colleague a link to a private doc. The dropdown, the segmented control and the separate people dialog collapse into one Share dialog. Someone without access lands on a screen naming the doc and its owner with a Request access button; the owner is notified and grants with one click.

The doc header goes from twelve icon buttons to breadcrumb, save status, Share, one overflow menu and New doc.

Board

Drag works everywhere. Saved views and project boards both hardcoded draggable={false}, which is why dragging did nothing there. Both allow it now, with cross-team state resolution, and cards move between columns even when the board is sorted by something other than manual.

Cards land where they are dropped. The cause was in the cache, not the pointer handling: reconcile refused to insert a row into any list carrying a filter, so a filtered board removed the card from its old column, never added it to the new one, and waited for a refetch. The optimistic move now writes into the destination column directly. Empty columns also show by default on boards, so every state is a drop target.

Pointer-first collision detection, a placeholder gap at the landing spot, edge auto-scroll, no more lift-and-rotate on the dragged card, and row publishing moved to a ref so a drag no longer re-renders every card.

Speed

A board used to walk one cursor-paginated list, 100 rows at a time, sequentially. One new endpoint returns the first page of every column in a single windowed query, then each column pages independently.

Measured against 500 seeded issues across 7 columns:

before after
round trips for the first screen 5 sequential 1
database work 14.4ms 6.6ms

The round-trip count is the real win. Those are localhost numbers, so the query timings understate what this saves against a deployed database.

Projects

Lead, start, target, status and teams are editable in place from the project header, each writing through the project update endpoint, each falling back to plain text without project:manage.

Schema

doc_collection.position, doc.sort_order, a generated doc.search_vector with a GIN index, the doc_access_request table, and two notification reasons. Per the repo rules these must be applied to the target database before this ships. packages/db/catchup/doc-tree-order-catchup.sql backfills the manual order for docs that predate the change.

Checks

bun run verify is green: 3181 tests across nine packages, zero failures, run against the current main merged into this branch.

Greptile Summary

The PR adds real document folders and placement controls, access requests and archival workflows, draggable boards with aggregate initial loading, searchable document content, and editable project metadata.

  • Enforces document placement and sibling ordering in the core service.
  • Loads the first page of all board columns through one aggregate query before enabling independently paginated column queries.
  • Adds document access-request, move, restore, archive, permanent-delete, search, and sharing surfaces.
  • Extends the database schema for document ordering, search vectors, access requests, and notification reasons.

Confidence Score: 5/5

The PR appears safe to merge because both previously reported blocking paths are fixed and no new eligible blocking failure remains.

No blocking failure remains.

Important Files Changed

Filename Overview
packages/core/src/content/doc-service.ts Implements document placement, subtree propagation, scoped sibling anchors, ordering, search ranking, archival, and deletion; the previously reported anchor-scoping defect is fixed.
apps/web/src/features/issues/board.tsx Enables dragging across board contexts and gates individual column queries until aggregate loading completes; the previously reported duplicate-request path is fixed.
apps/web/src/lib/query/use-issues.ts Adds aggregate board fetching, per-column cache seeding, optimistic destination insertion, and independent pagination.
packages/core/src/content/doc-access-request-service.ts Adds organization-scoped document access requests, gateway metadata, owner decisions, and notification actions.
packages/db/src/schema/content.ts Extends document storage with placement ordering and generated full-text search while adding access-request persistence.

Sequence Diagram

sequenceDiagram
  participant UI as Board UI
  participant Aggregate as Aggregate board query
  participant Cache as Query cache
  participant Columns as Column queries
  UI->>Aggregate: Request first page for every column
  Note over UI,Columns: Individual column queries remain disabled
  Aggregate-->>UI: Return grouped first pages and cursors
  UI->>Cache: Seed each column cache
  UI->>Columns: Enable independent pagination
  Columns->>Cache: Read fresh seeded pages
  Columns->>Aggregate: Request only subsequent column pages
Loading

Reviews (3): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

@imshashank
imshashank requested a review from pulkitxm as a code owner August 8, 2026 06:14
@vercel

vercel Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
orbit Ready Ready Preview Aug 8, 2026 10:17am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 114 files, which is 14 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 59658b5c-8851-4c6f-b3fb-12c108e811ad

📥 Commits

Reviewing files that changed from the base of the PR and between 76302f7 and e32bbc0.

📒 Files selected for processing (114)
  • apps/web/AGENTS.md
  • apps/web/CLAUDE.md
  • apps/web/e2e/api.ts
  • apps/web/e2e/doc-drag.spec.ts
  • apps/web/e2e/doc-sharing.spec.ts
  • apps/web/e2e/docs.spec.ts
  • apps/web/e2e/saved-view-drag.spec.ts
  • apps/web/src/app/(app)/projects/[slug]/layout.tsx
  • apps/web/src/app/api/docs/[id]/access-requests/route.ts
  • apps/web/src/app/api/docs/[id]/move/route.ts
  • apps/web/src/app/api/docs/[id]/restore/route.ts
  • apps/web/src/app/api/docs/[id]/route.ts
  • apps/web/src/app/api/docs/access-requests/[requestId]/route.ts
  • apps/web/src/app/api/issues/board/route.ts
  • apps/web/src/components/layout/app-shell.tsx
  • apps/web/src/components/layout/top-bar.tsx
  • apps/web/src/components/ui/dropdown-menu.tsx
  • apps/web/src/components/ui/toast.tsx
  • apps/web/src/features/docs/doc-access-requests.tsx
  • apps/web/src/features/docs/doc-archive-section.tsx
  • apps/web/src/features/docs/doc-body.tsx
  • apps/web/src/features/docs/doc-drop.ts
  • apps/web/src/features/docs/doc-export-menu.tsx
  • apps/web/src/features/docs/doc-gateway.tsx
  • apps/web/src/features/docs/doc-header.tsx
  • apps/web/src/features/docs/doc-history.tsx
  • apps/web/src/features/docs/doc-row-menu.tsx
  • apps/web/src/features/docs/doc-search-results.tsx
  • apps/web/src/features/docs/doc-share-menu.tsx
  • apps/web/src/features/docs/doc-surface.tsx
  • apps/web/src/features/docs/doc-tree-model.ts
  • apps/web/src/features/docs/doc-tree-rows.tsx
  • apps/web/src/features/docs/doc-tree.tsx
  • apps/web/src/features/docs/docs-sidebar.tsx
  • apps/web/src/features/docs/search-highlight.tsx
  • apps/web/src/features/docs/use-doc-drag.ts
  • apps/web/src/features/filters/display-menu.tsx
  • apps/web/src/features/filters/use-view-config.ts
  • apps/web/src/features/filters/view-config.ts
  • apps/web/src/features/inbox/inbox-view.tsx
  • apps/web/src/features/issues/board.tsx
  • apps/web/src/features/issues/issue-card.tsx
  • apps/web/src/features/issues/quick-create.tsx
  • apps/web/src/features/issues/team-view.tsx
  • apps/web/src/features/issues/use-board-autoscroll.ts
  • apps/web/src/features/issues/use-issue-view-model.ts
  • apps/web/src/features/projects/project-fields.tsx
  • apps/web/src/features/projects/project-issues.tsx
  • apps/web/src/features/views/saved-view-page.tsx
  • apps/web/src/lib/docs/paths.ts
  • apps/web/src/lib/query/issue-search.ts
  • apps/web/src/lib/query/keys.ts
  • apps/web/src/lib/query/schemas.ts
  • apps/web/src/lib/query/sync.ts
  • apps/web/src/lib/query/use-doc-access.ts
  • apps/web/src/lib/query/use-docs.ts
  • apps/web/src/lib/query/use-issues.ts
  • apps/web/src/lib/realtime/delta-bridge.tsx
  • apps/web/src/lib/use-media-query.ts
  • apps/web/tests/app/api/docs/duplicate.test.ts
  • apps/web/tests/components/command-palette-docs.test.tsx
  • apps/web/tests/components/layout/top-bar-search.test.tsx
  • apps/web/tests/features/docs/doc-body-chrome.test.tsx
  • apps/web/tests/features/docs/doc-drop.test.ts
  • apps/web/tests/features/docs/doc-export-menu.test.tsx
  • apps/web/tests/features/docs/doc-gateway.test.tsx
  • apps/web/tests/features/docs/doc-reader.test.tsx
  • apps/web/tests/features/docs/doc-share-menu.test.tsx
  • apps/web/tests/features/docs/doc-surface-access.test.tsx
  • apps/web/tests/features/docs/doc-surface-anchors.test.tsx
  • apps/web/tests/features/docs/doc-surface-return.test.tsx
  • apps/web/tests/features/docs/doc-tree-folders.test.tsx
  • apps/web/tests/features/docs/doc-tree-search.test.tsx
  • apps/web/tests/features/docs/doc-tree.test.tsx
  • apps/web/tests/features/docs/docs.test.ts
  • apps/web/tests/features/docs/nest-picker.test.tsx
  • apps/web/tests/features/docs/use-hash-scroll.test.tsx
  • apps/web/tests/features/issues/board-drag-reach.test.ts
  • apps/web/tests/features/issues/issue-card.test.tsx
  • apps/web/tests/features/issues/quick-create.test.tsx
  • apps/web/tests/features/projects/project-fields.test.tsx
  • apps/web/tests/lib/query/board-page.test.ts
  • apps/web/tests/lib/query/use-doc-search.test.tsx
  • apps/web/tests/lib/realtime/delta-bridge.test.tsx
  • docs/superpowers/specs/2026-08-07-docs-and-board-redesign-design.md
  • packages/core/src/content/doc-access-request-service.ts
  • packages/core/src/content/doc-service.ts
  • packages/core/src/index.ts
  • packages/core/src/realtime/backfill.ts
  • packages/core/src/work/issue-service.ts
  • packages/core/tests/content/doc-access-request-service.test.ts
  • packages/core/tests/content/doc-delete.test.ts
  • packages/core/tests/content/doc-payload.test.ts
  • packages/core/tests/content/doc-placement.test.ts
  • packages/core/tests/content/doc-search-ranking.test.ts
  • packages/core/tests/content/doc-search.test.ts
  • packages/core/tests/content/doc-service.test.ts
  • packages/core/tests/realtime/backfill.test.ts
  • packages/core/tests/work/board-groups.test.ts
  • packages/db/catchup/doc-tree-order-catchup.sql
  • packages/db/src/schema/comms.ts
  • packages/db/src/schema/content.ts
  • packages/db/src/schema/types.ts
  • packages/db/tests/schema/index.test.ts
  • packages/services/src/markdown/index.ts
  • packages/services/src/markdown/sanitize.ts
  • packages/services/tests/markdown/markdown.test.ts
  • packages/shared/src/constants/notification.ts
  • packages/shared/src/constants/ordering.ts
  • packages/shared/src/filters/index.ts
  • packages/shared/src/utils/highlight.ts
  • packages/shared/src/utils/index.ts
  • packages/shared/src/validators/doc.ts
  • packages/shared/tests/filters/filters.test.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added documentation Docs, the README, or anything that explains Orbit tests Test coverage and test infrastructure area: web The Next.js app and its UI area: database Schema, migrations, queries, seed area: issues Issues, lists and boards area: docs-feature The docs product and its editor labels Aug 8, 2026
Comment thread apps/web/src/features/issues/board.tsx Resolved
…r its own

fix(docs): only order a moved doc against anchors in its own destination
@imshashank

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

# Conflicts:
#	apps/web/src/lib/query/keys.ts
#	packages/core/src/work/issue-service.ts
… team has no projects or sprints

feat(shell): put a search box in the top bar that opens the command palette
@greptile-apps

greptile-apps Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

Too many files changed for review (114 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

… a column widen its scope

fix(board): order a seeded column by its rank, not by the issue ordering
fix(board): only offer drag to someone who may update an issue
fix(docs): return only placement from a move, never another author's body
test(e2e): cover dragging a doc into a folder and copying a private link
Bound the generated search vector with left(content, 200000) so a long
multibyte doc can never exceed the tsvector byte cap and become
permanently unsavable. Match the body with ts_filter over the stored
vector instead of recomputing to_tsvector per row, and quote the
headline fragment delimiter so it keeps its spaces.

Refuse a move that names both a folder and a project, refuse a parent
the mover cannot read, and refuse a parent already nested MAX_DEPTH
deep, which is what let a cycle slip past the ancestor guard and reach
an unbounded recursive walk. Bound that walk too.

Give every doc a place of its own: deleting a folder now lifts its
pages to the top level with fresh orders and update actions rather
than leaving them silently homeless, deleting a page renumbers the
orphans it promotes, and duplicating twice no longer stacks both
copies on one order. Rebalancing is one statement instead of one per
row, the access request path reads doc columns rather than the whole
vector, and granting write over an existing read raises the level
instead of doing nothing.
A drag that names no neighbour was still writing a fresh sortOrder, so
moving a card between columns collapsed the column's manual order to a
constant. Only reposition when a neighbour is named.

Cap the grouped endpoint at 60 columns, ordered by size, so grouping a
large workspace by assignee or label cannot answer with thousands of
groups. The page reports whether it left any out.

Seed the per column caches from the board query itself so the seed
lands before the columns enable, refuse a column search that would
widen past its scope, read the peek panel from the rows a column
loaded rather than the props, and mark the aggregate page stale after
a mutation so a remount cannot serve a snapshot from before it.

Auto scroll now resolves its scroll containers only when the pointer
has really moved, and steps aside entirely under prefers-reduced-motion.
…e team picker

Every catch up loader ran its own query against the pool, so a write
landing between two of them could be reported by one model and missed
by another while the resume watermark moved past it. They now all read
inside one read only repeatable read transaction.

The markdown renderer dropped the alignment a table asked for, so
| :-: | rendered left aligned. Carry it through as an align attribute
and let the prose styles honour it.

A saved view that never chose whether to show empty groups reported
itself dirty the moment it opened, because the layout default was
compared against the unset tri state. Normalise before comparing.

The project team picker read its selection from a prop that only
refreshes after the round trip, so toggling two teams quickly dropped
the first. It now holds its own selection and re-seeds when the server
answer changes.

Cover the saved view board drag path end to end.
@imshashank
imshashank merged commit c7fc4a0 into main Aug 8, 2026
10 checks passed
@imshashank
imshashank deleted the claude/docs-area-redesign-2a2395 branch August 8, 2026 10:32

This branch was successfully deployed

1 active deployment
Preview — e32bbc0c Deployed Aug 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: database Schema, migrations, queries, seed area: docs-feature The docs product and its editor area: issues Issues, lists and boards area: web The Next.js app and its UI documentation Docs, the README, or anything that explains Orbit tests Test coverage and test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant