Commit Graph

92 Commits

Author SHA1 Message Date
e55dfbe4ee feat(sentry): add error monitoring, tracing, session replay, and structured logging
Integrates @sentry/sveltekit 10.49.0 via the modern SvelteKit path
(instrumentation.server.ts + experimental.instrumentation.server).

- instrumentation.server.ts: server-side init with tracing, logging,
  and console capture (log/warn/error forwarded to Sentry)
- hooks.client.ts: client-side init with browserTracingIntegration,
  replayIntegration (maskAllText/blockAllMedia), consoleLoggingIntegration,
  and handleErrorWithSentry
- hooks.server.ts: adds handleErrorWithSentry export, composes existing
  appHandle with sentryHandle() via sequence(), and sets isolation scope
  attributes (user_id, username, permission_level) per request for
  log/trace correlation
- svelte.config.js: enables experimental.instrumentation.server and
  experimental.tracing.server
- vite.config.ts: adds sentrySvelteKit() plugin for source map uploads
- .env.example: documents VITE_SENTRY_DSN, SENTRY_DSN, SENTRY_ORG,
  SENTRY_PROJECT, SENTRY_AUTH_TOKEN

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 16:10:36 +08:00
4de2112a11 docs: update docker→podman/container references in spec and overview
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 13:30:47 +08:00
3c4d9dd15a chore: rename Dockerfile/.dockerignore to Containerfile/.containerignore
Project uses Podman; Containerfile is the conventional name.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 13:30:30 +08:00
786e1c709e docs: mark M9 Polish as shipped in overview; fix 2 residual E2E tests
- overview.md: M9 row flipped to shipped, links to spec/plan added,
  roadmap paragraph updated with actual deliverables, conventions
  updated to reflect dual-theme support
- tests/e2e/auth.spec.ts: add GET /event/list override so the dashboard
  renders after the magic-link → token flow (was 500ing with no override)
- tests/e2e/profile.spec.ts: use { exact: true } on username assertion to
  avoid strict-mode violation (username 'alice' matched 3 elements)
- Formatting: prettier --write pass on polish spec/plan, layout.css,
  layout.svelte

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 13:27:37 +08:00
3cf40462b3 feat(container): add Dockerfile, Caddyfile, and .dockerignore
Multi-stage Dockerfile for production builds with adapter-node, reverse proxy config with Caddy, and optimized Docker context.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 13:17:20 +08:00
f5c8cc420f test(e2e): add networkidle wait to auth magic-link flow test
Cookie propagation across the use:enhance redirect chain (authorize →
/token → /) may not settle before Playwright proceeds. Waiting for
networkidle after the submit click gives the chain time to complete
before asserting on the URL and user-menu elements.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 13:16:26 +08:00
39c44c292e test(e2e): fix profile test remove permission label assertion
ProfileCard never renders the permission level label, so the '普通用户'
assertion always fails. Replace with assertion on loggedInUser.username which
is guaranteed to be rendered.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 13:15:21 +08:00
c619f4b1b0 test(e2e): fix agenda mock status field and replace create test
Fix 1: mock items in 'agenda tab lists items' now use status/description
fields instead of is_published, matching the page's filter logic.

Fix 2: 'agenda create submits form' replaced with 'approve button opens
approve dialog' since the admin agenda page has no 新增 button — it only
supports review (approve/reject) of user-submitted items.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 13:14:35 +08:00
034add383e test(e2e): fix attendance mock shape data→data.items
The attendance tab test was providing a mock response with shape
{ status: 200, data: [ ... ] } (flat array). But +page.server.ts for
the admin events page casts the response to read inner?.items ?? [],
expecting shape { status: 200, data: { items: [ ... ] } }.

