mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-16 02:40:39 +09:00
[codex] Polish inbox nested issue UI (#4959)
## Thinking Path > - Paperclip orchestrates AI agents through issue lists and issue-thread interactions > - The inbox must preserve nested issue visibility and keyboard navigation as work decomposes into deeper sub-issues > - Some UI polish issues made nested rows harder to scan and pending question cancellation less covered > - The issue list also had a small test indentation regression around load-more behavior > - This pull request tightens nested inbox rendering and related issue-thread/list polish > - The benefit is a more reliable operator inbox for multi-level work trees ## What Changed - Included nested grandchild issues in inbox keyboard navigation and recursive row rendering. - Sort parent rows by descendant activity so active subtrees remain visible. - Removed extra inbox card background styling in favor of the page surface. - Added regression coverage for pending question cancellation. - Cleaned up the issue-list load-more test indentation. ## Verification - `pnpm exec vitest run ui/src/lib/inbox.test.ts ui/src/components/IssueChatThread.test.tsx ui/src/components/IssuesList.test.tsx` - Screenshots were not captured in this PR split; the visible flow is covered by focused component/helper tests and should get browser QA in the follow-up issue. ## Risks - Medium risk: nested inbox rendering and keyboard navigation are user-visible. The changes are localized to inbox grouping/rendering helpers and covered by targeted tests. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - OpenAI Codex, GPT-5 coding agent, tool use and local command execution. Exact context window was not exposed in the runtime. ## 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) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] 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
2d72292ad6
commit
fe401b7fa9
6 changed files with 200 additions and 48 deletions
|
|
@ -634,6 +634,71 @@ describe("inbox helpers", () => {
|
|||
]);
|
||||
});
|
||||
|
||||
it("keeps nested grandchild issues visible in keyboard navigation", () => {
|
||||
const parentIssue = makeIssue("parent", true);
|
||||
parentIssue.lastActivityAt = new Date("2026-03-11T01:00:00.000Z");
|
||||
const childIssue = makeIssue("child", true);
|
||||
childIssue.parentId = parentIssue.id;
|
||||
childIssue.lastActivityAt = new Date("2026-03-11T02:00:00.000Z");
|
||||
const grandchildIssue = makeIssue("grandchild", false);
|
||||
grandchildIssue.parentId = childIssue.id;
|
||||
grandchildIssue.lastActivityAt = new Date("2026-03-11T05:00:00.000Z");
|
||||
|
||||
const [section] = buildGroupedInboxSections(
|
||||
getInboxWorkItems({ issues: [parentIssue, childIssue, grandchildIssue], approvals: [] }),
|
||||
"none",
|
||||
{},
|
||||
{ nestingEnabled: true },
|
||||
);
|
||||
|
||||
expect(section?.displayItems.map((item) => item.kind === "issue" ? item.issue.id : "other")).toEqual([
|
||||
parentIssue.id,
|
||||
]);
|
||||
expect(section?.displayItems[0]?.timestamp).toBe(new Date("2026-03-11T05:00:00.000Z").getTime());
|
||||
|
||||
expect(
|
||||
buildInboxKeyboardNavEntries([section!], new Set(), new Set()).map((entry) => entry.type === "top"
|
||||
? entry.item.kind === "issue" ? entry.item.issue.id : "other"
|
||||
: entry.type === "child"
|
||||
? entry.issueId
|
||||
: entry.groupKey),
|
||||
).toEqual([parentIssue.id, childIssue.id, grandchildIssue.id]);
|
||||
|
||||
expect(
|
||||
buildInboxKeyboardNavEntries([section!], new Set(), new Set([childIssue.id])).map((entry) => entry.type === "top"
|
||||
? entry.item.kind === "issue" ? entry.item.issue.id : "other"
|
||||
: entry.type === "child"
|
||||
? entry.issueId
|
||||
: entry.groupKey),
|
||||
).toEqual([parentIssue.id, childIssue.id]);
|
||||
});
|
||||
|
||||
it("stops cyclic child issue traversal when building keyboard navigation", () => {
|
||||
const parentIssue = makeIssue("parent", true);
|
||||
const childIssue = makeIssue("child", true);
|
||||
childIssue.parentId = parentIssue.id;
|
||||
parentIssue.parentId = childIssue.id;
|
||||
|
||||
const groupedSections = [
|
||||
{
|
||||
key: "workspace:default",
|
||||
displayItems: [{ kind: "issue", timestamp: 2, issue: parentIssue } satisfies InboxWorkItem],
|
||||
childrenByIssueId: new Map([
|
||||
[parentIssue.id, [childIssue]],
|
||||
[childIssue.id, [parentIssue]],
|
||||
]),
|
||||
},
|
||||
];
|
||||
|
||||
expect(
|
||||
buildInboxKeyboardNavEntries(groupedSections, new Set(), new Set()).map((entry) => entry.type === "top"
|
||||
? entry.item.kind === "issue" ? entry.item.issue.id : "other"
|
||||
: entry.type === "child"
|
||||
? entry.issueId
|
||||
: entry.groupKey),
|
||||
).toEqual([parentIssue.id, childIssue.id]);
|
||||
});
|
||||
|
||||
it("emits a group nav entry for labeled groups and omits children when the group is collapsed", () => {
|
||||
const visibleIssue = makeIssue("visible", true);
|
||||
const hiddenIssue = makeIssue("hidden", true);
|
||||
|
|
|
|||
|
|
@ -906,9 +906,26 @@ export function buildInboxNesting(items: InboxWorkItem[]): {
|
|||
}
|
||||
}
|
||||
|
||||
// Sort each child list by most recent activity
|
||||
const subtreeActivityTimestamp = (issue: Issue, seen: ReadonlySet<string> = new Set()): number => {
|
||||
const ownTimestamp = issueLastActivityTimestamp(issue);
|
||||
if (seen.has(issue.id)) return ownTimestamp;
|
||||
const nextSeen = new Set(seen);
|
||||
nextSeen.add(issue.id);
|
||||
const children = childrenByIssueId.get(issue.id) ?? [];
|
||||
if (children.length === 0) return ownTimestamp;
|
||||
return Math.max(
|
||||
ownTimestamp,
|
||||
...children.map((child) => subtreeActivityTimestamp(child, nextSeen)),
|
||||
);
|
||||
};
|
||||
|
||||
// Sort each child list by most recent descendant activity, not just direct issue activity.
|
||||
for (const children of childrenByIssueId.values()) {
|
||||
children.sort(sortIssuesByMostRecentActivity);
|
||||
children.sort((a, b) => {
|
||||
const activityDiff = subtreeActivityTimestamp(b) - subtreeActivityTimestamp(a);
|
||||
if (activityDiff !== 0) return activityDiff;
|
||||
return sortIssuesByMostRecentActivity(a, b);
|
||||
});
|
||||
}
|
||||
|
||||
// Build root issue items with group-adjusted timestamps
|
||||
|
|
@ -917,7 +934,7 @@ export function buildInboxNesting(items: InboxWorkItem[]): {
|
|||
.map((item) => {
|
||||
const children = childrenByIssueId.get(item.issue.id);
|
||||
if (!children?.length) return item;
|
||||
const maxChildTs = Math.max(...children.map(issueLastActivityTimestamp));
|
||||
const maxChildTs = Math.max(...children.map((child) => subtreeActivityTimestamp(child)));
|
||||
return { ...item, timestamp: Math.max(item.timestamp, maxChildTs) };
|
||||
});
|
||||
|
||||
|
|
@ -985,6 +1002,23 @@ export function buildInboxKeyboardNavEntries(
|
|||
}
|
||||
if (isCollapsed) continue;
|
||||
|
||||
const addIssueChildren = (issueId: string, seen: ReadonlySet<string>) => {
|
||||
const children = group.childrenByIssueId.get(issueId);
|
||||
if (!children?.length || collapsedInboxParents.has(issueId)) return;
|
||||
|
||||
for (const child of children) {
|
||||
if (seen.has(child.id)) continue;
|
||||
const nextSeen = new Set(seen);
|
||||
nextSeen.add(child.id);
|
||||
entries.push({
|
||||
type: "child",
|
||||
issueId: child.id,
|
||||
issue: child,
|
||||
});
|
||||
addIssueChildren(child.id, nextSeen);
|
||||
}
|
||||
};
|
||||
|
||||
for (const item of group.displayItems) {
|
||||
entries.push({
|
||||
type: "top",
|
||||
|
|
@ -993,17 +1027,7 @@ export function buildInboxKeyboardNavEntries(
|
|||
});
|
||||
|
||||
if (item.kind !== "issue") continue;
|
||||
|
||||
const children = group.childrenByIssueId.get(item.issue.id);
|
||||
if (!children?.length || collapsedInboxParents.has(item.issue.id)) continue;
|
||||
|
||||
for (const child of children) {
|
||||
entries.push({
|
||||
type: "child",
|
||||
issueId: child.id,
|
||||
issue: child,
|
||||
});
|
||||
}
|
||||
addIssueChildren(item.issue.id, new Set([item.issue.id]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue