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
changelog: note the audit sweep's test, validation, cycle, and a11y fixes
[._.]/ Adam Eivy6e5bdb294b3d
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex cf1954d8ab..28dcb8ebd1 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -7,3 +7,21 @@These are identifiers, not credentials — Tailscale ACLs still gate all actual network access, and no auth key, token, or secret was ever committed. The historical occurrences remain in git history by deliberate decision (see #3455): a `git filter-repo` rewrite would break every fork and clone of this fork-aware project to remove values that grant no access on their own.- **The productivity streak store no longer hands back its module-level defaults, and both it and the weekly digest now have real tests.** `server/services/productivity.js` and `server/services/weeklyDigest.js` were referenced in the suite only as `vi.mock()` targets, so ~1,400 lines of streak arithmetic, day/week-boundary handling, and digest assembly were executed by zero tests. They now have direct suites (66 cases) that stub only the file-I/O boundary and the agent-history source and assert concrete values — streak counts across gaps, midnight and year-boundary rollovers, insight copy, week-over-week deltas, and the rendered text summary. Writing them surfaced a real bug: `loadProductivity()` returned the shared `DEFAULT_PRODUCTIVITY` object when no store file existed, so the first incremental `onTaskCompleted()` mutated the module constant in place and every later "empty store" read came back pre-populated. It now clones the defaults per read.++- **Tests that re-implemented the code they claimed to test now import the real thing — which exposed a NaN bug and a timezone mismatch.** Seven suites (`meatspace`, `identity`, `meatspaceAlcohol`, `meatspaceHealth`, `taskConflict`, `appleHealthClinical`, `featureAgents`) defined local copies of the pure functions under test, with comments calling it the project pattern. Every one of those functions was already exported, so the copies bought nothing and passed regardless of what production did. Swapping in the real imports surfaced two divergences the copies had been hiding: `computeGoalUrgency` guards `horizonYears <= 0 || yearsRemaining <= 0` and returns `1`, which the stale copy lacked — so a lifetime-horizon goal computed after a user's life expectancy has elapsed divided `0/0` and rendered `NaN` urgency; and `computeRollingAverages` keys days by local calendar date while its fixtures used UTC, a mismatch that only bites near local midnight west of UTC and passed on UTC-set CI by coincidence. `meatspaceHealth`'s helpers were never exported at all, so that suite now drives the real async functions with I/O mocked, and takes its BP classifier from the client module that is its actual source of truth (kept in sync with the iOS companion) instead of a third copy.++- **The cron core beneath every scheduler is no longer executed by zero tests.** `server/services/eventScheduler.js` was `vi.mock()`'d out by all five of its consumers, so its field parsing and timer math never ran under test. It now has 43 tests covering cron syntax, out-of-range and malformed input, the `dayOfWeek` 7≡0 alias, and the `schedule`/`cancel`/`pause`/`resume` lifecycle under fake timers. Adds first coverage for `localThinking.js` (21 tests) and `useOpenClawStream.js` (10, including the stale-session-switch guard and abort-on-unmount), and exports `calculateBackoff` so its math is tested directly rather than transcribed.++- **The shared `settled()` test helper no longer inherits a 1-second timeout.** `client/src/test/settledInput.js` called `waitFor` with no override, and neither `client/vitest.config.js` nor `client/src/test/setup.js` raises testing-library's 1000ms default — too tight for a `user.type()` plus a React re-render when parallel workers are contending for CPU. It produced a phantom `toHaveValue` failure in 1 of the 7 suites that use it. Now 3000ms, with a comment explaining why so it doesn't get simplified back.++## Fixed++- **`PUT /api/lmstudio/config` validated nothing.** It read `baseUrl`/`timeout`/`defaultThinkingModel` straight off `req.body`, and `updateConfig()` assigned any truthy value into module-level config that every other LM Studio call then interpolates into fetch URLs — so one malformed request degraded local-LLM connectivity until restart. All eight routes in the file now validate through `lib/validation.js` schemas, matching the rest of `server/routes/`. The schemas are non-`.strict()`, so incidental extra fields still pass through.++- **A throw in the `logs:subscribe` socket handler could kill the process, and its error events were being silently dropped.** It was the only async handler in `server/services/socket.js` without a try/catch — and an `async` function passed to `socket.on()` has no framework rejection handler, so a synchronous throw became an unhandled rejection. Adding the guard exposed a second bug: `processName` was destructured inside the `try`, so the `catch` emitted `logs:error` without it, and the client's listener filters on `processName` — meaning every error event was discarded and the log panel hung with no feedback. Both fixed, with a test that fails against the old emit shape.++- **Two import cycles, one of which leaked filesystem I/O into a directory reserved for pure helpers.** `server/lib/storyBible.js` re-exported `createBibleStore` from `services/bibleStore.js`, which imports back from it — so roughly fifteen genuinely-pure `lib/` modules that import only sanitizers were transitively pulling in that service's file CRUD. Separately `meatspacePost.js` and `meatspacePostTraining.js` imported each other with none of the dynamic-import mitigation their sibling cycles carry; the shared streak computation and the training-log storage primitives are now two one-way modules. Both cycles verified gone with `madge --circular`. Also moves the upload functions out of `client/src/utils/fileUpload.js` (they made live network calls from a pure-helpers directory) into `services/apiMedia.js`, which already owned the underlying HTTP wrappers, behind a re-export so no caller had to change (#3452 tracks retiring it).++- **184 icon-only buttons had no accessible name, and 62 close buttons were smaller than a fingertip.** The icon-only buttons carried only a `title`, which is mouse-hover-only — undiscoverable on touch, and this app is opened from phones and tablets over the tailnet — and is not reliably read as the accessible name. The close buttons were sized to their bare icon (`w-4 h-4`, `p-1`) rather than the 44px minimum `Drawer.jsx` already established; only 9 of 59 files followed it, and one had no sizing at all. Where a smaller `min-h` token already existed it was replaced rather than paired, since two competing `min-h-*` utilities resolve by stylesheet order, not source order. `a11yConventions.test.js` now enforces both rules — writing the guard found five more buttons with no accessible name at all, and hardening it after review found two live sub-44px close buttons its first version couldn't see because it only matched literal `aria-label="Close…"` strings and missed every dynamic label.++- **The tailnet identity guard had a bypass on exactly the leak class it exists to catch.** Its suffix pattern required a digit in the `tail<token>` segment, but Tailscale picks that token at random from lowercase alphanumerics — so a real hostname like `device.tailabcxyz.ts.net` passed silently. It now matches the shape and subtracts known placeholder tokens by exact name, which fails closed: an unrecognized placeholder trips the guard and gets looked at, rather than a real hostname slipping through for lacking a digit.