Skip to content

fix(studio): wire Settings → Deployments page into router and nav - #299

Merged
khuepm merged 2 commits into
mainfrom
feature/loving-satoshi-be374d
Jul 27, 2026
Merged

fix(studio): wire Settings → Deployments page into router and nav#299
khuepm merged 2 commits into
mainfrom
feature/loving-satoshi-be374d

Conversation

@khuepm

@khuepm khuepm commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Summary

apps/studio/src/modules/settings/deployments-page.tsx đã hoàn chỉnh từ lâu — list targets, "Deploy now", poll status, xem build log, gọi backend /api/v1/deployments đã mount sẵn — nhưng không ai link tới nó: router.tsx không có route, sidebar Settings không có nav entry. git grep "DeploymentsPage\|deployments-page" -- apps/studio/src chỉ khớp đúng dòng khai báo của chính nó. Tức là dead code phía client kể từ khi ship.

PR này chỉ nối dây (không đụng backend/schema/SDK):

  • Route — thêm /settings/deployments + biến thể $adminPath (/$adminPath/settings/deployments), theo đúng pattern createRoute({...}) + withSuspense(lazy(...)) của các trang Integrations kề bên (webhooks, git, email, notifications, extensions, marketplace đều có cả hai cây).
  • Nav{ id: 'deployments', label: 'Deployments', to: '/settings/deployments' } vào nhóm integrations của settings/layout.tsx.
  • Tripwire (DoD §6) — khoá cả class thay vì chỉ trang này: source-scan bắt buộc MỌI *-page.tsx trong modules/settings/ phải được router.tsx tham chiếu và MỌI nav to: phải có route khớp; cộng test chạy cây route thật trên memory history.

Loại thay đổi

  • fix — Sửa bug
  • test — Thêm / sửa test
  • docs — Cập nhật tài liệu

Phase / Feature liên quan

Mở rộng #28 deployment-integrations (Setup Impact Registry) — phần Studio wiring còn thiếu. Xem docs/en/features/deployment-integrations.md §8.


✅ Definition of Done (DoD)

Code Quality

  • Không có TypeScript error — pnpm typecheck 16/16 pass
  • Tất cả tests pass — Studio 353/353 (63 file); pre-commit hook chạy full CMS 2264 passed / 3 skipped + Studio
  • Không có lint error
  • Self-review: diff nhỏ (5 dòng wiring + test + docs), đã đọc lại từng dòng

Architecture & Docs

  • architecture.md — n/a, không đổi cấu trúc hệ thống
  • apps/cms/openapi.yaml — n/a, không có endpoint mới (/api/v1/deployments đã tồn tại và đã có trong spec)
  • packages/sdk — n/a, client.deployments.* đã có sẵn trong rest/legacy.ts + types
  • docs/en/features/deployment-integrations.md §8 ghi rõ đường dẫn route + vị trí trong sidebar

Testing

  • Unit test: settings/__tests__/deployments-page.test.tsx — render trang với API mock (targets + deployments + status badge)
  • Integration test: settings/__tests__/deployments-route.test.tsx — dựng routeTree thật từ router.tsx trên createMemoryHistory, khẳng định /settings/deployments resolve ra trang trong SettingsLayout, link sidebar href="/settings/deployments" + aria-current="page", và /my-admin/settings/deployments cũng resolve
  • Property-based test — n/a, không có boundary logic
  • Test thủ công trên Docker runtime — chưa làm được, xem "Notes for Reviewers"

Negative control: stash 2 file wiring → 6/8 test đỏ; restore → xanh. Test không phải loại "luôn pass".

Runtime Compatibility

  • CF Workers / [x] Node.js — n/a theo nghĩa runtime CMS: thay đổi thuần client-side routing trong SPA, không có code chạy server.

Security

  • Không hardcode secret
  • Input validation — không thêm input mới; form tạo target đã có sẵn và validate ở backend
  • Multi-tenant isolation — không thêm query; các endpoint /api/v1/deployments giữ nguyên guard + scope siteId sẵn có
  • Token không log/plaintext — không đụng đường token của deployment target (vẫn mã hoá at-rest ở backend)

Database / Migrations

  • Không có schema change → không migration, không backfill

Conventional Commits

  • fix(studio): wire Settings → Deployments page into router and nav

Setup impact (DoD §2)

  • Dòng fix: prevent path traversal vulnerabilities #84 trong .kiro/specs/admin-setup-wizard/setup-impact.md, trạng thái n/a — KHÔNG seed / settings key / policy DB / bước wizard / capability / backfill. pnpm registry:check → 85 dòng, số không trùng.

