fix(ci): frontend lint to zero errors + dev-deps installable on clean image #149
Reference in New Issue
Block a user
Delete Branch "fix/ci-cleanup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Follow-up to PRs #141 / #147 / #148. Three categories of fix:
After this lands, frontend CI is green, backend CI is dramatically less red (488 errors → 4), and we can enable Gitea branch protection on
main.Measured impact
Full backend pytest run, before vs after:
The remaining 54 failures and 4 errors are real test bugs (mostly fixture/test-cleanup issues like duplicate-email registration), not infrastructure cascades. They're tractable as their own focused follow-ups now that the dominant noise is gone.
What's fixed
1. Frontend lint: 20 errors → 0 errors
setStatesynchronously in effect (real cascade bugs flagged by react-hooks v5)useMediaQuery.ts,DeviceNode.tsx,GroupNode.tsx,TicketQueue.tsxuseMediaQueryswitched touseSyncExternalStore(canonical for external subscriptions); the prop-sync effects inDeviceNode/GroupNodewere redundant — display now reads the prop directly during render, edit buffer initializes only when an edit session starts;TicketQueuemoved its clear/loading writes inside the async fetch (post-await boundary) and added a request-id ref to drop stale responses.react-refresh/only-export-componentsrouter.tsxAssistantSessionRedirectto its own file undercomponents/routing/so the router-config module only exports a constant.@typescript-eslint/no-explicit-anyuseFlowPilotSession.ts,FlowPilotSessionPage.tsxas anywith narrow inline error/state shapes.@typescript-eslint/no-unused-expressions(×8)TicketsPage.tsxif/elseblocks.no-unused-varsScriptBuilderTab.tsxhandleViewScriptplaceholder declares its args properly withvoidto match theScriptBuilderChatPropssignature.tsc -bclean across the merged tree.2. Backend dev deps: ResolutionImpossible → installable
backend/requirements-dev.txthadpytest==7.4.3pinned alongsidepytest-asyncio==0.24.0, but pytest-asyncio 0.24 declarespytest>=8.2. A clean pip install fails withResolutionImpossible. Bumped:3. Test-DB schema now creates the full schema
backend/tests/conftest.py'stest_dbfixture callsBase.metadata.create_allon a fresh DB. That only creates tables for models that have been imported by the time the fixture runs.app.mainimports models lazily (inside scheduler functions and route modules), which is fine at runtime but leaves the metadata incomplete at fixture-setup time. Tests that exercise PSA, network diagrams, ratings, escalations, etc. were all failing withUndefinedTableError: relation "X" does not exist, with cascading 500s from every endpoint that queried the missing table.Added
from app import models as _modelsto conftest soapp/models/__init__.pyruns (which imports every model module — registering all ~60 tables onBase.metadatabeforecreate_allruns). Thefrom app import modelsform is used instead ofimport app.modelsso it doesn't shadow theappFastAPI instance imported just above.Test plan
npm run lint— 0 errors / 23 warnings (warnings are missing-deps in useEffect, opt-in cleanup later).npx tsc -b— clean.pip install -r requirements-dev.txt— resolves cleanly on Python 3.12.pytest— 1018 passed / 54 failed / 4 errors / 35 deselected (vs. 482/44/488/0 before this PR).🤖 Generated with Claude Code