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.

Commit

Error groups name an old number legacy_number

The field kept 'issue' in its name. A new telemetry migration renames the column; the contracts, store, web page and docs follow. The reference example's session_url uses the /<ws>/-/work/sessions/<id> address.

G1T-Session:
ses_01m56w3nj9ecqa57g0647a7evd
syntaqxcommitted Parenta80fc2dBrowse files
8 files+36−140/8 viewed
+0−0

Binary or large file; its contents are not shown.

+1−1
8181 An error group names its work item as `item`, its number in the
8282 workspace; `update_error` with `item_number` links one, and `null` unlinks
8383 it. A group linked to an issue before work items, whose work item is not
84−known yet, has that issue's number as `legacy_issue`.
84+known yet, has that old number as `legacy_number`.
8585
8686 ## Apps on g1t.page
8787
+0−0

Binary or large file; its contents are not shown.

+5−5
119119 {g.service || "app"}
120120 </Badge>
121121 {g.environment && <Badge tone="neutral">{g.environment}</Badge>}
122− {(g.item ?? g.legacy_issue) != null && (
122+ {(g.item ?? g.legacy_number) != null && (
123123 <Link
124− to={g.item != null ? itemPath(params.owner, g.item) : `${base}/ref/${g.legacy_issue}`}
124+ to={g.item != null ? itemPath(params.owner, g.item) : `${base}/ref/${g.legacy_number}`}
125125 className="inline-flex items-center gap-1 text-xs text-accent hover:underline"
126126 >
127− <CircleDot size={12} />#{g.item ?? g.legacy_issue}
127+ <CircleDot size={12} />#{g.item ?? g.legacy_number}
128128 </Link>
129129 )}
130130 </p>
162162 <pre className="mt-2 max-h-72 overflow-auto rounded-md border border-line bg-bg p-3 font-mono text-xs whitespace-pre">{g.stack}</pre>
163163 </details>
164164 )}
165− {(can.triage || (can.item && g.item == null && g.legacy_issue == null)) && (
165+ {(can.triage || (can.item && g.item == null && g.legacy_number == null)) && (
166166 <div className="mt-3 flex flex-wrap items-center gap-2 border-t border-line pt-3">
167− {can.item && g.item == null && g.legacy_issue == null && (
167+ {can.item && g.item == null && g.legacy_number == null && (
168168 <Form method="post" className="flex flex-wrap items-center gap-2">
169169 <input type="hidden" name="fingerprint" value={g.fingerprint} />
170170 <SubmitButton name="intent" value="item" size="sm" variant="outline">
+1−1
227227 * project's repository, whose address (`/<owner>/<repo>/issues/<n>`)
228228 * still leads to the work item. Null once `item` is set.
229229 */
230− legacy_issue: number | null;
230+ legacy_number: number | null;
231231 };
232232
233233 /** What every list query can narrow by. */
+22−4
66
77 test("an error group linked to an issue keeps its old number when issues become work items", () => {
88 const db = new DatabaseSync(":memory:");
9− for (const step of MIGRATIONS.slice(0, -1)) db.exec(step);
9+ for (const step of MIGRATIONS.slice(0, -2)) db.exec(step);
1010 db.exec(
1111 `INSERT INTO error_groups (fingerprint, name, message, service, first_us, last_us, issue_number)
1212 VALUES ('fp_1', 'TypeError', 'boom', 'web', 1, 2, 7), ('fp_2', 'TypeError', 'bang', 'web', 1, 2, NULL)`,
1313 );
14+ for (const step of MIGRATIONS.slice(-2)) db.exec(step);
15+ const rows = db.prepare("SELECT fingerprint, item, legacy_number FROM error_groups ORDER BY fingerprint").all();
16+ assert.deepEqual(
17+ rows.map((row) => ({ ...row })),
18+ [
19+ { fingerprint: "fp_1", item: null, legacy_number: 7 },
20+ { fingerprint: "fp_2", item: null, legacy_number: null },
21+ ],
22+ );
23+});
24+
25+test("an error group's old number moves to legacy_number", () => {
26+ const db = new DatabaseSync(":memory:");
27+ for (const step of MIGRATIONS.slice(0, -1)) db.exec(step);
28+ db.exec(
29+ `INSERT INTO error_groups (fingerprint, name, message, service, first_us, last_us, item, legacy_issue)
30+ VALUES ('fp_1', 'TypeError', 'boom', 'web', 1, 2, NULL, 7), ('fp_2', 'TypeError', 'bang', 'web', 1, 2, 3, NULL)`,
31+ );
1432 db.exec(MIGRATIONS.at(-1)!);
15− const rows = db.prepare("SELECT fingerprint, item, legacy_issue FROM error_groups ORDER BY fingerprint").all();
33+ const rows = db.prepare("SELECT fingerprint, item, legacy_number FROM error_groups ORDER BY fingerprint").all();
1634 assert.deepEqual(
1735 rows.map((row) => ({ ...row })),
1836 [
19− { fingerprint: "fp_1", item: null, legacy_issue: 7 },
20− { fingerprint: "fp_2", item: null, legacy_issue: null },
37+ { fingerprint: "fp_1", item: null, legacy_number: 7 },
38+ { fingerprint: "fp_2", item: 3, legacy_number: null },
2139 ],
2240 );
2341 });
+4−0
206206 ALTER TABLE error_groups RENAME COLUMN issue_number TO legacy_issue;
207207 ALTER TABLE error_groups ADD COLUMN item INTEGER;
208208 `,
209+ // That old number is a work item number too, so its column says so.
210+ `
211+ ALTER TABLE error_groups RENAME COLUMN legacy_issue TO legacy_number;
212+ `,
209213 ];
210214
211215 /**
+3−3
573573 this.sql.exec("DELETE FROM spans WHERE start_us < ?", keep);
574574 this.sql.exec("DELETE FROM metric_points WHERE time_us < ?", keep);
575575 this.sql.exec("DELETE FROM rollups WHERE minute < ?", Math.floor((now - ROLLUP_DAYS * DAY_US) / MINUTE_US));
576− this.sql.exec("DELETE FROM error_groups WHERE last_us < ? AND item IS NULL AND legacy_issue IS NULL", now - ROLLUP_DAYS * DAY_US);
576+ this.sql.exec("DELETE FROM error_groups WHERE last_us < ? AND item IS NULL AND legacy_number IS NULL", now - ROLLUP_DAYS * DAY_US);
577577 this.sql.exec("DELETE FROM usage_days WHERE day < ?", day(now - 40 * DAY_US));
578578 // Over its size, the store sheds a day at a time from the oldest.
579579 for (let i = 0; i < 30 && this.state.storage.sql.databaseSize > MAX_BYTES; i++) {
879879 setError(fp: string, change: { state?: ErrorGroup["state"]; item?: number | null }): ErrorGroup | null {
880880 if (change.state && !["open", "resolved", "ignored"].includes(change.state)) throw new Error("State is open, resolved or ignored.");
881881 if (change.state) this.sql.exec("UPDATE error_groups SET state = ? WHERE fingerprint = ?", change.state, fp);
882− if (change.item !== undefined) this.sql.exec("UPDATE error_groups SET item = ?, legacy_issue = NULL WHERE fingerprint = ?", change.item, fp);
882+ if (change.item !== undefined) this.sql.exec("UPDATE error_groups SET item = ?, legacy_number = NULL WHERE fingerprint = ?", change.item, fp);
883883 const row = this.rows("SELECT * FROM error_groups WHERE fingerprint = ?", fp)[0];
884884 return row ? errorOf(row) : null;
885885 }
11291129 last_trace_id: strOrNull(r.last_trace_id),
11301130 state: String(r.state) as ErrorGroup["state"],
11311131 item: numOrNull(r.item),
1132− legacy_issue: numOrNull(r.legacy_issue),
1132+ legacy_number: numOrNull(r.legacy_number),
11331133 };
11341134 }
11351135

Comments

Sign in to comment.