From f2c1ebba1ce5fbb6d3cfeaf01e438c98f6deebe4 Mon Sep 17 00:00:00 2001 From: S'Bussiso Dube <80188685+Sbussiso@users.noreply.github.com> Date: Sat, 12 Sep 2026 23:25:46 -0700 Subject: [PATCH] Remove three stale lint suppressions; say which DB the migrator manages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two small accuracy fixes found while reviewing, neither changing behaviour. 1. Three `eslint-disable-next-line react-hooks/exhaustive-deps` comments suppress nothing. eslint reports them as unused directives, which means the rule no longer fires on those lines — the dependency arrays were completed and the suppressions left behind. AdminPage.jsx was a plain duplicate: two identical directives on consecutive lines, so the first applied to the second comment rather than to any code. These matter more than the count suggests. A stale exhaustive-deps suppression silently swallows the next genuine missing dependency on that line, which is a real bug class in effect hooks — exactly the kind of thing the rule exists to catch. Lint drops 47 -> 44 problems, still 0 errors. 2. app/core/migrations.py opened with "Lightweight schema sync for SQLite", and all of its caveats are written in SQLite terms, which reads as though it were self-host-only machinery. It is not: main.py calls sync_schema() unconditionally on every boot against whatever engine is configured, so on Fly this module plus create_all() IS the production Postgres schema management — there is no Alembic in this repo. Says so now, and notes where the SQLite caveats read differently on Postgres. ruff clean, 864 backend tests pass, frontend lint exits 0. Co-Authored-By: Claude Opus 5 --- backend/app/core/migrations.py | 17 ++++++++++++++++- frontend/src/hooks/useMotionAlerts.jsx | 1 - frontend/src/hooks/useNotifications.jsx | 1 - frontend/src/pages/AdminPage.jsx | 1 - 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/backend/app/core/migrations.py b/backend/app/core/migrations.py index d784d6a..62f79ea 100644 --- a/backend/app/core/migrations.py +++ b/backend/app/core/migrations.py @@ -1,4 +1,19 @@ -"""Lightweight schema sync for SQLite + one-shot migration helpers. +"""Lightweight schema sync + one-shot migration helpers. + +THIS MANAGES THE PRODUCTION POSTGRES SCHEMA, not just SQLite. The header +used to say "for SQLite", and every caveat below is still written in +SQLite terms, which reads as though this were self-host-only machinery. +It is not: ``app/main.py`` calls ``sync_schema(engine, Base.metadata)`` +unconditionally on every boot, against whatever engine is configured — +Postgres on Fly, SQLite for a self-hosted install. There is no Alembic +in this repo, so this module plus ``create_all`` IS the schema +management for production. + +Two of the SQLite caveats below read differently on Postgres: adding a +NOT NULL column without a default fails there too, but an ADD COLUMN +with a non-volatile default is metadata-only and fast (PG11+), where +SQLite rewrites. The "renames, type changes and drops need a real +migration" caveat applies equally to both. Two kinds of function live here: diff --git a/frontend/src/hooks/useMotionAlerts.jsx b/frontend/src/hooks/useMotionAlerts.jsx index dc1f02b..e1151d4 100644 --- a/frontend/src/hooks/useMotionAlerts.jsx +++ b/frontend/src/hooks/useMotionAlerts.jsx @@ -133,6 +133,5 @@ export function useMotionAlerts(cameras) { abortRef.current?.abort() } // orgId: tear down + reconnect the stream under the new org's token. - // eslint-disable-next-line react-hooks/exhaustive-deps }, [getToken, showToast, orgId]) } diff --git a/frontend/src/hooks/useNotifications.jsx b/frontend/src/hooks/useNotifications.jsx index a1f062c..4a9e3d4 100644 --- a/frontend/src/hooks/useNotifications.jsx +++ b/frontend/src/hooks/useNotifications.jsx @@ -213,7 +213,6 @@ export function useNotifications() { controller?.abort() } // orgId: tear down + reconnect the stream under the new org's token. - // eslint-disable-next-line react-hooks/exhaustive-deps }, [getToken, orgId]) return { diff --git a/frontend/src/pages/AdminPage.jsx b/frontend/src/pages/AdminPage.jsx index 1df20ad..e50450d 100644 --- a/frontend/src/pages/AdminPage.jsx +++ b/frontend/src/pages/AdminPage.jsx @@ -303,7 +303,6 @@ function AdminPage() { if (reader) reader.cancel().catch(() => {}) } // eslint-disable-next-line react-hooks/exhaustive-deps - // eslint-disable-next-line react-hooks/exhaustive-deps }, [organization?.id, hasAdminFeature]) const handleMcpFilterChange = (key, value) => {