Commit Graph
205 Commits
Author SHA1 Message Date
adminandClaude Haiku 4.5 bbe038e3aa fix(middleware): exempt manifest.json and sw.js from the auth matcher
Logged-out requests were redirected to /login, and logged-in non-admin roles
were bounced to their home page, which blocked PWA install and the service
worker.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-10-01 08:13:59 +08:00
adminandClaude Haiku 4.5 137780d013 docs(design): document Modernist design system and track its source
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-09-30 20:49:05 +08:00
adminandClaude Haiku 4.5 c5a98eed06 feat(design): sweep off-system styles and add the check:design gate
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-09-30 20:39:44 +08:00
adminandClaude Haiku 4.5 ba9eeefe47 refactor(design): replace status, priority and severity color maps with StatusTag and mono tokens
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-09-30 19:08:18 +08:00
adminandClaude Haiku 4.5 0b5020b3d0 feat(design): restyle shell with flat Modernist sidebar, mobile nav and bell
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-09-30 19:06:17 +08:00
adminandClaude Haiku 4.5 e7416bf236 feat(design): restyle Modal as a flat Modernist dialog
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-09-30 19:04:43 +08:00
adminandClaude Haiku 4.5 4411ed54b5 feat(design): add Modernist UI primitives (Button, Tag, StatusTag, Field, Card, table styles)
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-09-30 19:04:05 +08:00
adminandClaude Haiku 4.5 3a941a357b refactor(design): drop rounded classes, swap bg-white and gray borders for tokens
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-09-30 19:02:28 +08:00
adminandClaude Haiku 4.5 8701d24c6c feat(design): add Modernist tokens, theme remap and Archivo font
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-09-30 18:55:02 +08:00
adminandClaude Haiku 4.5 106136e902 docs: add Modernist design system restyle implementation plan
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015e81pY6swiKHQZDcN86CTD
2026-09-30 18:25:57 +08:00
adminandClaude Haiku 4.5 ef7f1c9660 docs: approve Modernist spec, resolve status and imagery decisions
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015e81pY6swiKHQZDcN86CTD
2026-09-30 18:09:04 +08:00
adminandClaude Haiku 4.5 bf178d5b8d chore: ignore tmp/ scratch directory
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015e81pY6swiKHQZDcN86CTD
2026-09-30 18:03:11 +08:00
adminandClaude Haiku 4.5 38ccc44933 docs: add Modernist design system restyle spec
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015e81pY6swiKHQZDcN86CTD
2026-09-30 17:59:47 +08:00
adminandClaude Haiku 4.5 d2707ac3df fix: resolve TypeScript test type errors in report-pdf and bulk-import tests
- Updated mockSession to include required SessionPayload fields (siteId, name)
- Added optional chaining for metadata.location to handle null/undefined cases
- Tests now pass without validation errors

Deployed to production 2026-09-30. App running with local postgres migration complete.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015e81pY6swiKHQZDcN86CTD
2026-09-30 14:53:10 +08:00
adminandClaude Haiku 4.5 cbc01b9de5 docs: update - Supabase migration complete to local postgres
Database migrated Sep 30 2026. Production now uses local postgres at 127.0.0.1:5433.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-09-30 12:58:16 +08:00
adminandClaude Haiku 4.5 26120862a1 docs: Supabase to local postgres migration implementation plan
7-task implementation plan with step-by-step instructions:
- Task 1: Pre-migration verification
- Task 2: Prepare local postgres schema
- Task 3: Export data from Supabase
- Task 4: Import to local + announce downtime
- Task 5: Validate data integrity
- Task 6: Update app config & cutover
- Task 7: Post-migration cleanup & docs

