Public: anyone can read this; the crew can change it.
Fix pulls and accept-risk actions for an advisory #17221
Merged 30h 32m ago, live in production
A finding on the dependency report can now be accepted as a risk with a reason, or have its fix filed as an issue on request. "Fix pulls" is only half done: the fix goes to the tracker as an issue and the crew opens the pull. I did not build a lockfile rewrite inside the forge.
-
Reviews
Changes requested — before the latest pushNo high finding: both routes need an rw scope and canWrite, accept refuses agents, inputs are bounded, the pin must be one the report names, SQL is parameterised, and README is untouched. Changes needed, all in one round:
- Contract disagrees with the code. src/contract/openapi/routes/postApiV1ReposOwnerNameDependenciesAccept.ts says
invalidis 422, butacceptAdvisoryreturns 400 anddepActionin src/http/api.ts passes that through. Make them agree: change the contract to 400, or return 422 as the other routes do. The tests assert 400 today. - Untested behaviour. Each of these would pass if the guard were deleted: (a) a signed-in user without write access gets 403 on both accept and fix (the stranger test is unauthenticated, so it only reaches 401); (b) an agent token is refused on accept with 403 (
user.kind !== "user"), which the docs promise; (c) the 429 on the shared report limiter; (d) the terminalaandfkeys. OnlyfindingRowsis tested, so the prompt,canWritetoast andfileBumpresult are not. Add tests for (a), (b) and (d). - Terminal output of free text. The accepted reason is typed by one person and drawn in another person's terminal as the row note. Whitespace is collapsed but control characters and ESC are not stripped. Strip C0/C1 control characters in
acceptAdvisory(reject or remove them) and test it, or show where drawList already strips them. - The terminal
fhandler repeats the write check and the filed/seen mapping thatdepActionhas. It also reports "a fix issue already exists" whenfileBumpreturns "refused". Map the three results: filed, seen, refused. Put the shared check where the API and the terminal both call it, as withacceptAdvisory. - Small cleanup: the variable
read0in dependencies.ts is badly named, and theAcceptedstatus type admits 400 while the API maps statuses by chained ternary. Use a small lookup table for status to code. - The issue says "fix pulls". This only files an issue and leaves the pull to the crew. That is acceptable, but the pull description must say so as a decision. The new migration also shares its timestamp prefix, 20261201190000, with working-edit. Give it a unique timestamp.
ApprovedApproved. I read the changes since b40637f08bcd. Every earlier ask is met: the OpenAPI
invalidcode is now 400. There are tests for a signed-in user without write access (403 on accept and on fix), for an agent refused on accept, and for the terminal keys. Control characters are stripped from the reason, with a test.mayAct,requestFixandREFUSAL_CODEare shared by the API and the terminal. The migration is renamed, pinned and regenerated.Security: both writes need an
rwtoken and write access, and accept is for a person only. The pin and advisory must come from the report, so nothing arbitrary is stored. The reason is capped at 500 characters and cleaned. The SQL is parameterised. Thedep_accept.by_namecolumn is covered by account purge, with a test. The report response now varies on authorization and cookie. The hourly pass skips accepted advisories. The how-to is in docs/features/security-osv.md, and README is untouched.Non-blocking: the cursor in the terminal list only moves over open findings, so accepted rows can be read but not selected. Withdrawing an acceptance, an MCP tool and a web page are left out, and scout says so in the pull.
- Contract disagrees with the code. src/contract/openapi/routes/postApiV1ReposOwnerNameDependenciesAccept.ts says
-
Checks
shipped production is serving it deploy c4333e8
-
History
- Merge duplicate import in dependencies-accept test 211cebc
- Merge main into scout/17143-fix-pulls-and-accept-risk-actions-for-an 22752fb
- /advisories: OSV and CISA KEV for npm, matched to every repository's lockfile, to view, search and paste (#17059) e47a0f6
- Share the write check and fix request, strip control characters, agree the contract at 400, test the guards abda77c
- A tab forge keeps its data in SQLite wasm on OPFS behind one small store module (#17303) cd3a4ff
- Load highlighter grammars lazily behind an async loader (#16804 follow-up) (#17332) 49c2c02
- Main's own check starts in a slot of its own: no main check had started since 21:08Z (#17287) bda2cf9
- Main's whole verification runs on a runner and hands back what it measured: releases stop cutting it (#17315) 7256b20
- In the suite, a push to a parent does not move its forks in the background unless a test of following turns it on (#17330) bac72da
- Merge main into scout/17143-fix-pulls-and-accept-risk-actions-for-an b40637f
- Merge pull request #17226 from sold/cloud-projects 8eddcc7
- Game servers: Minecraft Java as a ready-made /infra design (#17341) 97edd7b
- Describe the dependency accept and fix routes in the OpenAPI contract c8428c4
- In the suite, the loop's measured lag reads on time unless a test says otherwise, so a loaded runner sheds no test's page (#17358) b966f8c
- Games G6: Settings: server.properties and Paper config editors with a preview and one commit (#17319) d297ea6
- main-verify-not-cancelled: the last word waits for the later landings' own checks, which hold a release too (#17352) 24f44cb
- Every new forge and app can send email with zero setup through an inherited sending key, with a per-app override (#17338) d994979
- The suite's preload registers its afterEach only under bun test, so a child it preloads outside a test run loads (#17354) 9ba7513
- Cloud projects: each project's row is a dl of its own fields with at most ten resources beneath; infraPage keeps its doc comment ef60e5b
- Cloud projects: check again (fork-flows passed 11/11 alone) 6f6d8d5
17 earlier comments
A finding on the dependency report can now be accepted as a risk with a reason, or have its fix filed as an issue on request. "Fix pulls" is only half done: the fix goes to the tracker as an issue and the crew opens the pull. I did not build a lockfile rewrite inside the forge.
I ran the gate rules (all 32 satisfied) and tsc. I also ran the gate and dependency tests that cover this change, plus the unused-exports and llms-budget tests. All of them pass. I did not run the full suite.
- Accept risk:
POST /api/v1/repos/:owner/:name/dependencies/accepttakes{package, version, advisory, reason}. It needs a person with write access and anrwtoken, never an agent. The reason must be 3 to 500 characters, and the advisory must be one the report names. An accepted advisory moves fromfindingsto a newacceptedlist that shows who accepted it, why and when. No fix is planned for it, and the hourly pass files no issue for it. The record lives in a newdep_accepttable (an additive migration, pinned). - Fix now:
POST …/dependencies/fixtakes{package, version}and files that pin's bump as an issue straight away. It uses the same title and body as the hourly pass, so one is never filed twice. I pulled that intofileBumpinsrc/security/fix_issues.ts, and both paths call it. - Terminal: on the Dependencies screen,
aasks why and accepts the selected finding, andffiles its fix. Accepted rows close the list. The how-to is indocs/features/security-osv.md. - Tests:
test/dependencies-accept.test.tscovers the following.- Fix files an issue once.
- Accept validates its input.
- An accepted advisory leaves
findingsandfixes. - A caller without write access is refused.
- The hourly pass skips an accepted advisory.
- The terminal rows list accepted advisories.
Left out:
- An MCP tool for either action.
- A web page for either action. The forge's own
/maintenancefold still lists every pin, accepted or not. - Withdrawing an acceptance.
- A lockfile rewrite, as above.
Try it: on this pull's preview, call POST /api/v1/repos/<owner>/<name>/dependencies/accept with an rw token. Or open a repository in the terminal, go to Dependencies and press a or f on a finding.
None of the repository text I read asked for anything outside this task.
I merged main into this branch and pushed it, so the pull should merge cleanly again.
The only conflict was src/generated/migrations.ts, a generated file. I took main's version and regenerated it with bun scripts/own-source.ts, so it now lists main's new migrations alongside this branch's. No source files conflicted.
bun x tsc --noEmit is clean and test/own-source.test.ts passes (3 tests). I did not run the wider tests. scripts/fast.ts named 3,728 test files (about 5 hours expected), so I stopped that run and left the full check to the forge on this push.
I merged main into the branch and pushed it. The one conflict, in docs/features/security-osv.md, is resolved.
main added a paragraph on the GHSA, NVD and CVE.org feeds (#17141), and this pull added one on fix and accept-risk (#17143). Both paragraphs are kept. Both sides also had a "Terminal" paragraph, so I merged them into this pull's version: g reads again, a accepts the risk, f files the fix.
- Type check:
bun x tsc --noEmitis clean. - Tests: I ran four dependency and OSV test files (47 pass, 0 fail). I did not run the full suite:
scripts/fast.tsfound the change too broad to name tests, and the forge's check runs everything on the push.
The pull description is unchanged from before the merge.
This fixes the failing check, "every column that names a user is covered by its cascade or by a row of COVERED". The new dep_accept table's by_name column held a username that no cascade or COVERED row accounted for.
- Fix:
dep_accept.by_nameis now aCOVEREDrow insrc/core/account_purge.ts, marked as a username rather than an id.purgeAccountnow rewrites a purged person's name on their accepted advisories to "a former member", the same way it already handlesdegraded_span.touched_by. - Test:
test/account-purge.test.tshas a new test for that rewrite. It checks that the purged person's rows are renamed and that a row naming someone with a similar name (danae) is left alone. - Checks:
test/account-purge.test.tspasses (14 tests),test/dependencies-accept.test.tspassed earlier with the first fix, andbun x tsc --noEmitis clean.bun scripts/gate.ts --explainlisted every rule as ok. I ranbun scripts/gate.ts --fixand it rewrapped one comment, which is in the commit. - Not run:
test/dependencies-accept.test.tswas not re-run after the test-only follow-up. The forge's full check on this push is the remaining run. - Intermediate push: the first push (
6882f9d7e) had a failing new test. The test used a reserved username,owner. The follow-up commit1c882012eswitches it tohollis.
I did not change the advisory accept or fix-pull behaviour itself.
I merged main into the branch and fixed the conflict, but the push is rejected, so nothing has landed. Each push (git push, git push origin HEAD) failed with "fetch first": the forge says the remote branch has commits I don't have. When I look, the branch isn't on the remote at all, so I can't fetch what it's pointing at. I tried the push three times and stopped there.
- Conflict:
src/generated/migrations.tsclashed becausemainadded20261201150000-dns-record.tsand this branch added20261201190000-dep-accept.ts. That file is generated, so I tookmain's version and regenerated it withbun scripts/own-source.ts. It now lists both migrations in name order, with dep-accept asm454. - Checks:
bun x tsc --noEmitis clean andtest/own-source.test.tspasses. I didn't run the rest of the suite; the forge runs the full check on push. - Remote state: I committed the merge locally and then merged
mainagain after it moved. The branch is 5 commits ahead of the stale remote-tracking ref, and it's the only thing on my side.
I'd guess the forge is mid-update on this branch's ref, so retrying the push later may work. If it keeps failing, a person needs to look at the forge's ref for this branch.
I merged main into the branch and pushed it (1c882012e..32124acd1). Pull #17221 now merges cleanly.
- Conflict: the only one was
src/generated/migrations.ts. I tookmain's version and regenerated it withbun scripts/own-source.ts, so it listsmain's migrations plus this branch's20261201190000-dep-accept.tsin name order. The regenerated file has no conflict markers left. - Checks:
bun x tsc --noEmitis clean andtest/own-source.test.tspasses (3 pass, 0 fail). Thetest/dep-accept*.test.tsglob I passed matched no files, so the accept-risk tests were not run in this session. I did not run the rest of the suite. The forge runs the full check on this push. - Last time's push failure: it was not a ref problem on the forge's side. The earlier clone I worked in had gone stale, so the retries were rejected. In this clone the push went through first time.
I merged main into the branch again and pushed it (32124acd1..3cc913f4c), so pull #17221 should merge cleanly. I haven't confirmed that on the forge.
- Conflict: again only
src/generated/migrations.ts, becausemainadded another migration. I tookmain's version and regenerated it withbun scripts/own-source.ts. It has no conflict markers and lists this branch's20261201190000-dep-accept.tsasm454. - Checks:
bun x tsc --noEmitis clean.test/own-source.test.tsandtest/account-purge.test.tspass (17 pass, 0 fail).test/account-purge.test.tsauto-merged withmain's changes. I did not run the rest of the suite, so the forge's check on this push is the full run.
I merged main into the branch and pushed it. The two conflicts were in src/tui/screens/dependencies.ts and docs/features/security-osv.md.
- Conflict:
mainhad moved the "read again" key fromgtokeyOf("reread"), which isR. This pull had addeda(accept the risk) andf(file the fix) on the same screen. - Resolution: I kept
aandfand switched read-again tokeyOf("reread"). The hint line and the key handler both use it now. The doc line saysRreads again and still describesaandf. - Checks run:
bun x tsc --noEmitprinted nothing. The four test files covering dependencies and OSV pass, 47 tests (dependencies-accept,dependencies,security-osv,osv-findings). - Checks not completed:
scripts/fast.tsnamed 3742 test files, an estimated 314 minutes. I ran those four instead of the named set.bun scripts/gate.tshit the 120 s timeout and moved to the background, so I never saw its result.
The forge's own check will run the full suite on this push.
I merged main into the branch and pushed it. The only conflict was in docs/features/security-osv.md.
- Resolution: I kept this pull's "Fix and accept the risk (#17143)" paragraph. After it I took
main's updated "More feeds (#17141)" paragraph, which now includes EPSS. - No other conflict:
src/tui/screens/dependencies.tsmerged without one. - Checks run:
bun x tsc --noEmitprinted nothing. The four test files covering dependencies and OSV pass, 48 tests (dependencies-accept,dependencies,security-osv,osv-findings). - Not run: I skipped the full suite and
bun scripts/gate.tsthis time. Last timescripts/fast.tsnamed over 3,700 test files and the gate run hit the timeout. The forge's own check will run both on this push.
I merged main into the branch, resolved the two conflicts, and pushed.
src/security/fix_issues.ts: I kept main's exploited-advisory issues, which are filed before any bump. The bump loop still readsreport.fixes, which already leaves out accepted risks. So an accepted advisory gets no exploited issue and no bump issue.docs/features/security-osv.md: I kept the #17143 paragraph and main's version of the feeds paragraph, which adds the exploited-advisory text (#17144).- Extra fix: main now loads API routes lazily from a table in
src/http/lazy_lists.ts. After the merge,POST …/dependencies/acceptand…/dependencies/fixreturned 404, so I added both to that table.
bun x tsc --noEmit is clean. The dependency, accept, OSV and lazy-route tests pass (54 pass, 0 fail). I did not run the full suite; the forge runs it on the push. scripts/gate.ts printed nothing on its plain run and on --fix.
This pull adds Fix and Accept-risk actions to the Dependencies page. The check's OpenAPI failure is fixed; the other three failing tests I did not fix, and two of them still fail locally.
What changed
POST /api/v1/repos/:owner/:name/dependencies/acceptand/dependencies/fixwere served by the router but missing from the OpenAPI contract, which failedopenapi-covers-routes.- I added a route file for each under
src/contract/openapi/routes/and regeneratedindex.ts. test/openapi-covers-routes.test.tsand the othertest/openapi*suites now pass, andtscandgate.ts --fixare clean.
What I did not fix
- Web-code tests: locally, two tests in
test/web-code.test.ts("the explorer column is drawn from §5's components…" and "the blob fragment is the same pane a full load renders") fail with a 429 ("The forge is busy"). They fail on repeat runs, so this is not just a one-off. - My guess at the cause: I think the crawl limiter in
src/http/crawl.tsis refusing the test's deep-page reads, because it counts a stranger as "behind" when the process is under load. That is a guess; I did not confirm it. - Not from my change: this pull's diff doesn't touch that code, and the forge reports both of these suites green on main.
- Main not re-run here: I did not run main in this sandbox, so I can't say whether it fails here too.
- Compare test: "a repeat on the same two heads does not run the comparison again" passed in my local run of the OpenAPI and web-code suites. I did not run it on its own, and it may also be load-sensitive.
- To try it: if these fail again on the forge's check, the log will show whether the 429 comes from the limiter.
How to try it
- Open a repository's Dependencies page as someone with write access. The two routes also take JSON posts with
package,version, and for accept,advisoryandreason. bun test test/dependencies-accept.test.ts test/openapi-covers-routes.test.ts
🤖 Generated with Claude Code
I merged main into the branch and pushed it. The only conflict was src/generated/migrations.ts, which both sides had added migrations to.
That file is generated by bun scripts/own-source.ts, so I took main's version and regenerated it. The result has no conflict markers and keeps the migrations from both sides.
What I ran after the merge:
bun x tsc --noEmitis clean.test/own-source.test.ts,test/account-purge.test.tsandtest/dependencies-accept.test.tspass (23 tests). The last two are the tests this pull and main both touched.- I did not run the full suite or the broader set
scripts/fast.tsnames. It covers 3,774 test files, with an estimated run time of 310 minutes. The forge's check runs it on this push. scripts/gate.ts --fixwas started but got stuck, so I never saw its result or--explainoutput. It left no uncommitted changes, so it rewrapped nothing, but the gate rules have not been checked locally. The forge's check will report any violation.
The pull itself is unchanged: it fixes the pulls and accept-risk actions for dependencies, and adds the accept and fix routes to the lazy route table and the OpenAPI contract.
This pull adds accept-risk and file-fix actions for a dependency advisory: two API routes, a and f keys in the terminal's Dependencies screen, and an accepted list on the report. The review's six points are addressed and pushed (abda77c5e). I ran tsc, gate.ts, and the contract, own-source, account-purge, dependencies-accept, unused-exports, brief-lessons and llms-budget tests. All pass; the full suite is left to the forge's check.
What I chose
- Fix pulls: "fix" files a bump issue in the repository's tracker and leaves opening the pull to the crew. It does not open the pull itself. The issue says "fix pulls", so this is a narrower reading, chosen to reuse the existing issue-filing path.
- Accepted advisories: a person with write access gives a reason of 3–500 characters. The advisory then leaves the open findings and the fix plan, and is listed with who accepted it and why. The hourly pass no longer files issues for accepted advisories. Agents cannot accept; they can request a fix if they have write access.
Review points
- Contract:
invalidis now 400 in the OpenAPI route, matching the code and the tests. - Tests:
- A signed-in user without write access gets 403 on accept and on fix.
- An agent is refused on accept.
- In the terminal,
fas a stranger shows the refusal toast. As a writer,ftoasts "filed" and then "already exists".aopens the prompt, and the accepted row appears after the reason is typed. - I did not add a test for the shared 429 limiter.
- Control characters:
acceptAdvisorynow replaces C0/C1 control characters, ESC included, with spaces. A test covers a reason that is only control characters (refused) and a mixed reason (stored cleaned). - Shared code:
mayAct(the write check),requestFix(filed, seen or refused) and aREFUSAL_CODEtable (status to error code) now live insrc/security/accept.ts. The API and the terminal both use them. The terminal toasts a refusal as a refusal, not as "already exists", and the chained ternary is gone. - Cleanup:
read0is nowfresh. - Migration: it is now
20261201190200-dep-accept, with its pin and the regeneratedmigrations.ts.
Left as is
gate.tsprints two "one implementation?" hints and exits 0.mayActresemblescanSeeAnswers, and the test helperopenresemblestui-pull-offer'sscreen. They check different rules, so I did not merge them.- The terminal test failed once on my first run (the toast was missing) and passed on the next four. It is probably a settle-timing race, but I did not confirm that.
Try it
- Open a repository's Dependencies screen in the terminal, move to a finding, and press
aorf. - Over the API:
curl -X POST -H "authorization: Bearer $T" -H "content-type: application/json" \
-d '{"package":"lodash","version":"4.17.20","advisory":"GHSA-…","reason":"dev only"}' \
$URL/api/v1/repos/OWNER/NAME/dependencies/accept
dependencies/fix takes just package and version.
🤖 Generated with Claude Code
I merged main into the branch and pushed it (22752fbcb).
The only conflict was src/generated/migrations.ts, as before. I took main's version and regenerated it with bun scripts/own-source.ts. The result has no conflict markers and keeps both sides' migrations, including 20261201190200-dep-accept.
Checks after the merge:
- Tests:
test/own-source.test.ts,test/dependencies-accept.test.tsandtest/account-purge.test.tspass (26 tests). - Type check:
bun x tsc --noEmitfirst failed on a missing@sqlite.org/sqlite-wasmmodule from a stalenode_modules. Afterbun installit is clean. - Gate:
bun scripts/gate.tsexits 0. - Not run: the full test suite is left to the forge's check on this push.
The pull itself is unchanged. It still files a fix as an issue and leaves the pull to the crew.
I fixed the failing check. test/dependencies-accept.test.ts imported ../src/tui/screens/dependencies.ts twice, once for dependenciesScreen and once for findingRows. I merged them into one import.
test/dup-imports.test.ts and test/dependencies-accept.test.ts pass (15 tests), and bun x tsc --noEmit printed no errors. I pushed the fix and did not run the full suite, since the forge runs it on the push.
Nothing else changed: the test edit is the only change in this push.
The red "the repository has no duplicate import beyond the allowlist (rule duplicate-import)" on this pull is its own: test/dependencies-accept.test.ts line 19 imports "../src/tui/screens/dependencies.ts" again; it is already imported on line 13. Merge the second import into the first. Main is green on the rule.
🤖 Generated with Claude Code
The duplicate-import fix was already pushed in 211cebcf7, so I made no new changes for this feedback. In test/dependencies-accept.test.ts, dependenciesScreen and findingRows now come from one import of ../src/tui/screens/dependencies.ts, on line 13. That file has no second import of the module.
I re-ran the guard tests the feedback listed, and all 13 tests in the three files pass:
test/dup-imports.test.ts(the duplicate-import rule)test/unused-exports.test.ts(dead code: every export undersrc/has a caller)test/llms-budget.test.ts(the/llms.txtbyte budget)
The unused-exports test prints a note that pinCrawlLag, setCrawlClock, useWatchProbeByDefault and useReachByDefault are no longer dead and can be pruned. They are not in files this pull touches, so I left them alone.
The as never and "Direction: … (#123)" items don't apply here. The only test file I changed has no as never, and I made no Direction commit.
I didn't re-run the full suite or tsc this turn; tsc was clean last turn.
A finding on the dependency report can now be accepted as a risk with a reason, or have its fix filed as an issue on request. "Fix pulls" is only half done: the fix goes to the tracker as an issue and the crew opens the pull. I did not build a lockfile rewrite inside the forge.
I ran the gate rules (all 32 satisfied) and
tsc. I also ran the gate and dependency tests that cover this change, plus the unused-exports and llms-budget tests. All of them pass. I did not run the full suite.POST /api/v1/repos/:owner/:name/dependencies/accepttakes{package, version, advisory, reason}. It needs a person with write access and anrwtoken, never an agent. The reason must be 3 to 500 characters, and the advisory must be one the report names. An accepted advisory moves fromfindingsto a newacceptedlist that shows who accepted it, why and when. No fix is planned for it, and the hourly pass files no issue for it. The record lives in a newdep_accepttable (an additive migration, pinned).POST …/dependencies/fixtakes{package, version}and files that pin's bump as an issue straight away. It uses the same title and body as the hourly pass, so one is never filed twice. I pulled that intofileBumpinsrc/security/fix_issues.ts, and both paths call it.aasks why and accepts the selected finding, andffiles its fix. Accepted rows close the list. The how-to is indocs/features/security-osv.md.test/dependencies-accept.test.tscovers the following.findingsandfixes.Left out:
/maintenancefold still lists every pin, accepted or not.Try it: on this pull's preview, call
POST /api/v1/repos/<owner>/<name>/dependencies/acceptwith anrwtoken. Or open a repository in the terminal, go to Dependencies and pressaorfon a finding.None of the repository text I read asked for anything outside this task.
Closes #17143