refactor(dashboard): cut over to the Bun workspace SDK - #13
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 37ed756a1c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "vaul": "^1.1.2", | ||
| "zod": "^3.24.2", | ||
| "@vektorprogrammet/sdk": "^0.1.2", | ||
| "@vektorprogrammet/sdk": "workspace:*", |
There was a problem hiding this comment.
Align the profile endpoint before selecting the workspace SDK
With this workspace dependency selected, every non-fixture dashboard request reaches the parent loader's client.me.profile(). The local client sends GET /api/me/profile (packages/sdk/src/domains/me.ts:15-16), but the backend only registers GET /api/me (apps/server/src/App/Identity/Api/Resource/ProfileResource.php:14-17); the new fixture masks this mismatch by implementing the nonexistent /api/me/profile route. Against the real backend the profile request returns 404, the parent loader redirects to login, and the login loader redirects the still-authenticated cookie back to the dashboard, preventing users from entering the application.
Useful? React with 👍 / 👎.
| const result = await client.receipts.list(status ? { status } : undefined); | ||
| return { receipts: result.items as Receipt[] }; | ||
| } catch { | ||
| return { receipts: [] }; | ||
| return { receipts: result.items.map(mapReceiptView), error: undefined }; |
There was a problem hiding this comment.
Use the backend's user receipt collection endpoint
When Mine Utlegg loads against the real backend, the workspace SDK's receipts.list() sends GET /api/receipts (packages/sdk/src/domains/receipts.ts:20), while the server registers the user-scoped collection at /api/my/receipts (apps/server/src/App/Operations/Api/Resource/UserReceiptListResource.php:13-16) and exposes /api/receipts only for creation. The added stub implements GET /api/receipts, so the browser test passes despite production returning a method/route error and this loader rendering an empty receipt table with an error.
Useful? React with 👍 / 👎.
| const result = await client.admin.receipts.list(status ? { status } : undefined); | ||
| return { receipts: result.items as Receipt[] }; | ||
| } catch { | ||
| return { receipts: [] }; | ||
| return { receipts: result.items.map(mapAdminReceiptView), error: undefined }; |
There was a problem hiding this comment.
Match the admin receipt schema to the server payload
Whenever the admin collection contains a receipt, the workspace SDK requires every AdminReceipt to contain refundDate (packages/sdk/src/schemas/receipt.ts:18-27), but the backend's AdminReceiptListResource has no such property (apps/server/src/App/Operations/Api/Resource/AdminReceiptListResource.php:21-30) and its provider never populates one. Collection decoding therefore throws a ValidationError before this mapping runs, causing the loader to replace all real admin receipts with an empty list; the new fixture masks the incompatibility by supplying refundDate on its synthetic admin rows.
Useful? React with 👍 / 👎.
Design spec
design-specs/0010-dashboard-bun-sdk-resolution.mdJourney
A dashboard maintainer uses one Bun workspace SDK authority for cold install, build, auth/public/admin routes, and the Receipt consumer journey without duplicated wire clients.
Experience it
Evidence
What is real
The workspace SDK cutover, cold build boundary, and Receipt journey are real. Nine unrelated dashboard type diagnostics remain; this PR does not claim a broad-green dashboard, backend parity, provider behavior, deployment, or production acceptance.