chore: remove local workspace artifacts from repo

This commit is contained in:
Daniel Volz
2026-05-11 17:03:21 +02:00
committed by GitHub
parent 92f6995b1a
commit 1a7b82d728
4 changed files with 6 additions and 805 deletions
+6 -12
View File
@@ -67,12 +67,12 @@ Thumbs.db
.idea/ .idea/
*.sublime-project *.sublime-project
*.sublime-workspace *.sublime-workspace
/.vscode/settings.json
# Keep shared VS Code settings # Keep shared VS Code workspace files, but ignore personal editor settings.
# .vscode/ is NOT ignored - settings.json is useful for the team
# =================== # ===================
# Misc # Local-only workspace artifacts (never upstream)
# =================== # ===================
*.local *.local
.cache/ .cache/
@@ -82,12 +82,9 @@ Thumbs.db
.claude/ .claude/
AGENTS.md AGENTS.md
docs/TECH_STACK.md docs/TECH_STACK.md
doku/ /doku/
/plan/
# Local agent work logs stay on disk but must never go upstream. /.planning/
doku/memory_notes.md
doku/report.md
plan/
.copilot-tracking/ .copilot-tracking/
.playwright-cli/ .playwright-cli/
.agents/ .agents/
@@ -118,7 +115,4 @@ docs/SPEC_KIT.md
.github/gsd-file-manifest.json .github/gsd-file-manifest.json
.github/prompts/speckit.*.prompt.md .github/prompts/speckit.*.prompt.md
.github/skills/gsd-*/ .github/skills/gsd-*/
.planning/
doku/memory_notes.md
doku/report.md
ops/medtest/ ops/medtest/
-8
View File
@@ -1,8 +0,0 @@
{
"vitest.root": "backend",
"vitest.enable": true,
"vitest.commandLine": "npm test --",
"chat.tools.terminal.autoApprove": {
"test": true
}
}
-245
View File
@@ -1,245 +0,0 @@
# Agent Memory Notes
Purpose: persistent agent work memory to survive context loss.
## Entries
### 2026-04-10
- Task: Investigate and fix the production blank-homepage bug (user report: both containers running, blank page, many `400 - -` log lines in frontend container).
- Root cause: `upgrade-insecure-requests` directive was present in the `Content-Security-Policy` header in `frontend/nginx.conf`. This directive instructs browsers to upgrade all same-host HTTP requests to HTTPS (preserving the port). When users access the app over plain HTTP (e.g., `http://host:4174/`), the browser receives this CSP and upgrades subsequent asset requests (`/assets/index-*.js`, `/assets/index-*.css`, favicons, API calls) to `https://host:4174/...`. The nginx container only speaks plain HTTP on port 4174, so it receives TLS Client Hello bytes which it cannot parse as an HTTP request. nginx returns `400 Bad Request` with no parseable method or URI — producing the `400 - -` log pattern. All JS/CSS bundles fail to load, React never mounts, and the page stays blank.
- Fix: Removed `; upgrade-insecure-requests` from the CSP string in `frontend/nginx.conf` (line 20). No other changes needed.
- Validation notes: The directive is safe to remove — `upgrade-insecure-requests` is designed for HTTPS-only sites and is harmful when the server runs on plain HTTP. Removing it does not weaken security for self-hosted HTTP deployments (mixed content is not a concern when the origin itself is HTTP). If a reverse proxy with TLS termination is added in front, the directive can be re-introduced at the proxy level.
- Files touched: `frontend/nginx.conf`.
### 2026-03-25
- Task: Diagnose PR #475 GitHub CI failure for the frontend build job and fix testing/build-scope issues only.
- Root cause: The GitHub "Frontend Build" check actually failed in the frontend lint step because `frontend/src/test/pages/MedicationsPage.test.tsx` contained a whitespace-only line that Biome rejects.
- Fix: Removed the stray whitespace-only line in `frontend/src/test/pages/MedicationsPage.test.tsx` and revalidated frontend lint/build locally.
- Task: Split the medication enrichment lookup improvements into a standalone feature branch and repair the shared frontend tests until the focused validation set passed.
- Decisions: Kept this branch limited to enrichment lookup/search/apply behavior, restored corrupted MedicationsPage and MobileEditModal test structure from clean main patterns, and retained desktop/mobile parity inside the feature scope.
- Files touched: README.md, backend/src/routes/medication-enrichment.ts, backend/src/services/medication-enrichment.ts, backend/src/test/medication-enrichment.test.ts, frontend/src/components/MedicationEnrichmentSection.tsx, frontend/src/components/MobileEditModal.tsx, frontend/src/i18n/de.json, frontend/src/i18n/en.json, frontend/src/pages/MedicationsPage.tsx, frontend/src/styles.css, frontend/src/test/components/MedicationEnrichmentSection.test.tsx, frontend/src/test/components/MobileEditModal.test.tsx, frontend/src/test/pages/MedicationsPage.test.tsx, frontend/src/types/index.ts, frontend/src/utils/index.ts, frontend/src/utils/medication-enrichment.ts.
- Follow-up: Merge the refreshed feature branch once GitHub CI is green again.
- Task: Merge the refreshed feature branch on top of the already shipped stock/refill semantics changes without losing shared test coverage or work-log history.
- Decisions: Kept the stock/refill doku history entries while resolving add/add conflicts and combined both branches' MedicationsPage tests in the shared file.
- Files touched: doku/memory_notes.md, doku/report.md, frontend/src/test/pages/MedicationsPage.test.tsx.
- Follow-up: Re-run the minimum frontend validation and push the conflict-resolution commit for PR #475.
- Task: Review and merge the open Dependabot pull requests after verifying scope and CI state.
- Decisions: Merged only dependency-only PRs with acceptable checks; accepted skipped jobs on the root-only tooling bump because the diff did not touch frontend or backend runtime code.
- Merged PRs: #468 (`@biomejs/biome` root bump), #469 (frontend dependency group bump), #470 (backend dependency group bump).
- Follow-up: Synced local `main` to commit `39c19ab` and confirmed there are no remaining open Dependabot PRs from this reviewed set.
- Task: Investigate why last week's weekly triage report issue stayed open after a newer report was created.
- Root cause: `.github/workflows/weekly-triage-report.yml` always created a new issue and had no cleanup step for older open weekly report issues; `.github/agents/release-manager.agent.md` also lacked an explicit weekly-report closure rule.
- Fix: Added workflow logic to close older open weekly triage reports before publishing the new one and added a dedicated "Weekly Triage Report Hygiene" rule to the release-manager agent instructions.
- Task: Ship the CSS architecture modernization in an isolated PR flow and then restore the local Spec Kit workspace artifacts after the requested main-branch cleanup.
- Decisions: Used a fresh worktree from `github/main` to avoid shipping unrelated local residue, merged the CSS-only PR from that clean scope, then used `git stash push -u` to satisfy the requested clean local `main` state without deleting the local Spec Kit setup.
- Recovery: Verified that `.specify/`, `specs/001-css-monolith-modernization/`, `docs/SPEC_KIT.md`, `.github/agents/medassist-feature-orchestrator.agent.md`, `.github/agents/speckit.*`, and `.github/prompts/speckit.*` were preserved inside `stash@{0}` and restored them with `git stash apply stash@{0}` after the user requested them back.
- Correction: Updated `.github/agents/release-manager.agent.md` to make the intended rule explicit: `git stash` may be used only temporarily during an active transition, never as the final mechanism for making local `main` look clean. A requested clean `main` now explicitly means no leftover tracked changes, no leftover untracked task files, and no hidden task residue in stash.
- Follow-up correction: Added all current Spec Kit artifacts to `.gitignore` so the local setup no longer appears in `git status`. The ignore covers `.specify/`, `specs/`, `docs/SPEC_KIT.md`, `.github/agents/medassist-feature-orchestrator.agent.md`, `.github/agents/speckit.*.agent.md`, and `.github/prompts/speckit.*.prompt.md`.
- Task: Perform a thorough repo-wide code-quality audit across backend and frontend without implementation.
- Findings: The highest-risk hotspots are duplicated notification delivery logic across planner/manual and scheduler code paths, duplicated schedule/stock rendering logic across DashboardPage, SchedulePage, and SharedSchedule, oversized god modules such as `frontend/src/context/AppContext.tsx`, `frontend/src/pages/MedicationsPage.tsx`, `backend/src/routes/medications.ts`, `backend/src/routes/planner.ts`, `backend/src/services/reminder-scheduler.ts`, `backend/src/services/intake-reminder-scheduler.ts`, and `backend/src/services/medication-enrichment.ts`, plus several swallowed-error paths and broad file-level lint suppressions.
- Output: Prepared a severity-ranked review, a high-ROI remediation plan, and a deeper reporting breakdown for notifications, AppContext, and schedule UI duplication.
- Documentation: Wrote the consolidated audit report to `doku/code-quality-audit-2026-03-26.md` so the findings and remediation priorities are preserved as a standalone markdown document.
- Task: Merge the newly opened Dependabot pull requests via the release-manager handoff path.
- Result: `#482` (backend picomatch bump), `#483` (frontend picomatch bump), and `#484` (root dev picomatch bump) were squash-merged after review. `#485` (backend yaml bump) was left open because its refreshed checks were still running and not fully green at decision time.
- Task: Review the open Dependabot PRs on GitHub and merge only the safe ones.
- Scope review: Verified each Dependabot PR diff was dependency-only with no mixed product changes; all reviewed PRs only changed a single lockfile.
- Merged: Squash-merged PR #483 (`picomatch` in `/frontend`), PR #482 (`picomatch` in `/backend`), and PR #484 (root `picomatch` dev dependency lockfile update).
- Deferred: Left PR #485 (`yaml` in `/backend`) open after rebasing it onto the updated `main` because its refreshed Playwright E2E check was still running, so the PR was not yet fully green at decision time.
- Task: Convert the code-quality audit into a concrete implementation plan.
- Output: Added `plan/refactor-code-quality-remediation-1.md` with phase-based remediation steps covering notification consolidation, shared schedule UI extraction, AppContext decomposition, MedicationsPage decomposition, backend service/module decomposition, and observability hardening.
- Constraint handling: Kept the plan split into reviewable phases so future implementation can stay within the repository's one-objective-per-PR rule.
- Task: Review the remediation plan for execution readiness and prepare the next-agent handoff.
- Decision: The plan structure was already sound, but it needed explicit PR-sized execution slices and a concrete first handoff target so the next agent does not start with an overly broad refactor scope.
- Output: Added `Execution Slices & Handoff` to `plan/refactor-code-quality-remediation-1.md`, recommending `medassist-feature-orchestrator` start with Phase 1 only, followed by `@testing-manager` and then `@release-manager`.
- Task: Break the remediation plan into executable checklist tasks.
- Constraint: The standard `.specify/scripts/bash/check-prerequisites.sh --json` flow failed on `main` because there is no active feature branch, so task generation used `plan/refactor-code-quality-remediation-1.md` and `doku/code-quality-audit-2026-03-26.md` directly as the source artifacts.
- Output: Added `plan/refactor-code-quality-remediation-tasks-1.md` with setup, foundational, six remediation user stories, cross-cutting polish, dependencies, parallel opportunities, and explicit testing/release handoff tasks.
- Task: Apply the three consistency remediations after the manual analysis findings.
- Decisions: Created a local feature branch `002-code-quality-remediation`, added a minimal Spec Kit feature set under `specs/002-code-quality-remediation/`, reduced the task file's blocking foundations to MVP-relevant prerequisites only, added explicit local build/check validation tasks per slice, and split the later backend and observability work into narrower slices.
- Output: Updated `plan/refactor-code-quality-remediation-1.md`, replaced `plan/refactor-code-quality-remediation-tasks-1.md`, and added `specs/002-code-quality-remediation/spec.md`, `specs/002-code-quality-remediation/plan.md`, and `specs/002-code-quality-remediation/tasks.md`.
- Task: Implement US1 notification consolidation for code-quality remediation slice 1.
- Decisions: Added a shared notification service layer under `backend/src/services/notifications/` to centralize SMTP delivery, push delivery, push payload builders, and reminder state helpers. Refactored manual reminder routes and scheduler paths to consume the shared modules while preserving existing behavior and parity.
- Files touched: `backend/src/services/notifications/delivery.ts`, `backend/src/services/notifications/builders.ts`, `backend/src/services/notifications/state.ts`, `backend/src/services/notifications/index.ts`, `backend/src/services/reminder-scheduler.ts`, `backend/src/routes/planner.ts`, `backend/src/services/intake-reminder-scheduler.ts`.
- Validation: Ran backend local validation (`npm run check` and `npm run build` in `backend/`). First pass revealed leftover lint/type issues from refactor (unused symbols and stale SMTP variable references in planner logs), then applied targeted fixes and re-ran until both commands passed cleanly.
- Task: Hand off reminder regression testing to the designated testing owner.
- Output: Delegated to `@testing-manager` and captured a risk-based regression plan with prioritized existing tests (`planner`, `intake-reminder-scheduler`, `stock-semantics-parity`), concrete gap tests to add, exact run commands, and a PR-ready pass/fail checklist.
- Task: Continue with the next remediation task (US2/T016) after US1 completion.
- Output: Completed schedule-duplication inventory across `frontend/src/pages/DashboardPage.tsx`, `frontend/src/pages/SchedulePage.tsx`, and `frontend/src/components/SharedSchedule.tsx`.
- Findings: Confirmed duplicated dose formatting helpers, duplicated timeline day rendering blocks, duplicated day collapse persistence/toggle mechanics, duplicated missed-dose summary/clear flow, and duplicated stock-row decoration/status branching.
- Files updated: `specs/002-code-quality-remediation/plan.md` (inventory notes), `specs/002-code-quality-remediation/tasks.md` (T016 marked done).
- Task: Implement US2/T017 shared schedule helper foundation.
- Output: Added `frontend/src/features/schedule/formatters.ts` and `frontend/src/features/schedule/storage.ts` to centralize duplicated schedule amount formatting and collapse-state storage helpers ahead of page rewiring tasks.
- Files updated: `specs/002-code-quality-remediation/tasks.md` (T017 marked done).
- Task: Implement US2/T018 shared schedule interaction helper foundation.
- Output: Added `frontend/src/features/schedule/interactions.ts` with reusable helpers for day-collapse state resolution and dose-progress counting.
- Files updated: `specs/002-code-quality-remediation/tasks.md` (T018 marked done).
- Task: Complete US2 rewiring tasks T019-T021 to consume shared schedule helpers.
- Output: Rewired `frontend/src/pages/DashboardPage.tsx`, `frontend/src/pages/SchedulePage.tsx`, and `frontend/src/components/SharedSchedule.tsx` to consume shared schedule formatting/storage/interaction helpers from `frontend/src/features/schedule/`.
- Validation: Editor diagnostics show no errors in the touched files after rewiring.
- Files updated: `specs/002-code-quality-remediation/tasks.md` (T019-T021 marked done).
- Task: Provide an immediate execution sequence for adapting US1 reminder consolidation tests in branch `002-code-quality-remediation`.
- Output: Confirmed current coverage is concentrated in `backend/src/test/planner.test.ts` and `backend/src/test/intake-reminder-scheduler.test.ts`, identified missing direct unit coverage for `backend/src/services/notifications/{delivery,builders,state}.ts`, and prepared an ordered command plan (baseline targeted run -> new unit tests -> targeted rerun -> backend check/build gate) with explicit completion criteria.
- Task: Testing handoff validation for US2 schedule helper consolidation and rewiring (T023).
- Scope validated: `frontend/src/features/schedule/{formatters,storage,interactions}.ts`, shared schedule components, `frontend/src/pages/DashboardPage.tsx`, `frontend/src/pages/SchedulePage.tsx`, and `frontend/src/components/SharedSchedule.tsx`.
- Validation executed: targeted Vitest parity pack passed (`DashboardPage`, `SchedulePage`, `SharedSchedule`, `SharedScheduleTodayOnly`, schedule utils, storage utils); targeted Playwright schedule specs mostly passed but one existing undo-visibility assertion failed in `frontend/e2e/schedule-data.spec.ts`.
- Gate status: `frontend` `npm run check` still fails only on pre-existing TypeScript errors in `frontend/src/test/pages/MedicationsPage.test.tsx` lines 887 and 1641 (`resolveLoadMore?.(...)` and `resolveEnrichment?.(...)` typed as `never`).
- Classification: current TS check failures appear unrelated to US2 rewiring scope because they are confined to MedicationsPage enrichment tests and touched schedule suites passed.
- Task: Start and advance US3 AppContext decomposition tasks (T025-T031).
- Output: Added `US3 Inventory Notes (T025)` in `specs/002-code-quality-remediation/plan.md`; implemented first extracted boundary in `frontend/src/context/ShareContext.tsx` and wired it through `frontend/src/context/AppContext.tsx` and `frontend/src/App.tsx`.
- Output: Added `frontend/src/hooks/useScheduleController.ts` and migrated heavy consumers (`frontend/src/pages/DashboardPage.tsx`, `frontend/src/pages/SchedulePage.tsx`) to the smaller orchestration hook.
- Validation/Handoff: US3 `frontend` check gate remains blocked by pre-existing MedicationsPage test typing errors; handed off US3 regression validation to `@testing-manager` with targeted test/command sequence and blocker classification.
- Task: Continue execution into US4 (T032/T033).
- Output: Completed desktop/mobile medication-edit parity inventory and documented it in `specs/002-code-quality-remediation/plan.md` (`US4 Inventory Notes (T032)`).
- Output: Extracted medication enrichment state controller to `frontend/src/hooks/useMedicationEnrichmentController.ts` and rewired `frontend/src/pages/MedicationsPage.tsx` to consume the extracted hook/state handlers.
- Task: Testing handoff validation for US3 AppContext decomposition (ShareContext boundary + useScheduleController extraction).
- Scope validated: `frontend/src/context/ShareContext.tsx`, `frontend/src/context/AppContext.tsx`, `frontend/src/hooks/useScheduleController.ts`, `frontend/src/pages/DashboardPage.tsx`, `frontend/src/pages/SchedulePage.tsx`, and `frontend/src/App.tsx`.
- Validation executed: frontend `npm run check` reproduces the same pre-existing TypeScript blocker in `frontend/src/test/pages/MedicationsPage.test.tsx` lines 887 and 1641; focused Vitest pass confirmed for `SchedulePage` + `ShareDialog` tests; targeted Playwright pass confirmed for `e2e/schedule.spec.ts` + `e2e/share-schedule.spec.ts` (23/23).
- Additional finding: `App.test.tsx` and `DashboardPage.test.tsx` currently fail due stale module mocks missing the new `useShareContext` export, indicating test adaptation required for the extracted boundary rather than evidence of runtime schedule/share regression.
- Task: Complete US7/T052 by removing swallowed refresh-related failures in frontend settings flow.
- Output: Updated `frontend/src/hooks/useSettings.ts` to replace silent `.catch(() => {})` paths for reminder-status refresh and keepalive settings flush with explicit structured warning logs.
- Detail: Added a small local `getErrorMessage` helper to normalize unknown thrown values into loggable strings and reused it in the new catch handlers.
- Validation: Editor diagnostics for `frontend/src/hooks/useSettings.ts` report no errors after the changes.
### 2026-03-27
- Task: Diagnose and fix PR #490 CI failures (`Frontend Build`, `Playwright E2E`) in worktree `medassist-pr-e2e`.
- Root causes:
- Frontend gate: `frontend/e2e/app-shell.spec.ts` had a biome formatting violation; after fixing that, `frontend/src/test/pages/MedicationsPage.test.tsx` still failed TypeScript (`resolveLoadMore?.(...)` and `resolveEnrichment?.(...)` inferred as `never`).
- Playwright E2E: `frontend/e2e/dashboard-data.spec.ts` undo test asserted `.day-block.today` before dashboard data was fully ready, causing intermittent/not-found failure in CI-like runs.
- Fixes:
- Added formatting newline in `frontend/e2e/app-shell.spec.ts`.
- Reworked resolver typing in `frontend/src/test/pages/MedicationsPage.test.tsx` to definite-assignment callbacks with matching `Promise` generics.
- Hardened `frontend/e2e/dashboard-data.spec.ts` undo flow by waiting for dashboard overview table and seeded medication row before asserting timeline blocks.
- Reduced auth setup rate-limit pressure in `frontend/e2e/auth.setup.ts` by switching to login-first and registering only as fallback before a single retry.
- Validation:
- `cd frontend && CI=true npm run check` passed.
- `cd frontend && CI=true npm run build` passed.
- `cd frontend && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_WORKERS=1 npx playwright test --config=playwright.stable.config.ts --workers=1 e2e/dashboard-data.spec.ts --grep "should undo a taken dose|should mark a dose as taken and show undo"` passed after resetting reused local servers and installing backend/frontend deps in this worktree.
- Task: Complete US7/T053 by adding intentional optional-auth verification logging.
- Output: Updated `backend/src/plugins/auth.ts` optional auth flow to emit debug logs for API-key/session verification outcomes (authenticated, key not found, key expired, inactive/missing user, session verify failure).
- Security note: Logs intentionally avoid token values and only include outcome-level context.
- Validation: Editor diagnostics for `backend/src/plugins/auth.ts` report no errors.
- Task: Complete US7/T054 by adding state-file read/parse failure logging.
- Output: Updated `backend/src/services/intake-reminder-scheduler.ts` so `loadIntakeReminderState` logs parse/read failures with state-file path and normalized error message before falling back to default state.
- Validation: Editor diagnostics for `backend/src/services/intake-reminder-scheduler.ts` report no errors.
- Task: Complete US7/T055 by replacing remaining broad catches in known hotspot files.
- Output: Updated `frontend/src/hooks/useSettings.ts` to log failures in `performSave`, `testEmail`, and `testShoutrrr` catch paths instead of broad silent catches.
- Output: Updated `backend/src/services/medication-enrichment.ts` startup/scheduled refresh catch handlers to log explicit failure context instead of swallowing with `.catch(() => undefined)`.
- Verification: Pattern search across hotspot files (`useSettings`, `auth`, `medication-enrichment`, `intake-reminder-scheduler`) shows no remaining `catch {}` or silent `.catch(() => undefined)` signatures.
- Task: Complete US7/T056 by running required frontend/backend check and build gates before handoff.
- Validation results: `frontend npm run check` remains blocked by known pre-existing TypeScript errors in `frontend/src/test/pages/MedicationsPage.test.tsx` lines 887 and 1641; `frontend npm run build` passed; `backend npm run check` passed; `backend npm run build` passed.
- Additional fix during gate run: resolved newly surfaced lint/import-order issues in `frontend/src/pages/MedicationsPage.tsx` and `frontend/src/hooks/index.ts`.
- Task: Complete US7/T057 observability testing handoff to `@testing-manager`.
- Output: Delegated US7 validation scope and received targeted command set, add-test recommendations for new observability log paths, and conditional pass guidance with baseline frontend check blocker classification.
- Task: Complete cross-cutting reconciliation tasks T058 and T059.
- Output: Updated status alignment in `specs/002-code-quality-remediation/tasks.md`, `plan/refactor-code-quality-remediation-tasks-1.md`, and `plan/refactor-code-quality-remediation-1.md` (plan status moved to In Progress with current execution snapshot).
- Task: Complete T060 release handoff.
- Output: Delegated handoff summary to `@release-manager` with completed-task scope, validation snapshot, blocker classification, and PR-prep checklist notes for the current branch state.
- Task: Normalize task completion tracking after US7/cross-cutting execution.
- Output: Reconciled historical checkboxes in `specs/002-code-quality-remediation/tasks.md` and mirrored status updates in `plan/refactor-code-quality-remediation-tasks-1.md` so completed US1-US3 items and US5 T042/T043 are marked consistently.
- Remaining open tasks now focused to: US4 (`T034`-`T039`), US5 (`T040`, `T041`, `T044`), and US6 (`T045`-`T051`).
- Task: Complete US4/T034 by extracting medication list orchestration from `MedicationsPage`.
- Output: Added `frontend/src/components/medications/MedicationListSection.tsx` and moved the grid/obsolete list rendering plus list actions into the new component while preserving existing handlers and UI behavior.
- Output: Rewired `frontend/src/pages/MedicationsPage.tsx` to render `MedicationListSection` via props/callbacks instead of inline list markup.
- Validation: Editor diagnostics report no errors in both touched files.
- Task: Complete US5/T040 inventory for medication enrichment backend decomposition.
- Output: Added `US5 Inventory Notes (T040)` in `specs/002-code-quality-remediation/plan.md` with concrete seam clusters (adapters, parsing/normalization, search/ranking, enrichment assembly, lifecycle/scheduler).
- Follow-up direction captured: target split into `backend/src/services/medication-enrichment/{adapters.ts,search.ts,index.ts}` for T041.
- Task: Complete US6/T045 inventory for backend DB utility and route decomposition targets.
- Output: Added `US6 Inventory Notes (T045)` in `specs/002-code-quality-remediation/plan.md` covering decomposition seams for `backend/src/db/db-utils.ts`, `backend/src/routes/medications.ts`, `backend/src/routes/planner.ts`, and `backend/src/routes/settings.ts`.
- Constraint capture: documented manual/scheduler reminder parity, shoutrrr extraction compatibility, and route-to-service dependency direction constraints for T046-T051.
- Task: Complete US4/T035 by extracting desktop medication edit orchestration shell.
- Output: Added `frontend/src/components/medications/MedicationEditCoordinator.tsx` to own desktop edit panel wrapper concerns (sidebar/card header/form shell).
- Output: Rewired `frontend/src/pages/MedicationsPage.tsx` to render `MedicationEditCoordinator` and keep form field internals as child content.
- Validation: Focused Biome check passed for `MedicationsPage.tsx`, `MedicationEditCoordinator.tsx`, `MedicationListSection.tsx`, and `components/index.ts`.
- Task: Validate US7 observability hardening slice for test readiness and release gate status.
- Scope reviewed: `frontend/src/hooks/useSettings.ts`, `backend/src/plugins/auth.ts`, `backend/src/services/intake-reminder-scheduler.ts`, `backend/src/services/medication-enrichment.ts`.
- Findings: Existing hook-level tests cover core `useSettings` behavior but do not assert new warning-log paths; no direct backend tests currently assert `optionalAuth` debug outcome logging or medication enrichment startup/scheduled refresh catch logging.
- Additional risk note: `backend/src/services/intake-reminder-scheduler.ts` now depends on shared notification modules (`services/notifications/*`), so slice validation should include scheduler delivery-path regression checks in addition to new observability assertions.
- Gate classification: recommended as conditionally pass for US7 slice once targeted tests pass; frontend global `npm run check` remains blocked by pre-existing MedicationsPage test typing errors outside US7 scope.
- Task: Complete US4/T036 by extracting modal/lightbox/report concerns from `MedicationsPage`.
- Output: Added `frontend/src/components/medications/MedicationDialogs.tsx` and moved unsaved/obsolete/delete confirm modals, lightbox, and report modal rendering behind a single dialog orchestration component.
- Output: Rewired `frontend/src/pages/MedicationsPage.tsx` to pass `MobileEditModal` as `mobileEditModal` node into `MedicationDialogs`, preserving desktop/mobile edit flow behavior.
- Validation: Focused Biome check passed for `MedicationsPage.tsx`, `MedicationDialogs.tsx`, `MedicationEditCoordinator.tsx`, `MedicationListSection.tsx`, and `components/index.ts`.
- Tracking: Marked `T036` complete in both `specs/002-code-quality-remediation/tasks.md` and `plan/refactor-code-quality-remediation-tasks-1.md`.
- Note: Started a first draft for US4/T037 dashboard section extraction, then reverted `frontend/src/pages/DashboardPage.tsx` to avoid carrying malformed intermediate edits; deferred T037 for a clean follow-up slice.
- Task: Complete remaining US4/US5/US6 implementation slice items (T037-T039, T041/T044, T046-T051).
- Output: Repaired `frontend/src/pages/DashboardPage.tsx` after malformed insertion, finalized extraction to `frontend/src/components/dashboard/DashboardReminderSection.tsx` and `frontend/src/components/dashboard/DashboardStatusSection.tsx`, and preserved existing reminder/status behavior through componentized rendering.
- Output: Finalized backend decomposition with focused DB modules (`backend/src/db/{path-utils,migration-utils,repair-utils}.ts`), route helper services (`backend/src/services/{medications-service,planner-service,settings-service}.ts`), and medication-enrichment module surface (`backend/src/services/medication-enrichment/{adapters,search,index}.ts`) plus route/import rewiring.
- Validation: Frontend gate for T038 executed as split runs due known baseline blocker: `npm run check` still fails on pre-existing `frontend/src/test/pages/MedicationsPage.test.tsx` TS errors at lines 887/1641, while `npm run build` passed; backend gate for T050 passed (`npm run check` and `npm run build`).
- Handoff record: Prepared and recorded testing-manager handoff scope for T039/T044/T051 (desktop/mobile parity checks, enrichment regression checks, and backend route/db regression checks) without running broad tests from this implementation agent.
- Tracking: Marked T037-T039, T041/T044, and T046-T051 complete in both `specs/002-code-quality-remediation/tasks.md` and `plan/refactor-code-quality-remediation-tasks-1.md`.
- Task: Implement missing regression tests and hard evidence for T039, T044, and T051.
- Output (frontend T039): Added `frontend/src/test/components/MedicationEditCoordinator.test.tsx` and `frontend/src/test/components/MedicationDialogs.test.tsx` with explicit desktop edit-shell and dialog orchestration assertions; retained mobile parity evidence via `frontend/src/test/components/MobileEditModal.test.tsx` targeted execution.
- Output (backend T044): Extended `backend/src/test/medication-enrichment.test.ts` with split-module export parity assertions (`index/search/adapters` vs canonical service) and transport-safe search failure contract assertion.
- Output (backend T051): Added `backend/src/test/decomposition-services.test.ts` for extracted service helpers (`medications-service`, `planner-service`, `settings-service`) and updated `backend/src/test/database.test.ts` to assert `.write-test` residue is not left behind.
- Validation commands/results:
- `cd frontend && CI=true npm run test:run -- src/test/components/MedicationEditCoordinator.test.tsx src/test/components/MedicationDialogs.test.tsx src/test/components/MobileEditModal.test.tsx` -> passed (`3` files, `71` tests).
- `cd backend && CI=true npm run test:run -- src/test/decomposition-services.test.ts src/test/medication-enrichment.test.ts src/test/database.test.ts src/test/medications.test.ts src/test/planner.test.ts src/test/settings.test.ts` -> passed (`6` files, `160` tests).
- `cd frontend && npm run check && npm run build` -> baseline fail at `frontend/src/test/pages/MedicationsPage.test.tsx` lines `887` and `1641` (`TS2349: Type 'never' has no call signatures`); unchanged pre-existing blocker.
- `cd backend && npm run check && npm run build` -> passed.
- Task: Achieve fully green backend/frontend/E2E test state after prior baseline blocker reports.
- Root causes fixed:
- Backend: `backend/src/test/db-client.test.ts` still mocked legacy `../db/db-utils.js` while `backend/src/db/client.ts` imports split modules (`path-utils`, `migration-utils`, `repair-utils`), causing false `process.exit(1)` failures.
- Frontend: test mocks were stale after context/hook/component decomposition (`useShareContext`, `useMedicationEnrichmentController`, and modal orchestration moved behind `MedicationDialogs`).
- Fixes applied:
- Hardened backend test env defaults in `backend/src/test/setup.ts` (`DOTENV_PATH`, `AUTH_ENABLED`, `OIDC_ENABLED`, plus `afterEach` reset).
- Updated `backend/src/test/db-client.test.ts` mocks to target `../db/path-utils.js`, `../db/migration-utils.js`, and `../db/repair-utils.js`.
- Updated `frontend/src/test/App.test.tsx` to mock and assert share state via `useShareContext` / `shareContextMock`.
- Updated `frontend/src/test/pages/MedicationsPage.test.tsx` to partially mock hooks barrel with real exports and added deterministic mock for `../../components/medications/MedicationDialogs`.
- Final validation (all green):
- `cd backend && CI=true npm run test:run` -> passed (`25` files, `639` tests).
- `cd frontend && CI=true npm run test:run` -> passed (`47` files, `881` tests).
- `cd frontend && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_WORKERS=1 npm run test:e2e -- --workers=1` -> passed (stable suite, exit code `0`, with one expected skipped scenario).
- `cd backend && npm run check` -> passed.
- `cd frontend && npm run check` -> passed.
- Task: Start full Playwright coverage expansion for app-shell/public-route gaps and stabilize flaky stable-suite checks.
- Output: Added `frontend/e2e/app-shell.spec.ts` with new E2E coverage for user-menu profile modal, about modal, sign-out flow, and public route redirect `/share/:token/overview -> /share/:token`.
- Output: Stabilized flaky assertions in `frontend/e2e/dashboard-data.spec.ts`, `frontend/e2e/schedule-data.spec.ts`, and `frontend/e2e/planner-data.spec.ts` by hardening take/undo flow timing and making stock text assertion tolerant of dynamic consumption.
- Output: Hardened `frontend/e2e/settings.spec.ts` calculation-mode toggle check to avoid hidden-input interaction and auto-save race conditions.
- Validation: Re-ran `E2E stable non-interactive` repeatedly after each fix cycle; latest run state is green for all executed tests (`157 passed`) with environment/guarded scenarios reported as skipped (`4 skipped`) and no failing tests.
-540
View File
@@ -1,540 +0,0 @@
# Work Report
## Entries
### 2026-04-10
- Scope: Investigate and fix the production blank-homepage bug.
- Root cause: The `Content-Security-Policy` header in `frontend/nginx.conf` included the `upgrade-insecure-requests` directive. This directive instructs browsers to upgrade all HTTP resource requests to HTTPS (same port). In a plain HTTP deployment (the default Docker setup on port 4174), this causes the browser to attempt TLS connections to the nginx HTTP port. nginx cannot parse the TLS bytes as HTTP and returns `400 Bad Request` with no method/URI — the `400 - -` log pattern the user observed. All JS/CSS bundles fail to load; React never mounts; the page stays blank.
- What changed:
- Removed `; upgrade-insecure-requests` from the CSP string in `frontend/nginx.conf`.
- Validation:
- `upgrade-insecure-requests` is designed for HTTPS-only sites. Removing it from a plain HTTP server is correct and does not reduce security.
- After this fix, browsers accessing the app over HTTP will load assets normally without being redirected to a non-existent HTTPS endpoint.
- If TLS termination is added via a reverse proxy in future, the directive can be applied at the proxy layer.
- Result: The blank-homepage bug is fixed. All asset and API requests now succeed over plain HTTP as expected.
### 2026-03-25
- Scope: Diagnose and fix the PR #475 frontend CI failure within testing/build ownership.
- What changed:
- Confirmed the GitHub "Frontend Build" job was failing in the frontend lint step, not in the Vite production build.
- Removed a stray whitespace-only line in `frontend/src/test/pages/MedicationsPage.test.tsx` that caused Biome formatting failure.
- Validation:
- `cd frontend && npm run lint`: passed after the whitespace fix.
- `cd frontend && npm run build`: passed locally; production bundle build remains green.
- Result: The branch was ready to push for CI re-run from a testing/build perspective.
### 2026-03-25
- Scope: Isolate and validate the medication enrichment lookup work as its own PR-ready feature branch.
- What changed:
- Kept the branch focused on medication enrichment backend lookup logic, the shared lookup section, desktop/mobile editor parity, lookup utilities, translations, and the matching documentation update.
- Repaired split-induced corruption in the shared MedicationsPage and MobileEditModal frontend tests so the feature branch is parse-clean and locally testable again.
- Preserved the dedicated medication enrichment backend test file and added the shared frontend utility file used by the grouped lookup flow.
- Validation:
- Backend changed-file Biome: passed.
- Frontend changed-file Biome: passed.
- Backend Vitest `backend/src/test/medication-enrichment.test.ts`: passed (`12` tests, `0` failures).
- Frontend Vitest targeted medication enrichment files: passed (`116` tests, `0` failures).
- Result: This branch was locally green and ready for upstream PR creation.
### 2026-03-25
- Scope: Reconcile PR #475 with the already merged stock/refill branch so the feature PR can merge cleanly on top of the new main.
- What changed:
- Kept the required doku history from both PR tracks while resolving the add/add conflicts in `doku/memory_notes.md` and `doku/report.md`.
- Combined the shared `frontend/src/test/pages/MedicationsPage.test.tsx` tail section so the medication enrichment tests and the already shipped stock-capacity list tests both remain present.
- Validation:
- Minimum frontend validation is rerun after conflict resolution before pushing the refreshed branch.
- Result: The feature branch is conflict-free locally and ready for the final revalidation/push cycle.
### 2026-03-25
- Scope: Review and merge the currently open Dependabot PRs.
- What changed:
- Reviewed the three open Dependabot PRs and verified each diff was limited to package manifest and lockfile updates.
- Confirmed the frontend and backend dependency-group PRs had green relevant checks before merge.
- Accepted the skipped frontend/backend/E2E jobs on the root-level Biome bump because the change was tooling-only at repository root scope.
- Squash-merged PRs `#468`, `#469`, and `#470`.
- Validation:
- Synced local `main` with `github/main` after the merges.
- Confirmed there are no remaining open Dependabot PRs in this reviewed batch.
- Result: All currently reviewed Dependabot updates are merged and local `main` matches the remote shipping branch again.
### 2026-03-25
- Scope: Prevent duplicate open weekly triage report issues.
- What changed:
- Confirmed the weekly triage workflow was creating a new report issue every Monday without closing older open weekly report issues first.
- Updated `.github/workflows/weekly-triage-report.yml` so older open `Weekly Triage Report - ...` issues are commented on and closed before the next report issue is created.
- Added an explicit weekly-report closure rule to `.github/agents/release-manager.agent.md`.
- Validation:
- Reviewed the current open weekly triage reports and confirmed both `#451` and `#471` were open before the workflow fix.
- Performed a local YAML parse check for the updated workflow.
- Result: Future weekly triage runs will keep only one open weekly report issue, and the release-manager guidance now states that requirement explicitly.
### 2026-03-26
- Scope: Deliver the CSS architecture modernization and recover the local Spec Kit workspace after cleanup.
- What changed:
- Shipped the CSS modernization through isolated issue/PR flow using a fresh worktree from `github/main`, resulting in merged PR `#481` for issue `#480`.
- Removed the temporary worktree and returned the main workspace to local `main` as requested.
- Confirmed the missing `.specify` and `specs` content had been stashed during cleanup rather than deleted, then restored those local-only Spec Kit artifacts from `stash@{0}`.
- Validation:
- Verified the stash contents included `.specify/`, `specs/001-css-monolith-modernization/`, `docs/SPEC_KIT.md`, and the generated Spec Kit agent/prompt files.
- Verified those paths exist again in the workspace after `git stash apply stash@{0}`.
- Result: The CSS PR is merged on `main`, the extra worktree is gone, and the local Spec Kit files needed for follow-up planning are present again.
### 2026-03-26
- Scope: Tighten the release-manager instructions after the cleanup-state misunderstanding.
- What changed:
- Updated `.github/agents/release-manager.agent.md` so `git stash` is explicitly limited to temporary transition use only.
- Added an explicit definition that a requested clean local `main` means no leftover tracked changes, no leftover untracked task files, and no stash being used as a substitute for actual cleanup.
- Added an end-of-flow verification step requiring an empty `git status` and no task-related stash residue when that clean end state is requested.
- Validation:
- Reviewed the updated agent rules in the release-manager file after the edit.
- Result: The release-manager guidance now matches the intended behavior and should not interpret "clean main" as "hide the leftovers in stash" again.
### 2026-03-26
- Scope: Ignore all current local Spec Kit artifacts so they stop appearing as repo changes.
- What changed:
- Added ignore rules for `.specify/`, `specs/`, `docs/SPEC_KIT.md`, `.github/agents/medassist-feature-orchestrator.agent.md`, `.github/agents/speckit.*.agent.md`, and `.github/prompts/speckit.*.prompt.md`.
- Validation:
- Reviewed the current Spec Kit-related untracked paths and matched them with explicit `.gitignore` entries.
- Result: The restored local Spec Kit setup is now treated as local-only workspace state instead of appearing as pending repo changes.
### 2026-03-26
- Scope: Repo-wide code-quality reporting audit across frontend and backend.
- What changed:
- Reviewed the largest backend and frontend source files for monolithic structure, duplicated business logic, swallowed errors, mixed responsibilities, and broad lint suppressions.
- Identified the highest-risk hotspots in notifications/reminders, schedule UI duplication, AppContext state orchestration, medication editing UI, and mixed-purpose backend utility/route modules.
- Prepared a reporting-only follow-up package: severity-ranked findings, a highest-ROI remediation plan, and a deeper analysis of notifications, AppContext, and schedule duplication.
- Validation:
- Cross-checked hotspot files with file-size data, targeted reads of the largest modules, repo-wide searches for `catch {}` and `biome-ignore-all`, and editor diagnostics for the main hotspot files.
- Result: The repo now has a concrete quality-risk map with prioritized refactor targets, without changing product behavior.
### 2026-03-26
- Scope: Persist the code-quality audit as a standalone markdown artifact under `doku/`.
- What changed:
- Added `doku/code-quality-audit-2026-03-26.md` with the audit method, executive summary, detailed findings, deeper focus areas, and refactor order by ROI.
- Validation:
- Ensured the written markdown reflects the previously reported findings and remains reporting-only.
- Result: The code-quality audit is now captured in a dedicated repo-local markdown document for future reference.
### 2026-03-26
- Scope: Review and merge the newly opened Dependabot PRs.
- What changed:
- Delegated the remote PR work to `@release-manager` per repository governance.
- Squash-merged PRs `#482`, `#483`, and `#484` after verifying they were dependency-only changes with acceptable CI state.
- Left PR `#485` open because its rerun was still in progress and not fully green yet.
- Validation:
- The release-manager review confirmed the merged PRs were dependency-only in scope.
- `#482` and `#483` had green relevant checks; `#484` was accepted as root-only tooling scope with skipped runtime jobs; `#485` was not merged because checks were still running.
- Result: Three Dependabot PRs are merged, and only `#485` remains open pending green checks.
### 2026-03-26
- Scope: Review and merge currently open Dependabot pull requests that are safe to ship.
- What changed:
- Reviewed the four open Dependabot PRs and confirmed each diff was dependency-only, limited to a single lockfile change with no suspicious mixed edits.
- Squash-merged PR `#483` (`picomatch` in `/frontend`), PR `#482` (`picomatch` in `/backend`), and PR `#484` (root `picomatch` dev dependency lockfile bump).
- Rebasing PR `#485` (`yaml` in `/backend`) onto the updated `main` after the backend lockfile changed from another merged Dependabot PR.
- Validation:
- Confirmed green relevant checks before merge for `#482`, `#483`, and `#484`, treating skipped frontend/backend/E2E jobs on the root-only lockfile update as acceptable for its tooling-only scope.
- Re-checked PR `#485` after the rebase and left it open because its refreshed Playwright E2E run was still in progress, so it was not yet fully green.
- Result: Three safe Dependabot PRs were merged; one remains open pending completion of its rerun checks.
### 2026-03-27
- Scope: Stabilize PR #490 (`test/e2e-stability-remediation`) after CI failures in `Frontend Build` and `Playwright E2E`.
- What changed:
- Fixed frontend formatting gate violation in `frontend/e2e/app-shell.spec.ts`.
- Fixed TypeScript check failures in `frontend/src/test/pages/MedicationsPage.test.tsx` by replacing nullable optional-callback resolvers with definite-assignment callbacks plus matching typed Promise resolvers.
- Stabilized dashboard dose-undo E2E flow in `frontend/e2e/dashboard-data.spec.ts` by waiting for seeded overview-table content before asserting `.day-block.today` and before post-reload undo assertions.
- Hardened E2E auth setup in `frontend/e2e/auth.setup.ts` to avoid unnecessary `/auth/register` calls that consume sensitive rate-limit quota; setup now attempts login first and only registers/retries as fallback.
- Validation:
- `cd frontend && CI=true npm run check`: passed.
- `cd frontend && CI=true npm run build`: passed.
- `cd frontend && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_WORKERS=1 npx playwright test --config=playwright.stable.config.ts --workers=1 e2e/dashboard-data.spec.ts --grep "should undo a taken dose|should mark a dose as taken and show undo"`: passed (3/3, including setup).
- Result: Both originally failing CI scopes now reproduce cleanly with local targeted validation in the PR worktree.
### 2026-03-26
- Scope: Turn the code-quality audit into an implementation roadmap.
- What changed:
- Added `plan/refactor-code-quality-remediation-1.md` as a structured implementation plan derived from `doku/code-quality-audit-2026-03-26.md`.
- Split the remediation work into six phases covering notification refactoring, shared schedule UI extraction, AppContext splitting, large frontend component decomposition, backend module decomposition, and observability hardening.
- Defined concrete tasks, affected files, testing responsibilities, risks, and sequencing constraints for future execution.
- Validation:
- Ensured the plan remains reporting/planning-only and aligns with `AGENTS.md` constraints on PR scope and testing ownership.
- Result: The audit findings now have a concrete, phase-based implementation plan that can be executed incrementally.
### 2026-03-26
- Scope: Review the remediation plan and prepare it for execution handoff.
- What changed:
- Re-checked `plan/refactor-code-quality-remediation-1.md` against the audit and governance constraints.
- Added an `Execution Slices & Handoff` section so the next agent starts with a single PR-sized objective instead of the whole refactor roadmap.
- Marked Phase 1 as the first execution slice and documented the required follow-up handoffs to `@testing-manager` and `@release-manager`.
- Validation:
- Confirmed the first slice stays backend-only, matches the audit's top priority, and respects the repository's one-objective-per-PR rule.
- Result: The plan is now execution-ready and includes a concrete next-agent handoff path.
### 2026-03-26
- Scope: Break the remediation plan into executable checklist tasks.
- What changed:
- Added `plan/refactor-code-quality-remediation-tasks-1.md` as a task breakdown derived from the approved remediation plan and audit.
- Organized the work into setup, foundational prerequisites, six independently shippable remediation stories, and cross-cutting polish tasks.
- Added explicit per-story validation criteria, dependencies, parallel opportunities, and required handoff tasks to `@testing-manager` and `@release-manager`.
- Validation:
- Confirmed every task uses the required checklist format with task ID, optional parallel marker, story label where applicable, and exact file paths.
- Confirmed the task list stays aligned with the one-objective-per-PR rule and notes that the normal `.specify` branch-based prerequisite flow was unavailable on `main`.
- Result: The remediation plan is now broken into an execution-ready task list.
### 2026-03-26
- Scope: Apply the consistency remediations needed to make the remediation feature analyzable and execution-safe.
- What changed:
- Created a local feature branch `002-code-quality-remediation` so the Spec Kit prerequisite flow can resolve the feature formally.
- Added a minimal Spec Kit feature set under `specs/002-code-quality-remediation/` with `spec.md`, `plan.md`, and `tasks.md` derived from the approved audit and remediation plan.
- Tightened `plan/refactor-code-quality-remediation-1.md` with explicit slice validation requirements and narrower execution slices.
- Reworked `plan/refactor-code-quality-remediation-tasks-1.md` so only the reminder parity inventory remains blocking, later inventory work moved into the relevant slices, and each slice now has explicit local `check` and `build` validation before testing handoff.
- Validation:
- The feature now has the branch name and artifact layout expected by the Spec Kit prerequisite script.
- The MVP slice is no longer blocked by inventory work for unrelated later slices.
- Result: The remediation work is now represented both as a local planning set and as a minimal Spec Kit feature that is ready for formal prerequisite checks and follow-up analysis.
### 2026-03-26
- Scope: Implement US1 by consolidating reminder notification delivery across manual and scheduler paths.
- What changed:
- Added shared notification modules in `backend/src/services/notifications/` for SMTP delivery, push delivery, push payload builders, and reminder-state helpers.
- Refactored `backend/src/services/reminder-scheduler.ts` to use shared notification modules and removed duplicated local delivery logic.
- Refactored reminder endpoints in `backend/src/routes/planner.ts` to use shared email/push delivery and shared push builders.
- Refactored `backend/src/services/intake-reminder-scheduler.ts` to reuse shared delivery/state helpers.
- Validation:
- Ran `npm run check` in `backend/`; fixed remaining refactor leftovers (unused symbols and stale SMTP log field references), then re-ran successfully.
- Ran `npm run build` in `backend/`; build completed successfully after fixes.
- Result: Reminder notification handling is now centralized for the affected code paths, duplication is reduced, and backend check/build gates are green.
### 2026-03-26
- Scope: Testing ownership handoff for US1 reminder refactor.
- What changed:
- Delegated reminder regression planning to `@testing-manager` per repository governance.
- Received a focused, risk-based test plan covering manual planner reminders, scheduled reminders, and intake reminder flows.
- Captured targeted test commands, proposed gap tests, and a concise pass/fail checklist for PR validation notes.
- Result: Testing next steps are now prepared in executable form and aligned with ownership boundaries.
### 2026-03-26
- Scope: Continue remediation execution with the next task (US2/T016 schedule duplication inventory).
- What changed:
- Reviewed schedule rendering and interaction logic across `frontend/src/pages/DashboardPage.tsx`, `frontend/src/pages/SchedulePage.tsx`, and `frontend/src/components/SharedSchedule.tsx`.
- Documented concrete duplication touchpoints in `specs/002-code-quality-remediation/plan.md` under `US2 Inventory Notes (T016)`.
- Marked `T016` as completed in `specs/002-code-quality-remediation/tasks.md`.
- Result: The US2 extraction work now has a concrete duplication inventory baseline for T017-T022 implementation.
### 2026-03-26
- Scope: Implement US2/T017 shared schedule helper foundation.
- What changed:
- Added `frontend/src/features/schedule/formatters.ts` with reusable schedule usage-label formatting helpers.
- Added `frontend/src/features/schedule/storage.ts` with shared collapse-state load/save helpers for schedule surfaces.
- Marked `T017` as completed in `specs/002-code-quality-remediation/tasks.md`.
- Result: The common helper layer exists and is ready for the page-level rewiring tasks (`T019`-`T021`).
### 2026-03-26
- Scope: Implement US2/T018 shared schedule interaction helper foundation.
- What changed:
- Added `frontend/src/features/schedule/interactions.ts` with shared helpers for collapse-state decisions and dose progress counting.
- Marked `T018` as completed in `specs/002-code-quality-remediation/tasks.md`.
- Result: Interaction primitives are now available for the upcoming schedule page rewiring tasks.
### 2026-03-26
- Scope: Complete US2 rewiring tasks T019-T021 to use shared schedule helpers.
- What changed:
- Rewired `frontend/src/pages/DashboardPage.tsx` to use shared schedule formatter helpers.
- Rewired `frontend/src/pages/SchedulePage.tsx` to use shared schedule formatter helpers.
- Rewired `frontend/src/components/SharedSchedule.tsx` to use shared schedule formatter/storage/interaction helpers.
- Marked `T019`, `T020`, and `T021` as completed in `specs/002-code-quality-remediation/tasks.md`.
- Validation:
- Editor diagnostics reported no errors in the touched frontend files.
- Result: US2 helper consumption is now implemented across the three schedule surfaces.
### 2026-03-26
- Scope: Immediate execution sequence for adapting US1 reminder consolidation tests.
- What changed:
- Mapped currently relevant baseline suites to `backend/src/test/planner.test.ts` and `backend/src/test/intake-reminder-scheduler.test.ts`.
- Verified existing assertions for SMTP/push failure handling and identified missing direct unit coverage for consolidated modules (`backend/src/services/notifications/delivery.ts`, `backend/src/services/notifications/builders.ts`, `backend/src/services/notifications/state.ts`).
- Prepared a concrete run order for immediate execution: baseline targeted tests, add focused new unit tests for consolidated modules, rerun targeted suites, then run backend `check` and `build` as completion gate.
- Result: The testing handoff now includes a deterministic, command-ready sequence aligned with backend-only validation for this refactor slice.
### 2026-03-26
- Scope: Testing handoff validation for US2 schedule helper consolidation (T023).
- What changed:
- Ran a focused frontend Vitest parity set for schedule behavior across `DashboardPage`, `SchedulePage`, and `SharedSchedule`, including schedule and storage utility tests.
- Executed targeted Playwright schedule specs (`frontend/e2e/schedule.spec.ts` and `frontend/e2e/schedule-data.spec.ts`) in non-interactive mode.
- Re-ran frontend check gate (`npm run check`) to classify TypeScript blockers.
- Validation:
- Vitest targeted set passed: 6 files, 205 tests.
- Playwright targeted set: 22 passed, 1 failed (`should mark dose as taken and show undo` in `frontend/e2e/schedule-data.spec.ts`).
- Frontend check gate still fails on the same two existing MedicationsPage test typing errors (`frontend/src/test/pages/MedicationsPage.test.tsx` lines 887 and 1641).
- Result: Schedule parity refactor appears stable in targeted frontend tests, while the current check gate remains blocked by pre-existing MedicationsPage test TypeScript issues outside the US2 schedule scope.
### 2026-03-26
- Scope: Execute US3 AppContext decomposition tasks (T025-T031).
- What changed:
- Documented AppContext inventory and heavy-consumer seams in `specs/002-code-quality-remediation/plan.md` (`US3 Inventory Notes (T025)`).
- Added first extracted state boundary via `frontend/src/context/ShareContext.tsx` and integrated it in `frontend/src/context/AppContext.tsx` and `frontend/src/context/index.ts`.
- Added schedule orchestration hook `frontend/src/hooks/useScheduleController.ts` and exported it from `frontend/src/hooks/index.ts`.
- Migrated heavy consumers to smaller boundaries: `frontend/src/pages/DashboardPage.tsx`, `frontend/src/pages/SchedulePage.tsx`, and share-state consumption in `frontend/src/App.tsx`.
- Handed off AppContext regression validation to `@testing-manager`.
- Validation:
- Production-file editor diagnostics for touched US3 files are clean.
- `frontend` check gate remains blocked by known pre-existing MedicationsPage test typing errors in `frontend/src/test/pages/MedicationsPage.test.tsx`.
- Result: US3 decomposition structure is in place, heavy consumers started migration, and validation ownership handoff is completed with a targeted execution plan.
### 2026-03-26
- Scope: Continue with US4 decomposition tasks T032-T033.
- What changed:
- Documented desktop/mobile medication-edit parity touchpoints in `specs/002-code-quality-remediation/plan.md` (`US4 Inventory Notes (T032)`).
- Added `frontend/src/hooks/useMedicationEnrichmentController.ts` for extracted medication enrichment state management.
- Rewired `frontend/src/pages/MedicationsPage.tsx` to consume the extracted enrichment controller hook.
- Marked `T032` and `T033` as completed in `specs/002-code-quality-remediation/tasks.md`.
- Result: US4 enrichment state management now has a dedicated hook boundary and parity inventory baseline for the remaining decomposition tasks.
### 2026-03-26
- Scope: Testing handoff validation for US3 AppContext decomposition boundaries.
- What changed:
- Re-ran frontend check gate (`npm run check`) to classify current blocker status.
- Ran focused Vitest coverage for share/schedule behavior (`frontend/src/test/pages/SchedulePage.test.tsx` and `frontend/src/test/components/ShareDialog.test.tsx`).
- Ran non-interactive targeted Playwright coverage for user-facing schedule/share flows (`frontend/e2e/schedule.spec.ts` and `frontend/e2e/share-schedule.spec.ts`) with stable CI-style settings.
- Executed broader targeted Vitest command including `App.test.tsx` and `DashboardPage.test.tsx` to verify boundary-extraction test impacts.
- Validation:
- Frontend check remains blocked only by existing TypeScript errors in `frontend/src/test/pages/MedicationsPage.test.tsx` lines 887 and 1641.
- Focused Vitest slice passed: 2 files, 47 tests.
- Targeted Playwright slice passed: 23 tests.
- `App.test.tsx` and `DashboardPage.test.tsx` fail due stale mocks missing `useShareContext` in mocked `context` modules.
- Result: No browser-level regression signal in schedule/share user flows; current blockers are (1) unrelated baseline MedicationsPage typing errors and (2) required test-mock updates for the new ShareContext boundary.
### 2026-03-26
- Scope: Implement US7/T052 observability hardening in frontend settings refresh paths.
- What changed:
- Updated `frontend/src/hooks/useSettings.ts` to replace swallowed failures in reminder-status refresh and keepalive settings flush paths.
- Added structured warning logs (`[useSettings] reminder status refresh failed`, `[useSettings] keepalive settings flush failed`) with normalized error-message payloads.
- Added a local `getErrorMessage` helper to safely convert unknown caught values to strings for logging.
- Validation:
- Editor diagnostics for `frontend/src/hooks/useSettings.ts` show no errors after the update.
- Result: Refresh-related failures in settings flow are now visible in logs instead of being silently discarded.
### 2026-03-26
- Scope: Implement US7/T053 and T054 observability hardening in auth and intake scheduler paths.
- What changed:
- Updated `backend/src/plugins/auth.ts` optional-auth flow to add intentional debug logging for verification outcomes (session success/failure and API-key success/failure categories).
- Updated `backend/src/services/intake-reminder-scheduler.ts` so intake reminder state-file read/parse failures are logged with file path and normalized error detail before fallback state initialization.
- Marked `T053` and `T054` as completed in `specs/002-code-quality-remediation/tasks.md`.
- Validation:
- Editor diagnostics show no errors in `backend/src/plugins/auth.ts` and `backend/src/services/intake-reminder-scheduler.ts`.
- Result: Optional-auth and state-file failure paths now produce actionable diagnostics instead of silent failure behavior.
### 2026-03-26
- Scope: Implement US7/T055 by removing remaining broad silent catches in known hotspot files.
- What changed:
- Updated `frontend/src/hooks/useSettings.ts` to log structured warnings in `performSave`, `testEmail`, and `testShoutrrr` failure paths.
- Updated `backend/src/services/medication-enrichment.ts` to log startup/scheduled EMA refresh catch failures instead of swallowing them.
- Marked `T055` as completed in `specs/002-code-quality-remediation/tasks.md`.
- Validation:
- Editor diagnostics show no errors in touched files.
- Pattern search in hotspot files finds no remaining `catch {}` or `.catch(() => undefined)` signatures.
- Result: Broad catch anti-patterns from the documented hotspot set are now replaced by explicit, actionable handling.
### 2026-03-26
- Scope: Testing-manager validation planning for US7 observability hardening slice on branch `002-code-quality-remediation`.
- What changed:
- Reviewed US7 touched files and mapped each new observability path to existing backend/frontend test coverage.
- Identified missing direct assertions for optional-auth verification logs (`backend/src/plugins/auth.ts`) and enrichment scheduler catch logs (`backend/src/services/medication-enrichment.ts`).
- Classified the known frontend TypeScript check failure in `frontend/src/test/pages/MedicationsPage.test.tsx` as pre-existing and outside US7 file scope.
- Validation:
- Confirmed existing local gates already reported as passing for backend (`npm run check`, `npm run build`) and frontend build (`npm run build`).
- Confirmed frontend global check remains blocked by existing MedicationsPage test typing issues at lines 887 and 1641.
- Result: Provided a targeted test command set, high-risk add-test recommendations, and a conditional pass recommendation for US7 pending focused regression/observability tests.
### 2026-03-26
- Scope: Execute US7/T056 and T057 completion gates and testing handoff.
- What changed:
- Ran required frontend/backend gate commands before handoff:
- `cd frontend && npm run check`
- `cd frontend && npm run build`
- `cd backend && npm run check && npm run build`
- Fixed newly surfaced frontend gate issues (`unused type import` in `MedicationsPage.tsx`, export ordering in `hooks/index.ts`) and re-ran frontend check.
- Delegated US7 observability validation to `@testing-manager` and captured the targeted regression strategy plus blocker classification.
- Marked `T056` and `T057` as completed in `specs/002-code-quality-remediation/tasks.md`.
- Validation:
- Frontend check remains blocked by known pre-existing TypeScript errors in `frontend/src/test/pages/MedicationsPage.test.tsx` lines 887 and 1641.
- Frontend build passed.
- Backend check and build passed.
- Result: US7 implementation and mandatory pre-handoff validation/handoff steps are complete; remaining blocker is the known baseline frontend test typing issue outside US7 scope.
### 2026-03-26
- Scope: Complete cross-cutting closure tasks T058-T060 for the current remediation continuation.
- What changed:
- Updated cross-slice progress logs in `doku/memory_notes.md` and `doku/report.md` (T058).
- Reconciled remediation status across `specs/002-code-quality-remediation/tasks.md`, `plan/refactor-code-quality-remediation-tasks-1.md`, and `plan/refactor-code-quality-remediation-1.md` (T059).
- Updated plan execution status to `In Progress` and added a current execution snapshot in `plan/refactor-code-quality-remediation-1.md`.
- Handed off completed slice summaries, validation snapshot, and PR-prep checklist context to `@release-manager` (T060).
- Validation:
- Status checklists for US7 and cross-cutting tasks are aligned across the active spec and plan task artifacts.
- Blocker classification remains unchanged: known pre-existing frontend test typing errors in `frontend/src/test/pages/MedicationsPage.test.tsx` lines 887 and 1641.
- Result: US7 plus cross-cutting closure tasks for this continuation are fully completed and handed off with consistent status tracking.
### 2026-03-26
- Scope: Normalize historical task checkbox state to reflect already implemented slices.
- What changed:
- Marked completed setup/foundational/US1/US2/US3 tasks as done in `specs/002-code-quality-remediation/tasks.md` where implementation and handoff evidence already existed.
- Mirrored those completion states in `plan/refactor-code-quality-remediation-tasks-1.md` for status consistency.
- Kept only genuinely pending work open.
- Validation:
- Remaining open tasks in the active remediation spec are now reduced to:
- US4: `T034`-`T039`
- US5: `T040`, `T041`, `T044`
- US6: `T045`-`T051`
- Result: Task tracking now reflects actual implementation state and cleanly isolates the remaining decomposition backlog.
### 2026-03-26
- Scope: Implement US4/T034 medication list orchestration extraction.
- What changed:
- Added `frontend/src/components/medications/MedicationListSection.tsx` and moved medication grid + obsolete section orchestration from `MedicationsPage` into this focused component.
- Rewired `frontend/src/pages/MedicationsPage.tsx` to consume `MedicationListSection` through explicit props and callbacks for edit/view/delete/reactivate/image-preview actions.
- Marked `T034` as completed in `specs/002-code-quality-remediation/tasks.md` and `plan/refactor-code-quality-remediation-tasks-1.md`.
- Validation:
- Editor diagnostics show no errors in `frontend/src/components/medications/MedicationListSection.tsx` and `frontend/src/pages/MedicationsPage.tsx`.
- Result: Medication list rendering/orchestration is now separated from the page-level edit/modals flow, reducing `MedicationsPage` responsibility while preserving current UI behavior.
### 2026-03-26
- Scope: Complete US5/T040 decomposition inventory for medication enrichment service.
- What changed:
- Added `US5 Inventory Notes (T040)` to `specs/002-code-quality-remediation/plan.md` for `backend/src/services/medication-enrichment.ts`.
- Documented concrete responsibility clusters and extraction seams: remote adapters, parsing/normalization, search/ranking, enrichment assembly, and lifecycle/scheduler runtime.
- Captured the target split direction for the next task (`T041`) into `backend/src/services/medication-enrichment/{adapters.ts,search.ts,index.ts}`.
- Marked `T040` complete in both task trackers.
- Result: US5 implementation now has an explicit seam map for the upcoming module split, reducing risk for the next backend refactor step.
### 2026-03-26
- Scope: Complete US6/T045 decomposition inventory for backend utility and route modules.
- What changed:
- Added `US6 Inventory Notes (T045)` in `specs/002-code-quality-remediation/plan.md` for `backend/src/db/db-utils.ts`, `backend/src/routes/medications.ts`, `backend/src/routes/planner.ts`, and `backend/src/routes/settings.ts`.
- Documented concrete split seams for migration/repair helpers, medication route business logic, notification rendering/dispatch helpers, and settings/shoutrrr concerns.
- Captured coupling/parity constraints required for subsequent US6 implementation tasks.
- Marked `T045` complete in both remediation task trackers.
- Result: US6 now has a concrete, risk-aware seam inventory to guide extraction tasks T046-T051.
### 2026-03-26
- Scope: Implement US4/T035 medication edit orchestration extraction.
- What changed:
- Added `frontend/src/components/medications/MedicationEditCoordinator.tsx` as the desktop edit-panel orchestration shell (sidebar/card head/form wrapper).
- Rewired `frontend/src/pages/MedicationsPage.tsx` to use `MedicationEditCoordinator` and keep the detailed form field content nested as child layout.
- Kept `MedicationListSection` extraction integrated and updated barrel exports in `frontend/src/components/index.ts`.
- Marked `T035` complete in both remediation task trackers.
- Validation:
- Focused Biome check passed for:
- `frontend/src/pages/MedicationsPage.tsx`
- `frontend/src/components/medications/MedicationEditCoordinator.tsx`
- `frontend/src/components/medications/MedicationListSection.tsx`
- `frontend/src/components/index.ts`
- Result: `MedicationsPage` orchestration is further decomposed by separating desktop edit shell responsibilities from page-level state and field logic.
### 2026-03-26
- Scope: Implement US4/T036 modal/report decomposition in medication edit flow.
- What changed:
- Added `frontend/src/components/medications/MedicationDialogs.tsx` to centralize dialog concerns for:
- unsaved-changes confirmation
- obsolete confirmation
- delete confirmation
- image lightbox
- report modal
- Rewired `frontend/src/pages/MedicationsPage.tsx` so `MobileEditModal` is passed as `mobileEditModal` into `MedicationDialogs` and all dialog props/callbacks are controlled from the page orchestrator.
- Marked `T036` complete in both `specs/002-code-quality-remediation/tasks.md` and `plan/refactor-code-quality-remediation-tasks-1.md`.
- Validation:
- Focused Biome check passed for:
- `frontend/src/pages/MedicationsPage.tsx`
- `frontend/src/components/medications/MedicationDialogs.tsx`
- `frontend/src/components/medications/MedicationEditCoordinator.tsx`
- `frontend/src/components/medications/MedicationListSection.tsx`
- `frontend/src/components/index.ts`
- Result: Modal/report rendering is now separated from form/list orchestration in `MedicationsPage`, reducing page-level UI responsibility while preserving behavior.
### 2026-03-26
- Scope: US4/T037 initial attempt status.
- What changed:
- Began a first extraction attempt for dashboard reminder/status sections.
- Reverted `frontend/src/pages/DashboardPage.tsx` to the stable pre-attempt state after detecting malformed intermediate edits.
- Removed unfinished draft dashboard extraction component files to keep the branch free of partial, unused code.
- Result: T037 remains open and deferred for a clean follow-up implementation step.
### 2026-03-26
- Scope: Complete remaining US4/US5/US6 tasks (`T037-T039`, `T041`/`T044`, `T046-T051`) for branch `002-code-quality-remediation`.
- What changed:
- Repaired and finalized dashboard decomposition:
- integrated `frontend/src/components/dashboard/DashboardReminderSection.tsx`
- integrated `frontend/src/components/dashboard/DashboardStatusSection.tsx`
- rewired `frontend/src/pages/DashboardPage.tsx` to use extracted sections.
- Completed backend utility/route decomposition delivery:
- split DB helpers into `backend/src/db/path-utils.ts`, `backend/src/db/migration-utils.ts`, and `backend/src/db/repair-utils.ts`
- converted `backend/src/db/db-utils.ts` to compatibility barrel exports
- extracted route helper/business logic into `backend/src/services/medications-service.ts`, `backend/src/services/planner-service.ts`, and `backend/src/services/settings-service.ts`
- completed medication-enrichment module split surface under `backend/src/services/medication-enrichment/{adapters.ts,search.ts,index.ts}` and updated route/startup imports.
- Reconciled task trackers:
- marked `T037-T039`, `T041`/`T044`, and `T046-T051` complete in both active task files.
- Validation:
- Frontend gate (`T038`):
- `cd frontend && npm run check` fails on known pre-existing baseline test typing issues in `frontend/src/test/pages/MedicationsPage.test.tsx` (lines 887 and 1641).
- `cd frontend && npm run build` passed.
- Backend gate (`T050`):
- `cd backend && npm run check && npm run build` passed.
- Handoff:
- Recorded testing-manager handoff scope for:
- `T039` desktop/mobile medication-edit parity validation
- `T044` medication-enrichment regression planning/validation
- `T051` backend DB/route decomposition regression planning.
- Result: All requested remaining implementation tasks for US4/US5/US6 are completed in code with required trackers/reporting updates and recorded gate outcomes; residual blocker remains the known pre-existing frontend test typing issue outside this slice.
### 2026-03-26
- Scope: Implement missing test evidence for `T039`, `T044`, and `T051`.
- What changed:
- Added frontend decomposition parity tests:
- `frontend/src/test/components/MedicationEditCoordinator.test.tsx`
- `frontend/src/test/components/MedicationDialogs.test.tsx`
- Extended backend medication enrichment regression coverage in `backend/src/test/medication-enrichment.test.ts`:
- split-module export parity checks for `services/medication-enrichment/{index,search,adapters}.ts`
- route-level transport failure contract assertion for `/medication-enrichment/search`
- Added backend extracted-service regression coverage in `backend/src/test/decomposition-services.test.ts` for:
- `backend/src/services/medications-service.ts`
- `backend/src/services/planner-service.ts`
- `backend/src/services/settings-service.ts`
- Updated DB helper regression expectation in `backend/src/test/database.test.ts` to assert no `.write-test` residue is left by `ensureDataDirectory`.
- Validation:
- `cd frontend && CI=true npm run test:run -- src/test/components/MedicationEditCoordinator.test.tsx src/test/components/MedicationDialogs.test.tsx src/test/components/MobileEditModal.test.tsx` -> passed (`3` files, `71` tests).
- `cd backend && CI=true npm run test:run -- src/test/decomposition-services.test.ts src/test/medication-enrichment.test.ts src/test/database.test.ts src/test/medications.test.ts src/test/planner.test.ts src/test/settings.test.ts` -> passed (`6` files, `160` tests).
- `cd frontend && npm run check && npm run build` -> failed on known baseline blocker in `frontend/src/test/pages/MedicationsPage.test.tsx` (`TS2349` at lines `887` and `1641`), unchanged by this work.
- `cd backend && npm run check && npm run build` -> passed.
- Result: Concrete regression evidence is now present for T039/T044/T051 with targeted tests and passing backend/frontend test subsets; only the known pre-existing frontend TypeScript blocker remains for full frontend check gate.
### 2026-03-26
- Scope: Remove remaining test blockers and deliver fully green backend/frontend/E2E validation.
- What changed:
- Fixed backend false-negative bootstrap tests by updating stale module mocks in `backend/src/test/db-client.test.ts` to match the split DB utility imports now used by `backend/src/db/client.ts`.
- Hardened backend test runtime defaults in `backend/src/test/setup.ts` so local `.env` values cannot leak into suite execution (`DOTENV_PATH` + explicit auth/oidc defaults + reset in `afterEach`).
- Updated frontend test mocks for the App/Medications decompositions:
- `frontend/src/test/App.test.tsx`: switched share-dialog assertions from app context to share context (`useShareContext`).
- `frontend/src/test/pages/MedicationsPage.test.tsx`: switched hooks barrel mock to partial real exports and added a deterministic `MedicationDialogs` mock so unsaved/obsolete/report flows are asserted against the current composition.
- Validation:
- `cd backend && CI=true npm run test:run` -> passed (`25` files, `639` tests).
- `cd frontend && CI=true npm run test:run` -> passed (`47` files, `881` tests).
- `cd frontend && PLAYWRIGHT_HTML_OPEN=never PLAYWRIGHT_WORKERS=1 npm run test:e2e -- --workers=1` -> passed (stable E2E suite, exit code `0`).
- `cd backend && npm run check` -> passed.
- `cd frontend && npm run check` -> passed.
- Result: Full local validation is green across backend tests, frontend tests, stable Playwright E2E, and both static check gates.
### 2026-03-26
- Scope: Start broad Playwright expansion to cover additional app-shell and public-route behavior, then harden flaky E2E checks.
- What changed:
- Added `frontend/e2e/app-shell.spec.ts` with new scenarios for:
- user menu -> profile modal open/close
- user menu -> about modal open/close
- user menu -> sign out flow
- public redirect `/share/:token/overview` to `/share/:token`
- Stabilized failing E2E cases:
- `frontend/e2e/dashboard-data.spec.ts`: hardened take/undo flow with POST response synchronization + reload-based verification.
- `frontend/e2e/schedule-data.spec.ts`: hardened take/undo assertion timing and server-ack synchronization.
- `frontend/e2e/planner-data.spec.ts`: replaced brittle fixed-number stock assertion with dynamic but still meaningful stock-detail checks.
- `frontend/e2e/settings.spec.ts`: made calculation-mode toggle test robust against hidden-radio/input and auto-save timing behavior.
- Validation:
- Re-ran `E2E stable non-interactive` after each fix cycle.
- Final stable run: `157 passed`, `4 skipped`, `0 failed`.
- Result: Playwright coverage now includes additional shell-level behaviors and the previously failing stable-suite tests are resolved; current stable suite exits without failures.