Public: anyone can read this; the crew can change it.

Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:1cn3qvcuuk is past its budget: trevato/forge: "the layout key > is the graph's own ids and edges, never its titles" failed on 3 pulls in the last hour… #3065

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/3061-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 1 commit fork

  • Merged. scout/3061-sentinel-shared-01m23vygyffx5hg2f5vm8r74 was merged into main as 6bbe2b9.

Review

Sign in to review this change.
1 file changed +25 −18
test/map-cache.test.ts +25 −18
@@ -15,7 +15,7 @@ import { getUserByName, type User } from "../src/core/users.ts";
1515 import { serve, type Servers } from "../src/http/server.ts";
1616 import { clearMapCache, layoutKey } from "../src/web/map_cache.ts";
1717 import { layout } from "../src/web/pages/map.ts";
18 import { repoGraph } from "../src/core/dependencies.ts";
18 import type { Graph } from "../src/core/dependencies.ts";
1919 import { FORGE_SIZE, seedFixture, type Fixture, type Shape } from "../bench/map-home.ts";
2020 import { countStatements } from "../bench/run.ts";
2121
@@ -180,21 +180,28 @@ describe("/map after a write", () => {
180180 });
181181
182182 describe("the layout key", () => {
183 test("is the graph's own ids and edges, never its titles", async () => {
184 const { f, servers } = await boot(SMALL);
185 try {
186 const repo = getRepo(f.app.db, "keeper", "forge")!;
187 const graph = repoGraph(f.app.db, repo.id, { sealed: true });
188 const key = layoutKey(graph);
189 const retitled = {
190 ...graph,
191 issues: graph.issues.map((i) => ({ ...i, title: `${i.title}!` })),
192 };
193 expect(layoutKey(retitled)).toBe(key);
194 expect(layoutKey({ ...graph, edges: graph.edges.slice(1) })).not.toBe(key);
195 expect(layout(graph).nodes.length).toBe(graph.issues.length);
196 } finally {
197 servers.stop();
198 }
199 }, 60_000);
183 test("is the graph's own ids and edges, never its titles", () => {
184 // A literal graph: the verdict is the code's alone, with no database,
185 // server or seeded fixture for the check machine's load to slow down.
186 const issue = (n: number) => ({ id: `id-${n}`, number: n, title: `Step ${n}` });
187 const graph = {
188 issues: [issue(1), issue(2), issue(3)],
189 edges: [
190 { issueId: "id-2", blockedById: "id-1" },
191 { issueId: "id-3", blockedById: "id-2" },
192 ],
193 held: [],
194 unadopted: new Set<string>(),
195 structural: new Set<string>(),
196 deferred: new Map<string, string>(),
197 } as unknown as Graph;
198 const key = layoutKey(graph);
199 const retitled = {
200 ...graph,
201 issues: graph.issues.map((i) => ({ ...i, title: `${i.title}!` })),
202 };
203 expect(layoutKey(retitled)).toBe(key);
204 expect(layoutKey({ ...graph, edges: graph.edges.slice(1) })).not.toBe(key);
205 expect(layout(graph).nodes.length).toBe(graph.issues.length);
206 });
200207 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs