Relationships
#4919 The serve host takes its workspaces from the workspace registry, with no change to what it serves
Opened by zack · 11/19/2026· Shipped 11/20/2026
Third of six steps that merge a serve host's workspaces into the workspace registry and make the host folder optional. swamp-club#4865 lists the whole sequence. One PR. Depends on swamp-club#4918 (a host registers the workspaces it runs).
Problem
After swamp-club#4918 every workspace a host runs is a registry entry, but the host still decides what exists from a scan of workspaces/, and builds each child's repo folder as workspaces/<name>. swamp-club#4865 serves repos that are registered anywhere on the machine. That needs the host and the workspace services to work from registry entries, each with a folder of its own.
This issue makes that switch and changes nothing an operator or a client sees. Keeping it apart from swamp-club#4865 lets it be reviewed for one thing: nothing an existing host does today changes.
Change
The host and the workspace services take their workspaces from the registry. Only entries whose folder is inside the host's workspaces/ count for now, so the set of workspaces is the one the folder scan gives today.
The host
- With each rescan the host registers the folders in
workspaces/first (swamp-club#4918), then reads the registry. - The read never adopts and takes no lock that a workspace command would wait on.
- A workspace is an entry whose folder is inside
workspaces/. Any other entry is passed over without a log line; swamp-club#4865 lists those. - A child's repo folder is the entry's folder. The registry does not store every folder by its real path, so the host resolves each one before it compares one with another.
- The reconciler, the supervisor's child spec and the status writer take a name and a folder where they take a name today.
- The wanted and status files stay in
workspaces/, under the workspace's name.
A folder that is not in the registry
- A folder in
workspaces/that could not be registered (swamp-club#4918, A folder that cannot be registered), or that a failed write has not registered yet, is still a workspace, served from its folder as today. So a registry write that fails never stops a serve.
A registry that cannot be read
- While the host runs: log it, change nothing, and keep the entries last read whole.
- At startup, with nothing read yet: the host takes its workspaces from the folders in
workspaces/, as today. A corrupt registry, or one written by a newer swamp, does not stop a host at its next restart.
The workspace services
list,get,suspend,resume,deleteandcreatetake the names that exist from the same source as the host: registry entries insideworkspaces/, plus the folders above. A name with a wanted file and no folder is still shown, as an unfinished create or delete is today.- What they return is unchanged and still names no host path.
Compatibility
- No change for an operator or a client: the same workspaces, states, addresses, replies and files.
- The registry file is read, and written only as swamp-club#4918 writes it.
Done when
- The integration test that runs a host in-process passes unchanged, apart from supplying a registry.
- A host started on an existing host folder serves the same workspaces, at the same addresses, from the same folders.
- A workspace whose registry entry names its folder by another spelling of the same path (a link, a trailing separator) is one workspace, not two.
- A repo registered outside
workspaces/is not listed, has no status file and has no serve. - With a registry that cannot be read, nothing running stops, and a host started that way serves the folders in
workspaces/. - A folder in
workspaces/that could not be registered is still served. - No reply of
workspace.listorworkspace.getdiffers from the one before this change. - The tests use a fake process port and a registry in a temp config folder supplied with
withMockedEnv. They spawn no processes. - The fitness rule for
src/serve/host/still passes.
Where to look
src/serve/host/serve_host.ts(specOf,hostDirectory),src/serve/host/workspace_folder.tsandsrc/serve/host/workspace_reconciler.ts.src/infrastructure/persistence/hosted_workspace_folder_scan.tsfor what the scan reports today.src/libswamp/hosted_workspace/deps.ts(hostedWorkspaceNames,changeHostedWorkspace,summarizeHostedWorkspace) for where the services find names.src/infrastructure/persistence/workspace_registry_file_repository.ts(load) andsrc/libswamp/workspace/workspace_store.tsfor the registry. The store adopts on first read, which the host's read must not do.
Out of scope
- Listing or serving a workspace registered outside
workspaces/. That is swamp-club#4865. - Any change to authorization.
- Any change to the wanted or status file.
Shipped
Click a lifecycle step above to view its details.
Sign in to post a ripple.