Skip to content

feat(web): add account export, deletion, source deletion#12

Merged
dubscode merged 2 commits intomainfrom
feature/lab-127-implement-export-account-deletion-and-data-ownership-flows
Apr 13, 2026
Merged

feat(web): add account export, deletion, source deletion#12
dubscode merged 2 commits intomainfrom
feature/lab-127-implement-export-account-deletion-and-data-ownership-flows

Conversation

@dubscode
Copy link
Copy Markdown
Contributor

Summary

  • Source-level deletion: items.delete oRPC procedure soft-deletes the source, its segments, its blobs, and any memories that only cited it, then removes the S3 objects. Wired into item detail as a confirm-to-delete button.
  • Full account export: new features/account module emitting a versioned (v1) JSON manifest w/ user, spaces, source items, blobs, segments, memories, citations, device tokens. Live blobs get 15m presigned download URLs so the vault is reconstructable offline. Exposed via /api/account/export and an AccountExportCard in Settings.
  • Account deletion: account.delete procedure transactionally hard-deletes memory_citations → memories → ingestion_jobs → evaluation_runs → segments → source_blobs → source_items → spaces → user (cascades session / device_tokens / connector_cursors / account), followed by S3 blob cleanup and sign-out. Gated behind a DELETE confirmation in the Settings danger zone.
  • Privacy + Settings wording rewritten to be explicit about live-data deletion and the 30d backup retention window.

Completes LAB-127.

Note on scope

This PR is stacked on top of the LAB-126 commit (457e04a feat(web): build inbox, spaces, item detail, ask, settings surfaces) because no PR was opened for LAB-126 yet. Please merge/rebase accordingly if LAB-126 ships in its own PR first.

Test plan

  • pnpm qc — biome, typecheck, vitest (110 passing incl. 8 new), and web build all green
  • 3 new tests for deleteItem (happy, blob failure, NOT_FOUND)
  • 5 new tests for exportAccount / deleteAccount (manifest shape, soft-deleted blobs get null URL, presign failure, NOT_FOUND, deletion happy / blob failure)
  • Manual: sign in, upload a file, delete the source, confirm it disappears from inbox + retrieval, confirm S3 object gone
  • Manual: download export, verify JSON manifest + signed URLs resolve
  • Manual: delete account, confirm redirect to /, confirm re-login creates a fresh empty vault

Unresolved questions

  • Backup retention window set at 30d — confirm w/ Neon/S3 config?
  • Account delete sign-out uses better-auth client — enough for all devices?
  • Export URL TTL 15m — enough for large vaults w/ many blobs?

- new features/items module w/ list + get
- extend features/spaces w/ router, service, count-aware repo methods
- app shell nav at components/app-shell
- quick capture composer (note/url/file) replaces verification shell
- item detail view w/ blob, segments, derived memories
- ask panel: real token streaming via streamGroundedAnswer
- reorder ask status yields; drop post-hoc phases
- pin wxt dev server to 3010 so extension stops racing next

Completes LAB-126
item delete soft-deletes source+segments+orphan memories and removes
S3 blob. account export emits versioned JSON manifest w/ presigned blob
URLs. account delete hard-deletes all live data, blobs, and user.
privacy page + settings updated w/ 30d backup retention wording.

Completes LAB-127
Copilot AI review requested due to automatic review settings April 13, 2026 04:52
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
memory-vault Ready Ready Preview, Comment Apr 13, 2026 4:53am

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds end-user “data ownership” flows to the web app (source deletion, full account export, and account deletion) while expanding the authenticated shell with Spaces + Ask surfaces and upgrading query answering to stream responses.

Changes:

  • Introduces oRPC routers + services for spaces, items (incl. deletion), and account export/deletion, plus corresponding UI in the app shell.
  • Adds /api/account/export endpoint emitting a versioned JSON manifest with presigned blob download URLs.
  • Updates query answering to stream model output deltas to the client UI.

Reviewed changes

