mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
* refactor(server): extract workspace provisioning into workspace-provisioning module Move the "find-or-create a workspace & project for a directory" cluster out of the 6.4k-line Session god class into session/workspace-provisioning/ behind an injected createWorkspaceProvisioningService(deps) port. Nine methods (~215 LOC) — findOrCreateWorkspaceForDirectory, resolveOrCreateWorkspaceIdForCreateAgent, createWorkspaceForDirectory, findOrCreateProjectForDirectory, ensureWorkspaceRecordUnarchived, and the private helpers resolveWorkspaceDirectory / findExactWorkspaceByDirectory / reclassifyOrUnarchiveWorkspaceForDirectory / resolveProjectRecordForPlacement — now live in one deep module with a 5-method interface. The session shed four pure-function imports it no longer needs and delegates from five call sites. The module's only dependencies are the workspace/project registries and the git-service checkout port — no emit, clientActivity, or observer coupling — so it is now unit-testable with real file-backed registries and a fake git port (workspace-provisioning-service.test.ts), instead of only through a booted Session. Behavior is unchanged: the existing open_project / import / create-agent characterization suites stay green. * refactor(server): address review — drop redundant spread property, test always-create - Remove the dead `workspaceId: input.workspace.workspaceId` in reclassifyOrUnarchiveWorkspaceForDirectory (already spread via ...input.workspace; behavior-identical). - Add a direct test pinning createWorkspaceForDirectory's always-mint-fresh contract (call twice for the same cwd → two distinct workspace ids), the property that distinguishes it from findOrCreateWorkspaceForDirectory.