Skip to content

feat(workspaces): add personal workspace archiving - #831

Merged
urjitc merged 4 commits into
mainfrom
codex/archive-workspaces
Sep 3, 2026
Merged

feat(workspaces): add personal workspace archiving#831
urjitc merged 4 commits into
mainfrom
codex/archive-workspaces

Conversation

@urjitc

@urjitc urjitc commented Sep 3, 2026

Copy link
Copy Markdown
Member

Old course workspaces clutter the active home view, but users still need a safe way to retain and revisit them. This adds personal archiving so each member can hide a workspace without affecting collaborators or deleting data.

What was requested

  • Let people archive old workspaces while keeping access to them.
  • Put the archive view in the top-bar control area alongside search.
  • Keep the empty state compact and provide clear archive/restore tooltips.

Changes

  • Store archive state on each workspace membership and expose it explicitly as archivedForCurrentUserAt.
  • Add archive and restore controls to workspace cards for every member role.
  • Add the route-backed /home?view=archived collection view with a muted top-bar filter button.
  • Keep the archive filter reachable on mobile while hiding only the search input.
  • Update caches only after successful mutations, avoiding unsafe optimistic rollbacks.
  • Add a focused test proving the update is scoped by both workspace and current user.

Testing

  • pnpm exec vp check on the 12 changed TypeScript files
  • pnpm exec vp test --run src/features/workspaces/server/mutations.test.ts
  • pnpm db:check
  • git diff --check origin/main...HEAD
  • Manually verified archive, archived-view navigation, restore, URL persistence, and tooltips at localhost:3000

Review Notes

Migration 0009_wild_blazing_skull adds the nullable membership archive timestamp. Workspace-level archivedAt remains the separate deletion lifecycle field.

A full production build was not run; focused checks and the local end-to-end flow cover this change.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Review in cubic

Summary by CodeRabbit

  • New Features
    • Added per-user workspace archiving and restoration.
    • Added an Active/Archived workspace view toggle with archived counts.
    • Added an empty-state message when no archived workspaces are available.
    • Added archive and restore controls to workspace cards, with success and error notifications.
  • Bug Fixes
    • Workspace view navigation now preserves only valid archive-view selections.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-03T19:13:31.203148Z ddf6a67 PR opened
ℹ️ About Codex in GitHub

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

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

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

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 32eaeca.

@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 20 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: f902692e-6058-4ddf-81f4-e4dd02268f46

📥 Commits

Reviewing files that changed from the base of the PR and between ddf6a67 and 32eaeca.

📒 Files selected for processing (3)
  • src/features/workspaces/components/WorkspaceHomePage.tsx
  • src/features/workspaces/use-set-workspace-archive-status.ts
  • src/routes/_protected/home.tsx

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 724a82fd-2c58-4620-8401-cb5e4dddb4a7

📥 Commits

Reviewing files that changed from the base of the PR and between 815a1ff and ddf6a67.

📒 Files selected for processing (15)
  • drizzle-postgres/0009_wild_blazing_skull.sql
  • drizzle-postgres/meta/0009_snapshot.json
  • drizzle-postgres/meta/_journal.json
  • src/db/schema.ts
  • src/features/workspaces/components/WorkspaceCard.tsx
  • src/features/workspaces/components/WorkspaceHomePage.tsx
  • src/features/workspaces/contracts.ts
  • src/features/workspaces/server/functions.ts
  • src/features/workspaces/server/mappers.ts
  • src/features/workspaces/server/mutations.test.ts
  • src/features/workspaces/server/mutations.ts
  • src/features/workspaces/server/queries.ts
  • src/features/workspaces/use-create-workspace.ts
  • src/features/workspaces/use-set-workspace-archive-status.ts
  • src/routes/_protected/home.tsx

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

This change adds per-user workspace archiving. It stores archive timestamps on memberships, exposes archive and restore mutations, updates workspace summaries and caches, and adds active or archived workspace views with card controls.

Changes

Workspace archiving

