Fixed field name mismatches for tables with lastUpdatedUTC (all-caps):
- IV_Product: lastUpdateUtc → lastUpdatedUTC
- Department: lastUpdateUtc → lastUpdatedUTC
These field names must match the Prisma schema exactly (case-sensitive).
Ensures smart sync decision logic can correctly probe for record updates.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add unsaved changes guard (UnsavedChangesDialog, EditGuard, dirtyState store)
- Add Breadcrumb component
- Add EmailText component
- Update sales opportunity detail with new tabs and workflow
- Add dashboard tab to sales page with metrics
- Update opportunity API URLs to include /opportunity/ path segment
- Add auth token refresh endpoint
- Add credential-types API endpoint
- Add CW members store
- Add sales-utils helpers
- Update layout server to return user info alongside canViewAdmin
- Fix unit tests to match updated API paths and return shapes
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Creates the CwMember table migration that was missing from the migration history
(previously applied locally via db push but never migrated for production).
- Add taxableFlag boolean field to product update schema and forecast patch
- Fall back to QUO-Narrative product customerDescription for quote narrative
- Reconcile orphaned local opportunity records not found in CW during refresh
- Invalidate caches for removed orphaned opportunities
- Add reconciled event and orphanedCount to refresh events
- Update API_ROUTES.md with taxableFlag field documentation
SvelteKit rejects files with + prefix in routes/ during vite build.
Renamed all +*.spec.ts files to drop the + prefix (e.g. +page.server.spec.ts → page.server.spec.ts).
This fixes both Docker and Electron Forge builds.
- Add Redis-backed opportunity cache with background refresh (30s interval)
- Fix concurrency bug: use lazy thunks instead of eager promises for batching
- Add withCwRetry utility with exponential backoff for transient CW errors
- Add adaptive TTL algorithms (primary, sub-resource, products) based on opportunity activity
- Add include query param on GET /sales/opportunities/:id (notes,contacts,products)
- Add opt-in CW API logger (LOG_CW_API env var) with timestamped files in cw-api-logs/
- Add debug-scripts/analyze-cw-calls.py for API call analysis
- Add computeSubResourceCacheTTL and computeProductsCacheTTL algorithms with tests
- Increase CW API timeout from 15s to 30s
- Unblock cache refresh from startup chain (remove await)
- Prioritize recently updated opportunities in refresh cycle
- Add CACHING.md documentation
- Update API_ROUTES.md with caching details and include param
- Update copilot instructions to require CACHING.md sync
- Add dev:log script for CW API call logging during development
- Add data-source hierarchy to opportunity manager (cache-only, cache-then-cw, cw-first)
- fetchPages/search/fetchByCompany use cache-only: Redis → DB (no CW calls)
- fetchItem uses cache-then-cw by default, cw-first when fresh=true
- Add idleTimeout: 255 to Bun.serve to prevent request timeouts
- Map CW status 57 (04. Confirmed Quote) to Active equivalency
- Add computeCacheTTL algorithm and opportunityCache module
- Show fully/partially cancelled products in forecast summary table
- Add cancellation KPI card with full/partial breakdown
- Fully cancelled rows: strikethrough + reduced opacity + red badge
- Partially cancelled rows: amber border + badge + effective/total qty
- Add productSequence prop to ProductsTab for custom ordering
- Fall back to CW sequenceNumber when no productSequence set
- Add productSequence field to SalesOpportunity interface
- Add POST /v1/sales/opportunities/:identifier/products with field-level permission gating
- Add CWForecastItemCreate type for forecast item creation
- Store product display order locally (productSequence Int[] on Opportunity)
- Rewrite resequenceProducts to be local-only (no CW PUT, stable IDs)
- Remove reorderProducts CW util (PUT regenerated IDs & broke procurement)
- Update fetchProducts to apply local ordering with CW sequenceNumber fallback
- Add productSequence to OpportunityController.toJson()
- Update API_ROUTES.md, PERMISSIONS.md, PermissionNodes.ts
- Add sales opportunity detail page with tabs (overview, notes, contacts, products, forecasts, activity)
- Add sales note CRUD endpoints (create, update, delete) with server routes
- Add opportunity types, contacts, product sequencing, and refresh API methods
- Add AddProductModal component for catalog browsing
- Update procurement.fetchMany to accept CatalogItemFilters object
- Add procurement.fetchCategories and procurement.fetchFilters endpoints
- Add resilient permission check (no-token returns all-true with __checkFailed)
- Parallelize company detail data fetches for performance
- Remove stale console.log statements across modules
- Add comprehensive unit tests for all new API methods and permission edge cases
- When the permission check API call fails (timeout, network error, etc.),
permissions now default to true instead of false
- This prevents UI elements like the WiFi tab from disappearing when the
permission check has a transient failure
- The API still enforces access server-side, so no security impact
- Added __checkFailed flag to PermissionMap for observability
- Spinner was disappearing when the OAuth popup closed, but the server
was still waiting for the socket callback (awaitAuthCallback)
- Now the spinner stays until BOTH the popup closes AND the form action
finishes
- Handle popup-blocked case by resetting loading state immediately
- Added dedicated /healthz route returning 200 OK
- Skip API health check in hooks.server.ts for /healthz path
- Updated K8s liveness/readiness probes to use /healthz instead of /login
- The /login probe was returning 503 when the API was unreachable, causing
Kubernetes to kill and restart the pod in a loop