Skip to content

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

fix([voice-weather-settings-location]): address claude+gemini review

Adam Eivy0a19df44281b
diff --git a/client/src/components/settings/GeneralTab.jsx b/client/src/components/settings/GeneralTab.jsx
index 88c6879aa1..040a7b306d 100644
--- a/client/src/components/settings/GeneralTab.jsx
+++ b/client/src/components/settings/GeneralTab.jsx
@@ -7,10 +7,12 @@ import { getSettings, updateSettings } from '../../services/api';
// Coordinate inputs are free text so a partially-typed "-" or "37." isn't
// clobbered mid-edit; parse + range-check only on save. Both blank = clear.
-const isBlank = (v) => v === '' || v === null || v === undefined;
+// Trim first so a whitespace-only field counts as blank (and never coerces to
+// Number(' ') === 0, which would pin the same 0,0 this feature guards against).
+const isBlank = (v) => v == null || String(v).trim() === '';
const parseCoord = (v) => {
if (isBlank(v)) return null;
- const n = Number(v);
+ const n = Number(String(v).trim());
return Number.isFinite(n) ? n : NaN; // NaN signals "non-empty but not a number"
};
@@ -25,7 +27,7 @@ export function GeneralTab() {
const allTimezones = useMemo(() => Intl.supportedValuesOf?.('timeZone') ?? [], []);
useEffect(() => {
- getSettings()
+ getSettings({ silent: true })
.then(settings => {
setTimezone(settings?.timezone || '');
setLat(settings?.location?.lat != null ? String(settings.location.lat) : '');
@@ -58,7 +60,7 @@ export function GeneralTab() {
}
setSavingLocation(true);
try {
- await updateSettings({ location: { lat: parsedLat, lon: parsedLon } });
+ await updateSettings({ location: { lat: parsedLat, lon: parsedLon } }, { silent: true });
toast.success(parsedLat === null ? 'Location cleared' : `Location set to ${parsedLat}, ${parsedLon}`);
} catch (err) {
toast.error(err.message || 'Failed to save location');
@@ -91,7 +93,7 @@ export function GeneralTab() {
setSaving(true);
try {
- await updateSettings({ timezone: tzToSave });
+ await updateSettings({ timezone: tzToSave }, { silent: true });
setTimezone(tzToSave);
toast.success(`Timezone set to ${tzToSave}`);
} catch (err) {
@@ -115,8 +117,10 @@ export function GeneralTab() {
<p className="text-sm text-gray-400 mb-4">
Used for job scheduling (cron expressions & scheduled times) and briefing dates.
</p>
+ <label htmlFor="timezone-input" className="sr-only">Timezone (IANA)</label>
<div className="flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3">
<input
+ id="timezone-input"
type="text"
value={timezone}
onChange={e => setTimezone(e.target.value)}
diff --git a/server/services/voice/tools.test.js b/server/services/voice/tools.test.js
index 4a5b8ba6b7..ea3bdc9abe 100644
--- a/server/services/voice/tools.test.js
+++ b/server/services/voice/tools.test.js
@@ -1,4 +1,4 @@
-import { describe, it, expect, vi } from 'vitest';
+import { describe, it, expect, vi, afterEach } from 'vitest';
// Stub every external side-effect before importing tools.js so the unit test
// exercises pure validation/dispatch logic without hitting the filesystem.
@@ -1036,6 +1036,9 @@ describe('meatspace_log_workout', () => {
});
describe('weather_now', () => {
+ // Reset in afterEach (not inline) so a thrown assertion can't leak a stale
+ // configured location into the next test.
+ afterEach(() => { settingsLocationRef.value = null; });
it('returns temperature + mapped conditions', async () => {
weatherFetchRef.value = { ok: true, json: async () => ({ current: { temperature_2m: 71.4, weather_code: 3 } }) };
const r = await dispatchTool('weather_now', { lat: 40, lon: -74 });
@@ -1062,7 +1065,6 @@ describe('weather_now', () => {
expect(r.ok).toBe(true);
expect(r.lat).toBe(51.5074);
expect(r.lon).toBe(-0.1278);
- settingsLocationRef.value = null;
});
it('lets explicit coordinates override the configured location', async () => {
weatherFetchRef.value = { ok: true, json: async () => ({ current: { temperature_2m: 55, weather_code: 0 } }) };
@@ -1071,7 +1073,6 @@ describe('weather_now', () => {
expect(r.ok).toBe(true);
expect(r.lat).toBe(40);
expect(r.lon).toBe(-74);
- settingsLocationRef.value = null;
});
it('falls back to the default location when settings.location is null-cleared', async () => {
weatherFetchRef.value = { ok: true, json: async () => ({ current: { temperature_2m: 55, weather_code: 0 } }) };
@@ -1082,7 +1083,6 @@ describe('weather_now', () => {
expect(r.ok).toBe(true);
expect(r.lat).toBe(37.7749);
expect(r.lon).toBe(-122.4194);
- settingsLocationRef.value = null;
});
});