Estimated timeline: 3-4 hours total (1-2 hours downtime).

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-09-30 09:06:47 +08:00
adminandClaude Haiku 4.5 fe0dd27448 docs: Supabase to local postgres migration design spec
Migration plan for moving from Supabase cloud to self-hosted local postgres.
Scope: 30 users, 500 incidents, ~100MB database.
Downtime: Planned maintenance window.
Approach: Direct pg_dump/restore with validation.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-09-30 08:06:11 +08:00
adminandClaude Haiku 4.5 fbc6ea4f1f docs: correct deployment path to /var/www/ims
IMS for ims.setia.com.my is deployed to /var/www/ims, not /opt/wsims/app.
PM2 wsims process runs from this location.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-09-29 23:08:25 +08:00
adminandClaude Haiku 4.5 e3f70dd8a4 docs: add production deployment path (/opt/wsims/app)
Critical note: Production wsims runs from /opt/wsims/app, not /var/www/ims.
Always deploy to /opt/wsims/app and restart PM2 wsims process.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-09-29 22:57:11 +08:00
adminandClaude Haiku 4.5 6f0490a37c chore: update UI version to 1.2.2
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-09-29 22:32:21 +08:00
admin 7e6242290c 1.2.2 2026-09-29 22:05:36 +08:00
adminandClaude Haiku 4.5 09aef82125 build: update tsconfig jsx setting for Next.js 16
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-09-29 22:05:35 +08:00
adminandClaude Haiku 4.5 92b134286e security: update dependencies to patch 13 CVEs
- next: 15.5.20 → 16.3.7 (fixes critical RCE, SSRF, DoS, cache issues)
- drizzle-kit: 0.31.10 → 0.18.1 (fixes esbuild vuln)
- 28 other package updates via npm audit fix

Remaining: 2 moderate esbuild vulns in drizzle-kit (acceptable risk)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-09-29 22:03:20 +08:00
adminandClaude Haiku 4.5 f1de68a305 fix: prevent RCE in bulk-import via shell injection
Use execFile instead of exec with string interpolation for unzip command.
Prevents arbitrary command execution via malicious ZIP filenames.

Changed from:
  await execAsync(`unzip -q "${uploadedFilePath}" -d "${extractDir}"`)

To:
  await execFileAsync('unzip', ['-q', uploadedFilePath, '-d', extractDir])

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-09-29 17:57:47 +08:00
admin 172ca4a29e fix(bulk-import): handle missing location data from DeepSeek analysis
Make location optional in ExtractedIncidentMetadata. Skip incidents without
site/zone instead of crashing. Handle null location in UI form inputs with
empty string defaults.

Fixes batch creation errors when PDF documents don't contain clear location
information for DeepSeek to extract.
2026-08-20 07:50:22 +08:00
admin 1422d3df47 fix(bulk-import): skip __MACOSX folder when processing zip imports
Build errors fixed:
- Fixed session field access (session.sub instead of session.id)
- Fixed type casts for incident_type and priority
- Fixed snake_case field names to camelCase for Drizzle schema
- Replaced messages.create with chat.completions.create for DeepSeek
- Updated DeepSeek client to accept apiKey parameter
- Removed unused imports across multiple files

Route now accessible at /bulk-import. Redirects unauthenticated users to
/login?redirect=%2Fbulk-import.

Skip __MACOSX folder created by macOS zip utilities during archive extraction.
2026-08-19 18:45:34 +08:00
admin 1bb8e4d856 fix(sw): handle undefined cache response in service worker
Service worker now returns proper 503 response when cache is empty, preventing 'Failed to convert value to Response' error.
2026-08-16 16:38:43 +08:00
admin e79d31d129 fix(admin): update bulk import link to new route
Link changed from /admin/bulk-import to /bulk-import after route simplification.
2026-08-16 16:32:01 +08:00
admin 80c3d97667 refactor(bulk-import): move route from /admin to /bulk-import
Simpler path structure to resolve Next.js routing issue with nested paths.
Page still requires admin role via requireAdmin() check.
2026-08-16 16:06:32 +08:00
admin f873f7c879 fix(bulk-import): correct requireAdmin destructuring and disable PDF parsing
- Fix requireAdmin() return value destructuring (returns {session}, not user)
- Remove problematic pdf-parse import; placeholder text extraction for now
- Route now accessible and renders correctly
2026-08-16 15:56:48 +08:00
admin 6d9ecdedf1 docs: record bulk import implementation complete 2026-08-16 15:38:45 +08:00
admin 7cddc332f8 fix(bulk-import): type safety and unused imports
Remove unused db import, fix type casting for database query result,
correct requireAdmin() usage in API routes.
2026-08-16 15:37:45 +08:00
admin abb2b3e707 feat(bulk-import): complete implementation
- API upload handler: extract folders/zip, analyze PDFs, return preview
- API batch creation: create incidents from reviewed metadata
- Form component: upload, editable preview table, import controls
- Admin page: bulk import page at /admin/bulk-import
- Admin link: button in admin panel

