Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions pm-stack/aggregator/src/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// the live source so the wire shape is parsed exactly once.
import type { GhItem, OrchestrationSection, ProjectAudit, ProjectPoolItem, RefKey } from "./model.ts";
import { isValidRef, refKey } from "./model.ts";
import { isRecord, isTimestampNotFuture } from "./validate.ts";
import { isIsoDate, isRecord, isTimestampNotFuture } from "./validate.ts";
import { workItemRefSet } from "./work-items.ts";

export const PROJECT_ID = "PVT_kwDOAZNvF84Bouay";
Expand Down Expand Up @@ -468,7 +468,12 @@ export function isProjectPoolItem(v: unknown): v is ProjectPoolItem {
(p.draft === undefined || typeof p.draft === "boolean") &&
(p.labels === undefined || (Array.isArray(p.labels) && p.labels.every((x) => typeof x === "string"))) &&
(p.author === undefined || typeof p.author === "string") &&
(p.updatedAt === undefined || typeof p.updatedAt === "string") &&
// updatedAt feeds Date.parse momentum/recency math downstream, so
// a present non-empty stamp must be a real ISO date: an impossible
// day (2026-02-30) would otherwise roll forward into fabricated
// recent activity (#5202). The collector spellings for a missing
// stamp - absent, or "" from updatedAt ?? "" - still pass.
(p.updatedAt === undefined || p.updatedAt === "" || isIsoDate(p.updatedAt)) &&
(p.closedAt === undefined || typeof p.closedAt === "string") &&
(p.mergedAt === undefined || typeof p.mergedAt === "string") &&
(p.state === "open" || p.state === "closed" || p.state === "merged") &&
Expand Down
21 changes: 21 additions & 0 deletions pm-stack/aggregator/test/projects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,27 @@ const PROV = {
aa: "x",
};

describe("isProjectPoolItem updatedAt gate (#5202)", () => {
const validItem = () => parseProjectItems(GQL)[0];

test("a valid ISO updatedAt passes", () => {
expect(isProjectPoolItem({ ...validItem(), updatedAt: "2026-02-25T00:00:00Z" })).toBe(true);
});

test("impossible and non-ISO updatedAt stamps are refused", () => {
for (const updatedAt of ["2026-02-30T00:00:00Z", "2026-04-31T00:00:00Z", "March 2, 2026", "not-a-date"]) {
expect(isProjectPoolItem({ ...validItem(), updatedAt })).toBe(false);
}
});

test("the collector missing-stamp spellings still pass: empty string and absent", () => {
expect(isProjectPoolItem({ ...validItem(), updatedAt: "" })).toBe(true);
const absent = { ...validItem() };
delete absent.updatedAt;
expect(isProjectPoolItem(absent)).toBe(true);
});
});

describe("collector projects parsing (GraphQL -> feed section)", () => {
test("parses items with fields, ref, and both URLs; skips unlinked drafts", () => {
const pool = parseProjectItems(GQL);
Expand Down
Loading