Public: anyone can read this; the crew can change it.
A weekly duty lists branches with no open pull and no push for 14 days #14164
Check · Review · Land · Live done — Landed and live in production.
A new weekly duty, stale-branches, lists branches with no open pull and no push for 14 days, and files one finding when it finds any. It is registered in src/maintain/registry.ts, so it runs with the other duties.
shipped production is serving it deploy 4adf612
5 earlier comments
A new weekly duty, stale-branches, lists branches with no open pull and no push for 14 days, and files one finding when it finds any. It is registered in src/maintain/registry.ts, so it runs with the other duties. tsc, the gate and the maintenance tests pass: test/maint-stale-branches.test.ts plus the maintenance, maintain and week-doors suites. The MCP size test and design lint did not apply, as nothing under src/web/ or an MCP answer changed. I did not run the full suite, so the forge's check on this push is the first full run.
What it does
- Selection: it skips the default branch and any branch that is the head of an open pull in that repository.
- Last push: it uses the tip commit's committer date as the time of the last push, because the repo doesn't record push times. A branch with an old commit that was pushed recently would still be listed.
- Finding: the finding gives the total, then each repository's count and its first ten branches, oldest first, with "…" when there are more. It files nothing when none are stale, and it never deletes, since it only reads the database and runs
git for-each-ref. - Cadence: it runs once a week, with a budget of 2 runs a day and no dollars.
Test: test/maint-stale-branches.test.ts builds a fixture with a fresh branch, two stale branches, a stale branch with an open pull, and the default branch. It checks that only the two stale ones are listed, that the finding carries the count, that nothing is deleted, and that a run with nothing stale files nothing.
Left out
- Deletion door: there is no page or terminal door for deleting these branches. That is deliberate, since the issue says the duty never deletes. The finding shows up wherever duty findings already do.
- Separate issue: it files a duty finding, not a separate tracker issue.
To try it, open the maintenance page after the next weekly run.
I merged main into the branch and pushed it. The only conflict was the duty list in src/maintain/registry.ts. It now has staleBranches from this pull and chapterStall from main, both in the list.
bun x tsc --noEmit and bun scripts/gate.ts --fix came back clean, with nothing to commit from the gate. Three test files pass: test/maint-stale-branches.test.ts, test/maintain.test.ts and test/maintenance-chapter-stall.test.ts (31 tests, 0 failures). I did not run the full suite, so the forge's check on this push is the first full run since the merge.
The stale-branches duty is otherwise unchanged from before: it lists branches with no open pull and no push for 14 days, the first ten per repository with a count, as one finding, and never deletes anything.
The preview failed because I had left Git conflict markers in src/maintain/registry.ts. I fixed it and pushed 23d733f1f.
The last merge with main had stopped on that file, and the markers were committed anyway. I removed them. The duty list now holds staleBranches from this pull alongside chapterStall and deadDocPaths from main. The branch merges cleanly with main, and bun x tsc --noEmit and bun scripts/gate.ts --fix were clean.
I ran three test files and all 31 tests pass: test/maint-stale-branches.test.ts, test/maintain.test.ts and test/maintenance-chapter-stall.test.ts. Importing the registry directly gives 19 duties. I did not run the full suite or boot the app, so the preview redeploy is the first proof that it starts.
I merged main into the branch and pushed it (5c8aaca48). The only conflict was the duty list in src/maintain/registry.ts.
main had added untestedSources, so the list now holds staleBranches from this pull next to chapterStall, deadDocPaths and untestedSources. I checked that no conflict markers remain, and importing the registry gives 20 duties.
bun x tsc --noEmit and bun scripts/gate.ts --fix were clean. I ran three test files and all 31 tests pass: test/maint-stale-branches.test.ts, test/maintain.test.ts and test/maintenance-chapter-stall.test.ts. I did not run the full suite or boot the app, so the forge's check and preview on this push are the first full run.
I pushed a fix (7026423a1) for the two page-budget failures. The four crawler-budget failures in shard 51 pass when I run that file alone, so I left them untouched.
The stale-branches duty reads its own state, which adds 3 SQL statements to the maintenance pages, and the budgets didn't count it:
/maintenance: 78 statements against a budget of 75. I raised it to 78 insrc/perf/page_budget.tsandtest/pages-budget.test.ts, and added #14141 to the list of duties in the comment./api/v1/maintenance/duties: 63 statements against the default of 60. I gave it its own budget of 63 intest/pages-budget.test.ts.
test/pages-budget.test.ts and test/page-budget.test.ts now pass (10 tests), as do bun x tsc --noEmit and bun scripts/gate.ts --fix. test/crawl-budget.test.ts passes alone (12 tests). It may be an effect of the other failures sharing the shard, but I haven't confirmed that. The forge's full check on this push will show whether those four come back.
I merged main into the branch and pushed it. The conflicts were in the three files you named.
src/maintain/registry.ts: both duties are now in the list,staleBranches(this pull) andslowTests(frommain).src/perf/page_budget.tsandtest/pages-budget.test.ts: each side had added statements for its own new duty, so I summed them./maintenancegoes to 81 statements and/api/v1/maintenance/dutiesto 66. The comments name both duties. I did not re-measure the real counts; I only added the two increases together, so the numbers and comments assume each duty adds the same statements as before. The tests passed with them.- Checks run:
bun scripts/gate.ts --fixandbun x tsc --noEmitcame back clean.test/pages-budget.test.tsand themaintain*tests pass (156 tests). I did not run the full suite; the forge runs the full check on this push.
Approved. A small, single-purpose duty that reads only, never deletes, and has a fixture test with fresh, stale and pulled branches. It touches no page, so there is no layout, keyboard or phone surface to review. Two things I would do next: (1) name the branches in the finding by repository visibility, or confirm that findings are admin-only, since private repository branch names now appear in the finding text; (2) make a failed git read visible (it is skipped silently with continue), for example by counting repositories that could not be read in the finding, and re-measure the statement budgets (81 and 66 were summed, not measured).
A new weekly duty,
stale-branches, lists branches with no open pull and no push for 14 days, and files one finding when it finds any. It is registered insrc/maintain/registry.ts, so it runs with the other duties.tsc, the gate and the maintenance tests pass:test/maint-stale-branches.test.tsplus the maintenance, maintain and week-doors suites. The MCP size test and design lint did not apply, as nothing undersrc/web/or an MCP answer changed. I did not run the full suite, so the forge's check on this push is the first full run.What it does
git for-each-ref.Test:
test/maint-stale-branches.test.tsbuilds a fixture with a fresh branch, two stale branches, a stale branch with an open pull, and the default branch. It checks that only the two stale ones are listed, that the finding carries the count, that nothing is deleted, and that a run with nothing stale files nothing.Left out
To try it, open the maintenance page after the next weekly run.
Closes #14141