Commit graph

300 commits

Author SHA1 Message Date
130ab46ffb fix(ci): update production deploy workflow for new heap limit and CRON_SECRET
- Remove redundant NODE_OPTIONS override (heap limit now in package.json)
- Add CRON_SECRET placeholder for pre-test build step

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:54:08 +00:00
a21f916300 fix(ci): add CRON_SECRET placeholder for production build
Next.js builds run in NODE_ENV=production which triggers env
validation requiring CRON_SECRET (added by security hardening).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:09:20 +00:00
4e3710655e fix(ci): increase build heap limit from 2GB to 4GB
The codebase grew past the 2GB heap limit with security/monitoring
additions. cross-env in build script overrides CI NODE_OPTIONS, so
the limit must be set in package.json itself.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:03:48 +00:00
037835d1de fix(ci): increase build heap size and format monitoring files
Build was OOM-ing in CI with default Node heap limit. Added
NODE_OPTIONS with 4GB heap. Also ran Prettier on monitoring files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 11:58:08 +00:00
884d33c0ae fix: remove .js extensions from monitoring module imports
Next.js webpack build cannot resolve .js extensions for .ts files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 11:51:25 +00:00
bb02128b28 fix: stabilize guard responses and validation typing 2026-02-17 11:47:55 +00:00
e3987e50dc feat: security hardening, monitoring improvements, and API guards
- Hardened cron endpoints with coordination and auth improvements
- Added API guards and input validation layer
- Security observability and secrets health checks
- Monitoring types and service improvements
- PDF URL validation and newsletter unsubscribe security
- Unit tests for security-critical paths

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 11:42:56 +00:00
4d1456fe98 feat: add production deploy health check script
Monitors porwoll.de and blogwoman.de for stale builds caused by
Plesk Git's silent deploy failures (code pulled but build never ran).

- Compares source file timestamps vs .next/BUILD_ID mtime
- HTTP health checks via public URLs
- --alert flag for CMS monitoring API integration
- Runs as cron job every 30 minutes on sv-payload

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 11:42:45 +00:00
063dae411c security: harden payload endpoints and access controls 2026-02-17 10:41:51 +00:00
01a0a43f39 docs: add tenant SMTP admin-save troubleshooting notes 2026-02-17 09:48:39 +00:00
80f7fd2e75 docs: update project status and add typecheck stabilization report 2026-02-17 09:30:19 +00:00
5f45cc820d fix: unblock tenant SMTP saves in admin 2026-02-17 08:58:21 +00:00
4386ac5d8d fix: resolve global typecheck errors 2026-02-17 08:57:32 +00:00
6b4dae8eeb fix: handle non-JSON responses in test email and prevent cascading failures
- Add content-type check in TestEmailButton before parsing response as JSON
- Wrap updateEmailLog in error handler with try-catch to prevent double failures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 16:32:32 +00:00
0c222b9aa9 fix(tenants): make SMTP password field visible in admin panel
neverReadable blocked the field everywhere including the admin UI.
Changed to allow read for authenticated users only, so the field
shows in admin but stays hidden in unauthenticated API responses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 16:19:09 +00:00
9bb041bd7c fix(blocks): add database migration for CardGridBlock icon fields
Adds missing columns (media_type, icon, icon_position) to
pages_blocks_card_grid_block_cards table. Without this migration,
pages API returns 500 on production.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 14:30:04 +00:00
85c76a1eb4 feat(blocks): add icon support to CardGridBlock
Cards can now display a Lucide icon as alternative to an image,
with configurable position (top/left). Fields show conditionally
based on mediaType selection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 14:07:51 +00:00
8abf3a346e refactor(pages): remove fixed hero group from Pages collection
Hero content is now handled via HeroBlock/HeroSliderBlock in the
flexible layout blocks system, giving editors full control.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:17:11 +00:00
9f7a9ad558 docs: update infrastructure, project status, and frontend docs
Add Multi-Server Orchestration (Phase 1-8) to all docs:
- INFRASTRUCTURE.md: Hetzner 1/2 production servers, SSH infrastructure,
  payload-contracts, deployment workflows, port-forwarding
