@mangeshraut712/merge-guide 0.1.4 → 0.1.6
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/README.md +13 -6
- package/SECURITY.md +1 -1
- package/bin/merge-guide.js +5 -1
- package/docs/adoption.json +4 -4
- package/docs/installer.md +7 -9
- package/docs/maintenance.md +4 -0
- package/docs/november-2026-review.md +25 -0
- package/docs/results.md +6 -0
- package/package.json +1 -1
- package/skills/oss-contribution-insights/SKILL.md +2 -0
- package/skills/oss-contribution-insights/references/contributor-playbook.md +12 -0
- package/skills/oss-contribution-insights/references/validation.md +6 -0
- package/skills/oss-contribution-insights/scripts/collect_pr_evidence.py +18 -7
- package/skills/oss-contribution-insights/scripts/test_collect_pr_evidence.py +15 -1
package/README.md
CHANGED
|
@@ -6,10 +6,15 @@ The repository is `mangeshs-merge-guide`. The installed skill folder and invocat
|
|
|
6
6
|
|
|
7
7
|
[](https://github.com/mangeshraut712/mangeshs-merge-guide/actions)
|
|
8
8
|
[](LICENSE)
|
|
9
|
+
[](https://www.npmjs.com/package/@mangeshraut712/merge-guide)
|
|
10
|
+
|
|
11
|
+
**1,034 npm downloads** from launch on November 12 through November 22, 2026. [Verify on npm](https://api.npmjs.org/downloads/point/2026-11-12:2026-11-22/@mangeshraut712/merge-guide).
|
|
12
|
+
|
|
13
|
+
If Merge Guide helped you prepare or improve a pull request, [star the repository](https://github.com/mangeshraut712/mangeshs-merge-guide) or [support development on GitHub Sponsors](https://github.com/sponsors/mangeshraut712).
|
|
9
14
|
|
|
10
15
|
## November 2026 status
|
|
11
16
|
|
|
12
|
-
Verified **14 November 2026**: public, MIT-licensed source and standalone skill. npm publishes **0.1.
|
|
17
|
+
Verified **14 November 2026**: public, MIT-licensed source and standalone skill. npm publishes **0.1.5** (latest tag, published 23 November 2026) with GitHub Actions provenance; 0.1.3 was the first release with provenance. Verify the release with `npm view @mangeshraut712/merge-guide version`; [source installation](#quick-start-from-source) is also available. See [release evidence and limits](docs/results.md).
|
|
13
18
|
|
|
14
19
|
## Start here
|
|
15
20
|
|
|
@@ -49,18 +54,18 @@ The [contributor playbook](skills/oss-contribution-insights/references/contribut
|
|
|
49
54
|
|
|
50
55
|
## Terminal installer
|
|
51
56
|
|
|
52
|
-
|
|
57
|
+
The commands below install the contributor playbook with the project-comparison exercise. The installer has passed native Linux, macOS and Windows checks. The [source installer](#quick-start-from-source) remains available.
|
|
53
58
|
|
|
54
59
|
Use Node.js 22, 24 or 26 (the current CI matrix) and npm:
|
|
55
60
|
|
|
56
61
|
```sh
|
|
57
|
-
npx @mangeshraut712/merge-guide@0.1.
|
|
58
|
-
npx @mangeshraut712/merge-guide@0.1.
|
|
62
|
+
npx @mangeshraut712/merge-guide@0.1.5 install --target codex --dry-run
|
|
63
|
+
npx @mangeshraut712/merge-guide@0.1.5 install --target codex
|
|
59
64
|
```
|
|
60
65
|
|
|
61
66
|
Replace `codex` with `claude` or `cursor`. The dry run shows the destination without writing; an existing installation is refused. To keep the installation in a project, run from that project's root and add `--scope project`. The version pin makes these commands reproducible. See [installer options and safe upgrades](docs/installer.md).
|
|
62
67
|
|
|
63
|
-
|
|
68
|
+
[npm package](https://www.npmjs.com/package/@mangeshraut712/merge-guide) · [release validation](docs/results.md). The installer provides the skill files; your chosen agent must already be installed and configured.
|
|
64
69
|
|
|
65
70
|
### Quick start from source
|
|
66
71
|
|
|
@@ -169,8 +174,10 @@ Changes should include relevant offline tests and sourced, scoped reasoning. Do
|
|
|
169
174
|
|
|
170
175
|
[Codex Insights](https://github.com/mangeshraut712/codex-insights) creates private Codex workflow reports and optional shareable aggregate profiles. These are separate skills with different installation routes.
|
|
171
176
|
|
|
172
|
-
|
|
177
|
+
npm recorded **222 downloads** during November 16–22, 2026. Downloads include repeat installs and CI. [Weekly count](https://api.npmjs.org/downloads/point/2026-11-16:2026-11-22/@mangeshraut712/merge-guide) · [Adoption data](docs/adoption.json) · [Methodology](docs/analytics.md).
|
|
173
178
|
|
|
174
179
|
Release 0.1.1 fixes managed upgrades after Python helpers generate bytecode. Source edits and added notes still block upgrades; the complete previous installation is retained as a backup.
|
|
175
180
|
|
|
176
181
|
Release 0.1.2 also inspects Python cache directories for added notes and symlinks while preserving valid bytecode in upgrade backups.
|
|
182
|
+
|
|
183
|
+
[November 2026 research, priorities and hands-on validation guide](docs/november-2026-review.md)
|
package/SECURITY.md
CHANGED
|
@@ -10,4 +10,4 @@ Ordinary reproducible bugs without sensitive details belong in the issue templat
|
|
|
10
10
|
|
|
11
11
|
## Version scope
|
|
12
12
|
|
|
13
|
-
This source targets version 0.1.
|
|
13
|
+
This source targets version 0.1.5; confirm the published registry version with `npm view @mangeshraut712/merge-guide version`. Review source/release notes before assuming later `main` fixes are in that artifact. No guaranteed support window or security response time is promised. This policy does not replace an upstream project's own disclosure rules.
|
package/bin/merge-guide.js
CHANGED
|
@@ -51,7 +51,8 @@ async function inventory(root, skipMarker=false, skipGenerated=false) {
|
|
|
51
51
|
}
|
|
52
52
|
const hashes = files => Object.fromEntries(Object.keys(files).sort().map(k=>[k,digest(files[k])]));
|
|
53
53
|
|
|
54
|
-
export async function install({dest,source=path.join(packageRoot,'skills',NAME),dryRun=false,upgrade=false,version
|
|
54
|
+
export async function install({dest,source=path.join(packageRoot,'skills',NAME),dryRun=false,upgrade=false,version}) {
|
|
55
|
+
version??=JSON.parse(await fs.readFile(path.join(packageRoot,'package.json'),'utf8')).version;
|
|
55
56
|
dest=path.resolve(dest);
|
|
56
57
|
await rejectSymlinkAncestors(dest);
|
|
57
58
|
const files=await inventory(source,false,true);
|
|
@@ -114,5 +115,8 @@ export async function main(args=process.argv.slice(2)) {
|
|
|
114
115
|
const result=await install({...options,dest:destination(options),version:pkg.version});
|
|
115
116
|
console.log(JSON.stringify(result,null,2));
|
|
116
117
|
if(!options.dryRun)console.log('Files installed. Verify discovery in your configured agent, then invoke oss-contribution-insights. Task execution and upstream acceptance are separate checks.');
|
|
118
|
+
if (result.action === 'installed' && process.stdout.isTTY && process.stderr.isTTY && !process.env.CI) {
|
|
119
|
+
console.error('If you use Merge Guide for your contributions, you can star the project: https://github.com/mangeshraut712/mangeshs-merge-guide');
|
|
120
|
+
}
|
|
117
121
|
}
|
|
118
122
|
if(process.argv[1] && await fs.realpath(process.argv[1]).catch(()=>null)===fileURLToPath(import.meta.url)) main().catch(e=>{console.error(`merge-guide: ${e.message}`);process.exitCode=1;});
|
package/docs/adoption.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"checked_at": "2026-11-
|
|
2
|
+
"checked_at": "2026-11-23T12:28:13.269616+00:00",
|
|
3
3
|
"repository": "mangeshraut712/mangeshs-merge-guide",
|
|
4
4
|
"github": {
|
|
5
5
|
"source": "https://api.github.com/repos/mangeshraut712/mangeshs-merge-guide",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"status": "published",
|
|
14
14
|
"downloads_source": "https://api.npmjs.org/downloads/point/last-month/%40mangeshraut712%2Fmerge-guide",
|
|
15
15
|
"last_month": {
|
|
16
|
-
"downloads":
|
|
17
|
-
"start": "2026-10-
|
|
18
|
-
"end": "2026-11-
|
|
16
|
+
"downloads": 1034,
|
|
17
|
+
"start": "2026-10-24",
|
|
18
|
+
"end": "2026-11-22",
|
|
19
19
|
"package": "@mangeshraut712/merge-guide"
|
|
20
20
|
}
|
|
21
21
|
}
|
package/docs/installer.md
CHANGED
|
@@ -4,16 +4,14 @@ The installer copies the bundled skill to an explicit agent destination. It does
|
|
|
4
4
|
|
|
5
5
|
## Current availability
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Release 0.1.3 is published with GitHub Actions provenance as the public npm package [`@mangeshraut712/merge-guide`](https://www.npmjs.com/package/@mangeshraut712/merge-guide):
|
|
7
|
+
Use the pinned npm commands to install the version with the project-comparison exercise.
|
|
10
8
|
|
|
11
9
|
```sh
|
|
12
|
-
npx @mangeshraut712/merge-guide@0.1.
|
|
13
|
-
npx @mangeshraut712/merge-guide@0.1.
|
|
10
|
+
npx @mangeshraut712/merge-guide@0.1.5 install --target codex --dry-run
|
|
11
|
+
npx @mangeshraut712/merge-guide@0.1.5 install --target codex
|
|
14
12
|
```
|
|
15
13
|
|
|
16
|
-
Use `--target claude` or `--target cursor` for those tools. To pin the exact release, use `npx @mangeshraut712/merge-guide@0.1.
|
|
14
|
+
Use `--target claude` or `--target cursor` for those tools. To pin the exact release, use `npx @mangeshraut712/merge-guide@0.1.5`. See [validation results](results.md) for the distinction between installer checks, runtime discovery, and native task execution.
|
|
17
15
|
|
|
18
16
|
After reviewing/downloading this repository, from its root:
|
|
19
17
|
|
|
@@ -26,8 +24,8 @@ To test the real npm packaging locally (no registry publication):
|
|
|
26
24
|
|
|
27
25
|
```sh
|
|
28
26
|
npm pack
|
|
29
|
-
npx --package ./mangeshraut712-merge-guide-0.1.
|
|
30
|
-
npx --package ./mangeshraut712-merge-guide-0.1.
|
|
27
|
+
npx --package ./mangeshraut712-merge-guide-0.1.5.tgz merge-guide install --target codex --dry-run
|
|
28
|
+
npx --package ./mangeshraut712-merge-guide-0.1.5.tgz merge-guide install --target codex
|
|
31
29
|
```
|
|
32
30
|
|
|
33
31
|
These commands use Node/npm, not POSIX-specific copy syntax; npm may ask for execution consent. Node 20+ and npm are prerequisites. A package name alone is not ownership proof; verify the npm owner and linked source repository.
|
|
@@ -44,7 +42,7 @@ Use `--scope project` only from the intended repository root. `--dest PATH` sele
|
|
|
44
42
|
|
|
45
43
|
Official documentation: [Codex](https://learn.chatgpt.com/docs/build-skills), [Claude Code](https://code.claude.com/docs/en/skills/), [Claude configuration roots](https://code.claude.com/docs/en/claude-directory), [Cursor](https://cursor.com/docs/skills). Codex uses `$oss-contribution-insights`; Claude Code uses `/oss-contribution-insights`; Cursor exposes `/oss-contribution-insights` in its Agent chat skill selector. Verify discovery in your installed version.
|
|
46
44
|
|
|
47
|
-
All
|
|
45
|
+
All 19 installer tests, packaged-install checks, 30 Python helper tests and 3 adoption-script tests pass on native Linux, macOS and Windows CI runners with Node 22, 24 and 26. [View release checks](https://github.com/mangeshraut712/mangeshs-merge-guide/actions/workflows/ci.yml). Claude/Cursor discovery and native agent-task invocation remain **unverified**; installer success does not establish runtime execution or every filesystem/ACL configuration. This is not universal IDE support, cloud installation or synchronization. A working agent runtime remains required; the earlier Codex task invocation was host-blocked despite successful discovery.
|
|
48
46
|
|
|
49
47
|
## Existing installations and upgrades
|
|
50
48
|
|
package/docs/maintenance.md
CHANGED
|
@@ -17,3 +17,7 @@ Contributions are welcome through [CONTRIBUTING.md](../CONTRIBUTING.md). Do not
|
|
|
17
17
|
Release 0.1.3 introduces the manually dispatched `release.yml` workflow. Ordinary pushes do not publish. After the exact main commit passes all nine release checks, dispatch **Publish npm with provenance** on main. The workflow repeats installer, packed-package and Python validation before publishing from a GitHub-hosted runner with `id-token: write`. Configure `NPM_TOKEN` as a repository secret with publishing access to this package and the npm permissions required for unattended publication; never commit the token.
|
|
18
18
|
|
|
19
19
|
The package enables `publishConfig.provenance`. Release publication must use the hosted workflow, not a local terminal. Confirm registry availability, download the public tarball, verify the provenance attestation and run fresh-cache npx installation checks before announcing success. Release 0.1.2 remains available without provenance; its artifact is unchanged.
|
|
20
|
+
|
|
21
|
+
## Opt-in reviewed merges
|
|
22
|
+
|
|
23
|
+
A maintainer can create and apply the label `merge-after-checks` to opt a PR into the reviewed-merge workflow. Apply it before the Release checks run completes. A successful PR run on main wakes the workflow. It verifies the current base and head, independent approval on that head, review state and reported checks before requesting a squash merge with the expected head SHA. Use ordinary review for PRs that lack a workflow-run PR association. If approval arrives after CI finishes, use the normal merge controls or rerun the release checks. Enable required reviews and checks in a main ruleset for server-enforced protection across all merge methods. Review publishing separately through the existing release workflow.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# November 2026 contribution skill review
|
|
2
|
+
|
|
3
|
+
On November 28 we checked the 105 distinct PRs in the public scoreboard’s external merge evidence against GitHub. All 105 had a merge timestamp. They span 47 repositories; 94 have at least one review record (including automated reviews) and 61 changed three files or fewer. We inspected titles, changed paths, review counts and merge status. These are observations from selected successes. They cannot estimate acceptance probability or the effect of AI. [Pinned scoreboard](https://github.com/mangeshraut712/mangeshraut712/blob/6b5ed6a37c6cbbc5a5328499c08e2984710f8143/data/oss-scoreboard.json)
|
|
4
|
+
|
|
5
|
+
| Priority | Evidence | Decision |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| 1. Identify the next person who can act | Local regression tests passed while the upstream workflow still required approval on [Claude Agent SDK #1536](https://github.com/anthropics/claude-agent-sdk-python/pull/1536#issuecomment-7234506497). | Collect workflow runs for the exact head alongside checks and statuses. Preserve partial results when access is limited. |
|
|
8
|
+
| 2. Give maintainers reproducible decisions | [Carbon #24019](https://github.com/carbon-design-system/carbon/pull/24019) identifies the keyboard sequence that resets the picker. [NVIDIA #3224](https://github.com/NVIDIA/cuda-python/pull/3224) distinguishes inherited filesystem permissions from a cache-mode regression. | Teach contributors to record the consumer action, expected outcome and runner details. Queue a reviewed revision for integration only while its checks and reviewed head still match. |
|
|
9
|
+
| 3. Make the same skill usable across hosts | The existing [Claude plugin proposal](https://github.com/mangeshraut712/mangeshs-merge-guide/pull/11) documents demand for native discovery. | Keep its proposal independent. Ship the same portable skill, examples and standard-library collector through the existing Codex, Claude and Cursor installer. |
|
|
10
|
+
|
|
11
|
+
The current Agent Skills specification supports progressive disclosure through Markdown, scripts and references. Claude Code supports skill discovery and plugin distribution, and Cursor documents skill discovery for its agent. These capabilities fit the existing installer. The evidence collector uses the GitHub workflow-runs REST endpoint and Python’s bounded thread pool; it needs no inference service or provider key. [Agent Skills specification](https://agentskills.io/specification) · [Claude Code skills](https://code.claude.com/docs/en/skills) · [Cursor skills](https://cursor.com/docs/skills) · [GitHub workflow runs](https://docs.github.com/en/rest/actions/workflow-runs#list-workflow-runs-for-a-repository)
|
|
12
|
+
|
|
13
|
+
## Try it
|
|
14
|
+
|
|
15
|
+
Start with the [installer walkthrough](installer.md) and [worked examples](examples.md). Ask your agent: “Read this PR and tell me which step I can take locally and which needs a maintainer.” A useful response identifies the revision and a specific test or upstream decision. For a reproducible snapshot, run the installed helper from the directory containing SKILL.md:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
python3 scripts/collect_pr_evidence.py OWNER/REPO NUMBER --output pr-evidence.json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Choose an unused filename. Exit 2 means some evidence was missing or changed during collection. Open the JSON, read the named error and retry only after the condition changes. A completed collection can still contain zero workflow runs. Use the [troubleshooting guide](troubleshooting.md) and include a redacted observation and expected outcome in the [feedback template](../.github/ISSUE_TEMPLATE/workflow_improvement.md).
|
|
22
|
+
|
|
23
|
+
## Maintainer acceptance and review cadence
|
|
24
|
+
|
|
25
|
+
For each release, exercise the installer and package smoke tests, the Python suites, and a beginner scenario using a PR whose CI needs authorization. Check that the operator can identify the next owner without sharing a raw snapshot. Ask a new contributor to try the walkthrough and record where they needed help. Review feedback monthly and revisit the linked host specifications before changing install paths or adding a dependency.
|
package/docs/results.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Validation results and limits
|
|
2
2
|
|
|
3
|
+
## November 28 release candidate 0.1.6
|
|
4
|
+
|
|
5
|
+
On macOS with Node 26.13.1, 19 installer tests and 36 Python tests passed. Packed-package journeys passed with npm 11 and npm 12 for all three targets: dry run, project install, file integrity, managed upgrade, backup and local edit preservation. The npm 12 check initially failed because the harness expected an array from npm pack; it now accepts both report formats.
|
|
6
|
+
|
|
7
|
+
A live read-only collection of [Claude Agent SDK Python #1536](https://github.com/anthropics/claude-agent-sdk-python/pull/1536) produced a complete snapshot for head `18a0e76ae0203cc87cebe6445beed0d782040946` and three workflow runs requiring authorization. Synthetic tests exercised eligible and ineligible merge decisions. Hosted merge execution, model-driven invocation in each IDE, and a fresh independent human usability session remain unverified for this candidate.
|
|
8
|
+
|
|
3
9
|
## November 14 release 0.1.3 with provenance
|
|
4
10
|
|
|
5
11
|
The [publish workflow](https://github.com/mangeshraut712/mangeshs-merge-guide/actions/runs/43575722083) passed and npm accepted version 0.1.3. After registry processing completed, anonymous metadata and tarball downloads returned HTTP 200. The downloaded SHA-512 matched the provenance subject, which identifies this repository and source commit `26e2830df116ea6cf162ca7a1b91225f2bedbc63`. The tarball SHA-1 is `6acd29d712c5cc5c7c5c594151753c0bf274ebef`.
|
package/package.json
CHANGED
|
@@ -65,3 +65,5 @@ Count distinct repositories and distinct PR identities behind patterns. Separate
|
|
|
65
65
|
Recheck later feedback on merged or landed work when a follow-up is requested or relevant new activity appears. Preserve the original merge/landing and separately record a discovered defect, correction, revert, or unresolved report; merged does not mean correct or permanently complete.
|
|
66
66
|
|
|
67
67
|
Finish with a concise evidence-linked assessment: what worked, what improved, what remains blocked, and the next specific action. Update the task's approved contribution ledger in place when maintaining one; keep private retrospectives out of upstream repositories unless the user explicitly requests publication. Update the ledger when permitted evidence changes. Amend reusable guidance only for a meaningful demonstrated lesson, not every new merge; validate and verify the saved skill after an edit. Skill content does not create a running automation, broaden access, or grant GitHub write permission. Claim ongoing monitoring only after a supported schedule or event subscription is verified.
|
|
68
|
+
|
|
69
|
+
When reporting a blank check rollup, use the [hosted CI receipt guide](references/validation.md#read-a-hosted-ci-receipt) to distinguish an approval-gated run from an unobserved run.
|
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Use this guide to adapt assistance to the contributor's experience. Explain unfamiliar terms, ask what they can reproduce, and offer the next small step rather than a wall of commands. Do not assume paid tools, maintainer access or a particular operating system. Let experienced contributors skip setup explanations while preserving verification and policy gates.
|
|
4
4
|
|
|
5
|
+
## Comparing projects for a first contribution
|
|
6
|
+
|
|
7
|
+
Start with something the contributor uses or wants to learn. For each plausible project, find one concrete user need and check whether the contributor can reproduce it and run the relevant check with the tools, hardware and time they have.
|
|
8
|
+
|
|
9
|
+
Read a few recent external PRs in the same area, including one still waiting and one closed without merging when available. Distinguish a maintainer’s substantive reply from a bot acknowledgement. Check why work paused or closed: a duplicate, a release freeze, or a fix already on main each calls for a different decision. Read dates against the project’s release and volunteer cadence. A small sample can describe what happened; it cannot predict a response time.
|
|
10
|
+
|
|
11
|
+
Inspect how a contributor verifies a change. Look for a baseline on the default branch, a documented local command, and any fork-only CI or hardware gate. If contribution instructions are missing, check the README, templates and recent maintainer decisions for the accepted process. For an ordinary scope question, use the project’s designated channel and first check whether someone already asked it.
|
|
12
|
+
|
|
13
|
+
Give the contributor a short comparison: **candidate issue • evidence the work is wanted • what they can verify • who owns the next step**. Link the evidence and flag anything unknown. Stars, team size and a “good first issue” label alone cannot answer those questions.
|
|
14
|
+
|
|
15
|
+
For example, a busy project’s labelled installer bug already has a patch under review. A quieter library has a maintainer-confirmed typo in its migration example that you can reproduce in a clean install. Choose the documentation fix and show the working command. If the first project’s maintainer instead asks for a Windows reproduction and you have that setup, testing the existing patch could be the more useful contribution.
|
|
16
|
+
|
|
5
17
|
## First contribution
|
|
6
18
|
|
|
7
19
|
1. Identify the actual user problem, a supported release, and an accessible development environment. A “good first issue” label is a lead, not proof that it is current or unclaimed.
|
|
@@ -14,3 +14,9 @@
|
|
|
14
14
|
After diagnosing the local blocker, record the checks that ran and the checks that still need the supported environment. When a draft PR is authorized and repository policy allows it, use hosted CI to finish verification. Record the tested head and check links. Move the PR out of draft only after the applicable checks pass and the diff is ready for review. Follow the repository’s ordinary review and merge rules.
|
|
15
15
|
|
|
16
16
|
For example, a dependency patch can pass lint and the lockfile audit while a local engine download stalls. A draft can exercise the supported CI job for installation, generation, build, and tests. If the job requires maintainer authorization, report that gate and keep the missing results pending. If CI passes on the same head, record the hosted results and the remaining review decision.
|
|
17
|
+
|
|
18
|
+
## Read a hosted CI receipt
|
|
19
|
+
|
|
20
|
+
When a PR has no check rollup, inspect the snapshot's `sections.workflow_runs`. It contains upstream repository runs filtered by the sampled head SHA. Match the event and PR before attributing a run; two branches can point to the same commit. A run with `action_required` needs an upstream decision. Report its URL, the head and the next owner. An empty array means the search returned no runs for that SHA; PR merge-ref workflows or external CI may still exist. If the section is absent, check `errors` and the collector version.
|
|
21
|
+
|
|
22
|
+
For a first contribution, ask “What can I verify locally on this PR?” Pick the changed behavior, run its focused test, then the project-prescribed suite. Report the runner, revision, passed and skipped counts, plus any hosted scenario left to exercise. A contributor with release experience can also compare the head with the last validated revision: changes to a dependency lockfile, package version or runner image may require a new consumer test even when the workflow file is identical.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""Save a read-only GitHub PR evidence snapshot using authenticated gh."""
|
|
3
3
|
import argparse
|
|
4
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
4
5
|
import datetime as dt
|
|
5
6
|
import json
|
|
6
7
|
import os
|
|
@@ -44,7 +45,8 @@ def api(endpoint, paginated=False):
|
|
|
44
45
|
|
|
45
46
|
|
|
46
47
|
def pages(endpoint, key=None):
|
|
47
|
-
|
|
48
|
+
separator = "&" if "?" in endpoint else "?"
|
|
49
|
+
data = api(endpoint + separator + "per_page=100", paginated=True)
|
|
48
50
|
if not isinstance(data, list):
|
|
49
51
|
raise CollectionError("Expected a paginated JSON array")
|
|
50
52
|
flattened = []
|
|
@@ -82,11 +84,16 @@ def collect(repo, number):
|
|
|
82
84
|
"check_runs": (f"repos/{repo}/commits/{sha}/check-runs", "check_runs"),
|
|
83
85
|
"commit_statuses": (f"repos/{repo}/commits/{sha}/statuses", None),
|
|
84
86
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
endpoints["workflow_runs"] = (f"repos/{repo}/actions/runs?head_sha={sha}", "workflow_runs")
|
|
88
|
+
# Bracket independent reads with serial head checks. Preserve section order
|
|
89
|
+
# and keep partial evidence usable when one endpoint is unavailable.
|
|
90
|
+
with ThreadPoolExecutor(max_workers=3) as pool:
|
|
91
|
+
pending = {section: pool.submit(pages, *request) for section, request in endpoints.items()}
|
|
92
|
+
for section, future in pending.items():
|
|
93
|
+
try:
|
|
94
|
+
snapshot["sections"][section] = future.result()
|
|
95
|
+
except CollectionError as exc:
|
|
96
|
+
snapshot["errors"][section] = str(exc)
|
|
90
97
|
if "commits" in snapshot["sections"]:
|
|
91
98
|
expected_commits = pr.get("commits")
|
|
92
99
|
collected_commits = len(snapshot["sections"]["commits"])
|
|
@@ -122,7 +129,11 @@ def main(argv=None):
|
|
|
122
129
|
parser.add_argument("number", type=int, help="Positive PR number")
|
|
123
130
|
parser.add_argument("--output", required=True, type=Path, help="New private snapshot file; never overwritten")
|
|
124
131
|
args = parser.parse_args(argv)
|
|
125
|
-
if
|
|
132
|
+
if (
|
|
133
|
+
not re.fullmatch(r"[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9_.-]+", args.repository)
|
|
134
|
+
or args.repository.split("/")[1] in {".", ".."}
|
|
135
|
+
or args.number < 1
|
|
136
|
+
):
|
|
126
137
|
parser.error("Provide OWNER/REPO and a positive PR number")
|
|
127
138
|
if args.output.exists():
|
|
128
139
|
parser.error("Output already exists; choose a new file")
|
|
@@ -21,6 +21,9 @@ def good_response(command, **kwargs):
|
|
|
21
21
|
endpoint = command[6]
|
|
22
22
|
if endpoint.endswith("/pulls/7"):
|
|
23
23
|
content = {"head": {"sha": SHA}, "state": "open", "merged": False, "commits": 2}
|
|
24
|
+
elif "/actions/runs?" in endpoint:
|
|
25
|
+
assert f"head_sha={SHA}&per_page=100" in endpoint
|
|
26
|
+
content = [{"workflow_runs": [{"head_sha": SHA, "conclusion": "action_required"}]}]
|
|
24
27
|
elif "/check-runs?" in endpoint:
|
|
25
28
|
content = [{"check_runs": [{"name": "unit", "conclusion": "success"}]}]
|
|
26
29
|
else:
|
|
@@ -33,11 +36,12 @@ class CollectorTests(unittest.TestCase):
|
|
|
33
36
|
def test_all_reads_and_pagination(self):
|
|
34
37
|
with patch.object(collector.subprocess, "run", side_effect=good_response) as run:
|
|
35
38
|
result = collector.collect("owner/repo", 7)
|
|
36
|
-
self.assertEqual(run.call_count,
|
|
39
|
+
self.assertEqual(run.call_count, 9)
|
|
37
40
|
self.assertTrue(result["collection_complete"])
|
|
38
41
|
self.assertEqual(len(result["sections"]["reviews"]), 2)
|
|
39
42
|
self.assertEqual(result["sections"]["check_runs"][0]["name"], "unit")
|
|
40
43
|
self.assertEqual(result["sampled_head_sha"], SHA)
|
|
44
|
+
self.assertEqual(result["sections"]["workflow_runs"][0]["conclusion"], "action_required")
|
|
41
45
|
|
|
42
46
|
def test_commit_endpoint_cap_is_partial(self):
|
|
43
47
|
def capped_response(command, **kwargs):
|
|
@@ -126,6 +130,16 @@ class CollectorTests(unittest.TestCase):
|
|
|
126
130
|
self.assertEqual(output.read_text(), "original")
|
|
127
131
|
collect.assert_not_called()
|
|
128
132
|
|
|
133
|
+
def test_dot_segment_repository_is_rejected(self):
|
|
134
|
+
with tempfile.TemporaryDirectory() as folder:
|
|
135
|
+
output = Path(folder) / "snapshot.json"
|
|
136
|
+
for repository in ("owner/..", "owner/."):
|
|
137
|
+
with patch.object(collector, "collect") as collect, contextlib.redirect_stderr(io.StringIO()):
|
|
138
|
+
with self.assertRaises(SystemExit):
|
|
139
|
+
collector.main([repository, "7", "--output", str(output)])
|
|
140
|
+
collect.assert_not_called()
|
|
141
|
+
self.assertFalse(output.exists())
|
|
142
|
+
|
|
129
143
|
def test_partial_file_has_nonzero_exit(self):
|
|
130
144
|
with tempfile.TemporaryDirectory() as folder:
|
|
131
145
|
output = Path(folder) / "snapshot.json"
|