xiaoju
852cad9c60
docs(rfc-001): archival watermark + workflow_runs materialized table
...
- Cold archival: meta table with archived_up_to watermark for crash-safe recovery
- Workflow state: workflow_runs materialized table (UPSERT in same txn as log write)
- O(active) queries instead of full table scan
- Derivable from logs if lost
小橘 <xiaoju@shazhou.work >
2026-04-22 08:15:28 +00:00
xiaoju
f5c561173d
docs(rfc-001): add Log concept, append-only storage architecture, workflow event sourcing
...
- §2.4: Log as data asset, not trigger source (anti-avalanche constraint)
- §3: Add Log to terminology table
- §5.4: New storage architecture section
- Unified logs table (append-only SQLite)
- Workflow state via event sourcing (no mutable tables)
- Cold archival: >30d data exported to daily JSONL files
- §5.6: Error handling now writes logs instead of error signals
- §8: Directory structure updated with logs.db and archive/
- §10: Design principles updated (8 principles, +1 log rule)
- Thread outputs are now Logs, not Signals
小橘 <xiaoju@shazhou.work >
2026-04-22 08:06:09 +00:00
xiaoju
636b00c0a3
fix(core): address PR #8 review — gracePeriod, maxQueue default, drop+maxQueue guard, workflow name validation
...
- SenseConfig: add gracePeriod field (RFC §5.3 two-tier timeout)
- WorkflowConfig: discriminated union (DropOverflowConfig | QueueOverflowConfig)
- overflow: queue defaults maxQueue to 100
- overflow: drop + max_queue now returns validation error
- Cross-validate workflow reflex references against defined workflows
- Update tests: 21 cases covering all new behaviors
小橘 <xiaoju@shazhou.work >
2026-04-22 07:55:23 +00:00
xiaoju
8784a4edc4
refactor: duration fields → number|null (milliseconds)
...
- throttle, timeout, interval: string|null → number|null
- parseDurationField now returns parsed ms (5s→5000, 10m→600000, 1h→3600000)
- biome.json: ignore dist/** from checks
小橘 <xiaoju@shazhou.work >
2026-04-22 07:41:22 +00:00
xiaoju
1949007c99
refactor: ban optional properties, use T|null + discriminated unions
...
- Add coding convention: no '?:', use explicit 'T | null'
- ReflexConfig → discriminated union (SenseReflexConfig | WorkflowReflexConfig)
- All optional fields → explicit null (throttle, timeout, interval, on, maxQueue, workflows)
- Add exactOptionalPropertyTypes to tsconfig
- Add lib: ES2022 to tsconfig
- Refactor validateReflexConfig to reduce cognitive complexity
小橘 <xiaoju@shazhou.work >
2026-04-22 07:33:14 +00:00
xiaoju
3159d3713d
feat(core): add autoincrement id to Signal type
...
Timestamp alone can't guarantee strict total ordering (multiple signals
in the same millisecond). An autoincrement id provides a reliable
sequence for ordering and cursor-based pagination.
小橘 <xiaoju@shazhou.work >
2026-04-22 07:22:10 +00:00
xiaoju
3eba156b6b
feat(core): Phase 1 — core types & config parsing
...
- Define Signal, SenseConfig, ReflexConfig, WorkflowConfig, NerveConfig types
- Implement Result<T,E> with ok()/err() helpers
- Implement parseNerveConfig() with full YAML validation
- 14 unit tests covering normal and error paths
- pnpm run check passes with 0 errors
Closes #2
小橘 <xiaoju@shazhou.work >
2026-04-22 07:16:49 +00:00