Layer / File(s) Summary
Archive storage and migration
drizzle-postgres/0009_wild_blazing_skull.sql, drizzle-postgres/meta/*, src/db/schema.ts
Adds nullable archived_at storage to workspace_members and updates migration metadata.
Workspace summary and query contracts
src/features/workspaces/contracts.ts, src/features/workspaces/server/mappers.ts, src/features/workspaces/server/queries.ts, src/features/workspaces/server/mutations.ts
Renames the summary field to archivedForCurrentUserAt and passes membership archive data through workspace queries and mapping.
Archive mutation and client cache flow
src/features/workspaces/server/functions.ts, src/features/workspaces/server/mutations.ts, src/features/workspaces/use-set-workspace-archive-status.ts, src/features/workspaces/server/mutations.test.ts
Adds validated archive and restore mutations, updates caches, shows status toasts, and tests the current-user membership update.
Workspace archive views and controls
src/features/workspaces/components/WorkspaceCard.tsx, src/features/workspaces/components/WorkspaceHomePage.tsx, src/routes/_protected/home.tsx, src/features/workspaces/use-create-workspace.ts
Adds archive controls, active or archived collection navigation, route validation, empty-state rendering, and updated optimistic workspace data.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to ddf6a

No concrete merge-blocking risk remains in the personal workspace archiving flow.

Sequence Diagram(s)

sequenceDiagram
  participant WorkspaceCard
  participant ArchiveMutation
  participant ArchiveServerFunction
  participant WorkspaceMembership
  WorkspaceCard->>ArchiveMutation: submit archive or restore status
  ArchiveMutation->>ArchiveServerFunction: call validated mutation
  ArchiveServerFunction->>WorkspaceMembership: update current user's archivedAt
  WorkspaceMembership-->>ArchiveMutation: return workspace summary
  ArchiveMutation-->>WorkspaceCard: update workspace cache and show toast
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 12 files. (3 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding personal workspace archiving.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 12 files. (3 skipped: 3 unsupported.)

✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/archive-workspaces

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.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ddf6a67876

ℹ️ About Codex in GitHub

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

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

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

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

Comment thread src/features/workspaces/use-set-workspace-archive-status.ts
@greptile-apps

greptile-apps Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This change adds per-user workspace archiving and an archived collection on the workspace home page. The active-search-to-empty-archive interaction was exercised and currently displays a search-empty message instead of the archive-specific empty state. Update WorkspaceHomePage.tsx so an empty archive is communicated correctly after switching collections.

Confidence Score: 4/5

The archive view has a reproducible empty-state messaging defect that should be corrected before release.

A focused component execution reproduced one user-facing behavior issue; no security impact was observed.

Files Needing Attention: src/features/workspaces/components/WorkspaceHomePage.tsx, specifically collection switching and archive empty-state selection.

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex produced a proof for a posted P2 finding and linked it to the corresponding review comment for details.
  • T-Rex produced a second proof for another posted P2 finding; no artifacts were attached.
  • General contract validation traced the WorkspaceHomePage behavior during a search in archived vs active workspaces, showing that changing the view does not clear the search and that the no-results card renders when there are no matches.

View all artifacts

T-Rex Ran code and verified through T-Rex

Comments Outside Diff (1)

  1. General comment

    P2 Archived empty state is hidden by a retained active-view search

    • Bug
      • After a user types a nonempty active-workspace search and opens an empty archived collection, the page displays “No matching workspaces” / NoWorkspaceSearchResultsCard instead of the archive-specific “No archived workspaces” empty state.
    • Cause
      • workspaceSearch is local state and handleWorkspaceCollectionChange at WorkspaceHomePage.tsx:69-76 updates only route view. At lines 66-67, showArchiveEmptyState additionally requires !hasWorkspaceSearch; consequently the retained search directs rendering to lines 117-118.
    • Fix
      • Clear workspaceSearch when the collection changes, or change the archive-empty-state precedence so a zero-item archived collection renders EmptyArchive regardless of a retained search.

    T-Rex Ran code and verified through T-Rex

Fix all with Greploop Fix All in Cursor

Reviews (1): Last reviewed commit: "feat(workspaces): add archive controls" | Re-trigger Greptile

Comment thread src/features/workspaces/components/WorkspaceHomePage.tsx Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 15 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/features/workspaces/use-set-workspace-archive-status.ts
Comment thread src/features/workspaces/components/WorkspaceHomePage.tsx Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 3 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/features/workspaces/use-set-workspace-archive-status.ts Outdated
Comment thread src/features/workspaces/components/WorkspaceHomePage.tsx

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

0 issues found across 1 file (changes from recent commits).

Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.

Re-trigger cubic

@urjitc
urjitc merged commit b7c0046 into main Sep 3, 2026
10 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Dev Board Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant