Public: anyone can read this; the crew can change it.
Granting an app a private destination in the terminal asks first: `g` names the app and destination, `y` grants #7966
Check · Review · Land · Live done — Landed and live in production.
In the terminal's Private egress screen, `g` now asks for confirmation before granting. Before, it granted the destination under the cursor as soon as the key was pressed. Revoking with `x` narrows the boundary, so it still takes one key.
shipped production is serving it deploy da65c36
In the terminal's Private egress screen, g now asks for confirmation before granting. Before, it granted the destination under the cursor as soon as the key was pressed. Revoking with x narrows the boundary, so it still takes one key.
What changed
- The confirm:
src/tui/screens/egress.ts: on a row that is not yet granted,gopensconfirmScreenwithyesNo: true. Its title is "Let <owner>/<name> reach <destination>?" and its one body line is "The app's outbound traffic to it is allowed until you revoke it with x."yor the Grant button callsgrantAppEgressand shows the usual "<destination> is granted." toast.norescgrants nothing. On a row that is already granted,gdoes nothing and opens no confirm. - Grants run through
runAsync: grant, revoke and the first load now go throughrunAsync. The app then counts them as busy, sosettleAppwaits for the write and the reload. Before this, the grant could land aftersettleAppreturned. That failed the test once, and the leftover grant then failed the later tests that share the database. - Dialog width:
src/tui/screens/common.ts:confirmScreentakes an optionalwidthand passes it todialog. The egress confirm uses 78 columns, because at the default 54 the body line was cut off mid-sentence.
Tests
test/tui-egress.test.ts:
- The site admin test now checks that g opens the confirm and grants nothing, that y grants and shows the toast, and that g on the granted row opens no confirm.
- A new test presses g then n, and g then esc. Both times it proves no grant and no event were written, and that egressView still shows the row not granted. Without the change, both admin tests fail.
- The writer and repository-admin tests are unchanged.
test/egress-admin.test.tsalso covered the old one-key grant, so it now pressesyafterg. That test changed because the behaviour changed on purpose, not because it was wrong.
Checks run
bun scripts/gate.tsandbun x tsc --noEmitboth pass.bun test test/tui-egress.test.ts test/egress-admin.test.tspasses. I rantui-egressthree times in a row.- I also ran the tests for the other screens that use
confirmScreen(tui-widgets,tui-forks-take,tui-people-verify,tui-agents,tui-screens,tui-deploys-egress); their one failure wasegress-admin, fixed by theypress above. scripts/fast.tsnamed 277 test files for this diff, well over its budget, so I chose the covering tests myself rather than run them all.
Not done: the web settings page's grant button is unchanged.
To try: as a site admin, open a repository whose forge.json asks for egress. Go to About, press e, then g. The dialog names the app and the destination. n leaves the row "asked for, not granted"; y grants it.
🤖 Generated with Claude Code
Read every changed line. The grant still goes through grantAppEgress, which decides who may, so the confirm adds a step and removes no check. The dialog opens only for a site admin on a row that is not yet granted. n and esc grant nothing, and the tests prove no grant and no event were written. The tests would fail without the change, and the one existing test that changed (egress-admin) changed because the behaviour changed on purpose. runAsync makes the write and its reload count as busy, and confirmScreen gains an optional width. The pull adds no dependency, no secret and no new input. One nit, not blocking: the header comment in src/tui/screens/egress.ts now has a very long last line, so re-wrap it. I did not exercise the dialog in the preview because it is a terminal screen; I judged it from the diff and the tests.
In the terminal's Private egress screen,
gnow asks for confirmation before granting. Before, it granted the destination under the cursor as soon as the key was pressed. Revoking withxnarrows the boundary, so it still takes one key.What changed
src/tui/screens/egress.ts: on a row that is not yet granted,gopensconfirmScreenwithyesNo: true. Its title is "Let <owner>/<name> reach <destination>?" and its one body line is "The app's outbound traffic to it is allowed until you revoke it with x."yor the Grant button callsgrantAppEgressand shows the usual "<destination> is granted." toast.norescgrants nothing. On a row that is already granted,gdoes nothing and opens no confirm.runAsync: grant, revoke and the first load now go throughrunAsync. The app then counts them as busy, sosettleAppwaits for the write and the reload. Before this, the grant could land aftersettleAppreturned. That failed the test once, and the leftover grant then failed the later tests that share the database.src/tui/screens/common.ts:confirmScreentakes an optionalwidthand passes it todialog. The egress confirm uses 78 columns, because at the default 54 the body line was cut off mid-sentence.Tests
test/tui-egress.test.ts:- The site admin test now checks that
gopens the confirm and grants nothing, thatygrants and shows the toast, and thatgon the granted row opens no confirm. - A new test pressesgthenn, andgthenesc. Both times it proves no grant and no event were written, and thategressViewstill shows the row not granted. Without the change, both admin tests fail. - The writer and repository-admin tests are unchanged.test/egress-admin.test.tsalso covered the old one-key grant, so it now pressesyafterg. That test changed because the behaviour changed on purpose, not because it was wrong.Checks run
bun scripts/gate.tsandbun x tsc --noEmitboth pass.bun test test/tui-egress.test.ts test/egress-admin.test.tspasses. I rantui-egressthree times in a row.confirmScreen(tui-widgets,tui-forks-take,tui-people-verify,tui-agents,tui-screens,tui-deploys-egress); their one failure wasegress-admin, fixed by theypress above.scripts/fast.tsnamed 277 test files for this diff, well over its budget, so I chose the covering tests myself rather than run them all.Not done: the web settings page's grant button is unchanged.
To try: as a site admin, open a repository whose forge.json asks for egress. Go to About, press
e, theng. The dialog names the app and the destination.nleaves the row "asked for, not granted";ygrants it.🤖 Generated with Claude Code
Closes #7961