chore(forge): search pull requests and issues, pr close and reopen, pr view --body and --json #831
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
beanstalk: approved @ 1697603
beanstalk: approved @ 2c5a62e
beanstalk: approved @ 4fd82b7
beanstalk: approved @ 64d6d09
beanstalk: approved @ 6f91fae
beanstalk: approved @ 70a78f9
beanstalk: approved @ 8015c9a
beanstalk: approved @ 8d361dc
beanstalk: approved @ 9d8356e
beanstalk: approved @ abf2227
beanstalk: approved @ d82f202
beanstalk: approved @ e5f1e40
beanstalk: approved @ ee8ab5f
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!831
Loading…
Reference in a new issue
No description provided.
Delete branch "zeldaootr/Longshot:forge-search-close-body"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: chore · Risk: low · Tested on: Linux, game-free checks and read-only calls to git.magicbean.dev · Needs: none
Why
An agent spent hours building a change that another contributor already had open as a WIP pull request under the same
switch name:
pr listprints only titles, over 350 of them, and nothing searches the descriptions. A PR superseded bya merged change could only be commented on, not closed, and editing a description meant calling the API by hand to get
its raw text. This adds the three commands that were missing.
What changed
forge.py searchfinds the pull requests and issues that already name a switch, a function or some words;pr closecloses a PR with a comment saying why;
pr view --bodyprints the description alone, so it can be edited and put back.search WORD|"A PHRASE" ... [--state open|closed|all] [--mine] [--limit N]inscripts/forge.py(
cmd_search,listing,matching_line): every word or quoted phrase must be in the title or the description, inany case. Each hit prints its number, PR or issue, its state (
open,wip,merged,closed), author, title andthe description's line with the match, shortened around it. Nothing found says so, with exit code 0. It reads the
issue listing (both kinds, 50 a page, 4 pages at once) and matches locally, not through Forgejo's
q=search: onthis forge (17.0.1) the indexer found 70 of the 90 items with "mesh" and "shaders" in them and was no faster.
--minepasses
created_by.pr close N (--comment TEXT | --comment-file F) [--force](cmd_pr_close) posts the comment, then closes.The comment is required, and someone else's PR is refused without
--force.pr reopen N [--comment ...](
cmd_pr_reopen) opens a closed PR again and refuses a merged one.pr view N --body(print_raw) prints the description exactly as stored and nothing else: into a file or apipe its UTF-8 bytes, so CRLF stays CRLF on Windows too.
--json(pr_json) prints number, title, state, WIP, headand base refs and commits, merge base, author, labels, description and times. Both exclude
--comments. The plainpr viewoutput is unchanged.docs/forge.md(a Search before building section, close and reopen,--bodyfor editing a description),AGENTS.md(search before building, in the Choosing or claiming work bullet, linkingdocs/forge.md).tests/test_forge_search.py(new) andtests/test_forge_pr.py, against a stand-in Forgejo in memory.Measurements
Nothing to measure: a script for the forge with its own game-free tests; the game doesn't run it.
Flags and settings
None
Testing
Tested: Linux.
python -I -B tests/run_all.py: 495 passed, 85 skipped, 14 failed. The same 14 fail onmain(
aa95d35f) on this PC, and none of them reads the forge script:test_appimage_player_build,test_lift_cache,test_crash_dialog,test_mods_size_table,test_make_game_cache,test_pipeline_tour,test_env_on,test_lift_cleanup_error,test_cpm_discovery,test_walk_key,test_bake_portability,test_vk_pgo,test_readback_late,test_options_budget_once. The forge checks (test_forge_pr,test_forge_search,test_forge_session_lock,test_check_pr_description) pass. The new tests cover search matching (a switch name in aFlags table, any case, a phrase across a line break, every word required), the output's shape, the states,
--state,--mine,--limitand paging, and nothing found. They also coverpr close's comment andPATCHbodies in thatorder, its refusals (no comment, an empty one, someone else's PR, a closed or merged one),
pr reopen,pr view --bodyprinting exactly the body (CRLF, no last newline, an emoji, into a cp1252 pipe), and
--json's fields. Close andreopen also ran over HTTP against a local stub server, which received the comment
POST, thenPATCH {"state": "closed"}(and{"state": "open"}for reopen), with the sign-in's bearer token. Read-only againstgit.magicbean.dev:
search RX_VK_ASTC_BC1(2 found, both WIP PRs naming it, in about 12 s),search "mesh shaders"(38 found in about 8 s),
pr view 687 --body | headandpr view 687 --json.Not tested:
pr closeandpr reopenagainst git.magicbean.dev itself (only read-only calls were made there);Windows (the code is the standard library only, and
--body's byte output is covered by the cp1252 pipe test).Must be tested:
Risks
What could break: Nothing existing:
pr list,pr viewwithout the new flags and the other commands print asbefore. A search lists every open item (about 570 now), which takes 8 to 15 s.
Turning it off: revert the commit
Compatibility: Nothing changes
Checklist
Everyone
type(scope): description) of the status line's type.main. Onto main94abdd57(headda418ffa) with one conflict, inAGENTS.md: main's08f3d3d3(docs(agents)) replaced its Pick and claim work section and the PR command block with a guide per task, so the search line now sits in the Choosing or claiming work bullet and linksdocs/forge.md#search-before-building, and thepr view --bodyandpr closelines, whichdocs/forge.mdin this PR already has, are no longer added toAGENTS.md(that commit is nowdocs(agents): search before building), with the commit subjects made Conventional Commits, which CI's lint job now checks for every commit, on a base that has CI's config (#417); each commit's change is the same as before bygit patch-id. The commits named in this description are from before this rebase:23e4ff77is now82d96724,c1452d58is now69c47ab4,1a8e39e6is nowb76e55a7,0be29674is nowaf1dd980,584b15c2is nowde07ec7d,b48507b4is now35f9e11e,306dd602is nowda418ffa. Re-run on94abdd57: the forge checks (test_forge_pr,test_forge_search,test_forge_session_lock,test_check_pr_description) and every check that reads the changed files pass, 5 of 5 with g++ and the 2 new ones with clang too.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.tests/that reads changed source updated in this PR, not weakened.pr view --bodyprints the raw description,--jsonthe fields 23e4ff771apr view --bodyand--jsonc1452d5804pr closesays why and is yours to close,pr reopen1a8e39e608pr closewith the reason required, andpr reopen0be2967492searchover pull requests and issues 584b15c249searchpull requests and issues by title and description b48507b4capr view --body,pr closeThis conflicts with
maininAGENTS.md: it was cut down to a pointer page and its pull request guidance moved todocs/agent-pull-requests.md(thedocs(agents)commit, then #571), so the two new lines (search before building,pr view --bodyandpr close) need a new home there. The code and test commits rebase without conflicts. Please rebase onto currentmain.306dd6027eda418ffa7aRebased onto
main94abdd57(headda418ffa), with one conflict, inAGENTS.md: main's08f3d3d3(docs(agents)) replaced its Pick and claim work section and the PR command block with a guide per task, so the search line now sits in the Choosing or claiming work bullet and linksdocs/forge.md#search-before-building, and thepr view --bodyandpr closelines, whichdocs/forge.mdin this PR already has, are no longer added toAGENTS.md(that commit is nowdocs(agents): search before building); the commit subjects are now Conventional Commits, which CircleCI's lint job checks for every commit of a pull request (#417), and the base has the CI's config, which a fork's pull request needs at its own head. No other change: each commit's change is the same as before bygit patch-id.Re-run on
94abdd57: the forge checks (test_forge_pr,test_forge_search,test_forge_session_lock,test_check_pr_description) and every check that reads the changed files pass, 5 of 5 with g++ and the 2 new ones with clang too. The description names the new commits.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.