mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-18 11:40:39 +09:00
[codex] Improve workspace runtime and navigation ergonomics (#3680)
## Thinking Path > - Paperclip orchestrates AI agents for zero-human companies > - That operator experience depends not just on issue chat, but also on how workspaces, inbox groups, and navigation state behave over long-running sessions > - The current branch included a separate cluster of workspace-runtime controls, inbox grouping, sidebar ordering, and worktree lifecycle fixes > - Those changes cross server, shared contracts, database state, and UI navigation, but they still form one coherent operator workflow area > - This pull request isolates the workspace/runtime and navigation ergonomics work into one standalone branch > - The benefit is better workspace recovery and navigation persistence without forcing reviewers through the unrelated issue-detail/chat work ## What Changed - Improved execution workspace and project workspace controls, request wiring, layout, and JSON editor ergonomics - Hardened linked worktree reuse/startup behavior and documented the `worktree repair` flow for recovering linked worktrees safely - Added inbox workspace grouping, mobile collapse, archive undo, keyboard navigation, shared group-header styling, and persisted collapsed-group behavior - Added persistent sidebar order preferences with the supporting DB migration, shared/server contracts, routes, services, hooks, and UI integration - Scoped issue-list preferences by context and added targeted UI/server tests for workspace controls, inbox behavior, sidebar preferences, and worktree validation ## Verification - `pnpm vitest run server/src/__tests__/sidebar-preferences-routes.test.ts ui/src/pages/Inbox.test.tsx ui/src/components/ProjectWorkspaceSummaryCard.test.tsx ui/src/components/WorkspaceRuntimeControls.test.tsx ui/src/api/workspace-runtime-control.test.ts` - `server/src/__tests__/workspace-runtime.test.ts` was attempted, but the embedded Postgres suite self-skipped/hung on this host after reporting an init-script issue, so it is not counted as a local pass here ## Risks - Medium: this branch includes migration-backed preference storage plus worktree/runtime behavior, so merge review should pay attention to state persistence and worktree recovery semantics - The sidebar preference migration is standalone, but it should still be watched for conflicts if another migration lands first ## Model Used - OpenAI Codex coding agent (GPT-5-class runtime in Codex CLI; exact deployed model ID is not exposed in this environment), reasoning enabled, tool use and local code execution enabled ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [ ] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [ ] If this change affects the UI, I have included before/after screenshots - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
6e6f538630
commit
e89076148a
64 changed files with 18576 additions and 1063 deletions
|
|
@ -12,11 +12,13 @@ import type {
|
|||
} from "@paperclipai/shared";
|
||||
import {
|
||||
DEFAULT_INBOX_ISSUE_COLUMNS,
|
||||
buildInboxKeyboardNavEntries,
|
||||
buildInboxDismissedAtByKey,
|
||||
computeInboxBadgeData,
|
||||
filterInboxIssues,
|
||||
getArchivedInboxSearchIssues,
|
||||
getAvailableInboxIssueColumns,
|
||||
getInboxWorkItemKey,
|
||||
getApprovalsForTab,
|
||||
getInboxWorkItems,
|
||||
getInboxKeyboardSelectionIndex,
|
||||
|
|
@ -28,16 +30,22 @@ import {
|
|||
isMineInboxTab,
|
||||
loadInboxFilterPreferences,
|
||||
loadInboxIssueColumns,
|
||||
loadInboxWorkItemGroupBy,
|
||||
loadCollapsedInboxGroupKeys,
|
||||
loadLastInboxTab,
|
||||
matchesInboxIssueSearch,
|
||||
normalizeInboxIssueColumns,
|
||||
RECENT_ISSUES_LIMIT,
|
||||
resolveInboxNestingEnabled,
|
||||
resolveIssueWorkspaceName,
|
||||
resolveIssueWorkspaceGroup,
|
||||
resolveInboxSelectionIndex,
|
||||
saveInboxFilterPreferences,
|
||||
saveCollapsedInboxGroupKeys,
|
||||
saveInboxIssueColumns,
|
||||
saveInboxWorkItemGroupBy,
|
||||
saveLastInboxTab,
|
||||
shouldResetInboxWorkspaceGrouping,
|
||||
shouldShowInboxSection,
|
||||
type InboxWorkItem,
|
||||
} from "./inbox";
|
||||
|
|
@ -487,6 +495,71 @@ describe("inbox helpers", () => {
|
|||
]);
|
||||
});
|
||||
|
||||
it("skips hidden groups when building keyboard navigation entries", () => {
|
||||
const visibleIssue = makeIssue("visible", true);
|
||||
const hiddenIssue = makeIssue("hidden", true);
|
||||
const approval = makeApprovalWithTimestamps("approval-1", "pending", "2026-03-11T03:00:00.000Z");
|
||||
|
||||
const entries = buildInboxKeyboardNavEntries(
|
||||
[
|
||||
{
|
||||
key: "visible-group",
|
||||
displayItems: [{ kind: "issue", timestamp: 3, issue: visibleIssue }],
|
||||
childrenByIssueId: new Map(),
|
||||
},
|
||||
{
|
||||
key: "hidden-group",
|
||||
displayItems: [
|
||||
{ kind: "issue", timestamp: 2, issue: hiddenIssue },
|
||||
{ kind: "approval", timestamp: 1, approval },
|
||||
],
|
||||
childrenByIssueId: new Map(),
|
||||
},
|
||||
],
|
||||
new Set(["hidden-group"]),
|
||||
new Set(),
|
||||
);
|
||||
|
||||
expect(entries).toEqual([
|
||||
{
|
||||
type: "top",
|
||||
itemKey: `visible-group:${getInboxWorkItemKey({ kind: "issue", timestamp: 3, issue: visibleIssue })}`,
|
||||
item: { kind: "issue", timestamp: 3, issue: visibleIssue },
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("includes child issues only when their parent row is expanded", () => {
|
||||
const parentIssue = makeIssue("parent", true);
|
||||
const childIssue = makeIssue("child", true);
|
||||
childIssue.parentId = parentIssue.id;
|
||||
|
||||
const groupedSections = [
|
||||
{
|
||||
key: "workspace:default",
|
||||
displayItems: [{ kind: "issue", timestamp: 2, issue: parentIssue } satisfies InboxWorkItem],
|
||||
childrenByIssueId: new Map([[parentIssue.id, [childIssue]]]),
|
||||
},
|
||||
];
|
||||
|
||||
expect(
|
||||
buildInboxKeyboardNavEntries(groupedSections, new Set(), new Set()).map((entry) => entry.type === "top"
|
||||
? entry.itemKey
|
||||
: entry.issueId),
|
||||
).toEqual([
|
||||
`workspace:default:${getInboxWorkItemKey({ kind: "issue", timestamp: 2, issue: parentIssue })}`,
|
||||
childIssue.id,
|
||||
]);
|
||||
|
||||
expect(
|
||||
buildInboxKeyboardNavEntries(groupedSections, new Set(), new Set([parentIssue.id])).map((entry) => entry.type === "top"
|
||||
? entry.itemKey
|
||||
: entry.issueId),
|
||||
).toEqual([
|
||||
`workspace:default:${getInboxWorkItemKey({ kind: "issue", timestamp: 2, issue: parentIssue })}`,
|
||||
]);
|
||||
});
|
||||
|
||||
it("sorts self-touched issues without external comments by updatedAt", () => {
|
||||
const recentSelfTouched = makeIssue("recent", false);
|
||||
recentSelfTouched.lastExternalCommentAt = null as unknown as Date;
|
||||
|
|
@ -575,6 +648,22 @@ describe("inbox helpers", () => {
|
|||
)).toBe(true);
|
||||
});
|
||||
|
||||
it("resolves the default workspace into an explicit grouping label", () => {
|
||||
const issue = makeIssue("default", false);
|
||||
issue.projectId = "project-1";
|
||||
issue.projectWorkspaceId = "project-workspace-1";
|
||||
|
||||
expect(resolveIssueWorkspaceGroup(issue, {
|
||||
projectWorkspaceById: new Map([
|
||||
["project-workspace-1", { name: "Primary workspace" }],
|
||||
]),
|
||||
defaultProjectWorkspaceIdByProjectId: new Map([["project-1", "project-workspace-1"]]),
|
||||
})).toEqual({
|
||||
key: "workspace:project:project-workspace-1",
|
||||
label: "Primary workspace (default)",
|
||||
});
|
||||
});
|
||||
|
||||
it("returns archived search matches that are not already visible in the inbox", () => {
|
||||
const visibleIssue = makeIssue("visible", false);
|
||||
visibleIssue.title = "Alpha visible task";
|
||||
|
|
@ -939,4 +1028,82 @@ describe("inbox helpers", () => {
|
|||
{ key: "join_request", label: "Join requests", items: [items[4]] },
|
||||
]);
|
||||
});
|
||||
|
||||
it("groups workspace sections by latest issue activity while preserving non-issue sections", () => {
|
||||
const defaultIssue = makeIssue("default", true);
|
||||
defaultIssue.projectId = "project-1";
|
||||
defaultIssue.projectWorkspaceId = "project-workspace-1";
|
||||
|
||||
const sharedDefaultIssue = makeIssue("shared-default", true);
|
||||
sharedDefaultIssue.projectId = "project-1";
|
||||
sharedDefaultIssue.projectWorkspaceId = "project-workspace-1";
|
||||
sharedDefaultIssue.executionWorkspaceId = "execution-workspace-shared-default";
|
||||
|
||||
const featureIssue = makeIssue("feature", false);
|
||||
featureIssue.projectId = "project-1";
|
||||
featureIssue.projectWorkspaceId = "project-workspace-2";
|
||||
|
||||
const execIssue = makeIssue("exec", false);
|
||||
execIssue.projectId = "project-1";
|
||||
execIssue.projectWorkspaceId = "project-workspace-1";
|
||||
execIssue.executionWorkspaceId = "execution-workspace-1";
|
||||
|
||||
const items: InboxWorkItem[] = [
|
||||
{ kind: "issue", timestamp: 5, issue: defaultIssue },
|
||||
{ kind: "approval", timestamp: 2, approval: makeApproval("pending") },
|
||||
{ kind: "issue", timestamp: 4, issue: sharedDefaultIssue },
|
||||
{ kind: "issue", timestamp: 7, issue: featureIssue },
|
||||
{ kind: "issue", timestamp: 9, issue: execIssue },
|
||||
];
|
||||
|
||||
expect(groupInboxWorkItems(items, "workspace", {
|
||||
executionWorkspaceById: new Map([
|
||||
["execution-workspace-1", { name: "Feature Branch", mode: "isolated_workspace", projectWorkspaceId: "project-workspace-1" }],
|
||||
["execution-workspace-shared-default", { name: "Shared default workspace", mode: "shared_workspace", projectWorkspaceId: "project-workspace-1" }],
|
||||
]),
|
||||
projectWorkspaceById: new Map([
|
||||
["project-workspace-1", { name: "Primary workspace" }],
|
||||
["project-workspace-2", { name: "Secondary workspace" }],
|
||||
]),
|
||||
defaultProjectWorkspaceIdByProjectId: new Map([["project-1", "project-workspace-1"]]),
|
||||
})).toEqual([
|
||||
{ key: "workspace:execution:execution-workspace-1", label: "Feature Branch", items: [items[4]] },
|
||||
{ key: "workspace:project:project-workspace-2", label: "Secondary workspace", items: [items[3]] },
|
||||
{
|
||||
key: "workspace:project:project-workspace-1",
|
||||
label: "Primary workspace (default)",
|
||||
items: [items[0], items[2]],
|
||||
},
|
||||
{ key: "kind:approval", label: "Approvals", items: [items[1]] },
|
||||
]);
|
||||
});
|
||||
|
||||
it("persists workspace grouping preferences", () => {
|
||||
saveInboxWorkItemGroupBy("workspace");
|
||||
expect(loadInboxWorkItemGroupBy()).toBe("workspace");
|
||||
});
|
||||
|
||||
it("persists collapsed inbox groups per company", () => {
|
||||
saveCollapsedInboxGroupKeys("company-1", new Set(["workspace:alpha", "workspace:beta"]));
|
||||
saveCollapsedInboxGroupKeys("company-2", new Set(["type:approval"]));
|
||||
|
||||
expect(loadCollapsedInboxGroupKeys("company-1")).toEqual(new Set(["workspace:alpha", "workspace:beta"]));
|
||||
expect(loadCollapsedInboxGroupKeys("company-2")).toEqual(new Set(["type:approval"]));
|
||||
});
|
||||
|
||||
it("returns empty collapsed inbox groups for missing or invalid storage", () => {
|
||||
expect(loadCollapsedInboxGroupKeys("company-1")).toEqual(new Set());
|
||||
localStorage.setItem("paperclip:inbox:collapsed-groups:company-1", JSON.stringify({ nope: true }));
|
||||
expect(loadCollapsedInboxGroupKeys("company-1")).toEqual(new Set());
|
||||
});
|
||||
|
||||
it("does not reset workspace grouping before experimental settings have loaded", () => {
|
||||
expect(shouldResetInboxWorkspaceGrouping("workspace", false, false)).toBe(false);
|
||||
});
|
||||
|
||||
it("resets workspace grouping only when settings are loaded and workspace grouping is unavailable", () => {
|
||||
expect(shouldResetInboxWorkspaceGrouping("workspace", false, true)).toBe(true);
|
||||
expect(shouldResetInboxWorkspaceGrouping("workspace", true, true)).toBe(false);
|
||||
expect(shouldResetInboxWorkspaceGrouping("none", false, true)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue