@biffo/cli 0.298.20 → 0.298.22
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.
|
@@ -489,7 +489,7 @@ function formatGroundTruthFailure({ closingIssuesReferences }) {
|
|
|
489
489
|
`GitHub's own closingIssuesReferences says this PR will close ${refs.join(', ')} on`,
|
|
490
490
|
'merge — but nothing in the PR body, title or commit messages reads as a',
|
|
491
491
|
'DELIBERATE closing directive (a keyword+reference at the start of the',
|
|
492
|
-
|
|
492
|
+
"document, a line, or a sentence). GitHub's linker does not care about",
|
|
493
493
|
'paths or sentence position; it only needs the lexical shape, wherever it',
|
|
494
494
|
'sits.',
|
|
495
495
|
'',
|
|
@@ -738,24 +738,64 @@ export async function resolveCommits({
|
|
|
738
738
|
* Fetch a PR's `closingIssuesReferences` via the GitHub CLI — GitHub's own
|
|
739
739
|
* ground truth for which issues this PR will close on merge (#1686). Same
|
|
740
740
|
* split as the other fetchers so tests can inject a fake. Each element is
|
|
741
|
-
* the shape `gh pr view --json closingIssuesReferences` returns:
|
|
742
741
|
* `{ id, number, repository: {...}, url }` (confirmed live against PR #1417,
|
|
743
|
-
* which genuinely closes an issue).
|
|
742
|
+
* which genuinely closes an issue, and against #1730/tabsii-crm#379 below).
|
|
743
|
+
*
|
|
744
|
+
* This calls `gh api graphql` with an explicit query, NOT `gh pr view --json
|
|
745
|
+
* closingIssuesReferences`. That shorthand only works if the installed `gh`
|
|
746
|
+
* binary's OWN hardcoded `--json` field allowlist happens to include the
|
|
747
|
+
* field — `closingIssuesReferences` was added to that allowlist partway
|
|
748
|
+
* through gh's release history, so it is a property of the CLI binary, not
|
|
749
|
+
* of the GitHub API. tabsii-crm#379 failed identically on two attempts of
|
|
750
|
+
* the same commit with `Unknown JSON field: "closingIssuesReferences"` —
|
|
751
|
+
* this repo's own `gh` (2.96.0) lists the field, but tabsii-crm's Release
|
|
752
|
+
* Guards runs on ITS OWN self-hosted runner fleet (`vars.RUNNER_LABEL:
|
|
753
|
+
* tabsii`), whose baked-in `gh` binary predates it. That is a real, and
|
|
754
|
+
* recurring, source of drift: every satellite's runner image can lag behind
|
|
755
|
+
* whatever `gh` happens to be on the machine this file was last tested on,
|
|
756
|
+
* and `check-closing-keywords.mjs` is distributed VERBATIM (`shared-files.json`
|
|
757
|
+
* `files`) to every one of them — so pinning to a newer allowlisted field is
|
|
758
|
+
* a bug this file WILL hit again on the next satellite with an older image,
|
|
759
|
+
* not a one-off.
|
|
760
|
+
*
|
|
761
|
+
* `gh api graphql` has no such allowlist: it sends the query text through
|
|
762
|
+
* to GitHub's GraphQL endpoint verbatim, and has done so since `gh api` was
|
|
763
|
+
* introduced, long before `closingIssuesReferences` reached `pr view --json`.
|
|
764
|
+
* Asking for a field GitHub's schema does not have is still a real failure —
|
|
765
|
+
* it always was, and always will be, GitHub's error rather than the local
|
|
766
|
+
* binary's — but a locally-out-of-date `gh` can no longer manufacture a
|
|
767
|
+
* false one. This removes the CLI-version dependency instead of chasing it
|
|
768
|
+
* runner image by runner image.
|
|
744
769
|
*/
|
|
745
770
|
export async function fetchPrClosingIssuesReferencesViaGh({ GH_TOKEN, PR_NUMBER, GH_REPO }) {
|
|
746
771
|
const { execFileSync } = await import('node:child_process')
|
|
772
|
+
const [owner, repo] = GH_REPO.split('/')
|
|
773
|
+
const query = `
|
|
774
|
+
query($owner: String!, $repo: String!, $num: Int!) {
|
|
775
|
+
repository(owner: $owner, name: $repo) {
|
|
776
|
+
pullRequest(number: $num) {
|
|
777
|
+
closingIssuesReferences(first: 50) {
|
|
778
|
+
nodes { id number url repository { nameWithOwner } }
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
`
|
|
747
784
|
const raw = execFileSync(
|
|
748
785
|
'gh',
|
|
749
786
|
[
|
|
750
|
-
'
|
|
751
|
-
'
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
'
|
|
787
|
+
'api',
|
|
788
|
+
'graphql',
|
|
789
|
+
'-f',
|
|
790
|
+
`query=${query}`,
|
|
791
|
+
'-f',
|
|
792
|
+
`owner=${owner}`,
|
|
793
|
+
'-f',
|
|
794
|
+
`repo=${repo}`,
|
|
795
|
+
'-F',
|
|
796
|
+
`num=${PR_NUMBER}`,
|
|
757
797
|
'--jq',
|
|
758
|
-
'.closingIssuesReferences',
|
|
798
|
+
'.data.repository.pullRequest.closingIssuesReferences.nodes',
|
|
759
799
|
],
|
|
760
800
|
{ encoding: 'utf8', env: { ...process.env, GH_TOKEN } },
|
|
761
801
|
).trim()
|
|
@@ -489,7 +489,7 @@ function formatGroundTruthFailure({ closingIssuesReferences }) {
|
|
|
489
489
|
`GitHub's own closingIssuesReferences says this PR will close ${refs.join(', ')} on`,
|
|
490
490
|
'merge — but nothing in the PR body, title or commit messages reads as a',
|
|
491
491
|
'DELIBERATE closing directive (a keyword+reference at the start of the',
|
|
492
|
-
|
|
492
|
+
"document, a line, or a sentence). GitHub's linker does not care about",
|
|
493
493
|
'paths or sentence position; it only needs the lexical shape, wherever it',
|
|
494
494
|
'sits.',
|
|
495
495
|
'',
|
|
@@ -738,24 +738,64 @@ export async function resolveCommits({
|
|
|
738
738
|
* Fetch a PR's `closingIssuesReferences` via the GitHub CLI — GitHub's own
|
|
739
739
|
* ground truth for which issues this PR will close on merge (#1686). Same
|
|
740
740
|
* split as the other fetchers so tests can inject a fake. Each element is
|
|
741
|
-
* the shape `gh pr view --json closingIssuesReferences` returns:
|
|
742
741
|
* `{ id, number, repository: {...}, url }` (confirmed live against PR #1417,
|
|
743
|
-
* which genuinely closes an issue).
|
|
742
|
+
* which genuinely closes an issue, and against #1730/tabsii-crm#379 below).
|
|
743
|
+
*
|
|
744
|
+
* This calls `gh api graphql` with an explicit query, NOT `gh pr view --json
|
|
745
|
+
* closingIssuesReferences`. That shorthand only works if the installed `gh`
|
|
746
|
+
* binary's OWN hardcoded `--json` field allowlist happens to include the
|
|
747
|
+
* field — `closingIssuesReferences` was added to that allowlist partway
|
|
748
|
+
* through gh's release history, so it is a property of the CLI binary, not
|
|
749
|
+
* of the GitHub API. tabsii-crm#379 failed identically on two attempts of
|
|
750
|
+
* the same commit with `Unknown JSON field: "closingIssuesReferences"` —
|
|
751
|
+
* this repo's own `gh` (2.96.0) lists the field, but tabsii-crm's Release
|
|
752
|
+
* Guards runs on ITS OWN self-hosted runner fleet (`vars.RUNNER_LABEL:
|
|
753
|
+
* tabsii`), whose baked-in `gh` binary predates it. That is a real, and
|
|
754
|
+
* recurring, source of drift: every satellite's runner image can lag behind
|
|
755
|
+
* whatever `gh` happens to be on the machine this file was last tested on,
|
|
756
|
+
* and `check-closing-keywords.mjs` is distributed VERBATIM (`shared-files.json`
|
|
757
|
+
* `files`) to every one of them — so pinning to a newer allowlisted field is
|
|
758
|
+
* a bug this file WILL hit again on the next satellite with an older image,
|
|
759
|
+
* not a one-off.
|
|
760
|
+
*
|
|
761
|
+
* `gh api graphql` has no such allowlist: it sends the query text through
|
|
762
|
+
* to GitHub's GraphQL endpoint verbatim, and has done so since `gh api` was
|
|
763
|
+
* introduced, long before `closingIssuesReferences` reached `pr view --json`.
|
|
764
|
+
* Asking for a field GitHub's schema does not have is still a real failure —
|
|
765
|
+
* it always was, and always will be, GitHub's error rather than the local
|
|
766
|
+
* binary's — but a locally-out-of-date `gh` can no longer manufacture a
|
|
767
|
+
* false one. This removes the CLI-version dependency instead of chasing it
|
|
768
|
+
* runner image by runner image.
|
|
744
769
|
*/
|
|
745
770
|
export async function fetchPrClosingIssuesReferencesViaGh({ GH_TOKEN, PR_NUMBER, GH_REPO }) {
|
|
746
771
|
const { execFileSync } = await import('node:child_process')
|
|
772
|
+
const [owner, repo] = GH_REPO.split('/')
|
|
773
|
+
const query = `
|
|
774
|
+
query($owner: String!, $repo: String!, $num: Int!) {
|
|
775
|
+
repository(owner: $owner, name: $repo) {
|
|
776
|
+
pullRequest(number: $num) {
|
|
777
|
+
closingIssuesReferences(first: 50) {
|
|
778
|
+
nodes { id number url repository { nameWithOwner } }
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
`
|
|
747
784
|
const raw = execFileSync(
|
|
748
785
|
'gh',
|
|
749
786
|
[
|
|
750
|
-
'
|
|
751
|
-
'
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
'
|
|
787
|
+
'api',
|
|
788
|
+
'graphql',
|
|
789
|
+
'-f',
|
|
790
|
+
`query=${query}`,
|
|
791
|
+
'-f',
|
|
792
|
+
`owner=${owner}`,
|
|
793
|
+
'-f',
|
|
794
|
+
`repo=${repo}`,
|
|
795
|
+
'-F',
|
|
796
|
+
`num=${PR_NUMBER}`,
|
|
757
797
|
'--jq',
|
|
758
|
-
'.closingIssuesReferences',
|
|
798
|
+
'.data.repository.pullRequest.closingIssuesReferences.nodes',
|
|
759
799
|
],
|
|
760
800
|
{ encoding: 'utf8', env: { ...process.env, GH_TOKEN } },
|
|
761
801
|
).trim()
|