@sentry/junior-github 0.316.0 → 0.318.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ ALTER TABLE "junior_github_pull_request_requesters" ADD COLUMN "pull_request_id" text;
@@ -0,0 +1,45 @@
1
+ {
2
+ "type": "diff",
3
+ "version": "10",
4
+ "dialect": "postgres",
5
+ "id": "7ac97a3c-2f86-4271-af98-d43ed2f90aec",
6
+ "prevIds": ["d55c20b0-3bf9-43eb-ac58-50b4141aa5c6"],
7
+ "footprints": [
8
+ {
9
+ "statementType": "add_column",
10
+ "statementTarget": [
11
+ "column",
12
+ "public",
13
+ "junior_github_pull_request_requesters",
14
+ "pull_request_id"
15
+ ],
16
+ "writes": [
17
+ "s|col|public.junior_github_pull_request_requesters.pull_request_id",
18
+ "n|col|public.junior_github_pull_request_requesters.pull_request_id",
19
+ "e|col|public.junior_github_pull_request_requesters.pull_request_id"
20
+ ],
21
+ "reads": [
22
+ "n|tbl|public.junior_github_pull_request_requesters",
23
+ "n|sch|public"
24
+ ]
25
+ }
26
+ ],
27
+ "deltas": [
28
+ {
29
+ "op": "create",
30
+ "row": {
31
+ "schema": "public",
32
+ "table": "junior_github_pull_request_requesters",
33
+ "name": "pull_request_id",
34
+ "type": "text",
35
+ "typeSchema": null,
36
+ "notNull": false,
37
+ "dimensions": 0,
38
+ "default": null,
39
+ "generated": null,
40
+ "identity": null,
41
+ "entityType": "columns"
42
+ }
43
+ }
44
+ ]
45
+ }
@@ -0,0 +1,27 @@
1
+ -- The migration before this one adds the GitHub id of the pull request to
2
+ -- its opener's row. Copy it from Junior's code index, by repository name and
3
+ -- number. A renamed repository no longer has the name on the row, so the
4
+ -- second update below finds it through the opener's Conversation.
5
+ -- junior:bounded-backfill: only the opener rows of Junior pull requests, one per pull request that Junior opened for a person, each written once.
6
+ UPDATE junior_github_pull_request_requesters AS requester
7
+ SET pull_request_id = change.provider_id
8
+ FROM junior_code_changes AS change
9
+ JOIN junior_code_repositories AS repository
10
+ ON repository.id = change.repository_id
11
+ WHERE requester.conversation_id IS NOT NULL
12
+ AND requester.pull_request_id IS NULL
13
+ AND change.provider = 'github'
14
+ AND lower(repository.name) = requester.repository_full_name
15
+ AND change.number = requester.number;--> statement-breakpoint
16
+ -- junior:bounded-backfill: only the opener rows that the update above left unset. Each gets the change with its number that its Conversation opened, when only one change matches. Two repositories with that number in one Conversation leave the row unset.
17
+ UPDATE junior_github_pull_request_requesters AS requester
18
+ SET pull_request_id = (
19
+ SELECT min(change.provider_id)
20
+ FROM junior_code_changes AS change
21
+ WHERE change.provider = 'github'
22
+ AND change.number = requester.number
23
+ AND change.conversation_ids @> ARRAY[requester.conversation_id]
24
+ HAVING count(*) = 1
25
+ )
26
+ WHERE requester.conversation_id IS NOT NULL
27
+ AND requester.pull_request_id IS NULL;
@@ -0,0 +1,9 @@
1
+ {
2
+ "type": "diff",
3
+ "version": "10",
4
+ "dialect": "postgres",
5
+ "id": "006495a2-fef5-4823-a9a8-23519cc7e60f",
6
+ "prevIds": ["7ac97a3c-2f86-4271-af98-d43ed2f90aec"],
7
+ "footprints": [],
8
+ "deltas": []
9
+ }
@@ -0,0 +1,9 @@
1
+ -- The next migration lets one opener row, a row with a Conversation, have
2
+ -- each pull request id, because core reads the owner Conversation of a pull
3
+ -- request's Inbox items from that row. The create keeps one opener row per
4
+ -- pull request, so two such rows are rare. When two rows have one id, the
5
+ -- oldest row keeps it, and the other rows lose it. They keep their
6
+ -- Conversation and requester, so a webhook still finds the opener by
7
+ -- repository and number.
8
+ -- junior:bounded-backfill: only opener rows whose pull request id an older opener row also has change.
9
+ UPDATE "junior_github_pull_request_requesters" AS "requester" SET "pull_request_id" = NULL, "updated_at" = now() WHERE "requester"."conversation_id" IS NOT NULL AND "requester"."pull_request_id" IS NOT NULL AND EXISTS (SELECT 1 FROM "junior_github_pull_request_requesters" AS "older" WHERE "older"."conversation_id" IS NOT NULL AND "older"."pull_request_id" = "requester"."pull_request_id" AND ("older"."created_at", "older"."repository_full_name", "older"."number", "older"."identity_id") < ("requester"."created_at", "requester"."repository_full_name", "requester"."number", "requester"."identity_id"));
@@ -0,0 +1,9 @@
1
+ {
2
+ "type": "diff",
3
+ "version": "10",
4
+ "dialect": "postgres",
5
+ "id": "037c7e54-e29d-48b3-b372-f018f721a90c",
6
+ "prevIds": ["006495a2-fef5-4823-a9a8-23519cc7e60f"],
7
+ "footprints": [],
8
+ "deltas": []
9
+ }
@@ -0,0 +1 @@
1
+ CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS "junior_github_pull_request_requesters_opener_id_uidx" ON "junior_github_pull_request_requesters" USING btree ("pull_request_id") WHERE "junior_github_pull_request_requesters"."conversation_id" is not null;
@@ -0,0 +1,9 @@
1
+ {
2
+ "type": "diff",
3
+ "version": "10",
4
+ "dialect": "postgres",
5
+ "id": "014e2bfa-183b-43bc-b81e-3ab454c7c0c3",
6
+ "prevIds": ["037c7e54-e29d-48b3-b372-f018f721a90c"],
7
+ "footprints": [],
8
+ "deltas": []
9
+ }
@@ -0,0 +1,4 @@
1
+ -- This migration does not change the database. The migration before it
2
+ -- builds `junior_github_pull_request_requesters_opener_id_uidx` concurrently,
3
+ -- after the one before that clears duplicate ids. This snapshot records the
4
+ -- index, so `drizzle-kit generate` does not write it again.
@@ -0,0 +1,54 @@
1
+ {
2
+ "type": "diff",
3
+ "version": "10",
4
+ "dialect": "postgres",
5
+ "id": "6daad623-cf70-43e4-8a43-233b09fb3607",
6
+ "prevIds": ["014e2bfa-183b-43bc-b81e-3ab454c7c0c3"],
7
+ "footprints": [
8
+ {
9
+ "statementType": "create_index",
10
+ "statementTarget": [
11
+ "index",
12
+ "public",
13
+ "junior_github_pull_request_requesters",
14
+ "junior_github_pull_request_requesters_opener_id_uidx"
15
+ ],
16
+ "writes": [
17
+ "s|idx|public.junior_github_pull_request_requesters_opener_id_uidx",
18
+ "n|idx|public.junior_github_pull_request_requesters_opener_id_uidx",
19
+ "e|idx|public.junior_github_pull_request_requesters_opener_id_uidx",
20
+ "n|rel|public.junior_github_pull_request_requesters_opener_id_uidx"
21
+ ],
22
+ "reads": [
23
+ "n|tbl|public.junior_github_pull_request_requesters",
24
+ "n|sch|public",
25
+ "n|col|public.junior_github_pull_request_requesters.pull_request_id"
26
+ ]
27
+ }
28
+ ],
29
+ "deltas": [
30
+ {
31
+ "op": "create",
32
+ "row": {
33
+ "schema": "public",
34
+ "table": "junior_github_pull_request_requesters",
35
+ "name": "junior_github_pull_request_requesters_opener_id_uidx",
36
+ "nameExplicit": true,
37
+ "columns": [
38
+ {
39
+ "value": "pull_request_id",
40
+ "isExpression": false,
41
+ "asc": true,
42
+ "nullsFirst": false,
43
+ "opclass": null
44
+ }
45
+ ],
46
+ "isUnique": true,
47
+ "where": "\"conversation_id\" is not null",
48
+ "with": "",
49
+ "method": "btree",
50
+ "entityType": "indexes"
51
+ }
52
+ }
53
+ ]
54
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-github",
3
- "version": "0.316.0",
3
+ "version": "0.318.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@0no-co/graphql.web": "^1.3.4",
32
- "@sentry/junior-plugin-api": "0.316.0",
32
+ "@sentry/junior-plugin-api": "0.318.0",
33
33
  "@sinclair/typebox": "^0.34.49",
34
34
  "drizzle-orm": "1.0.0-rc.6",
35
35
  "ignore": "^7.0.5",