🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(cli): include acceptance comments and rejection feedback (#19845)
AmAzing-a26015261e92
diff --git a/apps/cli/src/commands/acceptanceCommentFeedback.ts b/apps/cli/src/commands/acceptanceCommentFeedback.tsnew file mode 100644index 00000000000..28dbef8b259--- /dev/null+++ b/apps/cli/src/commands/acceptanceCommentFeedback.ts@@ -0,0 +1,54 @@+import type { AcceptanceCommentItem } from '@lobechat/types';++import { formatAnnotationRegion } from './verifyHelpers';++interface FeedbackCheck {+ id: string;+ seq: number;+ title: string;+}++/** Discussion lives outside getBundle; its threads are resolved explicitly, not by a new round. */+export const collectCommentFeedback = (+ items: AcceptanceCommentItem[],+ checks: FeedbackCheck[],+ evidenceLabels: Map<string, string>,+) => {+ const commentsById = new Map(items.map((item) => [item.id, item]));+ const checksById = new Map(checks.map((check) => [check.id, check]));++ return items.flatMap((item) => {+ if (item.kind !== 'comment' || item.deletedAt) return [];+ // Replies inherit the thread's evidence anchor and resolution state. A+ // deleted root is retained as a tombstone; its surviving replies still matter.+ const root = item.parentCommentId ? commentsById.get(item.parentCommentId) : item;+ if (!root) return [];+ const check = root.checkItemId ? checksById.get(root.checkItemId) : undefined;+ const annotation =+ root.evidenceId && root.rect+ ? { comment: item.content, evidenceId: root.evidenceId, rect: root.rect }+ : undefined;++ return [+ {+ actionable: !root.resolvedAt,+ annotations: annotation+ ? [{ ...annotation, region: formatAnnotationRegion(annotation, evidenceLabels) }]+ : undefined,+ attachments: item.attachments,+ author: item.author,+ checkId: root.checkItemId ?? undefined,+ checkSeq: check?.seq,+ comment: item.content,+ commentId: item.id,+ createdAt: item.createdAt.toISOString(),+ fileIds: item.attachments.map((attachment) => attachment.id),+ kind: 'comment' as const,+ parentCommentId: item.parentCommentId ?? undefined,+ roundIndex: item.contextRoundIndex ?? root.contextRoundIndex ?? 0,+ threadId: root.id,+ title: check?.title,+ },+ ];+ });+};diff --git a/apps/cli/src/commands/acceptanceFeedback.test.ts b/apps/cli/src/commands/acceptanceFeedback.test.tsnew file mode 100644index 00000000000..7b3a28e9400--- /dev/null+++ b/apps/cli/src/commands/acceptanceFeedback.test.ts@@ -0,0 +1,266 @@+import type { AcceptanceCommentItem } from '@lobechat/types';+import { Command } from 'commander';+import { afterEach, beforeEach, expect, it, vi } from 'vitest';++import type * as Format from '../utils/format';+import { registerAcceptanceCommands } from './verifyAcceptance';++const { getBundle, listComments, outputJson } = vi.hoisted(() => ({+ getBundle: vi.fn(),+ listComments: vi.fn(),+ outputJson: vi.fn(),+}));+vi.mock('../api/client', () => ({+ getTrpcClient: async () => ({+ acceptance: { getBundle: { query: getBundle } },+ acceptanceComment: { list: { query: listComments } },+ }),+}));+vi.mock('../utils/format', async (original) => ({+ ...(await original<typeof Format>()),+ outputJson,+}));++const rect = { x: 0.1, y: 0.2, width: 0.3, height: 0.4 };+const comment = (+ id: string,+ overrides: Partial<AcceptanceCommentItem> = {},+): AcceptanceCommentItem => ({+ acceptanceId: 'acceptance-id',+ anchorType: 'evidence',+ attachments: [],+ author: {+ avatar: null,+ fullName: 'Reviewer',+ id: 'user',+ status: 'active',+ type: 'user',+ username: null,+ },+ authorAgentId: null,+ authorUserId: 'user',+ canDelete: true,+ checkItemId: 'table',+ clientId: id,+ content: id,+ contextRoundIndex: 1,+ contextRunId: 'round-1',+ createdAt: new Date('2026-09-22T14:09:00Z'),+ deletedAt: null,+ editorData: null,+ evidenceId: 'image',+ id,+ kind: 'comment',+ parentCommentId: null,+ reactions: [],+ rect,+ resolvedAt: null,+ resolvedByUserId: null,+ updatedAt: new Date('2026-09-22T14:09:00Z'),+ ...overrides,+});++const bundle = () => ({+ checks: [+ {+ id: 'table',+ seq: 2,+ title: 'Token table',+ evidence: [],+ timeline: [{ evidence: [{ id: 'image', description: 'table.png' }] }],+ reviews: [],+ userReview: null,+ },+ ],+ flows: [],+ rounds: [+ {+ run: {+ id: 'round-1',+ roundIndex: 1,+ userDecision: 'reject',+ decisionDetail: {+ comment: 'Read my comments',+ decidedAt: '2026-09-22T14:18:00Z',+ },+ },+ },+ ],+});++const feedback = async (...flags: string[]) => {+ const program = new Command().exitOverride();+ registerAcceptanceCommands(program);+ await program.parseAsync(['node', 'lh', 'acceptance', 'feedback', 'acceptance-id', ...flags]);+ return outputJson.mock.calls.at(-1)?.[0];+};++beforeEach(() => {+ vi.clearAllMocks();+ getBundle.mockResolvedValue(bundle());+ listComments.mockResolvedValue({ items: [], canComment: true, canApprove: true });+});+afterEach(() => vi.restoreAllMocks());++it('returns independent region comments and the overall rejection even without check rejects', async () => {+ listComments.mockResolvedValue({+ items: [+ comment('region', {+ content: 'Not vertically centered',+ attachments: [+ { id: 'attachment', name: 'expected.png', url: 'https://example.com/expected.png' },+ ],+ }),+ ],+ });+ const { entries } = await feedback('--actionable', '--json');+ expect(entries).toHaveLength(2);+ expect(entries[0]).toMatchObject({+ kind: 'decision',+ actionable: true,+ comment: 'Read my comments',+ roundIndex: 1,+ });+ expect(entries[1]).toMatchObject({+ kind: 'comment',+ commentId: 'region',+ threadId: 'region',+ actionable: true,+ comment: 'Not vertically centered',+ checkId: 'table',+ checkSeq: 2,+ title: 'Token table',+ createdAt: '2026-09-22T14:09:00.000Z',+ fileIds: ['attachment'],+ attachments: [{ id: 'attachment', url: 'https://example.com/expected.png' }],+ annotations: [{ evidenceId: 'image', rect, region: expect.stringContaining('table.png') }],+ });+});++it('keeps unresolved older comments and replies actionable across rounds with the original anchor', async () => {+ const data = bundle();+ data.rounds.push({+ run: {+ id: 'round-2',+ roundIndex: 2,+ userDecision: 'accept',+ decisionDetail: { comment: 'Approved', decidedAt: '2026-09-23T14:00:00Z' },+ },+ });+ getBundle.mockResolvedValue(data);+ listComments.mockResolvedValue({+ items: [+ comment('root'),+ comment('reply', {+ anchorType: 'acceptance',+ checkItemId: null,+ evidenceId: null,+ rect: null,+ parentCommentId: 'root',+ contextRoundIndex: 2,+ contextRunId: 'round-2',+ }),+ ],+ });+ const { entries } = await feedback('--actionable', '--json');+ expect(entries).toHaveLength(2);+ expect(entries[1]).toMatchObject({+ commentId: 'reply',+ threadId: 'root',+ parentCommentId: 'root',+ checkId: 'table',+ annotations: [{ evidenceId: 'image', rect }],+ roundIndex: 2,+ });+});++it('excludes resolved threads, deleted comments and non-comment events from actionable feedback', async () => {+ listComments.mockResolvedValue({+ items: [+ comment('resolved', { resolvedAt: new Date() }),+ comment('reply', { parentCommentId: 'resolved' }),+ comment('deleted', { deletedAt: new Date(), content: '' }),+ comment('approval', { kind: 'approval' }),+ comment('proposal', { kind: 'proposal' }),+ comment('reaction', { kind: 'reaction' }),+ comment('global', {+ anchorType: 'acceptance',+ checkItemId: null,+ evidenceId: null,+ rect: null,+ }),+ ],+ });+ const { entries } = await feedback('--actionable', '--json');+ expect(entries.map((entry: { comment: string }) => entry.comment)).toEqual([+ 'Read my comments',+ 'global',+ ]);+ const history = await feedback('--json');+ expect(history.entries.filter((entry: { kind: string }) => entry.kind === 'comment')).toEqual([+ expect.objectContaining({ commentId: 'resolved', actionable: false }),+ expect.objectContaining({ commentId: 'reply', actionable: false }),+ expect.objectContaining({ commentId: 'global', actionable: true }),+ ]);+});++it('preserves live replies to deleted roots and round proposals', async () => {+ listComments.mockResolvedValue({+ items: [+ comment('deleted', { deletedAt: new Date(), content: '' }),+ comment('reply', { parentCommentId: 'deleted' }),+ comment('proposal', { kind: 'proposal' }),+ comment('proposal-reply', { parentCommentId: 'proposal' }),+ ],+ });+ const { entries } = await feedback('--actionable', '--json');+ expect(+ entries+ .filter((entry: { kind: string }) => entry.kind === 'comment')+ .map((entry: { commentId: string }) => entry.commentId),+ ).toEqual(['reply', 'proposal-reply']);+});++it('prints readable region, attachment and overall rejection context in plain text', async () => {+ const stdout = vi.spyOn(console, 'log').mockImplementation(() => {});+ listComments.mockResolvedValue({+ items: [+ comment('region', {+ content: 'Not vertically centered',+ attachments: [{ id: 'attachment', url: 'https://example.com/expected.png' }],+ }),+ ],+ });+ await feedback('--actionable');+ const text = stdout.mock.calls.flat().join('\n');+ expect(text).toContain('Read my comments');+ expect(text).toContain('Not vertically centered');+ expect(text).toContain('C2 Token table');+ expect(text).toContain('table.png');+ expect(text).toContain('attachment');+ expect(text).toContain('https://example.com/expected.png');+ expect(text).not.toContain('No actionable feedback');+});++it('reports a comment read failure instead of claiming there is no feedback', async () => {+ listComments.mockRejectedValue(new Error('Comments unavailable'));+ await expect(feedback('--actionable', '--json')).rejects.toThrow('Comments unavailable');+ expect(outputJson).not.toHaveBeenCalled();+});++it('retains historical rejection notes without treating them or approval notes as current feedback', async () => {+ const data = bundle();+ data.rounds.push({+ run: {+ id: 'round-2',+ roundIndex: 2,+ userDecision: 'accept',+ decisionDetail: { comment: 'Approved', decidedAt: '2026-09-23T14:00:00Z' },+ },+ });+ getBundle.mockResolvedValue(data);+ expect((await feedback('--actionable', '--json')).entries).toEqual([]);+ expect((await feedback('--json')).entries).toEqual([+ expect.objectContaining({ kind: 'decision', comment: 'Read my comments', actionable: false }),+ ]);+});diff --git a/apps/cli/src/commands/acceptanceFlowFeedback.test.ts b/apps/cli/src/commands/acceptanceFlowFeedback.test.tsindex c25be2c0194..eae9ce9bbc9 100644--- a/apps/cli/src/commands/acceptanceFlowFeedback.test.ts+++ b/apps/cli/src/commands/acceptanceFlowFeedback.test.ts@@ -6,7 +6,10 @@ import { registerAcceptanceCommands } from './verifyAcceptance';const { getBundle, outputJson } = vi.hoisted(() => ({ getBundle: vi.fn(), outputJson: vi.fn() }));vi.mock('../api/client', () => ({- getTrpcClient: async () => ({ acceptance: { getBundle: { query: getBundle } } }),+ getTrpcClient: async () => ({+ acceptance: { getBundle: { query: getBundle } },+ acceptanceComment: { list: { query: async () => ({ items: [] }) } },+ }),}));vi.mock('../utils/format', async (original) => ({...(await original<typeof Format>()),diff --git a/apps/cli/src/commands/verifyAcceptance.ts b/apps/cli/src/commands/verifyAcceptance.tsindex b8c02742b05..1903c92c841 100644--- a/apps/cli/src/commands/verifyAcceptance.ts+++ b/apps/cli/src/commands/verifyAcceptance.ts@@ -2,7 +2,7 @@ import { randomUUID } from 'node:crypto';import { readFile } from 'node:fs/promises';import { acceptanceSubjectTypes } from '@lobechat/const/verify';-import type { AcceptanceCheckGroup } from '@lobechat/types';+import type { AcceptanceAttachment, AcceptanceCheckGroup } from '@lobechat/types';import type { Command } from 'commander';import { InvalidArgumentError } from 'commander';import pc from 'picocolors';@@ -11,6 +11,7 @@ import { getTrpcClient } from '../api/client';import { resolveServerUrl } from '../settings';import { outputJson, printTable, timeAgo, truncate } from '../utils/format';import { log } from '../utils/logger';+import { collectCommentFeedback } from './acceptanceCommentFeedback';import { attachAcceptanceFlowCommands } from './acceptanceFlow';import { attachAcceptanceRunCommands } from './acceptanceRun';import type { ReviewAnnotationRegion } from './verifyHelpers';@@ -270,7 +271,7 @@ export function registerAcceptanceCommands(parent: Command, options?: { deprecatacceptance.command('feedback <idOrSubject>').description(- "The user's review feedback — check rejects (with region notes & attachments) plus group-scoped notes",+ "The user's review feedback — unresolved comments, region notes, attachments and rejection decisions",).option('--actionable', 'Only standing feedback the next repair round must act on').option('--json [fields]', 'Output JSON')@@ -278,7 +279,10 @@ export function registerAcceptanceCommands(parent: Command, options?: { deprecatasync (idOrSubject: string, options: { actionable?: boolean; json?: boolean | string }) => {const id = await resolveAcceptanceId(idOrSubject);const client = await getTrpcClient();- const bundle = await client.acceptance.getBundle.query({ id });+ const [bundle, comments] = await Promise.all([+ client.acceptance.getBundle.query({ id }),+ client.acceptanceComment.list.query({ acceptanceId: id }),+ ]);const currentRoundIndex = bundle.rounds.at(-1)?.run.roundIndex ?? 0;@@ -290,13 +294,15 @@ export function registerAcceptanceCommands(parent: Command, options?: { deprecat* screenshot — the location is the actionable half of a region.*/annotations?: (ReviewAnnotationRegion & { region?: string })[];+ attachments?: AcceptanceAttachment[];category?: string;checkId?: string;checkSeq?: number;comment: string;+ commentId?: string;createdAt?: string;fileIds?: string[];- kind: 'check' | 'group' | 'flow';+ kind: 'check' | 'group' | 'flow' | 'comment' | 'decision';roundIndex: number;title?: string;}@@ -392,8 +398,18 @@ export function registerAcceptanceCommands(parent: Command, options?: { deprecat}}for (const round of bundle.rounds) {+ const { decisionDetail, userDecision } = round.run;+ const roundIndex = round.run.roundIndex ?? 0;+ if (userDecision === 'reject' && decisionDetail?.comment?.trim()) {+ entries.push({+ actionable: roundIndex >= currentRoundIndex,+ comment: decisionDetail.comment,+ createdAt: decisionDetail.decidedAt,+ kind: 'decision',+ roundIndex,+ });+ }for (const entry of round.run.decisionDetail?.groupFeedback ?? []) {- const roundIndex = round.run.roundIndex ?? 0;entries.push({actionable: roundIndex >= currentRoundIndex,category: entry.category,@@ -405,6 +421,7 @@ export function registerAcceptanceCommands(parent: Command, options?: { deprecat});}}+ entries.push(...collectCommentFeedback(comments.items, bundle.checks, evidenceLabels));entries.sort((a, b) => (b.createdAt ?? '').localeCompare(a.createdAt ?? ''));const shown = options.actionable ? entries.filter((entry) => entry.actionable) : entries;@@ -424,19 +441,28 @@ export function registerAcceptanceCommands(parent: Command, options?: { deprecatfor (const entry of shown) {const marker = entry.actionable ? pc.red('▶ actionable') : pc.dim('· addressed');const label =- entry.kind === 'check'- ? `C${entry.checkSeq} ${truncate(entry.title ?? '', 60)}`- : entry.kind === 'flow'- ? `flow · ${entry.title}`- : `group · ${entry.category || 'overall'}`;+ entry.kind === 'decision'+ ? 'overall rejection'+ : entry.kind === 'comment'+ ? `comment ${entry.commentId} · ${entry.checkSeq === undefined ? 'overall' : `C${entry.checkSeq} ${truncate(entry.title ?? '', 60)}`}`+ : entry.kind === 'check'+ ? `C${entry.checkSeq} ${truncate(entry.title ?? '', 60)}`+ : entry.kind === 'flow'+ ? `flow · ${entry.title}`+ : `group · ${entry.category || 'overall'}`;console.log(`${marker} ${label} ${pc.dim(`(r${entry.roundIndex})`)}`);if (entry.comment) console.log(` ${entry.comment}`);for (const annotation of entry.annotations ?? []) {- if (annotation.comment) console.log(` ${pc.dim('region:')} ${annotation.comment}`);+ if (annotation.comment && annotation.comment !== entry.comment)+ console.log(` ${pc.dim('region:')} ${annotation.comment}`);if (annotation.region) console.log(` ${pc.dim(`└ ${annotation.region}`)}`);}if (entry.fileIds?.length)console.log(` ${pc.dim(`attachments: ${entry.fileIds.join(', ')}`)}`);+ for (const attachment of entry.attachments ?? []) {+ if (attachment.url)+ console.log(` ${attachment.name ?? attachment.id}: ${attachment.url}`);+ }}},);diff --git a/packages/database/src/models/__tests__/acceptanceComment.test.ts b/packages/database/src/models/__tests__/acceptanceComment.test.tsindex fb36569e1f0..3097efacfbe 100644--- a/packages/database/src/models/__tests__/acceptanceComment.test.ts+++ b/packages/database/src/models/__tests__/acceptanceComment.test.ts@@ -13,6 +13,7 @@ import {verifyEvidence,verifyRuns,} from '../../schemas';+import type { AcceptanceCommentRow } from '../../schemas/acceptanceComment';import type { LobeChatDatabase } from '../../type';import {ACCEPTANCE_COMMENT_PARENT_NOT_FOUND,@@ -199,6 +200,96 @@ describe('AcceptanceCommentModel', () => {});describe('listByAcceptance cap', () => {+ it('retains old thread roots and their review context for replies inside the cap', async () => {+ const roots: AcceptanceCommentRow[] = [];+ for (const clientId of ['open', 'resolved', 'deleted', 'proposal']) {+ const { comment } = await model.create({+ acceptanceId,+ anchor: { checkItemId: 'c2', evidenceId, rect },+ authorUserId: reviewer,+ clientId,+ content: clientId,+ contextRunId: runId,+ kind: clientId === 'proposal' ? 'proposal' : 'comment',+ });+ await serverDB+ .update(acceptanceComments)+ .set({ createdAt: new Date('2025-01-01') })+ .where(eq(acceptanceComments.id, comment.id));+ roots.push(comment);+ }+ await serverDB.insert(acceptanceComments).values({+ acceptanceId,+ authorUserId: owner,+ clientId: 'old-unrelated',+ content: 'Outside the recent window and not a thread parent',+ createdAt: new Date('2025-01-01'),+ });+ const { comment: foreign } = await model.create({+ acceptanceId: otherAcceptanceId,+ authorUserId: owner,+ clientId: 'foreign',+ content: 'A different acceptance',+ });+ // Real rows cross the production cap; a small ordering fixture cannot+ // prove that roots outside the latest 1,000 survive the read.+ await serverDB.insert(acceptanceComments).values(+ Array.from({ length: 1000 }, (_, index) => ({+ acceptanceId,+ authorUserId: owner,+ clientId: `padding-${index}`,+ content: `padding-${index}`,+ createdAt: new Date(Date.UTC(2026, 0, 1, 0, 0, index)),+ })),+ );+ const replies = [];+ for (const [index, root] of [...roots, roots[0]].entries()) {+ const { comment: reply } = await model.create({+ acceptanceId,+ authorUserId: owner,+ clientId: `reply-${index}`,+ content: `reply-${root.clientId}`,+ parentCommentId: root.id,+ });+ await serverDB+ .update(acceptanceComments)+ .set({ createdAt: new Date('2026-09-23') })+ .where(eq(acceptanceComments.id, reply.id));+ replies.push(reply);+ }+ await model.setResolved(roots[1].id, true, reviewer);+ await model.delete(roots[2].id, { authorUserId: reviewer });++ const rows = await model.listByAcceptance(acceptanceId);+ expect(rows).toHaveLength(1004);+ expect(new Set(rows.map((row) => row.id)).size).toBe(rows.length);+ for (const root of roots) {+ expect(rows.find((row) => row.id === root.id)).toMatchObject({+ anchorRect: rect,+ checkItemId: 'c2',+ evidenceId,+ contextRunId: runId,+ });+ }+ expect(rows.find((row) => row.id === roots[1].id)?.resolvedAt).toBeInstanceOf(Date);+ expect(rows.find((row) => row.id === roots[2].id)).toMatchObject({+ content: '',+ deletedAt: expect.any(Date),+ });+ expect(rows.find((row) => row.id === roots[3].id)?.kind).toBe('proposal');+ expect(+ rows+ .slice(-replies.length)+ .map((row) => row.id)+ .sort(),+ ).toEqual(replies.map((row) => row.id).sort());+ expect(rows.every((row, index) => !index || rows[index - 1].createdAt <= row.createdAt)).toBe(+ true,+ );+ expect(rows.some((row) => row.clientId === 'old-unrelated')).toBe(false);+ expect(rows.some((row) => row.id === foreign.id)).toBe(false);+ });+it('keeps the newest rows so a fresh post is never hidden', async () => {// The cap is 1000; prove the ordering rule on a stand-in that is small// enough to write, by checking the tail rather than the head.diff --git a/packages/database/src/models/acceptanceComment.ts b/packages/database/src/models/acceptanceComment.tsindex 315ba7693c2..1f57956ebf1 100644--- a/packages/database/src/models/acceptanceComment.ts+++ b/packages/database/src/models/acceptanceComment.ts@@ -4,7 +4,7 @@ import type {AcceptanceReviewAnnotation,DocumentCommentJson,} from '@lobechat/types';-import { and, count, desc, eq, gte, isNull, ne, sql } from 'drizzle-orm';+import { and, asc, count, desc, eq, gte, inArray, isNull, ne, sql } from 'drizzle-orm';import type { AcceptanceCommentRow } from '../schemas/acceptanceComment';import { acceptanceComments } from '../schemas/acceptanceComment';@@ -184,14 +184,15 @@ export class AcceptanceCommentModel {};/**- * Every row of one acceptance, oldest first. A discussion on one delivery is+ * Recent rows of one acceptance, oldest first. A discussion on one delivery is* small by nature (a handful of people over a handful of rounds), so the page* reads it whole and groups threads client-side.** The cap takes the NEWEST rows and hands them back in reading order. Taking* the oldest would mean that past the cap a successful post never appears —* the write succeeds, the reload drops it, and the author is told nothing.- * Losing the far end of a very long history is the better failure.+ * Retain roots referenced by recent replies even outside that window: they+ * carry the evidence anchor and resolution state needed to read each reply.*/listByAcceptance = async (acceptanceId: string) => {const rows = await this.db@@ -200,7 +201,31 @@ export class AcceptanceCommentModel {.where(eq(acceptanceComments.acceptanceId, acceptanceId)).orderBy(desc(acceptanceComments.createdAt), desc(acceptanceComments.id)).limit(MAX_COMMENTS_PER_ACCEPTANCE);- return rows.reverse();+ const visibleIds = new Set(rows.map((row) => row.id));+ const missingRootIds = [+ ...new Set(+ rows.flatMap((row) =>+ row.kind !== 'reaction' && row.parentCommentId && !visibleIds.has(row.parentCommentId)+ ? [row.parentCommentId]+ : [],+ ),+ ),+ ];+ if (missingRootIds.length === 0) return rows.reverse();++ const roots = await this.db+ .select()+ .from(acceptanceComments)+ .where(+ and(+ eq(acceptanceComments.acceptanceId, acceptanceId),+ inArray(acceptanceComments.id, missingRootIds),+ ),+ )+ .orderBy(asc(acceptanceComments.createdAt), asc(acceptanceComments.id));+ // Missing roots precede the capped window. Keep the DB's ordering (including+ // timestamp precision and ID tie-breaks) rather than sorting hydrated Dates.+ return [...roots, ...rows.reverse()];};/**