Updated the mock to wrap the attendance array in an { items: [...] }
object to match the server-side expectation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 13:12:57 +08:00
13a9413446 test(e2e): fix workbench checkin selector link→button
The "立即签到" button is rendered by bits-ui Dialog.Trigger as a
<button>, not <a>. Change getByRole('link') to getByRole('button')
on lines 120, 133, and 149 for selector consistency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 13:11:37 +08:00
212aa47f34 feat(theme): add light/dark toggle button and /theme endpoint
POST /app/theme sets the theme cookie and redirects back. Sun/Moon
button in the app navbar submits the form. E2E tests verify SSR
cookie-driven theme switching.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 13:05:21 +08:00
4300216e69 feat(theme): wire SSR theme cookie via transformPageChunk
Reads theme cookie in hooks.server.ts and rewrites data-theme on <html>
before the page is sent. Root and (app) layout servers expose theme so
the navbar can show the correct toggle icon. Removes hardcoded
color-scheme meta (DaisyUI CSS handles it per-theme).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:59:43 +08:00
2ad7519406 feat(theme): add light DaisyUI theme palette
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:55:56 +08:00
9c7376fa73 fix: set html lang to zh-CN
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:55:49 +08:00
ccdbdea83b docs: add M9 Polish implementation plan
12 bite-sized tasks: light theme CSS, SSR transformPageChunk pipeline,
theme endpoint + navbar toggle with E2E coverage, 6 targeted E2E test
fixes (wrong mock shapes / wrong role selectors), and Dockerfile +
Caddyfile for production deployment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:54:14 +08:00
9c6fcba1df docs: add M9 Polish design spec
Covers three deliverables: light theme + SSR cookie toggle (form-action
approach, transformPageChunk in hooks.server.ts), multi-stage Dockerfile
+ Caddyfile for adapter-node production deploy, and fixes for 6 failing
E2E tests (option b: tests corrected to match existing code — wrong mock
shapes, wrong Playwright role selectors, and tests for features that were
never built).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:48:14 +08:00
1ce29e4276 docs: update M9 Polish — drop Storybook, add test-passing deliverable
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:18:06 +08:00
9bdc3ece72 feat: svelte init 2026-04-18 12:14:30 +08:00
b491aa3669 cleanup: everything 2026-04-18 12:14:04 +08:00
8f328a1601 chore: ignore .worktrees directory
All checks were successful
Client Check Build (NixCN CMS) TeamCity build finished
2026-04-08 20:54:43 +08:00
4365304845 feat(kyc): improve KYC UI with structured info display and spinner
All checks were successful
Client Check Build (NixCN CMS) TeamCity build finished
- Replace raw JSON pre-block with typed KycInfoDetail component for passport/cnrid info
- Upgrade KYC method selection from dropdown to card-based picker with icons
- Fix passport form loading state: replace '...' with Spinner component

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 15:03:02 +08:00
9fa83b0a6f fix(checkin): force white background on QR code for scanner compatibility
All checks were successful
Client Check Build (NixCN CMS) TeamCity build finished
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 14:21:12 +08:00
615e42f05a fix: redirect to /authorize before rendering workbench if no token exists
Prevents the unauthorized error page from briefly flashing before the
logout interceptor navigates away, by checking token presence synchronously
in beforeLoad and throwing a redirect immediately.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 14:19:42 +08:00
a6469f4737 feat(checkin): add camera switcher to scanner dialog
All checks were successful
Client Check Build (NixCN CMS) TeamCity build finished
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 13:53:19 +08:00
7349997ab5 feat: resolve backend error codes to human-readable messages on error page
All checks were successful
Client Check Build (NixCN CMS) TeamCity build finished
Uses getErrorMessage from the new exception.gen.ts dictionary to display
Chinese error descriptions instead of raw 13-char error codes in GlobalError.
Adds gen:errors script and supporting files for regenerating the dictionary.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 13:38:13 +08:00
036a4e7fa5 fix(admin/users): invalidate getUserList queries after permission update
All checks were successful
Client Check Build (NixCN CMS) TeamCity build finished
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 11:33:24 +08:00
f9d0531713 fix: use correct user update endpoints and wrap mutations in hooks
All checks were successful
Client Check Build (NixCN CMS) TeamCity build finished
- useUpdateUserById: new hook for PATCH /user/update/{user_id} (admin updating others)
- user-permission-edit: switch to useUpdateUserById, move user_id from body to path
- useAuthToken: extract bare useMutation in token route into a proper data hook
- edit-profile: rename shadowed callback param (no behavior change)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 11:27:25 +08:00
5c2e48f0b3 fix(agenda): link submitter nicknames to profiles
All checks were successful
Client Check Build (NixCN CMS) TeamCity build finished
Update the admin agenda list to use the regenerated user_profile payload so submitter nicknames render correctly and link to the submitter's public profile.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-27 21:04:59 +08:00
d597c09905 fix(agenda): refresh admin agenda list after review
Use the generated agenda list query key so approve/reject, schedule, and edit mutations invalidate the correct cache entry. Sync the generated client types with the updated agenda list response shape.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-27 20:46:25 +08:00
1322ba48d4 fix: update API types, pass event_id in agenda review, sync story fixtures
All checks were successful
Client Check Build (NixCN CMS) TeamCity build finished
- Regenerate client types making required fields non-optional
- Add checkin_count/join_count fields to EventListItems
- Pass event_id in agenda approve/reject mutations
- Use non-null assertion for eventId in event update form
- Replace kyc_status with kyc_info in attendance story examples
- Remove kycStatusFilter prop from attendance list stories

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 20:36:32 +08:00
6e2fba8ec2 fix(agenda): show review buttons for pending agendas regardless of publish state
Pending agendas should always be reviewable by admins. The previous
!isPublished guard hid approve/reject buttons even when pending items
existed after agenda publication.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 20:32:05 +08:00
76921428b1 docs: add E2E test suite implementation plan
15 tasks covering Cypress setup, 92 test cases across 5 permission
levels, seed SQL, and Docker Compose CI configuration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 19:53:03 +08:00
6f17e25334 docs: update E2E spec for CI + Docker Compose + SQL dump
Switch from local-only to CI execution with Docker Compose isolation.
Replace manual test data setup with SQL dump (seed.sql) including
relative timestamps for ongoing event. Add docker-compose.e2e.yml note.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 19:40:48 +08:00
1c8abbff14 docs: add E2E test suite design spec
Covers all user permission levels (Lv10/20/30/40/50), 12 feature
modules, and 92 test cases (happy path + error states) using Cypress
against a real backend with fixed test accounts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 19:31:30 +08:00
efb7975184 fix: make admin event tabs sticky below header, improve list UX
- Sticky tabs now offset by --header-height to avoid hiding behind app header
- Replace type filter buttons with Tabs component for consistent styling
- Use isLoading + keepPreviousData in useAdminEvents to prevent list flash on page/filter change
- Expand trello skill label inference rules

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 19:02:14 +08:00
11268a307f fix: load attendance guide in edit form, fix tab active state, allow agenda unpublish, decode base64 guide, add dark mode prose
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 18:45:34 +08:00
ef4fa016e6 fix(attendance): remove KYC status filter/column, show KYC info col based on event.enable_kyc; fix search input focus loss
- Remove KYC status filter dropdown and status column from attendance list
- Conditionally render KYC type and operation columns based on event's enable_kyc field
- Add keepPreviousData to useAdminAttendance to prevent input focus loss on filter change

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 18:43:58 +08:00
b9d12637b7 feat: add quota/limit fields to event form and update API client types
- Regenerated API client: ServiceEventEventListResponse now wraps paginated
  items (renamed to ServiceEventEventListItems), event info includes quota/limit,
  attendance list includes checked_in_at, joined_at, kyc_status
