Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

23 linesCodeBlameRaw
1import assert from "node:assert/strict";
2import { DatabaseSync } from "node:sqlite";
3import test from "node:test";
4
5import { MIGRATIONS } from "./schema.ts";
6
7test("an error group linked to an issue keeps its old number when issues become work items", () => {
8 const db = new DatabaseSync(":memory:");
9 for (const step of MIGRATIONS.slice(0, -1)) db.exec(step);
10 db.exec(
11 `INSERT INTO error_groups (fingerprint, name, message, service, first_us, last_us, issue_number)
12 VALUES ('fp_1', 'TypeError', 'boom', 'web', 1, 2, 7), ('fp_2', 'TypeError', 'bang', 'web', 1, 2, NULL)`,
13 );
14 db.exec(MIGRATIONS.at(-1)!);
15 const rows = db.prepare("SELECT fingerprint, item, legacy_issue FROM error_groups ORDER BY fingerprint").all();
16 assert.deepEqual(
17 rows.map((row) => ({ ...row })),
18 [
19 { fingerprint: "fp_1", item: null, legacy_issue: 7 },
20 { fingerprint: "fp_2", item: null, legacy_issue: null },
21 ],
22 );
23});