@sentry/junior-github 0.315.0 → 0.317.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.
- package/dist/{events-D3Qnj4yY.js → events-BoMOs5Rd.js} +19 -5
- package/dist/index.js +1688 -727
- package/dist/testing.js +1 -1
- package/migrations/20261124230100_pull_request_requester_ids/migration.sql +1 -0
- package/migrations/20261124230100_pull_request_requester_ids/snapshot.json +45 -0
- package/migrations/20261124230103_pull_request_requester_ids_backfill/migration.sql +27 -0
- package/migrations/20261124230103_pull_request_requester_ids_backfill/snapshot.json +9 -0
- package/migrations/20261125013037_pull_request_opener_ids/migration.sql +9 -0
- package/migrations/20261125013037_pull_request_opener_ids/snapshot.json +9 -0
- package/migrations/20261125013040_pull_request_opener_id_index/migration.sql +1 -0
- package/migrations/20261125013040_pull_request_opener_id_index/snapshot.json +9 -0
- package/migrations/20261125013132_pull_request_opener_id_schema/migration.sql +4 -0
- package/migrations/20261125013132_pull_request_opener_id_schema/snapshot.json +54 -0
- package/package.json +2 -2
- package/skills/github-code/SKILL.md +1 -1
- package/skills/github-code/SPEC.md +1 -1
- package/skills/github-issues/references/api-surface.md +2 -1
package/dist/testing.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { n as normalizeGitHubEvents } from "./events-
|
|
1
|
+
export { n as normalizeGitHubEvents } from "./events-BoMOs5Rd.js";
|
|
@@ -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
|
+
-- 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 @@
|
|
|
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,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.
|
|
3
|
+
"version": "0.317.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.
|
|
32
|
+
"@sentry/junior-plugin-api": "0.317.0",
|
|
33
33
|
"@sinclair/typebox": "^0.34.49",
|
|
34
34
|
"drizzle-orm": "1.0.0-rc.6",
|
|
35
35
|
"ignore": "^7.0.5",
|
|
@@ -37,7 +37,7 @@ Use `git` and `gh` for repository work.
|
|
|
37
37
|
- When an error names a tool, use it. Change permissions only when GitHub rejected the request.
|
|
38
38
|
- Stop for an unclear target, missing access, destructive work, or a GitHub permission failure.
|
|
39
39
|
- Code changes always end in a pushed branch and a PR. Do not ask whether to open one. Skip it only when the user opts out or asks for investigation only.
|
|
40
|
-
- Open the PR as a draft, unless the requester asks for a ready PR. A scope or follow-up question is not a reason to stop: open the PR, and name the question in the PR body and in one line of the reply. Name each open decision of a draft in its PR body: when the required checks pass, the Watch marks a draft with no open decision ready for review. It checks the changed files against CODEOWNERS first: a draft that would ask code owners to review, or whose repo's `AGENTS.md` asks for drafts, stays a draft, and the Watch
|
|
40
|
+
- Open the PR as a draft, unless the requester asks for a ready PR. A scope or follow-up question is not a reason to stop: open the PR, and name the question in the PR body and in one line of the reply. Name each open decision of a draft in its PR body: when the required checks pass, the Watch marks a draft with no open decision ready for review. It checks the changed files against CODEOWNERS first: a draft that would ask code owners to review, or whose repo's `AGENTS.md` asks for drafts, stays a draft, and the Watch asks only the requester to review it, which adds their Inbox item. When the requester approves that draft, the Watch marks it ready.
|
|
41
41
|
- Link the PR. Mention checks only when they failed or were skipped.
|
|
42
42
|
- The runtime adds the requester `via` line. Do not write one.
|
|
43
43
|
- Credit other people, such as a reporter, by GitHub `@login` so GitHub notifies them. Get the login from `userLookup` (`linked_identities` with provider `github`, else a GitHub link in `profile_fields`). Pass the Slack user ID when known. With no login, write the name. Never guess a login. When you delegate the write, put the `@login` in the brief.
|
|
@@ -10,7 +10,7 @@ Guide evidence-first GitHub repository work from inspection through a reviewable
|
|
|
10
10
|
- Preserve unrelated work; reject destructive Git operations except `--force-with-lease` pushes to branches Junior pushed or the requester named.
|
|
11
11
|
- Treat shallow clones as inspection checkouts; deepen before history work; never force-push around missing ancestry.
|
|
12
12
|
- Install dependencies with the lockfile frozen mode before verification when needed.
|
|
13
|
-
- Finish every code change with a pushed PR, without asking, unless the user opts out or asked for investigation only. Open it as a draft unless the requester asks for a ready PR: opening a PR ready asks its code owners at once, and only the draft Watch checks the changed files against CODEOWNERS. An open scope question goes in the PR body, not in a stop. The Watch of a draft marks it ready when its required checks pass and no decision is open, so open decisions of a draft go in its PR body. A draft whose changed files have CODEOWNERS owners, or whose repo's root AGENTS.md asks for draft PRs or for a person to mark them ready, stays a draft unless the requester said to mark it ready, and Junior
|
|
13
|
+
- Finish every code change with a pushed PR, without asking, unless the user opts out or asked for investigation only. Open it as a draft unless the requester asks for a ready PR: opening a PR ready asks its code owners at once, and only the draft Watch checks the changed files against CODEOWNERS. An open scope question goes in the PR body, not in a stop. The Watch of a draft marks it ready when its required checks pass and no decision is open, so open decisions of a draft go in its PR body. A draft whose changed files have CODEOWNERS owners, or whose repo's root AGENTS.md asks for draft PRs or for a person to mark them ready, stays a draft unless the requester said to mark it ready, and Junior asks only the requester to review it on GitHub, which adds their Inbox item. When the requester approves a draft that Junior held, Junior marks it ready, so GitHub asks its code owners only then.
|
|
14
14
|
- After each push to a branch with an open PR, check mergeability. Resolve conflicts without asking, by merging the PR base branch (usually the default branch). Never rebase for this, except in a stack: a stack merges only with a linear history, so stacked PRs restack with `gh stack`. GitHub sends no event for a new conflict, and conflicted PRs get no new checks. The plugin publishes `pull_request.merge_conflict` for a watched PR only when another webhook event arrives for it, and for a Junior PR only while people work on it and never for a draft, so the post-push check stays.
|
|
15
15
|
- Write conventional PR titles and short plain-English bodies; keep check results out of the PR body.
|
|
16
16
|
- Report exact validation and permission failures.
|
|
@@ -38,9 +38,10 @@ Treat explicit repo flags as command-targeting safety rails, not as a credential
|
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
40
|
jr-rpc config get github.repo
|
|
41
|
-
jr-rpc config set github.repo owner/repo
|
|
42
41
|
```
|
|
43
42
|
|
|
43
|
+
Change `github.repo` with the `setConfiguration` tool.
|
|
44
|
+
|
|
44
45
|
## Behavior notes
|
|
45
46
|
|
|
46
47
|
- Prefer `--json` output for machine-readable parsing where available.
|