@fullstackhouse/cerber 1.2.0-pr.81.58d1702 → 1.2.0-pr.81.aa49442

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -148,6 +148,13 @@ export const PrInfoSchema = z.object({
148
148
  additions: z.number().int().default(0),
149
149
  deletions: z.number().int().default(0),
150
150
  changedFiles: z.number().int().default(0),
151
+ /**
152
+ * When the PR itself last changed on GitHub — not when cerber last wrote this
153
+ * file. On a row nobody has drafted, `updatedAt` is only when the poll found
154
+ * it, so this is what the queue shows and sorts by there. Optional: artifacts
155
+ * written before it existed load without it, and the poll fills it in.
156
+ */
157
+ updatedAt: z.string().optional(),
151
158
  });
152
159
  export const ArtifactStatusSchema = z.enum([
153
160
  "awaiting", // discovered, not yet reviewed by AI
package/dist/core/gh.js CHANGED
@@ -45,7 +45,7 @@ export async function fetchPrInfo(ref) {
45
45
  "--repo",
46
46
  `${ref.owner}/${ref.repo}`,
47
47
  "--json",
48
- "title,url,author,body,baseRefName,headRefName,headRefOid,additions,deletions,changedFiles,state,isDraft",
48
+ "title,url,author,body,baseRefName,headRefName,headRefOid,additions,deletions,changedFiles,state,isDraft,updatedAt",
49
49
  ]);
50
50
  const raw = JSON.parse(out);
51
51
  return PrInfoSchema.parse({
@@ -64,6 +64,7 @@ export async function fetchPrInfo(ref) {
64
64
  additions: raw.additions ?? 0,
65
65
  deletions: raw.deletions ?? 0,
66
66
  changedFiles: raw.changedFiles ?? 0,
67
+ updatedAt: raw.updatedAt ?? undefined,
67
68
  });
68
69
  }
69
70
  /**
@@ -61,6 +61,7 @@ export function stubArtifact(ref, own = false) {
61
61
  headSha: "",
62
62
  state: "OPEN",
63
63
  isDraft: ref.isDraft,
64
+ updatedAt: ref.updatedAt,
64
65
  additions: 0,
65
66
  deletions: 0,
66
67
  changedFiles: 0,
@@ -452,10 +453,22 @@ export function startDaemon(opts) {
452
453
  // predate a draft→ready flip. Refresh from it — it costs nothing, it's
453
454
  // already in hand — or the queue keeps calling a ready PR a draft until
454
455
  // something happens to re-review it.
455
- if (existing.pr.isDraft !== ref.isDraft) {
456
+ //
457
+ // The PR's last activity is refreshed only on a row nobody has drafted,
458
+ // the one place the queue reads it (`activityAt`). Every write bumps the
459
+ // artifact's own `updatedAt`, and on a drafted row that is the review's
460
+ // date: refreshing there would re-date every draft by the poll each time
461
+ // its PR saw a comment, which is the meaningless date this field exists
462
+ // to replace — and would race an open review's refresh besides.
463
+ const activity = existing.status === "awaiting" && existing.pr.updatedAt !== ref.updatedAt;
464
+ if (existing.pr.isDraft !== ref.isDraft || activity) {
456
465
  await updateArtifactByKey(artifactKey(existing.id), (a) => ({
457
466
  ...a,
458
- pr: { ...a.pr, isDraft: ref.isDraft },
467
+ pr: {
468
+ ...a.pr,
469
+ isDraft: ref.isDraft,
470
+ updatedAt: a.status === "awaiting" ? ref.updatedAt : a.pr.updatedAt,
471
+ },
459
472
  }));
460
473
  }
461
474
  continue;
@@ -280,6 +280,9 @@ export async function buildApp(opts) {
280
280
  number: a.pr.number,
281
281
  state: a.pr.state,
282
282
  isDraft: a.pr.isDraft,
283
+ // When the PR itself last changed — what an undrafted row is dated
284
+ // and sorted by in the queue (`activityAt`).
285
+ updatedAt: a.pr.updatedAt,
283
286
  additions: a.pr.additions,
284
287
  deletions: a.pr.deletions,
285
288
  changedFiles: a.pr.changedFiles,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fullstackhouse/cerber",
3
- "version": "1.2.0-pr.81.58d1702",
3
+ "version": "1.2.0-pr.81.aa49442",
4
4
  "description": "AI code-review cockpit: Claude reviews your PRs into local artifacts; nothing reaches GitHub until you say so.",
5
5
  "license": "MIT",
6
6
  "keywords": [