Skip to content

Commit bf7a459

Browse files
authored
Merge pull request #7286 from shin-core/fix/demo-portfolio-queue-items-7227-v2
fix(miner-ui): align demo portfolio-queue items with the summary, fleet-wide and per repo
2 parents 37ca8a5 + 551cbd6 commit bf7a459

2 files changed

Lines changed: 52 additions & 19 deletions

File tree

apps/loopover-miner-ui/src/lib/demo-data.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,30 @@ describe("demo portfolio-queue items (#5963)", () => {
7878
expect(getDemoPortfolioQueueItems().length).toBeGreaterThan(0);
7979
});
8080

81+
it("its in_progress/done counts match DEMO_PORTFOLIO_QUEUE_SUMMARY both fleet-wide AND per repo (#7227)", () => {
82+
const items = getDemoPortfolioQueueItems();
83+
const count = (rows: typeof items, status: string) => rows.filter((i) => i.status === status).length;
84+
85+
// Fleet-wide: the table can't disagree with the status cards above it.
86+
expect(count(items, "in_progress")).toBe(DEMO_PORTFOLIO_QUEUE_SUMMARY.byStatus.in_progress);
87+
expect(count(items, "done")).toBe(DEMO_PORTFOLIO_QUEUE_SUMMARY.byStatus.done);
88+
89+
// Per repo: each repo's actionable split matches its summary byStatus (only `queued`, which an actionable
90+
// item can't represent, is absent) -- so the fixture is internally consistent at every level.
91+
for (const repo of DEMO_PORTFOLIO_QUEUE_SUMMARY.repos) {
92+
const rows = items.filter((i) => i.repoFullName === repo.repoFullName);
93+
expect(count(rows, "in_progress")).toBe(repo.byStatus.in_progress);
94+
expect(count(rows, "done")).toBe(repo.byStatus.done);
95+
}
96+
});
97+
98+
it("references only the four synthetic demo repos, never a real repo name (#7227)", () => {
99+
const allowed = new Set(DEMO_PORTFOLIO_QUEUE_SUMMARY.repos.map((r) => r.repoFullName));
100+
for (const item of getDemoPortfolioQueueItems()) {
101+
expect(allowed.has(item.repoFullName)).toBe(true);
102+
}
103+
});
104+
81105
it("removeDemoPortfolioQueueItem removes and returns the matching item", () => {
82106
const beforeCount = getDemoPortfolioQueueItems().length;
83107
const target = { ...getDemoPortfolioQueueItems()[0]! };

apps/loopover-miner-ui/src/lib/demo-data.ts

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -97,26 +97,35 @@ export const DEMO_PORTFOLIO_QUEUE_SUMMARY: PortfolioQueueSummary = {
9797
oldestQueuedAgeMs: 6 * 60 * 60 * 1000, // 6h
9898
};
9999

100+
// Every actionable (in_progress/done) row the fleet's DEMO_PORTFOLIO_QUEUE_SUMMARY reports (#7227): 3
101+
// in_progress + 15 done = 18, so the demo "Queue actions" table can't visibly disagree with the status cards.
102+
// The per-repo in_progress/done split also matches each repo's summary byStatus (widgets 1/6, api-gateway 1/4,
103+
// docs-site 0/3, inventory 1/2) -- only the summary's `queued` rows, which PortfolioQueueActionItem can't
104+
// represent, are absent. Entirely synthetic: only the four demo repos and the existing wgt-/gw-/docs-/inv- ids.
105+
const FORGE = "https://forge.example.com";
100106
const DEFAULT_DEMO_PORTFOLIO_QUEUE_ITEMS: PortfolioQueueActionItem[] = [
101-
{
102-
apiBaseUrl: "https://forge.example.com",
103-
repoFullName: "acme/widgets",
104-
identifier: "wgt-2451",
105-
status: "in_progress",
106-
},
107-
{
108-
apiBaseUrl: "https://forge.example.com",
109-
repoFullName: "acme/api-gateway",
110-
identifier: "gw-118",
111-
status: "in_progress",
112-
},
113-
{ apiBaseUrl: "https://forge.example.com", repoFullName: "acme/widgets", identifier: "wgt-2438", status: "done" },
114-
{
115-
apiBaseUrl: "https://forge.example.com",
116-
repoFullName: "northwind/inventory",
117-
identifier: "inv-77",
118-
status: "done",
119-
},
107+
// acme/widgets — 1 in_progress, 6 done
108+
{ apiBaseUrl: FORGE, repoFullName: "acme/widgets", identifier: "wgt-2451", status: "in_progress" },
109+
{ apiBaseUrl: FORGE, repoFullName: "acme/widgets", identifier: "wgt-2438", status: "done" },
110+
{ apiBaseUrl: FORGE, repoFullName: "acme/widgets", identifier: "wgt-2402", status: "done" },
111+
{ apiBaseUrl: FORGE, repoFullName: "acme/widgets", identifier: "wgt-2377", status: "done" },
112+
{ apiBaseUrl: FORGE, repoFullName: "acme/widgets", identifier: "wgt-2340", status: "done" },
113+
{ apiBaseUrl: FORGE, repoFullName: "acme/widgets", identifier: "wgt-2311", status: "done" },
114+
{ apiBaseUrl: FORGE, repoFullName: "acme/widgets", identifier: "wgt-2288", status: "done" },
115+
// acme/api-gateway — 1 in_progress, 4 done
116+
{ apiBaseUrl: FORGE, repoFullName: "acme/api-gateway", identifier: "gw-118", status: "in_progress" },
117+
{ apiBaseUrl: FORGE, repoFullName: "acme/api-gateway", identifier: "gw-104", status: "done" },
118+
{ apiBaseUrl: FORGE, repoFullName: "acme/api-gateway", identifier: "gw-97", status: "done" },
119+
{ apiBaseUrl: FORGE, repoFullName: "acme/api-gateway", identifier: "gw-83", status: "done" },
120+
{ apiBaseUrl: FORGE, repoFullName: "acme/api-gateway", identifier: "gw-76", status: "done" },
121+
// acme/docs-site — 0 in_progress, 3 done
122+
{ apiBaseUrl: FORGE, repoFullName: "acme/docs-site", identifier: "docs-58", status: "done" },
123+
{ apiBaseUrl: FORGE, repoFullName: "acme/docs-site", identifier: "docs-51", status: "done" },
124+
{ apiBaseUrl: FORGE, repoFullName: "acme/docs-site", identifier: "docs-49", status: "done" },
125+
// northwind/inventory — 1 in_progress, 2 done
126+
{ apiBaseUrl: FORGE, repoFullName: "northwind/inventory", identifier: "inv-77", status: "in_progress" },
127+
{ apiBaseUrl: FORGE, repoFullName: "northwind/inventory", identifier: "inv-71", status: "done" },
128+
{ apiBaseUrl: FORGE, repoFullName: "northwind/inventory", identifier: "inv-64", status: "done" },
120129
];
121130

122131
// Mutable, in-memory, browser-session-only copy -- release/requeue removes the item from this actionable list

0 commit comments

Comments
 (0)