OUT-3662 | Auto-archive: workspace setting, schema & UI#1197
OUT-3662 | Auto-archive: workspace setting, schema & UI#1197arpandhakal wants to merge 27 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR introduces a per-workspace auto-archive threshold setting: a new
Confidence Score: 4/5Safe to merge after fixing the race condition in the find-then-create GET path. One P1 race condition in the service layer (find-then-create instead of upsert) that can cause a 500 on concurrent first access, capped at 4. All other changes — the migration, DTO schema, policy wiring, UI components, and route redirects — are clean and correct. src/app/api/workspace-settings/workspaceSettings.service.ts — non-atomic find-then-create needs to be replaced with upsert. Important Files Changed
Sequence DiagramsequenceDiagram
participant Browser
participant Page as /configure-tasks-app (RSC)
participant API as /api/workspace-settings
participant DB
Browser->>Page: GET (initial load)
Page->>API: GET — find-or-create
API->>DB: findUnique by workspaceId
alt Row exists
DB-->>API: WorkspaceSetting row
else First access (race-prone path)
DB-->>API: null
API->>DB: create workspaceId
DB-->>API: new row
end
API-->>Page: autoArchiveAfterDays
Page-->>Browser: Renders AutoArchiveSection
Browser->>API: PATCH autoArchiveAfterDays (Save settings)
API->>DB: upsert workspaceSetting
DB-->>API: updated row
API-->>Browser: 200 OK
|
|
Deployment failed with the following error: Learn More: https://vercel.link/multiple-function-regions |
set maxduration to 300
… page
- new WorkspaceSetting table (workspaceId unique, autoArchiveAfterDays Int default 0)
- /api/workspace-settings GET (find-or-create) + PATCH (zod-validated to {0,7,14,30,60,90}); IU-only
- listing page /manage-templates renamed to /configure-tasks-app with permanent redirect; details page /manage-templates/{id} stays put
- new Auto-archive section on the listing page (toggle + days dropdown) wired through the app-bridge "Save settings" CTA
- Templates section gets an inline "+ Add template" trigger; in-page "Create template" primary CTA removed (auto-archive section now owns the primary CTA)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- replace custom Stack trigger with GhostBtn + GrayAddMediumIcon for the "Add template" affordance (the white-stroke PlusIcon was invisible on a light surface; this matches the in-app tertiary-button pattern used by "Create subtask") - restyle the days dropdown: light EDEDF0 border (matches Autocomplete), no MUI focus ring, soft drop-shadow on the menu paper, no hover highlight on items, only the selected item has a subtle gray[100] background - disable open/close and chevron-rotate animations on the dropdown - drop the "Automatically archive completed tasks after 30 days" subtext from the toggle row Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… autoarchived in a cascading manner when their parent are elligible for autoarchived and the script runs
OUT-3663 | Auto-archive: daily cron job & activity log
The merge-base changed after approval.
The merge-base changed after approval.
…M company preview When an internal user enters CRM preview mode for a company, also include tasks assigned to clients of that company (TEAM TASKS) and IU tasks shared with those clients (SHARED WITH TEAM). Previously only company-level tasks and IU tasks shared with the company itself were visible. The shared task/comment filter is now async and fetches the company's clients via copilot.getCompanyClients only when the new IU-company-preview branch fires; the result is memoized per request to avoid duplicate calls. Other flows (client preview, CU portal, normal IU) skip the new branch entirely, so they incur no extra I/O — only an await on a synchronously resolved promise. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces react-dnd (HTML5 drag API + custom drag preview) with @dnd-kit/core for smoother, pointer-tracked task dragging that aligns with the App Library interaction. Drop business logic (redux update + PATCH) is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Hoist DragOverlay/snapCenterToCursor imports to module top (ES modules hoist them anyway; the mid-file placement was misleading). - Drop KeyboardSensor: without a column/section coordinateGetter it produced a non-functional drag affordance for keyboard users. - Document the deliberate touchAction: 'manipulation' choice so the trade-off vs. dnd-kit's recommended 'none' is explicit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ies from limited-access IUs Migrates Tasks.associations from jsonb[] to jsonb to enable Prisma's array_contains operator, then filters tasks by association companyId (not just assignee) for limited-access IUs across API, cascade SQL, and realtime. Also fixes a pre-existing useFilter dedup bug that caused disjoint-promoted subtasks to render twice. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Part 1 of OUT-3496. Sets up persistence, configuration UI, and the API for the per-workspace auto-archive threshold. The Trigger.dev cron that consumes this setting is the second subtask (OUT-3663).
WorkspaceSettingtable —workspaceIdunique,autoArchiveAfterDays Int @default(0).0= off; allowed non-zero values are7, 14, 30, 60, 90./api/workspace-settingsroute —GET(find-or-create) andPATCH(zod-validated to{0, 7, 14, 30, 60, 90}). IU-only viaResource.WorkspaceSetting./manage-templates→/configure-tasks-app(308 redirect kept for the listing). Detail route stays at/manage-templates/{templateId}per the design intent. Visible "Manage templates" copy on buttons/breadcrumbs unchanged.AutoArchiveSection— toggle + conditional days dropdown, owns the app-bridge "Save settings" primary CTA (replaces the old "Create template" CTA, which is now an inline "+ Add template" trigger in the Templates section header).Test plan
prisma migrate deployagainst the target environment and confirmWorkspaceSettingsexists withautoArchiveAfterDaysdefaulting to0.30 days, "Save settings" CTA appears in the parent app header.PATCH /api/workspace-settingsis sent with{ autoArchiveAfterDays: 30 }, row upserted, no error.7,14,60,90), save → value persists across reload.0, reload reflects off state.PATCHwith an invalid value (e.g.5) → API returns 400./manage-templatesURL → redirected to/configure-tasks-app. Stale/manage-templates/{templateId}URLs continue to work (no redirect, route still owns them)./manage-templates/{templateId}and breadcrumbs link back to/configure-tasks-app.🤖 Generated with Claude Code