Skip to content

feat: persist, import, and share named composer workspaces - #167

Merged
dotunv merged 7 commits into
Savitura:mainfrom
Calebstack:security/issue-149-feat-persist-import-and-share-named-composer
Aug 31, 2026
Merged

feat: persist, import, and share named composer workspaces#167
dotunv merged 7 commits into
Savitura:mainfrom
Calebstack:security/issue-149-feat-persist-import-and-share-named-composer

Conversation

@Calebstack

Copy link
Copy Markdown
Contributor

Overview

This PR adds named workspace persistence to the Transaction Composer. Users can save the current composer state (account, operations, memo, bounds, notes) to a named workspace, list/load/rename/delete/duplicate workspaces, export/import workspace JSON files, and generate read-only share links with configurable expiration. Imported JSON is schema-validated and sanitized before being applied, and workspaces persist across sessions and servers through the API.

Related Issue

Closes the bounty issue: feat: Persist, import, and share named composer workspaces

Changes

🗂️ Workspace Persistence & API

  • [ADD] apps/api/src/modules/workspace/entities/workspace.entity.ts

    • New workspaces table: id, owner_id, name, composer_state (JSON), operations[], created_at, updated_at.
    • Owner-scoped queries and timestamp tracking for last-saved/last-modified display.
  • [ADD] apps/api/src/modules/workspace/workspace.service.ts

    • Save, list, load, rename, delete, and duplicate workspace operations.
    • Export/import JSON serialization with deep validation and sanitization.
    • Share-link generation with short unique codes and expiration (default 7 days).
    • Access control: only the owner can write, delete, or rename a workspace.
  • [ADD] apps/api/src/modules/workspace/workspace.controller.ts

    • REST endpoints for workspace CRUD, duplicate, export, import, and share-link creation.

💾 Composer Integration & Storage

  • [MODIFY] apps/web/src/components/tools/composer/index.tsx

    • Save/load/duplicate/delete workspace actions in the composer toolbar.
    • Last-saved/last-modified timestamp shown next to each workspace name.
    • Import validation error display and pre-apply sanitization.
  • [MODIFY] apps/web/src/lib/composer-api.ts

    • Typed API client for workspace endpoints and share-link management.
  • [MODIFY] apps/web/src/lib/workspace-storage.ts

    • Local optimistic cache and cross-session workspace persistence support.
  • [MODIFY] apps/web/src/app/composer/page.tsx

    • Workspace list/load UI with rename, delete, duplicate, export, and import actions.

🧪 Tests

  • [ADD] apps/api/src/modules/workspace/workspace.service.spec.ts
    • Coverage for save/load, export/import, invalid import rejection, share-link expiry, and owner-only write access.

Verification Results

npm test -- apps/api/src/modules/workspace/workspace.service.spec.ts
✅ 18/18 passed

Live acceptance check:
✅ Save/load named workspace round-trip
✅ Export/import JSON round-trip
✅ Malformed JSON rejected with clear error
✅ Share link expires after configured period
✅ Non-owner write attempts return 403
✅ Last-modified timestamps update and display correctly
Acceptance Criteria Status
Users can save composer state to a named workspace ✅ Save persists account, operations, memo, bounds, and notes
Users can list, load, rename, delete, and duplicate workspaces ✅ Full workspace management in composer UI/API
Users can export a workspace to a JSON file ✅ Export endpoint and UI download
Users can import a workspace from a JSON file ✅ Import endpoint and UI file picker
Import validates JSON schema and rejects malformed files with a clear error ✅ Schema validation + sanitization before apply
A read-only share link can be generated for a workspace ✅ Short unique share code with read-only payload
Share links expire after a configurable period (default 7 days) ✅ Expiration enforced server-side; default 7 days
Workspaces persist across sessions and servers ✅ Postgres-backed workspaces table
Tests cover: save/load, export/import, invalid import rejection, share-link expiry, access control ✅ 18 unit/integration tests

Closes #149

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@Calebstack Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@dotunv
dotunv merged commit 78d17da into Savitura:main Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Persist, import, and share named composer workspaces

2 participants