Desktop/mobile shell impact (DoD §2d)

  • Không ảnh hưởng. Không đụng token store (C1), getApiBaseUrl() (C2), build.outDir/base (C3), port dev 2026 (C4), API webview mới (C5), luồng auth/CORS (C6), /health (C7). Không thêm endpoint SPA gọi — route mới chỉ là client-side route nên shell Tauri nhận tự động.

Out-of-scope findings (DoD §7)

  • Log B9 vào .kiro/steering/out-of-scope-backlog.md: cây admin-path còn thiếu change-feedencryption — sidebar hiện hai link đó ở mọi instance, nhưng trên instance dùng custom admin path chúng không resolve. Cùng class "quên nối dây" với PR này, để open vì ngoài scope. Tripwire hiện cố ý chỉ kiểm cây /settings để không đỏ CI vì hai route sẵn thiếu; khi vá B9 thì mở rộng tripwire kiểm cả hai cây.

Screenshots / Recordings

Chưa có — xem "Notes for Reviewers".

Rollback Plan

Revert commit. Không có migration, không có state ngoài; revert đưa trang về đúng trạng thái cũ (không reachable), không ảnh hưởng deployment target đã tạo (dữ liệu nằm ở backend, vẫn dùng được qua API/SDK).

Notes for Reviewers

  • Chưa verify được trên browser thật. Studio + CMS dev server chạy được ở máy local (/health 200), nhưng không có instance dùng được: lumibase/lumibase_setup_test chưa migrate, còn lumibase_base/lumibase_ci ở schema trước ADR-010 (thiếu cột realm) và /api/v1/setup/state trả uninitialized. Vào được /settings/deployments phải chạy setup wizard tạo tài khoản admin rồi đăng nhập. Bù lại, test deployments-route.test.tsx chạy cây route thật nên vẫn chứng minh được URL → trang và nav link → đúng URL. Ai có instance sẵn thì xác nhận giúp bằng ảnh chụp là đủ.
  • Vì sao thêm cả 2 test? Test render trang đơn lẻ vốn vẫn xanh suốt thời gian trang chết — đó chính là lý do bug lọt. Nên phần giá trị nằm ở source-scan (mọi settings page phải có route) + route-tree test, không phải ở test render.
  • Command palette (lib/keybindings/commands.ts) cố ý không đụng — danh sách đó vốn chỉ chọn một phần (change-feed, materialize, domains, uploads, notifications, git… cũng không có), thêm mỗi Deployments sẽ lệch quy ước hiện tại.
  • Lưu ý môi trường (không liên quan diff): test jsdom của Studio không chạy được trên Node 20.16 (ERR_REQUIRE_ESM từ html-encoding-sniffer qua jsdom 29) — lỗi này có sẵn trên main. Mình chạy test + pre-commit hook bằng Node 22.22.2.

khuepm added 2 commits July 26, 2026 19:10
`settings/deployments-page.tsx` shipped complete — targets list, deploy
trigger, status polling, build logs, against the already-mounted
`/api/v1/deployments` — but nothing linked to it: no route in `router.tsx`
and no sidebar entry, so the whole feature was dead code on the client.

- Register `/settings/deployments` and the `/$adminPath/settings/deployments`
  variant, following the surrounding `createRoute` + `withSuspense(lazy(...))`
  pattern used by the other Integrations pages.
- Add "Deployments" to the Integrations group of the settings sidebar.
- Add tripwires that lock the class, not just this page: a source scan
  requiring every `*-page.tsx` under `modules/settings/` to be referenced by
  `router.tsx` and every nav `to:` to have a matching route, plus a route-tree
  test driving the real `routeTree` over a memory history.
- DoD: setup-impact registry #84 (n/a), CHANGELOG, docs route path, and
  out-of-scope finding B9 (admin-path tree still misses change-feed and
  encryption — same class, left out of scope).
…i-be374d

# Conflicts:
#	.kiro/specs/admin-setup-wizard/setup-impact.md
@khuepm
khuepm merged commit 0b0cdce into main Jul 27, 2026
11 checks passed
@khuepm
khuepm deleted the feature/loving-satoshi-be374d branch July 27, 2026 04:16
khuepm added a commit that referenced this pull request Jul 27, 2026
…l-8d9631

Resolved three append-only conflicts, all from main landing the Studio
Deployments wiring PR (#299) in parallel:

- out-of-scope-backlog.md: main took B9 for the admin-path route gap, so
  the CF queue-consumer finding is renumbered B10.
- setup-impact.md: main took Registry rows 84 and 85, so this row moves
  to 86 (DoD requires a number above the current max, not "the next
  one").
- CHANGELOG.md: both Unreleased entries kept side by side.

Both PRs touch deployments and both added a tripwire, but they are
disjoint: main wired the Studio page to a route, this branch wires the
KeyProvider into the harness.
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.

1 participant