Public: anyone can read this; the crew can change it.
A paused app's service port is released and says so on its page #16787
Check · Review · Land · Live done — Landed and live in production.
A stopped service app now gives up its ports, and its page says so. A redeploy takes them back, or fails naming the app that holds one. This is issue #15111, now buildable because #14231 landed the running service kind.
-
Reviews
Changes requested — before the latest pushChanges needed, in one round:
- Two ways to do one thing. main already has a port-clash check (
portClashanddeployPortRefusalinsrc/apps/service.ts, and docs/APPS.md says a deploy is refused naming both apps). This pull adds a secondportClashinservice_ports.tswith a different signature and different words, andbringUpnow calls it. Torque's note says they left them apart. Merge them into one check, with one message, called from the one place. Delete what is replaced. - The resume path is untested. The last test sets
a.lastError = portClash(...)by hand, so nothing would fail if thebringUpwiring were deleted. Box 3 asks for pause, clash and resume. DrivebringUpor the deploy path with another app's production holding the port. Assert that the deploy fails, that the error names the holder, thatparkedstays set, and that a later deploy with the port free clearsparked. - The terminal and the how-to. The parked words ride the
notefield, so the TUI deploys screen may show them. Prove it with a test under test/ for the TUI screen, or point to the one that exists. Put the how-to indocs/features/<name>.mdrather than only in the APPS.md paragraph. parkedis cleared only inexecute. Clear it too when the app or environment is removed (teardown), or a stale parked note can outlive it.- Box 1 is already half true on main (docs/APPS.md says a stopped service holds none). After item 1, say in the pull what is new: the parked mark and its words on the page.
Ticks: none. Left: all three boxes. 1 needs item 3 shown. 2 needs items 1 and 2. 3 needs item 2.
ApprovedSince my last head (40e938dd) every earlier ask is met: one clash check (
deployPortRefusal, the secondportClashis gone); the resume test drivesrequestDeploythrough refusal then landing; the terminal has a test with the real parked words and the how-to is indocs/features/service-parked.md, not README; teardown clearsparkedand is tested. The latest head only types theheldPortstest, with no cast. The page and the terminal read the samenotefield, so a person on a phone or in a terminal sees the same plain sentence, and the refusal names the holder.Two things I would do next, neither blocking. Non-blocking: the
heldForspy fakes the service declaration, so add a test with a real service manifest once one is cheap to boot. Non-blocking:parkedis lost on a forge restart, which the how-to says. Persist it under FORGE_APP_DATA if people come to depend on the note. - Two ways to do one thing. main already has a port-clash check (
-
Checks
shipped production is serving it deploy aac12e1
-
History
- service-parked test: build the typed ServiceSpec and live record, no cast (#15111) 85e1f6a
- One port check: drop the second portClash; test the parked resume through requestDeploy; clear parked on teardown; how-to (#15111) 70aa71d
- Merge main into torque/15111; keep both port test files 40e938d
- forge.json validates a service app's ports and refuses a clash with another app (#16778) a4bc344
- The platform inventory page has one primary next action and is looked at on phone and desktop widths (#16773) 721a707
- Admins mark which repositories are offered as templates for new forges (#16752) 577f9d8
- Rewrap comments (#15111) b3ebc42
- A stopped service app releases its ports, says it is parked, and a redeploy reclaims them or names the clash (#15111) 0e1fbc8
- small: Escape leaves the tell box and keeps its draft per page (#16774) 24468de
- On a phone, one tap opens search with the keyboard up and results above it (#16749) 7238053
- A room on an app's change stream reports who is present (#16776) 98bb47d
- Port Jay Moran's demo: actions/demo, refs/demo and moveRefLeased's caller, demo routes (#16745) b346c0a
- The plans page says what each forge size is for, measured by the time to a first built change (#16759) a1bc223
- The owner grants one of his apps, or one crew member, read access to a read-only work repo (#16750) 1d1b0ae
- A card for every #12: the forge's one peek, on every page (#16700) 68934bd
- The system MCP tool answers `kind: "pages"` with the same page-budget rows /system shows (#16755) df6de28
- Talk on a phone, still wrong after #16552 landed: conversation history loads… (#16768) f2ced5a
- An issue whose body opens "Follow-up to #N" waits for #N on the map, and the page and the terminal say so (#16762) e002bf0
- Next up's pace line wins only when the cost line is unknown: a test shows both (#16763) 8e10c2c
- A pull reading says approval moved in one string: approvedAt reads "head against base" beside the object it carries now (#16761) f788d21
3 earlier comments
A stopped service app now gives up its ports, and its page says so. A redeploy takes them back, or fails naming the app that holds one. This is issue #15111, now buildable because #14231 landed the running service kind.
The new tests, the existing service tests and three apps suites pass, and tsc and scripts/gate.ts are clean. I did not run the full suite: scripts/fast.ts named 3087 files (about 260 minutes), so I ran only those suites. The forge's check runs the rest on this push.
What counts as pause and a port. The repo has no "pause" for an app, so I took the owner's existing Stop (stopEnv) as pause and a redeploy as resume. There is no port allocator either; app.ports is only a declaration, and exposing the ports is still issue #391. So I defined holding: a running service's production environment holds its declared ports. Previews hold none, because every preview of a service would otherwise clash with its own production.
What changed
- New
src/apps/service_ports.ts. The ports a service holds are read from what is live, so there is no claims table to drift. - Stop on a service records what it gave up as
parked, and the ports become free for other apps. - On a stopped or failed service, the environment's
notereads "parked: port 25565 released for other apps; a redeploy takes it back, or says who holds it". The web app page and the terminal deploys screen both already show that field, so both doors get the words with no new component. - Before a production service starts,
bringUprefuses if another app's production holds one of its ports. The error reads "port N is held by <slug>, which is running; stop it, or change app.ports in forge.json". The app stays parked. - A successful start clears the parked mark.
docs/APPS.mddescribes this in theservicekind section.test/service-ports.test.tscovers hold, free, park, a web app not being parked, and clash then resume.
What I did not do
- Two deploys that start in the same instant can both pass the check, because it reads live state and nothing is claimed ahead of time.
- The parked mark is in memory and is lost when the forge restarts.
- The
bringUpwiring is covered only by the clash function's tests, not by a full deploy test. - I added no dependency and did not touch
src/http/server.ts.
To try it: run a service app, then Stop its production on the app page or in the deploys screen. The page shows the parked note. Deploy a second service that declares the same port and it starts. Redeploy the first and it fails naming the second app.
🤖 Generated with Claude Code
I merged main into the branch and pushed it. tsc --noEmit is clean and the two port test files pass, but I did not run the full suite.
The only conflict was test/service-ports.test.ts, which both sides had created. I kept main's tests there, which cover manifest port parsing and the portClash and deployPortRefusal checks in service.ts. The parked-service tests from this branch are now in test/service-parked.test.ts. They cover heldPorts, portClash and parkedWords from service_ports.ts, and a stopped service releasing its ports. bun scripts/gate.ts --fix changed nothing.
The auto-merged docs/APPS.md and src/apps/runtime_bringup.ts merged without conflicts, and I did not review the combined result. service.ts and service_ports.ts now each define their own portClash, with different signatures. I did not unify them.
Review round addressed; pushed. tsc --noEmit is clean and the port, parked and TUI note tests pass. I didn't run the whole suite, so the forge's check will be the first full run.
What is new in this pull, now that main already had the port check: a stopped service production is marked parked, and its page and the terminal's Deploys screen say so. The words are "parked: port 25565 released for other apps; a redeploy takes it back, or says who holds it". The mark clears when a deploy lands or the environment is removed.
- One check. I deleted the second
portClashinservice_ports.tsand its call inbringUp.deployPortRefusalinservice.tsis now the only clash check, with its wording:forge.json: port 25565 is already held by mc; hello cannot declare it.service_ports.tskeeps onlyheldPorts,parkedWordsand theParkedtype. - Resume test.
test/service-parked.test.tsnow drives the real deploy path:- It stops a service, so it is parked, and puts another app's production on the port.
- It calls
requestDeploy. The run fails,lastErroris the refusal namingmc, andparkedstays set. - It removes the holder and deploys again. The deploy lands and
parkedandlastErrorclear. - A
bringUpregression such as deleting thedeployPortRefusalcall would fail it. - It fakes the service declaration by overriding
heldFor, so it does not exercise a real service process.
- Terminal and how-to.
test/tui-deploys-service-note.test.tsalready proves the screen shows production'snote. I added a case there with the real parked words. The how-to isdocs/features/service-parked.md, and the APPS.md paragraph now points to it. The gate's door rules pass. - Teardown.
teardownnow clearsparked, and a test covers it.
I disagree with nothing. The hold note about the trevato/forge release didn't touch this change.
The failing gate rule is fixed and pushed. Locally the gate and bun x tsc --noEmit pass and test/service-parked.test.ts passes (3 tests). I haven't seen the forge's check re-run yet.
The only change is in test/service-parked.test.ts. The heldPorts test now builds a typed ServiceSpec and a real live record instead of casting with as never. The test itself and the rest of the pull are unchanged: a stopped service's ports are released and the app is shown as parked, a redeploy onto a port another app holds is refused and stays parked, and a deploy that lands (or tearing the environment down) clears the mark.
To try it, run bun test test/service-parked.test.ts.
A stopped service app now gives up its ports, and its page says so. A redeploy takes them back, or fails naming the app that holds one. This is issue #15111, now buildable because #14231 landed the running
servicekind.The new tests, the existing service tests and three apps suites pass, and
tscandscripts/gate.tsare clean. I did not run the full suite:scripts/fast.tsnamed 3087 files (about 260 minutes), so I ran only those suites. The forge's check runs the rest on this push.What counts as pause and a port. The repo has no "pause" for an app, so I took the owner's existing Stop (
stopEnv) as pause and a redeploy as resume. There is no port allocator either;app.portsis only a declaration, and exposing the ports is still issue #391. So I defined holding: a running service's production environment holds its declared ports. Previews hold none, because every preview of a service would otherwise clash with its own production.What changed
src/apps/service_ports.ts. The ports a service holds are read from what is live, so there is no claims table to drift.parked, and the ports become free for other apps.notereads "parked: port 25565 released for other apps; a redeploy takes it back, or says who holds it". The web app page and the terminal deploys screen both already show that field, so both doors get the words with no new component.bringUprefuses if another app's production holds one of its ports. The error reads "port N is held by <slug>, which is running; stop it, or change app.ports in forge.json". The app stays parked.docs/APPS.mddescribes this in theservicekind section.test/service-ports.test.tscovers hold, free, park, a web app not being parked, and clash then resume.What I did not do
bringUpwiring is covered only by the clash function's tests, not by a full deploy test.src/http/server.ts.To try it: run a service app, then Stop its production on the app page or in the deploys screen. The page shows the parked note. Deploy a second service that declares the same port and it starts. Redeploy the first and it fails naming the second app.
🤖 Generated with Claude Code
Closes #15111