fix: hide harness issues from recent history

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-08-27 15:36:17 +00:00
1 parent c506d8c1b7
commit c6c52013ec
2 files changed
+7 -3

No files matched your search

@@ -160,6 +160,9 @@ describeEmbeddedPostgres("issue user recency persistence", () => {
}
const oldIssueId = await seedIssue(companyId, "Old", "RQB-28");
await recordIssueUserRecency(db, { companyId, userId, issueIds: [oldIssueId], kind: "commented", interactedAt: new Date("2026-07-01T00:00:00.000Z") });
const harnessIssueId = await seedIssue(companyId, "Internal harness", "RQB-29");
await db.update(issues).set({ harnessKind: "skill_test" }).where(eq(issues.id, harnessIssueId));
await recordIssueUserRecency(db, { companyId, userId, issueIds: [harnessIssueId], kind: "edited", interactedAt: now });
const otherIssueId = await seedIssue(otherCompanyId, "Other company", "RQC-1");
await recordIssueUserRecency(db, { companyId: otherCompanyId, userId, issueIds: [otherIssueId], kind: "edited", interactedAt: now });
@@ -179,7 +182,7 @@ describeEmbeddedPostgres("issue user recency persistence", () => {
const rows = await issueUserRecencyService(db).listRecentIssues(companyId, userId, 100, now);
expect(rows).toHaveLength(25);
expect(rows.map((row) => row.id)).toEqual(issueIds.slice(0, 25));
expect(rows.some((row) => row.id === oldIssueId || row.id === otherIssueId)).toBe(false);
expect(rows.some((row) => [oldIssueId, harnessIssueId, otherIssueId].includes(row.id))).toBe(false);
expect(rows[0]).toMatchObject({ hasActiveRun: true, needsAttention: true });
});
+3 -2
View File
@@ -1,4 +1,4 @@
import { and, desc, eq, gte, isNull, sql } from "drizzle-orm";
import { and, desc, eq, gte, sql } from "drizzle-orm";
import {
approvals,
heartbeatRuns,
@@ -10,6 +10,7 @@ import {
} from "@paperclipai/db";
import type { IssueStatus, IssueUserRecencyKind, RecentIssue } from "@paperclipai/shared";
import type { LogActivityInput } from "./activity-log.js";
import { visibleIssueCondition } from "./issue-visibility.js";
export const RECENT_ISSUES_MAX_LIMIT = 25;
export const RECENT_ISSUES_WINDOW_DAYS = 30;
@@ -151,7 +152,7 @@ export function issueUserRecencyService(db: Db) {
eq(issueUserRecency.companyId, companyId),
eq(issueUserRecency.userId, userId),
gte(issueUserRecency.lastInteractedAt, cutoff),
isNull(issues.hiddenAt),
visibleIssueCondition(),
))
.orderBy(desc(issueUserRecency.lastInteractedAt), desc(issueUserRecency.issueId))
.limit(limit);