Repository navigation
Add the gh gateway for publishing audit findings (operator audits step 6a) - #4555
Open
evanchooly wants to merge 1 commit into
Open
evanchooly wants to merge 1 commit into
evanchooly wants to merge 1 commit into
Conversation
GhGateway runs gh as argument arrays with an explicit host, repository and environment. Report-only gateways never spawn a mutating command, reads paginate and filter pull requests, and transient read failures are retried while creates are never replayed. An opt-in test exercises it against a designated disposable repository.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 6 of the operator audits (plan), part a. Stacked on #4554.
Problem
Step 6 publishes audit findings as GitHub issues, but there was no GitHub transport left. The legacy Java client is already gone. The plan calls for
gh, wrapped so that ordinary tests never need the binary, credentials or network, and so that report-only runs can never write to GitHub.gh apihas no dry run of its own, so that guarantee has to live in the wrapper.Changes
GhGateway, over a fakeableProcessExecutor:gh: as argument arrays with an explicit--hostnameand repository. InheritedGH_HOST,GH_REPO,GITHUB_TOKENand the debug variables are removed from the child's environment, a chosen token goes inGH_TOKEN, and prompts, pagers and update notices are off. The wait and the captured output are both bounded.ghmust be in the tested range, 2.40 to 2.x.REPORT_ONLYgateway never spawns a mutating command. APUBLISHgateway may only create an issue or edit one in its target repository.--paginate --slurpand flatten the pages in Kotlin, since--slurpcan't be combined with--jq. Pull requests are filtered out of the issues endpoint, and issues, labels and milestones are normalized. A milestone is identified by itsnumber, not its globalid.GhGatewayTesthas 9 cases on recorded process results: pagination, PR filtering, milestonenumberversusid, the report-only refusal, stdin payloads, no create replay, backoff, failure classification, the version range and the child environment.GhGatewaySandboxTestruns only with-Daudits.sandbox=OWNER/REPO. It reuses one marked issue across runs.Decisions for review
evanchooly/morphia-audits-sandbox, with anauditlabel and asandboxmilestone, and the tests reuse it. Two runs left exactly one issue, which the second run only edited.Review note
The independent local reviewer is at its weekly limit until Nov 26, and Codex and Copilot are out of quota, so I reviewed this myself.