From 6d15bc69562623f8d0975a183f845e7e80e0a8fe Mon Sep 17 00:00:00 2001 From: Codex Date: Wed, 17 Jun 2026 08:32:32 +0200 Subject: [PATCH] Clean frontend app entrypoint --- CHANGELOG.md | 7 +++++ ...t_sprint39_frontend_orchestration_hooks.py | 11 +++++++ docs/CODEX_EXECUTION_LOG.md | 29 +++++++++++++++++++ docs/TODO.md | 3 +- frontend/src/App.tsx | 2 +- 5 files changed, 50 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32a8ce3a..fb74b906 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ # Changelog +## Sprint 42 App entrypoint cleanup (2026-06-17) + +- Removed the stale `FormEvent`/`useState` React imports from `frontend/src/App.tsx`. +- Removed the UTF-8 BOM from the frontend entrypoint so future text patches and static checks are stable. +- Added a regression test that keeps `App.tsx` free of the stale imports and BOM. +- No behavior, API contracts, migrations, provider fetching or AI behavior changed. + ## Sprint 41 Demo workflow hook decomposition (2026-06-17) - Moved offline demo workflow orchestration from `App.tsx` into `frontend/src/hooks/useDemoWorkflow.ts`. diff --git a/backend/tests/test_sprint39_frontend_orchestration_hooks.py b/backend/tests/test_sprint39_frontend_orchestration_hooks.py index a394086a..5f3cf03d 100644 --- a/backend/tests/test_sprint39_frontend_orchestration_hooks.py +++ b/backend/tests/test_sprint39_frontend_orchestration_hooks.py @@ -27,6 +27,17 @@ def test_app_uses_shared_orchestration_hooks() -> None: assert "externalApi" not in app +def test_app_entrypoint_has_clean_encoding_and_react_imports() -> None: + app_path = ROOT / "frontend" / "src" / "App.tsx" + app_bytes = app_path.read_bytes() + app = app_path.read_text(encoding="utf-8") + + assert not app_bytes.startswith(b"\xef\xbb\xbf") + assert "import { useEffect, useMemo } from 'react'" in app + assert "FormEvent" not in app + assert "useState" not in app + + def test_demo_workflow_hook_owns_demo_api_and_cross_module_selection() -> None: hook = (ROOT / "frontend" / "src" / "hooks" / "useDemoWorkflow.ts").read_text(encoding="utf-8") diff --git a/docs/CODEX_EXECUTION_LOG.md b/docs/CODEX_EXECUTION_LOG.md index 80008529..f40ba502 100644 --- a/docs/CODEX_EXECUTION_LOG.md +++ b/docs/CODEX_EXECUTION_LOG.md @@ -1,3 +1,32 @@ +## Sprint 42 App entrypoint cleanup (2026-06-17) + +Changed: +- Removed the stale `FormEvent`/`useState` React imports from `frontend/src/App.tsx`. +- Removed the UTF-8 BOM from `App.tsx` so patches and static checks use normal UTF-8 text. +- Added a regression test that verifies the clean entrypoint encoding and React import set. +- Recorded the current `App.tsx` size audit: 622 lines after the orchestration hook decomposition passes. + +Validation: +- `cd backend && python -m pytest tests/test_sprint39_frontend_orchestration_hooks.py -q` passed: 8 tests. +- `python -m compileall backend/app` passed. +- `cd backend && python -m pytest -W error::DeprecationWarning` passed: 192 tests. +- `bash scripts/run_readiness_check.sh` passed. +- `cd frontend && npm run typecheck` passed. +- `cd frontend && npm run build` passed. +- `cd backend && python -m alembic heads` passed: `202606120900 (head)`. +- `cd backend && python -m alembic upgrade head --sql` passed. +- `bash -n scripts/live_migration_smoke.sh` passed. + +Open: +- Tower deployment and runtime smoke should run before considering this pass deployed. + +Limitations: +- No UX behavior, API contracts, migrations, provider fetching or AI behavior changed. +- `App.tsx` remains a large composition root; the remaining size is primarily panel wiring and hook outputs. + +Next recommended pass: +- Optional bootstrap-effect extraction if another no-behavior size reduction is useful. + ## Sprint 41 Demo workflow hook decomposition (2026-06-17) Changed: diff --git a/docs/TODO.md b/docs/TODO.md index 6e39281e..244b34a2 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -54,7 +54,8 @@ This file now starts with the current implementation status. Older preparation/b - [x] Provider, change-detection and map-workspace orchestration hook decomposition. - [x] Project/area/dataset cross-load orchestration hook decomposition. - [x] Demo workflow orchestration hook decomposition. -- [ ] Final `App.tsx` import/encoding cleanup and size audit. +- [x] Final `App.tsx` import/encoding cleanup and size audit. +- [ ] Optional final bootstrap-effect extraction if `App.tsx` orchestration needs another size reduction. ## Sprint 8 status diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index dd03e019..cb8c57d3 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,4 +1,4 @@ -import { FormEvent, useEffect, useMemo, useState } from 'react' +import { useEffect, useMemo } from 'react' import './styles/app.css' import { ChangeDetectionPanel } from './components/analysis/ChangeDetectionPanel' import { DatasetDetailPanel } from './components/datasets/DatasetDetailPanel'