docs,test: settle review follow-ups for the create-by-name deletion

Rewrite the three sibling Agent Note pairs that still described create-by-name
as current (workspace-ui-product-flow, session-list-browsing-and-manual-order,
same-basename-workspace-adoption) and the one-route note's own alternative and
section title; delete scripts/hero-composer-dom-continuity.mjs, which drove the
name dialog removed by the one-route change; mark WorkspaceRegistry.create's
now test-only title parameter with a deletion TODO; pin the retired { name }
spelling as a schema rejection; align the workspace spec on stageDir and the
fixture spec title on path creates.
This commit is contained in:
creatixchu
2026-08-07 14:48:26 +08:00
parent fbd3a6272b
commit 40ee7f5e27
17 changed files with 34 additions and 109 deletions

View File

@@ -535,7 +535,7 @@ describe('createFixtureApi', () => {
expect(reused.result.value).toMatchObject({ created: false, workspace: { workspaceId: 'fx-ws-fixture' } })
})
it('workspace.create by name mints a new entity and pushes host/workspace-changed', async () => {
it('workspace.create on a fresh path mints a new entity and pushes host/workspace-changed', async () => {
const api = createFixtureApi()
const abort = new AbortController()
const seen: HostFrame[] = []

View File

@@ -252,8 +252,7 @@ describe('host.openPath', () => {
describe('workspace.create', () => {
it('serializes concurrent creates of one path into a single registration', async () => {
const { api, root } = await harness()
const target = join(root, 'alpha')
mkdirSync(target)
const target = stageDir(root, 'alpha')
const responses = await Promise.all([
api.workspace.create(request({ path: target })),
api.workspace.create(request({ path: target })),
@@ -269,8 +268,7 @@ describe('workspace.create', () => {
it('adopts only existing directories', async () => {
const { api, root } = await harness()
const existing = join(root, 'existing')
mkdirSync(existing)
const existing = stageDir(root, 'existing')
const first = expectOk(await api.workspace.create(request({ path: existing })))
const repeated = expectOk(await api.workspace.create(request({ path: existing })))
expect(first).toMatchObject({ created: true, workspace: { path: existing, title: 'existing' } })

View File

@@ -327,6 +327,8 @@ describe('workspace domain schemas', () => {
it('create requires a path', () => {
expect(workspaceCreateRequestSchema.parse({ path: '/p' }).path).toBe('/p')
expect(() => workspaceCreateRequestSchema.parse({})).toThrow()
// The retired create-by-name spelling stays a clean schema rejection.
expect(() => workspaceCreateRequestSchema.parse({ name: 'n' })).toThrow()
expect(workspaceCreateValueSchema.parse({ workspace: view, created: false }).created).toBe(false)
})

View File

@@ -139,6 +139,11 @@ export class WorkspaceRegistry extends Service {
* @param title - Display title used only when a new record is created.
* @returns the existing or newly durable workspace.
*/
// TODO: `title` lost its last production caller when the gateway's
// create-by-name branch was deleted
// (.agents/notes/implemented/simplification/2026-07-31-one-route-to-add-a-workspace.md);
// drop the parameter with its @param clause and the `create(path, title?)`
// lines in this package's README pair.
async create(path: string, title?: string): Promise<Workspace> {
const canonical = await realpathNormalize(path)
if (!(await stat(canonical)).isDirectory()) {