- PROJECT_STATUS.md: Orchestration changelog, production URLs, SSH commands
- FRONTEND.md: payload-contracts usage, CI/CD pipelines, staging/production
  deploy, work order system, ESLint config, updated tenant IDs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 22:49:38 +00:00
0e978e77f4 feat: add frontend staging deploy script
Deploys frontend sites on sv-frontend via SSH.
Supports: blogwoman, porwoll, or all sites at once.

Usage: ./scripts/deploy-frontend.sh <blogwoman|porwoll|all>

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 18:26:34 +00:00
153e4a2d5f fix(monitoring): regenerate importMap with monitoring components
The importMap was missing MonitoringNavLinks and MonitoringDashboardView
entries, causing the /admin/monitoring page to render blank.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:24:51 +00:00
086dd269fa fix(monitoring): address code review findings
- SSE stream: detect client disconnect via request.signal to stop
  polling loop (prevents wasted DB queries after tab close)
- AlertEvaluator: split shouldFire/recordFired so cooldown is only
  recorded after successful dispatch (prevents alert suppression
  on dispatch failure)
- SnapshotCollector: cache payload instance (avoid re-importing on
  every 60s tick)
- Alert acknowledge: validate alertId type (string|number)
- Logs search: add 300ms debounce to prevent query-per-keystroke
- Replace remaining `any` cast with Record<string, unknown>

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:02:50 +00:00
96b8cca9d6 docs: update PROJECT_STATUS.md and CLAUDE.md with monitoring dashboard
- Mark Monitoring & Alerting Dashboard as completed in roadmap
- Add monitoring subsystem to CLAUDE.md subsystems table
- Add 4 monitoring collections to collections list (55+ → 59+)
- Add monitoring dashboard URL
- Add changelog entry for 15.02.2026

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:53:52 +00:00
151b96d641 fix(monitoring): cache payload instance in logger to prevent flaky tests
The fire-and-forget dynamic import chain (3 awaits) was racing with
test flush timeouts. Caching the resolved payload instance fixes both
the flakiness and eliminates per-call import overhead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:52:17 +00:00
dd73162035 feat(monitoring): add monitoring dashboard UI with 5 tabs, SSE connection, and shared components
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:45:41 +00:00
5f38136b95 feat(monitoring): add REST API endpoints for monitoring dashboard
Add 7 API route handlers for the monitoring system:
- GET /api/monitoring/health - system health overview
- GET /api/monitoring/services - individual service status checks
- GET /api/monitoring/performance - performance metrics with period filter
- GET /api/monitoring/alerts - paginated alert history with severity filter
- POST /api/monitoring/alerts/acknowledge - acknowledge alerts
- GET /api/monitoring/logs - paginated logs with level/source/date filters
- GET /api/monitoring/snapshots - time-series data for charts

All endpoints require super-admin authentication.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:37:01 +00:00
0615b22188 feat(monitoring): add snapshot collector to queue worker
Periodic metric collection running in the queue-worker PM2 process.
Collects system metrics every 60s (configurable), stores them in
MonitoringSnapshots, and evaluates alert rules against each snapshot.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:34:28 +00:00
d252ed321a feat(monitoring): add retention policies for monitoring collections
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:33:43 +00:00
0ff8b5c9d8 feat(monitoring): add structured monitoring logger
Fire-and-forget logger that writes to the monitoring-logs collection
with log level filtering via MONITORING_LOG_LEVEL env var. Falls back
to console output when Payload is not yet initialized.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:32:09 +00:00
97c8f32967 feat(monitoring): add alert evaluator with cooldown and multi-channel dispatch
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:30:21 +00:00
dc14c5dbc7 feat(monitoring): add performance tracker with ring buffer
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:29:58 +00:00
4907371715 feat(monitoring): add monitoring service with system health and service checks
Implements checkSystemHealth (CPU, memory, disk, load), service checks
(Redis, PostgreSQL, PgBouncer, SMTP, queues, OAuth, cron), and the
collectMetrics aggregator that gathers all metrics in parallel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:26:28 +00:00
ee981c32bc feat(monitoring): add database migration for 4 monitoring collections
Creates tables, enums, and indexes for monitoring_snapshots,
monitoring_logs, monitoring_alert_rules, and monitoring_alert_history.
Includes hasMany select tables and the critical
payload_locked_documents_rels columns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:19:35 +00:00
34becc8f49 feat(monitoring): add 4 monitoring collections (Snapshots, Logs, AlertRules, AlertHistory)
Add monitoring access controls to centralized access module and create
four new system-wide collections for the monitoring dashboard:
- MonitoringSnapshots: historical system metrics for trend charts
- MonitoringLogs: structured logs for business events (WORM)
- MonitoringAlertRules: configurable alert rule definitions
- MonitoringAlertHistory: alert log with acknowledge support

