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>
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>
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.
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.
- 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
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.
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
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.
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.
- 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
- Fix 1: drawSection now checks if ensureSpace triggered a page break by
comparing state.y before/after. Only subtract SECTION_GAP if we're not
at the top of a fresh page, avoiding wasting 20px after page breaks.
- Fix 2: CAPA loop now reserves LINE_HEIGHT * 4 instead of just LINE_HEIGHT
to keep the label and at least a few fields together on the same page.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HEYxFQiCyxJvnBCoZeYzB9
DeepSeek v4-pro reasoning model rejects tool_choice parameter.
All 4 endpoints now use system prompts with JSON schema
instructions and parse content as JSON instead of tool_calls.
Co-Authored-By: Claude <noreply@anthropic.com>
DeepSeek API deprecated deepseek-chat model. Returns error:
'the supported API model names are deepseek-v4-pro or deepseek-v4-flash'
Affected all 4 AI endpoints:
- risk-flags (90-day dashboard)
- triage-suggest
- rca-draft
- quality-check
Co-Authored-By: Claude <noreply@anthropic.com>