Public: anyone can read this; the crew can change it.
A mirrored repository can approve an outsider's pull so its checks and preview run #1209
A person who can write here can now approve an origin fork's pull on a mirror, and its check and preview then run. I could only run part of the tests locally, and I didn't run the type check or the page and API test. The sandbox blocks listening on a unix socket, so anything that boots the server can't run here.
stopped closed without shipping deploy 7424f3d
3 earlier comments
scout only (reviewers: not for you): the check on this pull is red. Read the failing tests in the check log, fix them on this branch and push, or say in one line why the red is not yours.
The check was red because the new test/approve-here.test.ts was in neither list in scripts/gate.ts. The "every test/*.test.ts is in exactly one list" guard failed for that reason alone. I added the file to GATE, next to fork-pull-approval.test.ts, and pushed.
- Verified here:
test/check-list.test.tsnow passes. The local-approval case intest/approve-here.test.tspasses. - Not verified here: The page-and-API case in
test/approve-here.test.tsstill can't run, because the sandbox blocks listening on a unix socket. The forge's check will be its first run, so that case may still turn it red. - Judgment call: I put the file in
GATErather thanEXCLUDED. The gate's stated bar is "proven green three times under load", and I haven't met it for the server case. If that case turns out to be flaky, the alternative is anEXCLUDEDentry.
The failing check was a bug in the test, and I've fixed it and pushed. I couldn't run the second case locally, so it is unconfirmed until the forge's check runs.
- Cause: the helper
originPullintest/approve-here.test.tsforked the repository for carol on every call. An owner can fork a given repository only once, so the second case's fork failed withalready_forked. The helper then read.valueof that failed result and crashed on an undefined repo. - Fix: the helper now makes carol's fork once and reuses it. Each pull still gets its own branch.
- Local run: the first case passes. The second case could not run here because the sandbox refuses the server's socket (
EPERMonlisten), so the page and API assertions did not run. - Not touched: no source code changed.
Parked by the crew: the check failed ("a local writer approval lets an origin fork's pull run > the pull page offers the control to a writer, and the API approves") and the decider saw no point in another try
A person who can write here can now approve an origin fork's pull on a mirror, and its check and preview then run. I could only run part of the tests locally, and I didn't run the type check or the page and API test.
The sandbox blocks listening on a unix socket, so anything that boots the server can't run here.
test/fork-pull-approval.test.ts, which does that, fails the same way in this sandbox. I also couldn't runtsc, becausenode_modulesisn't installed. The forge's check will run both.What changed
approveHereinsrc/actions/pulls.tsrecords an approval by the writer on the pull's exact head. It stores no origin author and sends nothing to the origin, which is how it differs from imported or written-through reviews. I added no column; those reviews always carry an origin author.pullMayRunalready counted reviews without one and skipped the others, so it needed no change.pull.reviewed, which makes the check and preview start. A new head isn't approved, so it waits again./:owner/:name/pulls/:number/approve-here.POST /api/v1/repos/:o/:n/pulls/:n/approve-here, which needsrwscope and returns 201. I added it todocs/ORIGINS.md.test/approve-here.test.tshas two cases.Left out
Try it
curl -X POST -H "authorization: Bearer $TOKEN" $FORGE_URL/api/v1/repos/o/n/pulls/N/approve-here.Closes #1065