Collections are registered in payload.config.ts but intentionally
excluded from multi-tenant plugin since they are system-wide.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:14:53 +00:00
214e2ddde8 feat(monitoring): add shared types for monitoring system
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:11:33 +00:00
c7fd95d3da docs: add monitoring dashboard implementation plan (31 tasks, 5 phases)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:01:16 +00:00
15bdd66eb6 docs: add monitoring & alerting dashboard design
Event-driven architecture with SSE real-time updates, 5-tab dashboard
(System Health, Services, Performance, Alerts, Logs), 4 new collections,
and integration with existing alert-service.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 23:53:25 +00:00
a0ef957a7f docs: add YouTube Operations Hub documentation
Add comprehensive YouTube feature documentation covering 9 collections,
12 custom API endpoints, 3 cron jobs, admin views, services, hooks,
and access control across CLAUDE.md, CLAUDE_REFERENCE.md, and
API_ANLEITUNG.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 18:02:59 +00:00
7446318bf3 docs: update Redis auth, PM2 config, and eviction policy documentation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 17:56:16 +00:00
d50d3cd208 feat: add update-contracts.sh for type extraction workflow
Script extracts types from payload-types.ts, updates the
payload-contracts repo, builds to verify, and optionally pushes.

Usage: ./scripts/update-contracts.sh [--push]

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 17:53:20 +00:00
e904f0949b fix(queue): resolve queue-worker crash-loop via Redis auth and PM2 config
Redis requires authentication but IORedis connections were not passing a
password, causing immediate NOAUTH failures and a PM2 crash-loop (1900+
restarts). Additionally, the PM2 config used `npx` as the script entry
which caused instability.

- Add REDIS_PASSWORD support to queue-service.ts and redis.ts
- Change PM2 script from npx wrapper to direct tsx CLI entry point
- Add explicit exec_mode: 'fork' to prevent cluster mode issues

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 17:46:54 +00:00
ed07e15670 fix: remove .js extensions from TypeScript imports
Fixes Next.js build failure caused by .js extensions in relative
imports within VideoMetricsSyncService and ChannelMetricsSyncService.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 17:24:43 +00:00
692498871c feat(youtube): register content calendar as admin view
Adds the Content Calendar view at /admin/content-calendar and
integrates it into the YouTube Dashboards nav group.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 17:18:12 +00:00
5394f628e4 feat(youtube): add FullCalendar content calendar component
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:53:30 +00:00
95079ec652 feat(youtube): add content calendar API with conflict detection
GET endpoint returns FullCalendar-compatible events with schedule
conflict detection. PATCH endpoint supports drag & drop rescheduling
with published-video protection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:52:17 +00:00
2466745e7f feat(youtube): add conflict detection service
Detect scheduling conflicts in the content calendar including same-day
longform collisions, weekly frequency limit violations, and weekend
scheduling warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:50:24 +00:00
d8118528db feat(youtube): add team capacity planning API
Adds a capacity calculator utility and API endpoint that computes
workload utilization for team members with YouTube roles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:49:55 +00:00
2ea42ca404 chore: add FullCalendar dependencies
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:49:32 +00:00
1f63ae14f4 docs: optimize CLAUDE.md for context window efficiency (1493→401 lines)
Extract detailed subsystem documentation into docs/CLAUDE_REFERENCE.md.
CLAUDE.md is loaded into every AI conversation - reducing it by 73% saves
~38KB of context window tokens per session while keeping all essential info.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:46:52 +00:00
8ae5841cc1 feat(youtube): add auto status transition hook
Automatically transitions YouTube content status when conditions are met
(e.g., upload_scheduled -> published when videoId is present) and sends
notifications to assigned users.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:42:25 +00:00