- Fixed toEventInfo to use renamed ServiceEventEventListItems type
- Added required quota (外显上限) and limit (实际上限) fields to event
  create/edit form with positive integer validation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 18:10:40 +08:00
11929e2644 fix: convert event start/end times to RFC3339 before API submission
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 17:38:51 +08:00
f9e41cad87 fix: fixes by autoresearch
All checks were successful
Client Check Build (NixCN CMS) TeamCity build finished
2026-03-27 09:04:18 +08:00
ba66fd96db docs: trello card skill 2026-03-27 09:04:00 +08:00
464b392375 docs: debug skill
Some checks failed
Client Check Build (NixCN CMS) TeamCity build failed
2026-03-26 21:20:50 +08:00
2463a51f33 feat: implement hooks 2026-03-26 21:20:49 +08:00
973a242604 fix: resolve build and lint issues from admin interface implementation 2026-03-26 19:54:32 +08:00
007cbb916b feat(agenda): integrate agenda cards into event detail page 2026-03-26 19:48:09 +08:00
cd86a037b5 fix(agenda): use explicit string comparison in formatTime 2026-03-26 19:46:49 +08:00
afb922cd7e fix(agenda): add Loading story variant to agenda submit dialog 2026-03-26 19:39:56 +08:00
32a455bc74 feat(agenda): add user-facing agenda submit/edit dialog
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 15:25:16 +08:00
eaae4e2766 feat(admin): add global and per-event statistics views
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 15:21:09 +08:00
d9929e2116 fix(admin): fix user management code quality - propagation, stale state, unused props
- Stop click propagation from Edit button to TableRow to prevent double-fire
- Store full editingUser state on open so dialog persists across page changes
- Remove unused targetUserId from dialog view props and currentUserId from container props
- Add useEffect to reset selectedLevel when targetCurrentLevel changes
- Replace double as-unknown-as cast with single typed assertion using ServiceUserUserInfoUpdateData

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 15:15:55 +08:00