Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (claude): wire daily_post_reminder into Telegram/dropdown, reuse HHMM_STRICT_RE, tolerate cleared time input
Adam Eivy42192fda2e1f
diff --git a/client/src/components/NotificationDropdown.jsx b/client/src/components/NotificationDropdown.jsxindex 7a47e3d5c0..d9d9f3a6ef 100644--- a/client/src/components/NotificationDropdown.jsx+++ b/client/src/components/NotificationDropdown.jsx@@ -1,6 +1,6 @@import { useState, useRef, useEffect } from 'react';import { useNavigate } from 'react-router-dom';-import { Bell, X, CheckCheck, Trash2, Brain, ListTodo, AlertTriangle, Code, HelpCircle } from 'lucide-react';+import { Bell, X, CheckCheck, Trash2, Brain, ListTodo, AlertTriangle, Code, HelpCircle, BellRing } from 'lucide-react';import { timeAgo } from '../utils/formatters';const NOTIFICATION_TYPE_CONFIG = {@@ -33,6 +33,11 @@ const NOTIFICATION_TYPE_CONFIG = {icon: AlertTriangle,color: 'text-yellow-400',bgColor: 'bg-yellow-500/20'+ },+ daily_post_reminder: {+ icon: BellRing,+ color: 'text-cyan-400',+ bgColor: 'bg-cyan-500/20'}};diff --git a/client/src/components/settings/TelegramTab.jsx b/client/src/components/settings/TelegramTab.jsxindex f18aff2737..b8ac5404d4 100644--- a/client/src/components/settings/TelegramTab.jsx+++ b/client/src/components/settings/TelegramTab.jsx@@ -14,7 +14,8 @@ const NOTIFICATION_TYPES = [{ key: 'health_issue', label: 'Health Issues' },{ key: 'briefing_ready', label: 'Briefings' },{ key: 'autobiography_prompt', label: 'Autobiography Prompts' },- { key: 'plan_question', label: 'Plan Questions' }+ { key: 'plan_question', label: 'Plan Questions' },+ { key: 'daily_post_reminder', label: 'POST Reminders' }];export function TelegramTab() {diff --git a/server/lib/postValidation.js b/server/lib/postValidation.jsindex caab99cb8e..0fcc604e4a 100644--- a/server/lib/postValidation.js+++ b/server/lib/postValidation.js@@ -1,6 +1,7 @@import { z } from 'zod';import { CACHEABLE_TYPES } from '../services/meatspacePostDrillCache.js';import { COGNITIVE_DRILL_TYPES } from '../services/meatspacePostCognitive.js';+import { HHMM_STRICT_RE } from './timezone.js';// =============================================================================// POST (Power On Self Test) VALIDATION SCHEMAS@@ -9,8 +10,9 @@ import { COGNITIVE_DRILL_TYPES } from '../services/meatspacePostCognitive.js';// Tags for session conditions (sleep, caffeine, stress, etc.)export const postTagsSchema = z.record(z.string().max(200));-// 24h "HH:MM" time-of-day, matches the pattern identityValidation.js uses.-const hhmmRegex = /^([01]\d|2[0-3]):[0-5]\d$/;+// 24h "HH:MM" time-of-day — HHMM_STRICT_RE is timezone.js's single source of+// truth for this exact zero-padded pattern (shared with dashboardLayouts.js's+// activateWindow validator); don't re-derive a local copy.// Individual question result (math + memory drills)// Math: server recomputes expected/correct via scoreDrill (numeric values)@@ -143,10 +145,17 @@ export const postConfigUpdateSchema = z.object({enabled: z.boolean().optional()}).optional(),// Opt-in daily reminder (default OFF, off by default). `time` is a 24h- // "HH:MM" string interpreted in the user's configured timezone.+ // "HH:MM" string interpreted in the user's configured timezone. The native+ // <input type="time"> can be cleared to '' by the user; treat that as+ // "no change" (absent) rather than a validation failure that would reject+ // the whole config PUT — same UI-sentinel-tolerance pattern CLAUDE.md+ // documents for CLI provider endpoints.reminder: z.object({enabled: z.boolean().optional(),- time: z.string().regex(hhmmRegex, 'Must be HH:MM format').optional()+ time: z.preprocess(+ v => (v === '' ? undefined : v),+ z.string().regex(HHMM_STRICT_RE, 'Must be HH:MM format').optional()+ )}).optional()}).partial();diff --git a/server/lib/postValidation.test.js b/server/lib/postValidation.test.jsindex 539c3a655c..a0b46edd87 100644--- a/server/lib/postValidation.test.js+++ b/server/lib/postValidation.test.js@@ -41,6 +41,20 @@ describe('postConfigUpdateSchema llmDrills', () => {expect(() => postConfigUpdateSchema.parse({ reminder: { enabled: true, time: '25:00' } })).toThrow();expect(() => postConfigUpdateSchema.parse({ reminder: { enabled: true, time: 'nine am' } })).toThrow();});++ // Regression: the native <input type="time"> can be cleared to '' by the+ // user (backspace/keyboard). Without this, an empty time rejected the WHOLE+ // config PUT — including unrelated mentalMath/adaptive/cognitive/llmDrills+ // edits sent in the same request — instead of just leaving the reminder+ // time unchanged.+ it('treats an empty reminder time as absent rather than rejecting the whole request', () => {+ const parsed = postConfigUpdateSchema.parse({+ adaptive: { enabled: true },+ reminder: { enabled: true, time: '' }+ });+ expect(parsed.reminder).toEqual({ enabled: true });+ expect(parsed.adaptive).toEqual({ enabled: true });+ });});describe('postLlmScoreRequestSchema', () => {diff --git a/server/services/meatspacePostReminder.js b/server/services/meatspacePostReminder.jsindex 985a5d22b1..5f24223304 100644--- a/server/services/meatspacePostReminder.js+++ b/server/services/meatspacePostReminder.js@@ -19,21 +19,19 @@*/import { schedule, cancel } from './eventScheduler.js';-import { getUserTimezone, getLocalParts, todayInTimezone } from '../lib/timezone.js';+import { getUserTimezone, getLocalParts, todayInTimezone, HHMM_STRICT_RE } from '../lib/timezone.js';import { getPostConfig, getPostSessions } from './meatspacePost.js';import { addNotification, NOTIFICATION_TYPES, PRIORITY_LEVELS } from './notifications.js';export const POST_REMINDER_EVENT_ID = 'post-daily-reminder';-const HHMM_RE = /^([01]\d|2[0-3]):[0-5]\d$/;-/*** Convert an "HH:MM" time-of-day into a daily cron expression ("M H * * *").* Pure — exported for unit testing. Returns null for a malformed/missing time* so callers can skip scheduling rather than register a bad cron string.*/export function reminderTimeToCron(time) {- if (typeof time !== 'string' || !HHMM_RE.test(time)) return null;+ if (typeof time !== 'string' || !HHMM_STRICT_RE.test(time)) return null;const [hour, minute] = time.split(':').map(Number);return `${minute} ${hour} * * *`;}diff --git a/server/services/meatspacePostReminder.test.js b/server/services/meatspacePostReminder.test.jsindex c79c102551..27e5bcb431 100644--- a/server/services/meatspacePostReminder.test.js+++ b/server/services/meatspacePostReminder.test.js@@ -16,7 +16,8 @@ vi.mock('./eventScheduler.js', () => ({vi.mock('../lib/timezone.js', () => ({getUserTimezone: vi.fn().mockResolvedValue('UTC'),getLocalParts: vi.fn(),- todayInTimezone: vi.fn()+ todayInTimezone: vi.fn(),+ HHMM_STRICT_RE: /^([01]\d|2[0-3]):[0-5]\d$/}));vi.mock('./meatspacePost.js', () => ({diff --git a/server/services/telegram.js b/server/services/telegram.jsindex 8ce588ef7f..7f894e3e9a 100644--- a/server/services/telegram.js+++ b/server/services/telegram.js@@ -54,7 +54,8 @@ const NOTIFICATION_EMOJI = {[NOTIFICATION_TYPES.HEALTH_ISSUE]: '⚠️',[NOTIFICATION_TYPES.BRIEFING_READY]: '📋',[NOTIFICATION_TYPES.AUTOBIOGRAPHY_PROMPT]: '📝',- [NOTIFICATION_TYPES.PLAN_QUESTION]: '❓'+ [NOTIFICATION_TYPES.PLAN_QUESTION]: '❓',+ [NOTIFICATION_TYPES.DAILY_POST_REMINDER]: '🧪'};// Priority emoji