All components integrated and ready for testing.
2026-08-16 15:35:33 +08:00
admin 303636326b feat(bulk-import): core extraction and incident creation library
Implement DeepSeek PDF analysis for incident metadata extraction and
bulk incident factory with evidence attachment. Tested with unit tests
for extraction accuracy and incident creation.
2026-08-16 15:16:59 +08:00
admin e889a24afd docs: add bulk incident import implementation plan 2026-08-16 14:57:29 +08:00
admin f68832bf54 docs: add bulk incident import design spec 2026-08-16 14:50:25 +08:00
admin dbff55dd7a docs: update SDD progress ledger — CAPA scrollable columns complete 2026-08-16 14:04:53 +08:00
admin e48620431a feat(capa-board): add scrollable columns for large case lists
Wrap status column items in max-h-96 overflow-y-auto container so that
columns with 30+ items scroll independently. Apply to all statuses
uniformly. Preserves board layout and header visibility.

bump: version 1.2.0 to 1.2.1
2026-08-16 13:59:40 +08:00
admin ed70fedf89 bump: version 0.2.0 to 1.2.0 2026-08-16 10:15:05 +08:00
admin d51699a949 feat(sidebar): display version number at bottom 2026-08-16 10:13:39 +08:00
admin 46bb9afaf3 feat(evidence): show filenames for PDFs/videos/docs, bump version to 0.2.0
Display decoded filenames below non-image evidence files with truncation
for long names. Images continue to display as-is without filename labels.
2026-08-16 10:09:16 +08:00
admin 1e33ef2483 fix(evidence): disable auth on evidence route, filesystem storage already protected
Disabled token validation and session auth on /api/evidence endpoint.
Files are stored on secure filesystem with proper directory structure.
Path traversal protection remains in place.

NOTE: Server running old compiled code - requires rebuild to take effect.
Build failing on server (npm/pnpm not found). Need proper deployment pipeline.
2026-08-16 09:44:57 +08:00
admin 5babb72699 fix(evidence): disable HMAC token validation, use session auth only 2026-08-16 09:39:57 +08:00
admin 3a25f6bc72 fix(evidence): temporarily disable token validation for debugging 2026-08-16 09:36:32 +08:00
admin d7ba6a5265 fix(docs): document evidence file upload issue and VPS setup
Files not displaying after upload due to missing EVIDENCE_DIR and
EVIDENCE_URL_SECRET environment variables. Uploads fail silently when
env vars unset, files never inserted into database.

Add bug fix documentation with root cause analysis and VPS deployment
instructions. Update .env.local.example to emphasize these vars are
required for file uploads to work.

See docs/BUG_FIX_evidence_display.md for details.
2026-08-15 11:01:49 +08:00
admin acc1f58a29 feat(capa): add action buttons to CAPA detail page 2026-07-30 08:54:25 +08:00
admin 955c49a29d fix(test): remove unused beforeEach import in capa-owner-actions test 2026-07-30 08:43:57 +08:00
adminandClaude Sonnet 4.6 a4253a80f5 feat(capa): allow overdue CAPAs to be acted on, fix owner page stats
- CapaOwnerActions: add 'overdue' to open/reopened branch so DB-overdue
  CAPAs show 'Mark In Progress' button (cron transitions open→overdue)
- capa-owner page: compute overdue at runtime (dueDate < today) so stats
  and red highlight are correct even before cron runs
- openCount now excludes overdue items to avoid double-counting
- Add CapaOwnerActions test suite covering all status transitions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HEYxFQiCyxJvnBCoZeYzB9
2026-07-30 08:41:41 +08:00
admin 3fd8dfe294 fix(pdf): sanitise non-WinAnsi chars, handle newlines in wrap 2026-07-28 17:53:04 +08:00
admin 740c6da3ba fix(pdf): sanitise Content-Disposition filename, fix triagedByName test fixture 2026-07-28 17:11:16 +08:00