Copilot reviewed 45 out of 46 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
apps/web/src/rpc/router.ts Registers new account, items, and spaces routers.
apps/web/src/lib/ai/query.ts Adds streamGroundedAnswer() using streamText.
apps/web/src/features/spaces/service.ts Space list/get service layer.
apps/web/src/features/spaces/schemas.ts Zod schemas for space list/detail.
apps/web/src/features/spaces/router.ts oRPC procedures for spaces.
apps/web/src/features/spaces/repository.ts Adds “with counts” queries for spaces.
apps/web/src/features/spaces/index.ts Exports space UI/types.
apps/web/src/features/spaces/components/space-list-card.tsx UI card for listing spaces.
apps/web/src/features/query/service.ts Streams answer deltas from AI to event generator.
apps/web/src/features/query/service.test.ts Updates mocks/tests for streamed answering + phase change.
apps/web/src/features/query/index.ts Exports AskPanel.
apps/web/src/features/query/components/ask-panel.tsx Client UI for ask-with-citations + streaming deltas.
apps/web/src/features/items/service.ts Item list/get + delete orchestration (DB + storage cleanup).
apps/web/src/features/items/service.test.ts Tests for item deletion behavior (happy + cleanup failure + NOT_FOUND).
apps/web/src/features/items/schemas.ts Zod schemas for item list/detail + delete.
apps/web/src/features/items/router.ts oRPC procedures for items.
apps/web/src/features/items/repository.ts DB access for items list/detail + transactional soft-delete.
apps/web/src/features/items/index.ts Exports item UI/types.
apps/web/src/features/items/components/item-preview-card.tsx UI preview card for inbox listings.
apps/web/src/features/items/components/item-link.tsx Shared link component to item detail.
apps/web/src/features/items/components/item-detail-view.tsx Item detail UI including delete danger zone.
apps/web/src/features/items/components/inbox-list.tsx List UI wrapper with empty state.
apps/web/src/features/items/components/delete-item-button.tsx Client confirm-to-delete button for items.
apps/web/src/features/captures/index.ts Switches exports to QuickCaptureComposer.
apps/web/src/features/captures/components/quick-capture-composer.tsx Unified note/url/file capture UI.
apps/web/src/features/captures/components/capture-verification-card.tsx Removes older capture verification UI.
apps/web/src/features/account/service.ts Implements export manifest + account deletion + S3 cleanup.
apps/web/src/features/account/service.test.ts Tests for export manifest + deletion cleanup behavior.
apps/web/src/features/account/schemas.ts Zod schema for export manifest + delete output.
apps/web/src/features/account/router.ts oRPC procedures for export + delete.
apps/web/src/features/account/repository.ts Loads export data + transactional hard-delete logic.
apps/web/src/features/account/index.ts Exports account settings UI/types.
apps/web/src/features/account/components/account-export-card.tsx Settings UI to download export.
apps/web/src/features/account/components/account-danger-zone-card.tsx Settings UI to delete account with confirmation phrase.
apps/web/src/components/app-shell/app-shell-nav.tsx Adds app shell navigation.
apps/web/src/app/privacy/page.tsx Updates privacy policy wording for export/deletion/retention.
apps/web/src/app/app/(shell)/spaces/page.tsx Spaces index page.
apps/web/src/app/app/(shell)/spaces/[spaceId]/page.tsx Space detail page (items in space).
apps/web/src/app/app/(shell)/settings/page.tsx Settings page wiring export + delete account UIs.
apps/web/src/app/app/(shell)/page.tsx Replaces prior internal surface with inbox + quick capture.
apps/web/src/app/app/(shell)/layout.tsx Updates shell header/nav layout.
apps/web/src/app/app/(shell)/items/[sourceItemId]/page.tsx Item detail page.
apps/web/src/app/app/(shell)/ask/page.tsx Ask page wiring AskPanel.
apps/web/src/app/api/account/export/route.ts New API route returning export manifest as downloadable JSON.
apps/web/next-env.d.ts Updates Next-generated TS routes import path.
apps/extension/wxt.config.ts Pins extension dev server origin/port.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/web/src/features/items/repository.ts
Comment thread apps/web/src/features/account/service.ts
@dubscode dubscode merged commit 494cb32 into main Apr 13, 2026
12 checks passed
@dubscode dubscode deleted the feature/lab-127-implement-export-account-deletion-and-data-ownership-flows branch April 13, 2026 06:08
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.

2 participants