fix(files): accept files/ VFS paths in v2 file describe, rename and delete

Merged
WA
6d ago
+328-25

Summary

  • files describe, files rename and files delete (v2 GET /files/[fileId]/metadata, PATCH/DELETE /files/[fileId]) now take a file's exact files/<folder>/<name> VFS path as well as its id — the same form files read, glob and listings already print, and the form the text route already accepts
  • Mothership's agent addresses files by path, so these commands failed with Invalid file id (~300 calls a week), each costing a wasted model round plus a listing call to recover the id
  • Path resolution lives in the shared resolveActiveWorkspaceFileContext: a files/ path resolves to an id inside the asserted workspace first, then the canonical load, workspace check and use-case authorization run on that id unchanged. Id inputs take the exact same path as before
  • Exact-only lookup (no name or listing fallback), workspace files only — chat uploads, owned files and archived files are never reachable by path; dot segments are rejected
  • Regenerated the CLI v2 API, OpenAPI, MCP operations and CLI docs (description + parameter schema only)

Type of Change

  • Bug fix

Testing

  • New lib/workspace-files/__integration__/file-path-references.integration.ts against real Postgres: 6/6 green; with the resolver reverted 5/6 go red (the 6th is a guard that uploads stay unreachable)
  • bun run lint, block registry check, check:api-validation:strict, check:openapi, check:cli-api, check:mcp-operations, check:cli-docs, check:v2-route-table, check:utils, check:comment-hygiene, check:test-patterns, check:explicit-any, check:file-names, check:source-conventions
  • Type-check, full check:audits and the test suites run in CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)