From ec2c64cb62e85ea9a5c3586207b2298eda43d117 Mon Sep 17 00:00:00 2001 From: ruv Date: Mon, 27 Jul 2026 14:19:51 -0400 Subject: [PATCH] fix(homecore-server): separate HA and dashboard event routes --- v2/crates/homecore-server/src/gateway.rs | 4 ++-- v2/crates/homecore-server/ui/js/api.js | 4 ++-- v2/crates/homecore-server/ui/js/panels/events.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/v2/crates/homecore-server/src/gateway.rs b/v2/crates/homecore-server/src/gateway.rs index 2f1f1816..34a0650a 100644 --- a/v2/crates/homecore-server/src/gateway.rs +++ b/v2/crates/homecore-server/src/gateway.rs @@ -115,7 +115,7 @@ pub fn gateway_router(state: GatewayState) -> Router { .route("/api/homecore/cogs/updates", get(empty_list)) .route("/api/homecore/hailo", get(stub_503)) .route("/api/homecore/tokens", get(stub_503)) - .route("/api/events", get(stub_503)) + .route("/api/homecore/events", get(stub_503)) .with_state(state) } @@ -728,7 +728,7 @@ mod tests { "/api/homecore/seeds", "/api/homecore/federation", "/api/homecore/witness", - "/api/events", + "/api/homecore/events", ] { let (status, body) = send(gateway_router(gw()), "GET", p).await; assert_eq!(status, StatusCode::SERVICE_UNAVAILABLE, "{p} should be 503"); diff --git a/v2/crates/homecore-server/ui/js/api.js b/v2/crates/homecore-server/ui/js/api.js index 5cedf3f0..70321796 100644 --- a/v2/crates/homecore-server/ui/js/api.js +++ b/v2/crates/homecore-server/ui/js/api.js @@ -76,7 +76,7 @@ export const api = { async callService(domain, service, data) { return this._post(`/api/services/${domain}/${service}`, data); }, async setState(entityId, state, attributes) { return this._post(`/api/states/${entityId}`, { state, attributes: attributes || {} }); }, - // ── gateway /api/homecore/* + /api/events (§11.2) ───────────────── + // ── gateway /api/homecore/* (§11.2) ─────────────────────────────── async appliance() { return this._data('appliance', '/api/homecore/appliance', (m) => m.applianceHealth()); }, async seeds() { return this._data('fleet', '/api/homecore/seeds', (m) => m.seeds()); }, async seed(id) { return this._data('fleet', '/api/homecore/seeds/' + encodeURIComponent(id), (m) => m.seed(id)); }, @@ -93,7 +93,7 @@ export const api = { async witnessLog(page = 0, size = 12) { return this._data('audit', `/api/homecore/witness?page=${page}&size=${size}`, (m) => m.witnessLog(page, size)); }, async privacyModes() { return this._data('audit', '/api/homecore/privacy', (m) => m.privacyModes()); }, async setPrivacy(seed, modeValue) { if (demoMode()) return { seed, mode: modeValue }; return this._post('/api/homecore/privacy', { seed, mode: modeValue }); }, - async eventHistory(n = 40) { return this._data('events', `/api/events?limit=${n}`, (m) => m.recentEvents(n)); }, + async eventHistory(n = 40) { return this._data('events', `/api/homecore/events?limit=${n}`, (m) => m.recentEvents(n)); }, recentEvents(n) { return this.eventHistory(n); }, // back-compat alias (async) async settings() { return this._data('settings', '/api/homecore/settings', (m) => m.settings()); }, async automations() { return this._data('automations', '/api/homecore/automations', () => []); }, diff --git a/v2/crates/homecore-server/ui/js/panels/events.js b/v2/crates/homecore-server/ui/js/panels/events.js index be4ffcbe..7724386d 100644 --- a/v2/crates/homecore-server/ui/js/panels/events.js +++ b/v2/crates/homecore-server/ui/js/panels/events.js @@ -1,6 +1,6 @@ // §4.8 Event Bus & Automation Feed — ADR-131 / ADR-129. // -// Live event stream (seeded from /api/events, then prepended live from +// Live event stream (seeded from /api/homecore/events, then prepended live from // the shared WS bus — never polled, §2/§4.4), a context-causality // breadcrumb on row expand (Context.id → parent_id → grandparent_id), // and a trigger→condition→action automation builder (ADR-129 scope: @@ -50,7 +50,7 @@ export default { root.appendChild(sectionHeader('Event Bus & Automation', 'Live entity events + causality + automation builder (ADR-131 §4.8, ADR-129)')); if (api.isDemo('events')) { - root.appendChild(banner('DEMO — event history is contract-conformant mock data until the live /api/events feed lands (§7.1). New rows still arrive over the WS bus.', 'amber')); + root.appendChild(banner('DEMO — event history is contract-conformant mock data until the live /api/homecore/events feed lands (§7.1). New rows still arrive over the WS bus.', 'amber')); } // ── live lag indicator (top, fed by the shared WS bus) ──────────