diff --git a/docs/plans/ci-cd-rebrand-main-nightly.md b/docs/plans/ci-cd-rebrand-main-nightly.md deleted file mode 100644 index 68e69b46d..000000000 --- a/docs/plans/ci-cd-rebrand-main-nightly.md +++ /dev/null @@ -1,47 +0,0 @@ -# Grimmory CI/CD Rebrand and Release Refactor - -## Summary - -- Before changing any build flow, cut one archival pre-migration release from the current state, record image digests and release metadata, and tag that commit with a non-semver marker such as `pre-grimmory-buildflow` so the current Booklore-era artifact remains recoverable. -- Execute the implementation in three parallel workstreams with disjoint ownership: workflow/release automation under `.github/workflows`, Docker packaging and asset layout under `Dockerfile`, `packaging/docker`, and `.dockerignore`, and deploy/docs surfaces under `deploy/` plus the operational docs/templates. -- The target operating model is: automatic validation on PRs and pushes, automatic nightly publication from `develop`, manual GHCR preview builds for PR refs, and maintainer-run batch stable releases from `main`. - -## Key Changes - -- Replace the current `develop` + stable-release publish model with four explicit workflows: - - `ci-validate.yml`: runs on PRs to `develop` and `main`, plus pushes to `develop` and `main`; runs migration diff/preview, backend tests, frontend tests, and a no-push packaging smoke build. - - `publish-nightly.yml`: runs on `schedule` and `workflow_dispatch`, explicitly checks out `develop`, and publishes `nightly` plus `nightly-YYYYMMDD-` to Docker Hub and GHCR. - - `publish-release.yml`: runs only on `workflow_dispatch`, accepts `ref` and `bump` (`major|minor|patch`), verifies the chosen ref is on `main`, creates and pushes `vX.Y.Z`, publishes `vX.Y.Z` and `latest` to both registries, and publishes the GitHub release. - - `preview-image.yml`: runs only on `workflow_dispatch`, accepts a PR ref or arbitrary ref, and publishes a GHCR-only preview tag such as `pr--` or `preview-`. -- Keep the reusable migration-check workflow, but make every caller pass explicit `base_ref`, `head_ref`, and `checkout_ref`; remove hard-coded `develop`, `HEAD`, and `HEAD~1` logic so PRs, push validations, nightly, and release workflows all diff the correct commits. -- Use the manual release workflow, not PR labels, as the source of truth for `major`/`minor`/`patch`. `release-drafter` stays only as a changelog formatter; it must no longer decide version bumps, and its repo/image links must be updated to Grimmory. -- Rename only build/release/deploy surfaces from Booklore to Grimmory in this pass: registry targets, OCI labels, GitHub release links and notes, deploy examples, operational docs, contributor guidance, and release/helper scripts. Do not rename `booklore-api`, `booklore-ui`, Java package names, DB identifiers, migration paths, dist paths, or other app/runtime internals yet. -- Replace all remaining stable-branch references with `main`, while keeping `develop` as the integration branch. Update contributor docs to state that PRs land on `develop`, maintainers promote selected changes to `main`, and stable releases are cut manually from `main`. -- Converge on a single canonical root `Dockerfile` and delete `Dockerfile.ci`. The Dockerfile should be a normal multi-stage source build that produces one minimal runtime image; CI should stop doing native workspace mutations like copying frontend build output into tracked resources or editing tracked `application.yaml` before packaging. -- Move packaging assets under `packaging/docker/`, keep the public build entrypoint as the root `Dockerfile`, and move deploy examples into a clear `deploy/` tree: `deploy/compose`, `deploy/helm/grimmory`, and `deploy/podman/quadlet`. Split scripts by purpose under `scripts/release` and `scripts/i18n` or `scripts/ops`. -- Tighten `.dockerignore` so docs, deploy examples, plans, and unrelated tooling do not bloat the Docker build context. -- Standardize tag policy and example usage: - - Stable: `vX.Y.Z` and `latest`. - - Nightly: `nightly` and `nightly-YYYYMMDD-`. - - Preview: GHCR-only, never `latest`, never Docker Hub. - - Stable deployment examples and README snippets should show pinned semver first, with `latest` documented as a convenience tag. - -## Test Plan - -- PR validation to `develop` and `main` runs automatically, publishes no images, and uses the correct migration diff base/head. -- Push validation on `develop` and `main` runs automatically and produces no registry side effects. -- Scheduled nightly runs from `develop` even though GitHub schedules execute from the default branch context, and it publishes only the nightly tags. -- Manual preview build for a PR ref publishes only to GHCR and never mutates stable/nightly tags. -- Manual stable release from a selected `main` commit creates and pushes the git tag, publishes semver plus `latest` to both registries, and publishes a GitHub release using Grimmory links and image names. -- Local `docker build .` and CI image publication both use the same Dockerfile and produce the same runtime image layout. -- The packaging path leaves tracked files untouched; no workflow step edits repo-tracked source files as part of building an image. -- Deploy examples, release metadata, OCI labels, and contributor docs all consistently use Grimmory registry names and `main`/`develop` semantics. - -## Assumptions and Defaults - -- `main` is the default branch and the only stable release source. -- `develop` remains the integration branch and the source for nightly images. -- Stable releases are intentionally batch-based and maintainer-triggered; merging to `main` does not automatically publish a release. -- GHCR preview images are sufficient for PR testing; Docker Hub preview publication is out of scope. -- The canonical registry targets are `grimmory/grimmory` and `ghcr.io/grimmory-tools/grimmory`. -- This pass is intentionally limited to build, release, deploy, and operational surfaces so the existing application internals remain intact while the delivery system is rebranded and stabilized. diff --git a/docs/plans/frontend-90-coverage-plan.md b/docs/plans/frontend-90-coverage-plan.md deleted file mode 100644 index 320823ded..000000000 --- a/docs/plans/frontend-90-coverage-plan.md +++ /dev/null @@ -1,506 +0,0 @@ -# Frontend 90% Coverage Controller Plan - -## Summary - -Drive the frontend to an honest `>=90%` on statements, branches, functions, and lines by attacking the coldest branch-deficit areas first. - -Current baseline on `chore/expand-frontend-tests` after `just ui typecheck`, `just ui lint`, `just ui test`, `just ui coverage`, and `just ui coverage-summary`: -- Global: statements `19.98%`, branches `15.25%`, functions `16.57%`, lines `36.00%` -- Lane ranking by uncovered branches: - - `metadata + settings + stats`: `3200` - - `book + author + series + notebook`: `2194` - - `readers`: `904` - - `shared`: `640` - - `core/auth/routes`: `51` - -Operating rules: -- No Playwright during the main coverage push -- No runtime code changes unless explicitly escalated as a narrow exception -- Test workers do not perform Git operations -- A dedicated Git/integration worker owns all Git and plan-doc mutations -- A dedicated notifier agent owns Pushover notifications -- The controller is orchestration-only: it does not generate tests, edit code, commit, integrate changes, or send notifications -- Progress toward branch coverage is the primary metric; low-yield churn is grounds for stopping and reassigning work - -## Roles - -### Controller -Owns orchestration only: -- run pre-flight checks -- spawn workers -- assign or reassign lanes and target files -- poll status -- detect anomalies -- order stop-all reviews -- decide whether a bucket is accepted, narrowed, restarted, or discarded -- set coordination flags consumed by the notifier agent - -The controller does not: -- edit tests -- edit runtime code -- update the plan doc directly -- run Git commands -- salvage large weak buckets by hand -- call the Pushover helper directly - -### Git/Integration Worker -Owns all repo mutations outside test generation: -- create and maintain `.worktrees/` -- create worker branches and worktrees -- keep `.worktrees/` ignored if needed -- update `docs/plans/frontend-90-coverage-plan.md` -- inspect `git status`, `git diff --stat`, and worktree health across all worker trees -- integrate accepted buckets one at a time -- create controller-approved commits with Conventional Commit messages and grouped markdown bodies -- prune or recreate discarded worktrees when instructed - -### Notifier Agent -Owns all watch/phone notifications through the `pushover-notify` skill: -- validate Pushover delivery in pre-flight -- send a periodic high-level status summary every 5 minutes -- send immediate human-needed alerts only when the controller explicitly marks the run as requiring the user to return -- never send noisy per-test spam -- never inspect or mutate Git state directly -- repeating summary and escalation behavior should be driven by one controller-owned loop, not repeated per-agent commands; use a temporary local script under `local-scripts/` when a cadence is needed - -### Test Workers -Own one lane each and only touch tests plus test-local helpers within owned paths unless explicitly escalated: -1. `core/auth/routes` -2. `book + author + series + notebook` -3. `metadata + settings + stats` -4. `readers` -5. `shared` - -Test workers do not: -- run Git commands -- edit the plan doc -- integrate other workers’ work -- drift into Playwright or harness churn - -## Pre-Flight Phase - -Before any worker launch, the controller must prove the run can proceed unattended. - -### Pre-flight checks -1. Confirm the branch and repo state are readable and sane. -- `git -C /Users/james/Projects/grimmory/grimmory status --short --branch` -- `git -C /Users/james/Projects/grimmory/grimmory worktree list` -- record any pre-existing untracked or unrelated files so they are not mistaken for worker drift - -2. Confirm the durable plan path exists. -- `docs/plans/frontend-90-coverage-plan.md` must be present and writable by the Git/integration worker - -3. Confirm worktree support is usable. -- `.gitignore` must contain `.worktrees/` -- if `.worktrees/` does not yet exist, that is acceptable; the Git worker creates it later - -4. Confirm Git capabilities are available without interactive approval. -- repo-local `git -C /Users/james/Projects/grimmory/grimmory ...` commands must succeed -- if branch creation or worktree creation requires approval, do not launch workers - -5. Confirm the frontend command surface is usable. -- `just ui typecheck` -- `just ui lint` -- `just ui test` -- `just ui coverage` -- `just ui coverage-summary` -- any failure here blocks launch until the controller re-baselines and updates the plan - -6. Confirm coordination transport is available. -- preferred: `valkey-cli ping` must return `PONG` -- fallback: if Valkey is unavailable, switch to controller polling via agent messages only -- if neither Valkey nor reliable agent polling is available, do not launch unattended - -7. Confirm notifier capability is available and working. -- `PUSHOVER_APP_TOKEN` and `PUSHOVER_USER_KEY` must be present -- notifier agent runs the skill-local helper once with `--dry-run` -- notifier agent then sends one real low-noise pre-flight notification -- if real delivery cannot be confirmed, unattended launch is blocked - -8. Confirm worker lanes are disjoint and target lists are current. -- regenerate the branch-deficit ranking from current coverage output -- verify each initial target file belongs to exactly one lane - -9. Confirm the Git/integration worker can own the repo-mutating path end to end. -- create worktrees -- inspect diffs -- update plan doc -- commit accepted buckets -- if any of these are uncertain, do not start the swarm - -### Pre-flight output -The controller must produce a launch record in the plan doc via the Git/integration worker containing: -- timestamp -- baseline coverage totals -- lane ranking by uncovered branches -- capability results for Git, Just, Valkey, and Pushover -- known pre-existing repo noise -- explicit `launch approved` or `launch blocked` - -### Launch blockers -Do not launch workers if any of the following are true: -- Git repo-local commands are not usable without approval -- the plan doc cannot be updated -- frontend baseline commands are failing -- coordination transport is unavailable -- Pushover delivery cannot be validated -- lane ownership is ambiguous -- current repo state is too noisy to distinguish worker drift from pre-existing changes - -## Launch Record - -- Status: pre-flight completed, swarm narrowed after incident review -- Branch: `chore/expand-frontend-tests` -- Repo state: root currently carries the metadata-viewer integration checkpoint and this plan-doc refresh draft -- Current HEAD: `97019536` -- Prior metadata checkpoint HEAD: `d3f05207` -- Worktree list: - - `/Users/james/Projects/grimmory/grimmory` - - `/Users/james/Projects/grimmory/grimmory/.worktrees/f90-book-author-series-notebook` - - `/Users/james/Projects/grimmory/grimmory/.worktrees/f90-core-auth-routes` - - `/Users/james/Projects/grimmory/grimmory/.worktrees/f90-metadata-settings-stats` - - `/Users/james/Projects/grimmory/grimmory/.worktrees/f90-readers` - - `/Users/james/Projects/grimmory/grimmory/.worktrees/f90-shared` -- `.worktrees/` ignore rule: present in `.gitignore` -- Historical pre-existing repo noise to record: `booklore-ui-migration-prompt.md` -- Notification state: paused pending the single local loop restart; the loop uses `/tmp/f90-status-loop.lock` and `local-scripts/.f90-status-loop.pid` -- Root integration state: - - HEAD `97019536` - - ahead of `origin/chore/expand-frontend-tests` by 11 commits - - integrated buckets: `core/auth/routes`, `bookdrop`, `readers(selection-service only)`, `metadata-viewer`, `book-card`, `shared(url-helper)`, `author-browser` -- Current combined root coverage checkpoint: - - global: statements `24.75%`, branches `19.73%`, functions `20.24%`, lines `38.79%` -- Recent root-side batch: - - `bedcc3b0` `test(readers): stabilize ebook event service spec` - - `9e20879e` `test(book): cover book card decision paths` - - `e4a37866` `test(shared): cover url helper routing fallbacks` -- Current coverage-summary highlights: - - `features/metadata`: statements `42.87%`, branches `23.68%`, functions `34.48%`, lines `45.4%` - - `features/readers`: statements `33.5%`, branches `26.88%`, functions `31.74%`, lines `44.37%` - - `features/book`: statements `21.86%`, branches `19%`, functions `15.3%`, lines `51.63%` - - `shared`: statements `22.96%`, branches `13.28%`, functions `19.9%`, lines `54.75%` - - `features/author-browser`: statements `7.86%`, branches `2.96%`, functions `7.59%`, lines `8.58%` -- Metadata batch acceptance: - - accepted file: `frontend/src/app/features/metadata/component/book-metadata-center/metadata-viewer/metadata-viewer.component.spec.ts` - - measured lane branch movement: `metadata + settings + stats` to `13.08%` branches (`464/3548`), `3084` uncovered - - measured file branch movement: `metadata-viewer.component.ts` to `38.28%` branches (`116/303`) -- Restart lanes available for the next wave: - - `metadata + settings + stats` - - `readers` - - `shared` - -### Incident Log - -- A nonstandard initial worktree setup was detected during launch prep. -- The root checkout remained normal throughout the incident and was not modified outside standard repo-local git operations. -- Malformed `.worktrees/` admin copies were removed safely. -- The lane worktrees were recreated successfully with standard `git worktree add` flows under `/Users/james/Projects/grimmory/grimmory/.worktrees/`. -- The first notifier path generated false-positive "return to machine" alerts; notifications are paused until the single local loop is restarted. -- The shared lane polluted the root checkout with untracked shared specs, so that batch was discarded. -- The broken `metadata`, `readers`, and `shared` lane worktrees were cleaned and recreated from the current root HEAD for restart. -- The preserved `core/auth` worktree edits remain available for later integration. -- The accepted metadata viewer batch was then integrated directly in the root checkout and recorded as the current integration checkpoint. -- The root-side readers/book/shared batch was then committed in sequence from the root checkout and the plan checkpoint refreshed again afterward. - -### Stop-All Review - -- Malformed initial worktree setup incident: nonstandard `.worktrees/` admin copies were detected and repaired before lane launch continued. -- Second incident: shared lane edits landed in the root checkout instead of the shared worktree, which polluted the root with untracked shared specs. -- Decision: - - discard the shared batch - - preserve the core/auth worktree edits for later integration - - keep the broken metadata/readers/shared worktrees cleaned and recreated for restart - - restart later only with stricter worktree-path instructions, tighter drift checks, and the notifier still paused unless the local loop is explicitly started - -## Current Integration Checkpoint - -- Root HEAD: `97019536` -- Root branch status: ahead of `origin/chore/expand-frontend-tests` by 11 commits -- Integrated and validated buckets so far: - - `core/auth/routes` - - `bookdrop` - - `readers(selection-service only)` - - `metadata-viewer` -- Recent root-side commits: - - `bedcc3b0` `test(readers): stabilize ebook event service spec` - - `9e20879e` `test(book): cover book card decision paths` - - `e4a37866` `test(shared): cover url helper routing fallbacks` -- Root tip also includes: - - `97019536` `test(author-browser): cover author service control flow` -- Accepted metadata batch checkpoint: - - commit: `d3f05207` `test(metadata-viewer): cover metadata viewer branches` - - changed file: `frontend/src/app/features/metadata/component/book-metadata-center/metadata-viewer/metadata-viewer.component.spec.ts` - - validation already completed in root: focused spec, typecheck, lint, test, coverage, coverage-summary -- Measured metadata movement: - - global: statements `23.00%`, branches `17.94%`, functions `19.49%`, lines `38.37%` - - `metadata-viewer.component.ts`: branches `38.28%` (`116/303`) - - `metadata/settings/stats`: branches `13.08%` (`464/3548`), uncovered `3084` -- Current combined root coverage checkpoint: - - statements `24.75%` - - branches `19.73%` - - functions `20.24%` - - lines `38.79%` -- Recreated restart lanes: - - `metadata + settings + stats` - - `readers` - - `shared` -- Notification state: - - single local loop is the only allowed status/notification driver - - lock file: `/tmp/f90-status-loop.lock` - - pid file: `local-scripts/.f90-status-loop.pid` - - notifications remain paused until the loop is deliberately restarted -- Next immediate action: - - restart the `book + author + series + notebook` lane on `author-browser` next, since coverage-summary still shows that bucket as the coldest branch surface; if that proves too broad, fall back to `metadata + settings + stats` starting at `metadata-searcher.component.ts` - -## Lane Ownership And First Targets - -### `metadata + settings + stats` -Highest-yield first wave. -Primary targets: -- `features/metadata/component/book-metadata-center/metadata-editor/metadata-editor.component.ts` -- `features/metadata/component/book-metadata-center/metadata-viewer/metadata-viewer.component.ts` -- `features/metadata/component/book-metadata-center/metadata-searcher/metadata-searcher.component.ts` -- `features/metadata/component/book-metadata-center/metadata-picker/metadata-picker.component.ts` -- `features/settings/task-management/task-management.component.ts` -- `features/stats/component/user-stats/charts/series-progress-chart/series-progress-chart.component.ts` -- `features/stats/component/library-stats/charts/author-universe-chart/author-universe-chart.component.ts` -- `features/settings/view-preferences-parent/view-preferences/view-preferences.component.ts` - -### `book + author + series + notebook` -Includes book-adjacent cold areas. -Primary targets: -- `features/bookdrop/component/bookdrop-file-review/bookdrop-file-review.component.ts` -- `features/book/components/book-browser/book-card/book-card.component.ts` -- `features/author-browser/components/author-browser/author-browser.component.ts` -- `features/book/components/book-browser/book-browser.component.ts` -- `features/book/components/series-page/series-page.component.ts` -- `features/book/components/book-browser/book-table/book-table.component.ts` -- `features/library-creator/library-creator.component.ts` - -### `readers` -Prioritize control-flow-heavy reader surfaces before shallow shells. -Primary targets: -- `features/readers/cbx-reader/cbx-reader.component.ts` -- `features/readers/audiobook-player/audiobook-player.component.ts` -- `features/readers/ebook-reader/core/event.service.ts` -- `features/readers/ebook-reader/ebook-reader.component.ts` -- `features/readers/ebook-reader/features/selection/selection.service.ts` -- `features/readers/pdf-reader/pdf-reader.component.ts` - -### `shared` -Keep as an explicit lane because it is still materially behind. -Primary targets: -- `shared/components/file-mover/file-mover-component.ts` -- `shared/components/book-uploader/book-uploader.component.ts` -- `shared/layout/component/layout-menu/app.menu.component.ts` -- `shared/service/url-helper.service.ts` -- `shared/components/icon-picker/icon-picker-component.ts` -- `shared/service/reading-session.service.ts` -- `shared/service/audiobook-session.service.ts` - -### `core/auth/routes` -Smallest lane, good candidate for an early clean win. -Primary targets: -- `core/security/oauth2-management/authentication-settings.component.ts` -- any remaining branch gaps in `core/custom-reuse-strategy.ts` -- any remaining branch gaps in `core/services/loading.service.ts` -- any remaining branch gaps in `core/security/auth-interceptor.service.ts` -- any remaining branch gaps in `core/security/secure-src.directive.ts` - -## Status And Communication Protocol - -Use a controller-visible heartbeat protocol so unattended runs can be supervised without passive waiting. - -### Status transport -Default: -- each test worker writes heartbeat and progress records to Valkey using a finite TTL namespace like `codex:grimmory:f90::status` -- the Git/integration worker writes per-worktree Git snapshots to `codex:grimmory:f90:git:` -- the controller writes orchestration state to keys like: - - `codex:grimmory:f90:controller:summary` - - `codex:grimmory:f90:controller:human_needed` - - `codex:grimmory:f90:controller:launch_state` -- the notifier agent reads only those shared coordination keys plus lane summaries -- if periodic polling or notification must run continuously, prefer a single controller-owned temporary script over repeated agent shell calls - -Fallback if Valkey is unavailable: -- workers send progress messages to the controller thread and the controller relays summary state to the notifier agent through direct agent messages - -### Test worker heartbeat payload -Emit on start, after target selection, after each meaningful test batch, after each validation run, on block, and before handoff. -Required fields: -- `lane` -- `owned_paths` -- `current_targets` -- `state`: one of `surveying`, `writing_tests`, `running_targeted`, `running_validation`, `ready_for_handoff`, `blocked`, `aborted` -- `spec_files_touched` -- `last_targeted_command` -- `last_targeted_result` -- `last_validation_commands` -- `last_validation_results` -- `latest_observed_coverage_signal` -- `residual_risks` -- `updated_at` - -Coverage signal should be lightweight and frequent: -- at minimum, report target-file count and targeted-test pass/fail -- after any substantial batch, report owned-file coverage movement from local coverage output if available -- do not run expensive full coverage repeatedly just to emit heartbeats - -### Git worker snapshot payload -Emit on a fixed polling cadence for every worktree. -Required fields: -- `lane` -- `worktree_path` -- `branch` -- `git_status_short` -- `diff_stat` -- `changed_files` -- `plan_doc_state` -- `updated_at` - -### Notifier behavior -Periodic summary: -- every 5 minutes -- low-noise, high-level only -- include current global coverage if available, active lanes, lanes ready for handoff, stalled lanes, and whether the run is healthy or in review -- prefer compact multiline messages through stdin; use `--title "Codex"` and `--monospace` when formatting helps - -Immediate human-needed alerts: -- send only when the controller explicitly marks `human_needed=true` -- examples: - - pre-flight blocked - - notification path broken - - Git/worktree operations unexpectedly require approval - - ambiguous repo state needs human judgment - - all viable lanes stalled after stop-all review - - a runtime-code exception appears necessary -- use a more attention-grabbing notification than the periodic summary, but do not use emergency retry mode unless absolutely necessary - -### Polling cadence -- Controller polls heartbeats every 5 minutes -- Git worker snapshots each worktree every 3 to 5 minutes -- Notifier agent sends a periodic summary every 5 minutes -- Any worker heartbeat older than 10 minutes is stale -- Any lane with repeated stale heartbeats triggers review - -## Acceptance Criteria Per Test Worker Bucket - -A bucket is handoff-ready only if all conditions hold: -- touched files stay within owned lane -- no runtime code change unless explicitly escalated and isolated -- targeted tests for the owned area pass via the Just command surface -- `just ui typecheck` passes -- `just ui lint` passes -- `just ui test` passes -- worker emits final handoff payload including: - - changed files - - commands run and results - - residual risks or known gaps - - proposed Conventional Commit subject - - proposed grouped markdown commit body - -Test workers should prefer root commands: -- `just ui ...` -Or, when working inside the frontend subtree: -- `just --justfile frontend/Justfile --working-directory frontend ...` - -No direct Yarn commands in worker instructions. - -## Controller Intervention Rules - -The controller should over-index on intervention rather than waiting for an unobtainable goal. - -Trigger a stop-all review when any of these occur: -- a worker heartbeat goes stale -- Git snapshot shows cross-lane file drift -- a worker accumulates a large diff without passing validation -- a worker reports repeated validation failures on the same bucket -- a worker has multiple test batches with no credible coverage movement -- Git state looks anomalous or inconsistent across worktrees -- a worker starts chasing decorative render coverage instead of branch-bearing logic - -Default low-yield threshold: -- if two successive meaningful batches do not materially reduce the lane’s target-file branch deficit, stop and review -- “materially” means visible improvement in the current target cluster, not just more tests added - -Stop-all review sequence: -1. Controller interrupts all test workers. -2. Git worker captures final status and diff snapshots for every worktree. -3. Controller classifies each lane as: - - `keep and integrate` - - `keep but narrow` - - `restart with new targets` - - `discard` -4. Git worker updates the plan doc with the review outcome. -5. Controller updates the shared summary state. -6. Notifier agent sends the next periodic summary reflecting the review outcome. -7. If human judgment is required, controller sets `human_needed=true` and notifier sends an immediate alert. -8. Controller restarts only the lanes that still have a defensible next move. - -Throwing away weak progress is acceptable. Avoid salvage rabbit holes. - -## Integration Workflow - -The Git/integration worker, under controller direction, performs all integration. - -Per accepted bucket: -1. verify handoff payload completeness -2. inspect worktree Git state and changed-file scope -3. integrate one bucket only -4. create one Conventional Commit for that bucket -5. run: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -6. after every two integrations, or sooner for a large bucket, run: - - `just ui coverage` - - `just ui coverage-summary` -7. update `docs/plans/frontend-90-coverage-plan.md` with: - - current totals - - lane totals - - accepted bucket - - discarded or restarted buckets - - next target shortlist -8. publish the updated high-level status for the notifier agent - -Default integration order by expected branch gain: -1. `metadata + settings + stats` -2. `book + author + series + notebook` -3. `readers` -4. `shared` -5. `core/auth/routes` - -## Plan Doc Requirements - -The plan doc is durable session state and must always be resumable without ambiguity. - -After baseline, after pre-flight, and after every accepted integration or stop-all review, it must contain: -- latest global coverage numbers -- latest lane ranking by uncovered branches -- active workers and owned paths -- current top target files per lane -- accepted buckets and commit subjects -- rejected buckets and why they were rejected -- open blockers and whether any runtime exception was approved -- latest launch record -- latest notification state -- next immediate actions - -The Git/integration worker owns these updates. The controller decides the content. - -## Next Immediate Actions - -1. Restart the `book + author + series + notebook` lane on `author-browser` next, since coverage-summary still shows that bucket as the coldest branch surface; if that proves too broad, fall back to `metadata + settings + stats` starting at `metadata-searcher.component.ts`. -2. Keep the notifier paused until the single local loop is deliberately restarted with tighter incident-only thresholds. -3. Re-rank the remaining cold lanes from the current coverage totals, still prioritizing branch deficit first. -4. Preserve the clean worktrees as the new controller baseline and keep the discarded shared batch out of rotation. -5. Commit this durable plan checkpoint after the metadata batch integration so later sessions can resume from the updated root truth. - -## Assumptions - -- The new `default.rules` entries are sufficient for repo-local Git operations under `git -C /Users/james/Projects/grimmory/grimmory` -- No escalated privileges will be available during the unattended run -- Test workers can rely on Just-based validation only -- Valkey is preferred for transient coordination and is currently available -- The `pushover-notify` skill helper is available and Pushover credentials are present in the environment -- The controller remains orchestration-only for the full run, including during failures and reviews diff --git a/docs/plans/frontend-coverage-phase-2-supervised-swarm.md b/docs/plans/frontend-coverage-phase-2-supervised-swarm.md deleted file mode 100644 index aa2d863dd..000000000 --- a/docs/plans/frontend-coverage-phase-2-supervised-swarm.md +++ /dev/null @@ -1,266 +0,0 @@ -# Frontend Coverage Phase 2: Harness-First Supervised Swarm - -## Summary - -Drive the next frontend coverage phase from reusable test harnesses instead of one-off spec rescue work. - -Validated baseline on `chore/expand-frontend-tests`: -- `just ui typecheck` -- `just ui lint` -- `just ui test` -- `just ui coverage-summary` - -Current baseline: -- statements `32.84%` -- branches `24.95%` -- functions `28.56%` -- lines `48.10%` - -Current skipped-spec distribution: -- `features/stats`: `32` -- `features/settings`: `26` -- `features/book`: `25` -- `features/readers`: `15` -- `shared`: `12` -- `features/metadata`: `7` -- `features/author-browser`: `6` - -Operating rules for this phase: -- no runtime code changes without explicit approval -- solve the next wave in the test harness first -- git operations stay in one thread only -- the controller is orchestration-only -- branch coverage gain is the primary metric -- mature packages are preferred when they clearly replace bespoke harness code - -## Step 0 - -This file is the new execution plan for the phase. - -Do not mutate `docs/plans/frontend-90-coverage-plan.md` except for cross-reference or historical context. - -Each execution checkpoint appended here must record: -- timestamp -- current branch totals from `just ui coverage-summary` -- accepted harness families -- worker roster and lane ownership -- accepted bucket list -- blocked seam list - -## Checkpoints - -### 2026-03-27 16:36:07 CDT - -Current branch totals from `just ui coverage-summary`: -- statements `33.60%` -- branches `25.28%` -- functions `29.59%` -- lines `48.65%` - -Accepted harness families: -- query/auth/signal bootstrap via `createQueryClientHarness()` and `createAuthServiceStub(...)` -- non-rendering chart bootstrap via `nextChartEmission(...)` and `fakeChartTooltipContext(...)` -- dialog/form bootstrap via `createDynamicDialogHarness(...)` and message-service helpers - -Worker roster and lane ownership for this bootstrap run: -- controller: local single-owner execution only -- harness lane: `frontend/src/app/core/testing/{query-testing,chart-testing,dialog-testing}.ts` -- query/service canaries: `AppSettingsService`, `LibraryService` -- chart canary: `GenreStatsChartComponent` -- dialog canary: `AuthorPhotoSearchComponent` - -Accepted bucket list: -- add `ng-mocks` -- publish shared bootstrap helpers for query, chart, and dialog seams -- convert four skipped canaries into active specs -- validate with `just ui typecheck`, `just ui lint`, `just ui test`, `just ui coverage`, and `just ui coverage-summary` - -Blocked seam list: -- none in the accepted bootstrap set - -## Harness Families - -### 1. Query/Auth/Signal Harness - -Purpose: -- cover eager `injectQuery(...)` -- control auth-token enablement -- assert computed loading and error state -- assert cache invalidation and token-cleared removal - -Shared helpers: -- `createQueryClientHarness()` -- `createAuthServiceStub(initialToken)` -- `flushSignalAndQueryEffects()` -- `createSignalFacade(...)` - -First canaries: -- `AppSettingsService` -- `LibraryService` - -### 2. Non-Rendering Chart Harness - -Purpose: -- assert derived chart datasets -- assert summary fields -- assert tooltip and label callbacks -- avoid live chart rendering as the main assertion surface - -Shared helpers: -- `createChartTranslocoStub()` -- `nextChartEmission(...)` -- `fakeChartTooltipContext(...)` - -First canary: -- `GenreStatsChartComponent` - -### 3. Dialog/Form Harness - -Purpose: -- standardize `DynamicDialogConfig` and `DynamicDialogRef` -- standardize message and confirmation spies -- standardize PrimeNG event payload stubs -- standardize fake-timer flows for dialog lifecycle - -Shared helpers: -- `createDynamicDialogHarness(data)` -- `createMessageServiceSpy()` -- `createConfirmServiceSpy()` - -First canary: -- `AuthorPhotoSearchComponent` - -### 4. Route/Timer/Host-Event Harness - -Purpose: -- query-param syncing -- router navigation doubles -- debounced search -- document click and host-listener control - -### 5. Reader Wrapper Harness - -Purpose: -- cover reader header, sidebar, panel, quick-settings, and settings wrappers -- explicitly exclude full reader runtimes - -## Package Posture - -Default package stance: -- use mature libraries when they directly match the seam and reduce bespoke mocking -- use repo-local helpers only for repo-specific state wiring and tiny adapter glue - -Immediate package decisions: -- standardize `@testing-library/angular` -- standardize `@testing-library/user-event` -- keep `jsdom` -- keep `vitest-canvas-mock` -- keep `msw` as secondary, not primary, for Angular service flows -- add `ng-mocks` early for standalone and PrimeNG-heavy shell work - -## Attack Order - -1. `features/stats` - - highest branch upside with one reusable chart family - - hold plugin and imperative canvas outliers until later -2. query-backed services across `shared`, `features/settings`, `features/book`, and `features/magic-shelf` -3. dialog and form specs across `features/book`, `features/bookdrop`, `features/author-browser`, and selected `features/metadata` -4. reader wrapper specs only -5. settings and shared shells that can reuse the proven signal and route harnesses - -Deferred hold bucket: -- shared layout and menu shells -- author-browser page shell -- full reader runtimes -- view-manager and similar runtime seams - -## Worker Model - -Phase 0: -- one harness owner only -- no swarm until the controller accepts the shared conventions - -Phase 1: -- one controller -- one git and integration lieutenant -- one notify lieutenant -- one harness-generation worker -- up to three spec-generation workers - -Hard rules: -- only git and integration runs git commands -- only notify uses Pushover -- only harness-generation edits shared helper files -- spec workers consume published harnesses and do not invent competing ones - -## Communication Spec - -The controller is assertive and supervises every worker, including git and notify. - -Worker heartbeat: -- target every `2-3` minutes -- absolute maximum `5` minutes -- immediate extra message on `start`, `blocked`, `handoff`, `needs-decision`, `done`, or `drift-detected` - -Worker status format: -- `state | owned_paths | current_target | last_result | blocker | next_10m` - -Allowed `state` values: -- `bootstrapping` -- `implementing` -- `validating` -- `blocked` -- `handoff-ready` -- `stopped` - -Controller reply format: -- `decision | scope | priority | continue_until | stop_condition` - -The controller interrupts immediately when: -- a heartbeat exceeds `5` minutes -- a status report is vague -- a worker touches unowned paths -- a worker proposes runtime edits without approval -- a worker continues low-yield work after a stop signal - -## Stop and Recovery Rules - -Harness canary window: -- `15-20` minutes maximum per family - -Stop a harness spike when: -- it does not unlock one real spec and one near-neighbor candidate inside the window - -Stop a lane when: -- two consecutive specs need bespoke lane-only mocks -- the worker edits outside the owned write set -- the worker reports no branch-relevant progress for one heartbeat cycle -- the worker proposes runtime changes without escalation - -Recovery: -- classify the blocker as `blocked-by-harness`, `blocked-by-runtime-seam`, or `blocked-by-package-gap` -- record the exact seam here -- let git and integration quarantine or discard the batch -- do not let the controller salvage the bucket by doing implementation work - -## Validation - -Per bootstrap canary: -- focused spec -- `just ui typecheck` - -Per accepted bucket: -- focused spec slice -- `just ui typecheck` -- `just ui lint` -- `just ui coverage-summary` - -Checkpoint gates: -- `just ui test` - -Phase close: -- `just ui coverage` -- `just ui coverage-summary` -- `just ui typecheck` -- `just ui lint` -- `just ui test` diff --git a/docs/plans/frontend-coverage-phase-3-lieutenants-swarm.md b/docs/plans/frontend-coverage-phase-3-lieutenants-swarm.md deleted file mode 100644 index 9815afc73..000000000 --- a/docs/plans/frontend-coverage-phase-3-lieutenants-swarm.md +++ /dev/null @@ -1,383 +0,0 @@ -# Frontend Coverage Phase 3: Lieutenants Swarm - -## Summary - -This phase moves from bootstrap into supervised multi-lane execution. - -Operating model: -- controller: orchestration only -- gitops lieutenant: all git, worktrees, staging, commits, and integration -- notify lieutenant: all Pushover communication through `$pushover-notify` -- workers: tightly bounded lane work only - -Current baseline at phase start on `chore/expand-frontend-tests` (`HEAD 111466b5`): -- statements `33.60%` -- branches `25.28%` -- functions `29.59%` -- lines `48.65%` - -Current skipped-spec distribution: -- `features/stats`: `31` -- `features/settings`: `26` -- `features/book`: `24` -- `features/readers`: `15` -- `shared`: `11` -- `features/metadata`: `7` -- `features/author-browser`: `5` -- `features/bookdrop`: `4` - -Hard constraints: -- no runtime code changes without explicit approval -- git operations stay in one thread only -- notifications are mandatory and plain English -- workers may do seam work, but only within a short, high-yield budget -- branch coverage gain is the primary metric - -## Step 0 - -This file is the execution artifact for the lieutenants swarm phase. - -Do not reuse: -- `docs/plans/frontend-90-coverage-plan.md` -- `docs/plans/frontend-coverage-phase-2-supervised-swarm.md` - -Every checkpoint appended here must record: -- timestamp -- active lanes -- accepted batch -- coverage totals -- bucket-level movement -- worker stop or replacement events -- blocked seams - -## Worktree Model - -Use a new worktree prefix for this phase: -- `.worktrees/covswarm-stats` -- `.worktrees/covswarm-query` -- `.worktrees/covswarm-dialog` -- `.worktrees/covswarm-harness` only if a dedicated shared-helper lane becomes necessary - -Legacy `f90-*` worktrees: -- preserve and ignore -- snapshot their status once during pre-flight -- do not edit them -- do not clean them up during this phase - -## Role Contract - -### Controller - -Responsibilities: -- launch and stop agents -- assign lanes and write scopes -- enforce heartbeats -- accept or reject worker batches -- tell gitops when to integrate -- tell notify when to send normal and urgent messages - -Not allowed: -- no code edits -- no git -- no notifications - -### Gitops Lieutenant - -Responsibilities: -- verify git write access before lane launch -- create and manage `covswarm-*` branches and worktrees -- snapshot root and legacy worktree state -- stage accepted lane changes -- create conventional commits -- integrate accepted lane commits into the root branch -- quarantine or discard failed lane worktrees - -Not allowed: -- no test implementation -- no runtime code edits -- no notifications - -### Notify Lieutenant - -Responsibilities: -- verify Pushover credentials -- run `$pushover-notify --dry-run` pre-flight -- send all progress and escalation messages - -Normal-priority events: -- swarm launch -- bootstrap handoff -- lane launch -- worker stopped or replaced -- checkpoint update -- integration complete -- coverage moved -- final completion - -Urgent events: -- blocker requiring a decision -- runtime change would be needed -- permission problem stops the swarm -- repeated worker-runtime failure -- controller halts the swarm - -Cadence: -- never more often than every `2` minutes -- target every `2-3` minutes when meaningful progress exists -- always at least once every `5` minutes while work is ongoing -- urgent alerts break through immediately - -### Workers - -Responsibilities: -- operate only inside assigned lane paths -- consume existing shared harnesses and packages -- run targeted tests only for touched specs -- report on cadence - -Not allowed: -- no git -- no notifications -- no package changes -- no docs changes -- no shared harness edits unless explicitly assigned as a harness worker - -Required status line: -- `state | owned_paths | current_target | last_result | blocker | next_10m` - -Allowed states: -- `bootstrapping` -- `implementing` -- `validating` -- `blocked` -- `handoff-ready` -- `stopped` - -## Pre-Flight - -Gitops pre-flight: -- confirm root checkout is clean except accepted baseline commits -- confirm `.worktrees/` exists and remains ignored -- snapshot root `git status` -- snapshot `git worktree list` -- snapshot status for each legacy `f90-*` worktree -- create fresh `covswarm-*` worktrees from current root `HEAD` - -Notify pre-flight: -- confirm `PUSHOVER_APP_TOKEN` and `PUSHOVER_USER_KEY` -- run `$pushover-notify --dry-run` -- send one real normal-priority launch update after dry-run success - -Worker runtime health gate: -- first useful status required within `2-3` minutes -- no heartbeat may exceed `5` minutes -- prompt contamination or silent workers fail the gate - -Failure handling: -1. interrupt once for status -2. replace once with a stronger model if needed -3. if replacement also fails, pause that lane and either narrow it or run it locally -4. notify sends normal replacement update and urgent alert only if the swarm is blocked - -## Lane Order - -### Lane 1: Stats - -Scope: -- `frontend/src/app/features/stats/**` spec files only - -Goal: -- convert the next `2-4` high-yield stats specs using the non-rendering chart harness - -Acceptance gate before opening lane 2: -- targeted Vitest for touched stats specs -- gitops integrates the accepted lane batch -- `just ui typecheck` -- `just ui lint` -- `just ui test` -- `just ui coverage-summary` -- controller confirms real `features/stats` branch movement - -### Lane 2: Query/Signal - -Start as soon as lane 1 passes its first acceptance gate. - -Priority order: -1. `frontend/src/app/features/book/service/shelf.service.spec.ts` -2. `frontend/src/app/features/settings/user-management/user.service.spec.ts` -3. `frontend/src/app/features/magic-shelf/service/magic-shelf.service.spec.ts` - -Deferred: -- `frontend/src/app/shared/service/custom-font.service.spec.ts` - - needs a separate browser-font seam family - -### Lane 3: Dialog/Overlay - -Start once either: -- lane 1 reaches its second healthy checkpoint, or -- lane 2 reaches its first healthy checkpoint after launch - -Priority order: -1. `frontend/src/app/features/bookdrop/component/bookdrop-bulk-edit-dialog/bookdrop-bulk-edit-dialog.component.spec.ts` -2. `frontend/src/app/features/book/components/book-browser/lock-unlock-metadata-dialog/lock-unlock-metadata-dialog.component.spec.ts` -3. `frontend/src/app/features/book/components/shelf-edit-dialog/shelf-edit-dialog.component.spec.ts` - -Deferred: -- full reader runtimes -- mixed query-heavy dialog seams until the relevant lane is ready - -Concurrency rule: -- start with lane 1 only -- expand to two active implementation lanes immediately after the first accepted stats batch -- expand to three only if heartbeat discipline and gitops throughput remain healthy - -## Seam Valuation - -Good seam work: -- reusing an existing shared harness -- small lane-local adapters that stay inside a spec file -- thin glue around an approved helper -- mature package usage instead of custom mocking - -Borderline seam work: -- one lane-local helper reused across `2+` specs in the same lane -- one small signal/effect flush or callback adapter -- one thin branch-enabling stub that does not spill into other lanes - -Bad seam work: -- inventing a new shared harness inside a worker lane -- reproducing package behavior with custom test infrastructure -- broad browser-runtime emulation for one spec -- `15-20` minutes of seam work without unlocking a real spec -- two consecutive candidate specs requiring bespoke seam rescue - -Rule: -- each lane gets one short seam spike -- if it does not unlock a real spec, stop and escalate -- if the helper would serve multiple lanes, it becomes a dedicated harness task rather than silent worker drift - -## Validation - -Per worker batch: -- targeted Vitest on touched files - -Per integrated lane batch: -- `just ui typecheck` -- `just ui lint` -- `just ui test` -- `just ui coverage-summary` - -Major checkpoints: -- `just ui coverage` - -## Checkpoints - -### 2026-03-27 bootstrap handoff - -Accepted baseline: -- bootstrap commit `111466b5` -- shared query/chart/dialog helpers landed -- `ng-mocks` added -- four canary specs activated - -Current coverage totals: -- statements `33.60%` -- branches `25.28%` -- functions `29.59%` -- lines `48.65%` - -Current blocked seams: -- browser-font-specific service testing -- full reader runtime seams - -### 2026-03-28 replay window 1 - -Accepted replay batches: -- `2a3b82b6` `test(author-browser): cover author match component flows` -- `152ee9a0` `test(book): cover book notes component flows` -- `fadf732a` `test(author-browser): cover author editor component flows` -- `bf3c5fc0` `test(book): cover shelf creator component flows` -- `6fc5a42d` `test(book): cover book file service flows` -- `32c1de1d` `test(stats): cover page count chart bucketing` - -Replay status: -- deferred queue drained into root -- root frontend gates passing after replay: - - `just ui typecheck` - - `just ui lint` - - `just ui test` - - `just ui coverage` - - `just ui coverage-summary` - -Current coverage totals: -- statements `37.50%` -- branches `27.59%` -- functions `34.66%` -- lines `51.74%` - -Highest-value bucket movement this cycle: -- `features/author-browser` branches `5.19% -> 14.81%` -- `features/book` branches `27.62% -> 29.68%` -- `features/stats` branches `8.40% -> 9.44%` - -Current queued accumulation batches: -- `covswarm-author3` - - file: `frontend/src/app/features/author-browser/components/author-card/author-card.component.spec.ts` - - targeted validation: `env YARN_ENABLE_GLOBAL_CACHE=0 YARN_CACHE_FOLDER=../.yarn/cache corepack yarn vitest run src/app/features/author-browser/components/author-card/author-card.component.spec.ts` - - result: `1` file passed, `8` tests passed - - proposed subject: `test(author-browser): cover author card component flows` -- `covswarm-bookcomp3` - - file: `frontend/src/app/features/book/components/shelf-assigner/shelf-assigner.component.spec.ts` - - targeted validation: `env YARN_ENABLE_GLOBAL_CACHE=0 YARN_CACHE_FOLDER=../.yarn/cache corepack yarn vitest run src/app/features/book/components/shelf-assigner/shelf-assigner.component.spec.ts` - - result: `1` file passed, `7` tests passed - - proposed subject: `test(book): cover shelf assigner component flows` -- `covswarm-author4` - - file: `frontend/src/app/features/author-browser/components/author-detail/author-detail.component.spec.ts` - - targeted validation: `env YARN_ENABLE_GLOBAL_CACHE=0 YARN_CACHE_FOLDER=../.yarn/cache corepack yarn vitest run src/app/features/author-browser/components/author-detail/author-detail.component.spec.ts` - - result: `1` file passed, `8` tests passed - - proposed subject: `test(author-browser): cover author detail component flows` -- `covswarm-bookcomp4` - - file: `frontend/src/app/features/book/components/add-physical-book-dialog/add-physical-book-dialog.component.spec.ts` - - targeted validation: `env YARN_ENABLE_GLOBAL_CACHE=0 YARN_CACHE_FOLDER=../.yarn/cache corepack yarn --cwd frontend vitest run src/app/features/book/components/add-physical-book-dialog/add-physical-book-dialog.component.spec.ts --config vitest.config.ts` - - result: `1` file passed, `10` tests passed - - proposed subject: `test(book): cover add physical book dialog flows` -- `covswarm-bookcomp5` - - file: `frontend/src/app/features/book/components/book-sender/book-sender.component.spec.ts` - - targeted validation: `env YARN_ENABLE_GLOBAL_CACHE=0 YARN_CACHE_FOLDER=../.yarn/cache corepack yarn ng test --watch=false --include src/app/features/book/components/book-sender/book-sender.component.spec.ts` - - result: `1` file passed, `6` tests passed - - proposed subject: `test(book): cover book sender component flows` -- `covswarm-stats2` - - file: `frontend/src/app/features/stats/component/library-stats/charts/language-chart/language-chart.component.spec.ts` - - targeted validation: `env YARN_ENABLE_GLOBAL_CACHE=0 YARN_CACHE_FOLDER=../.yarn/cache corepack yarn vitest run src/app/features/stats/component/library-stats/charts/language-chart/language-chart.component.spec.ts` - - result: `1` file passed, `4` tests passed - - proposed subject: `test(stats): cover language chart aggregation` -- `covswarm-stats3` - - file: `frontend/src/app/features/stats/component/library-stats/charts/metadata-score-chart/metadata-score-chart.component.spec.ts` - - targeted validation: `env YARN_ENABLE_GLOBAL_CACHE=0 YARN_CACHE_FOLDER=../.yarn/cache corepack yarn vitest run src/app/features/stats/component/library-stats/charts/metadata-score-chart/metadata-score-chart.component.spec.ts --config vitest.config.ts` - - result: `1` file passed, `4` tests passed - - proposed subject: `test(stats): cover metadata score chart states` -- `covswarm-bookcomp6` - - file: `frontend/src/app/features/book/components/book-reviews/book-reviews.component.spec.ts` - - targeted validation: `env YARN_ENABLE_GLOBAL_CACHE=0 YARN_CACHE_FOLDER=../.yarn/cache corepack yarn vitest run src/app/features/book/components/book-reviews/book-reviews.component.spec.ts --config vitest.config.ts` - - result: `1` file passed, `10` tests passed - - proposed subject: `test(book): cover book reviews component flows` -- `covswarm-bookcomp7` - - file: `frontend/src/app/features/book/components/book-file-attacher/book-file-attacher.component.spec.ts` - - targeted validation: `yarn vitest run src/app/features/book/components/book-file-attacher/book-file-attacher.component.spec.ts` - - result: `1` file passed, `8` tests passed - - proposed subject: `test(book): cover book file attacher flows` -- `covswarm-stats4` - - file: `frontend/src/app/features/stats/component/user-stats/charts/reading-progress-chart/reading-progress-chart.component.spec.ts` - - targeted validation: `env YARN_ENABLE_GLOBAL_CACHE=0 YARN_CACHE_FOLDER=../.yarn/cache corepack yarn vitest run src/app/features/stats/component/user-stats/charts/reading-progress-chart/reading-progress-chart.component.spec.ts` - - result: `1` file passed, `5` tests passed - - proposed subject: `test(stats): cover reading progress chart bucketing` - -Next accumulation lanes: -- `features/stats/component/user-stats/charts/read-status-chart/read-status-chart.component.spec.ts` -- `features/stats/component/library-stats/charts/publication-trend-chart/publication-trend-chart.component.spec.ts` -- `features/book/components/duplicate-merger/duplicate-merger.component.spec.ts` - -Current blocked seams: -- full `author-browser.component` shell remains high-risk and deferred -- browser-font-specific service testing remains deferred -- full reader runtime seams remain deferred diff --git a/docs/plans/frontend-grimmory-migration.md b/docs/plans/frontend-grimmory-migration.md deleted file mode 100644 index 7a53437e2..000000000 --- a/docs/plans/frontend-grimmory-migration.md +++ /dev/null @@ -1,114 +0,0 @@ -# Frontend Grimmory Migration - -## Summary - -This plan renames the Angular project from `booklore-ui/` to `frontend/`, keeps a temporary `booklore-ui -> frontend` symlink for compatibility, migrates the JavaScript tooling to Yarn 4 with the `node-modules` linker, adds a consistent frontend quality gate, and introduces replay automation for open pull requests that were based on the pre-migration tree. - -The work is intentionally staged so each step can be reviewed and, later, committed independently with minimal ambiguity. - -## Step 1: Planning and Inventory - -- Add this implementation plan under `docs/plans/`. -- Add a cleanup ledger under `docs/plans/frontend-post-cutover-cleanup-ledger.md` for Booklore-era aliases that must remain temporarily. -- Record the current frontend quality baseline before any lint cleanup: - - ESLint errors: `721` - - ESLint warnings: `0` - - Build warnings: `0` - -## Step 2: Rename `booklore-ui/` to `frontend/` - -- Move the tracked Angular project from `booklore-ui/` to `frontend/`. -- Add a tracked symlink `booklore-ui -> frontend` immediately after the move. -- Switch all first-party repo-owned path consumers to `frontend/` in the same pass: - - Root `Justfile` - - Root `AGENTS.md` - - `README.md` - - `CONTRIBUTING.md` - - `Dockerfile` - - `dev.docker-compose.yml` - - `scripts/i18n/weblate-setup.sh` - - `booklore-api/build.gradle.kts` - - `.github/workflows/*.yml` - - `.github/dependabot.yml` - -### Compatibility Window Rules - -- The symlink exists only to keep stale local workflows and existing PR branches from breaking immediately. -- New repo-owned code, docs, CI, and packaging should point at `frontend/`, not `booklore-ui/`. -- The symlink should remain until the replay tooling has been used on the active open PRs and the maintainers are comfortable removing the fallback. - -## Step 3: Migrate to Yarn 4 - -### Shared Defaults - -- Use Corepack-managed Yarn 4. -- Use the `node-modules` linker, not Plug'n'Play. -- Keep dependency versions unchanged during lockfile migration. -- Do not introduce a monorepo workspace layout in this phase. - -### Frontend Surface - -- Add `packageManager` to `frontend/package.json`. -- Replace `frontend/package-lock.json` with `frontend/yarn.lock`. -- Add or update repo-level Yarn config in `.yarnrc.yml`. -- Convert `frontend/Justfile`, Docker build steps, local setup docs, and test workflows from npm to Yarn. - -### Release Tooling Surface - -- Add `packageManager` to `tools/release/package.json`. -- Replace `tools/release/package-lock.json` with `tools/release/yarn.lock`. -- Convert `tools/release/Justfile` and release-preview/release-main workflows from npm to Yarn. - -## Step 4: Add the Frontend Quality Gate - -- Keep the current Angular ESLint setup for TypeScript and Angular templates. -- Add Stylelint for SCSS under `frontend/`. -- Keep `tsc --noEmit` and the production Angular build as required verification steps. -- Replace the threshold-only frontend workflow with explicit jobs that fail independently: - - ESLint - - Stylelint - - Typecheck - - Production build -- Store the current lint baseline in version control so CI can block regressions before the manual cleanup is complete. - -## Step 5: Safe Lint Passes - -- Run the least risky lint work first and keep each pass logically isolated: - 1. Stylelint autofixes and SCSS-only cleanup. - 2. ESLint autofixes that are mechanically safe. - 3. Low-risk manual fixes such as unused locals, `autofocus`, output naming collisions, and obvious accessibility handler fixes. -- Do not take on high-risk reader/Foliate typing work or broad `no-explicit-any` refactors in this migration unless a focused follow-up explicitly approves that churn. - -## Step 6: PR Replay Tooling - -- Add replay automation that rebases or replays pre-migration PRs onto `develop` after this migration lands. -- Default behavior should preserve commit topology: - - Recreate commits one by one when practical. - - Re-run the rename/lint normalization script before each recreated commit. - - Preserve the original author. - - Add traceability trailers such as `Replayed-from: ` and, when provided, the original PR URL. -- Support an explicit squash fallback for conflict-heavy PRs. -- Support both maintainer and contributor use: - - Maintainer replay against a contributor branch or patch series. - - Contributor self-service replay against their own topic branch. - -## Validation - -- After the rename pass: - - `just ui test` - - `just ui build` - - `just image-build` -- After the Yarn migration: - - `just ui install-ci` - - `just ui check` - - `just release install` - - `just image-build` -- After the lint and CI pass: - - Frontend lint/typecheck/build commands individually - - `just test` - - `just check` - -## Notes for Later Backend Work - -- The backend still hardcodes some frontend dist and path assumptions, so the frontend rename should keep those references minimal and explicit. -- The Booklore compatibility aliases tracked in the cleanup ledger should inform the backend migration plan, because some of those aliases can only be removed once backend contracts change. diff --git a/docs/plans/frontend-post-cutover-cleanup-ledger.md b/docs/plans/frontend-post-cutover-cleanup-ledger.md deleted file mode 100644 index 7e34da57f..000000000 --- a/docs/plans/frontend-post-cutover-cleanup-ledger.md +++ /dev/null @@ -1,38 +0,0 @@ -# Frontend Post-Cutover Cleanup Ledger - -This document tracks the remaining Booklore-era frontend references that should survive the `booklore-ui -> frontend` rename temporarily. The goal is to preserve short-term compatibility now and remove these aliases later with explicit triggers instead of ad hoc cleanup. - -## Remove Once the Symlink Window Closes - -- `frontend/README.md` - - Replace the remaining `booklore-ui` project-path wording and examples after the compatibility symlink is removed. -- `frontend/CONTRIBUTING.md` - - Replace the remaining `booklore-ui` project-path wording after the compatibility symlink is removed. - -## Remove After Existing PRs Have Been Replayed - -- The tracked symlink `booklore-ui -> frontend` - - Remove after the PR replay script has been exercised on the active open frontend PRs and maintainers no longer need the compatibility path. - -## Remove After the Local Storage Migration Window - -- [frontend/src/app/core/config/language-initializer.ts](/Users/james/Projects/grimmory/grimmory/frontend/src/app/core/config/language-initializer.ts) - - `LEGACY_LANG_STORAGE_KEY = 'booklore-lang'` - - Remove after at least one stable release cycle has shipped with the migration logic and maintainers are comfortable dropping the legacy browser key. - -## Remove After Backend API Contracts Are Renamed - -- [frontend/src/app/shared/constants/reset-progress-type.ts](/Users/james/Projects/grimmory/grimmory/frontend/src/app/shared/constants/reset-progress-type.ts) - - `GRIMMORY: 'BOOKLORE'` - - Remove after the backend emits a Grimmory-native reset-progress type. -- [frontend/src/app/features/settings/user-management/user.service.ts](/Users/james/Projects/grimmory/grimmory/frontend/src/app/features/settings/user-management/user.service.ts) - - Legacy Booklore permission and create-user aliases. - - Remove after the backend accepts only Grimmory naming. -- [frontend/src/app/features/settings/device-settings/component/koreader-settings/koreader.service.ts](/Users/james/Projects/grimmory/grimmory/frontend/src/app/features/settings/device-settings/component/koreader-settings/koreader.service.ts) - - Legacy Booklore KOReader sync field and fallback endpoint. - - Remove after the backend no longer returns or expects the Booklore alias. - -## Follow-Up Expectations - -- Any backend migration plan should reference this ledger and either consume or supersede the API-contract-driven entries. -- When an entry is removed, update this file in the same change so the ledger remains accurate. diff --git a/docs/plans/frontend-stub-fill-log.md b/docs/plans/frontend-stub-fill-log.md deleted file mode 100644 index b18d3a244..000000000 --- a/docs/plans/frontend-stub-fill-log.md +++ /dev/null @@ -1,799 +0,0 @@ -# Frontend Stub Fill Log - -Single-threaded pass to replace generic TODO spec stubs under `frontend/src/app`. - -Rules for this pass: -- No runtime code changes. -- Replace generic stubs with real specs where possible. -- If a real spec would need a new runtime seam, keep the spec skipped and state the seam explicitly. -- Commits are optional; this log is the durable grouping record. - -## 2026-03-26 - -### Batch 1 -- Scope: initial pure/type-bearing frontend files. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/core/config/api-config.spec.ts` - - `frontend/src/app/features/author-browser/model/author.model.spec.ts` - - `frontend/src/app/features/author-browser/service/author-query-keys.spec.ts` - - `frontend/src/app/features/book/components/book-browser/book-filter/book-filter.config.spec.ts` - - `frontend/src/app/features/book/components/book-browser/sorting/BookSorter.spec.ts` - - `frontend/src/app/features/book/model/library.model.spec.ts` - - `frontend/src/app/features/book/service/library-query-keys.spec.ts` - - `frontend/src/app/features/metadata/model/request/metadata-refresh-type.enum.spec.ts` - - `frontend/src/app/features/readers/ebook-reader/state/themes.constant.spec.ts` - - `frontend/src/app/shared/constants/reset-progress-type.spec.ts` - - `frontend/src/app/shared/model/app-state.model.spec.ts` - - `frontend/src/app/shared/websocket/model/log-notification.model.spec.ts` - -### Batch 2 -- Scope: additional pure models, enums, and type-only request payloads. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/features/book/model/sort.model.spec.ts` - - `frontend/src/app/features/book/model/shelf.model.spec.ts` - - `frontend/src/app/features/metadata/model/request/fetch-metadata-request.model.spec.ts` - - `frontend/src/app/features/metadata/model/request/metadata-refresh-options.model.spec.ts` - - `frontend/src/app/features/metadata/model/request/metadata-refresh-request.model.spec.ts` - - `frontend/src/app/features/notebook/model/notebook.model.spec.ts` - - `frontend/src/app/features/readers/audiobook-player/audiobook.model.spec.ts` - - `frontend/src/app/features/series-browser/model/series.model.spec.ts` - - `frontend/src/app/shared/layout/api/menuchangeevent.spec.ts` - - `frontend/src/app/shared/model/oidc-group-mapping.model.spec.ts` - - `frontend/src/app/shared/models/api-exception.model.spec.ts` - -### Batch 3 -- Scope: remaining pure query keys, settings/email contracts, and light index exports. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/shared/service/app-settings-query-keys.spec.ts` - - `frontend/src/app/features/settings/user-management/user-query-keys.spec.ts` - - `frontend/src/app/features/settings/email-v2/email-provider.model.spec.ts` - - `frontend/src/app/features/settings/email-v2/email-recipient.model.spec.ts` - - `frontend/src/app/features/settings/user-management/content-restriction.model.spec.ts` - - `frontend/src/app/shared/metadata/metadata-field.config.spec.ts` - - `frontend/src/app/shared/metadata/embeddable-fields.config.spec.ts` - - `frontend/src/app/shared/metadata/index.spec.ts` - - `frontend/src/app/features/readers/audiobook-player/index.spec.ts` - -### Batch 4 -- Scope: larger pure models and default config exports. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/shared/model/app-settings.model.spec.ts` - - `frontend/src/app/features/dashboard/models/dashboard-config.model.spec.ts` - - `frontend/src/app/features/book/model/book.model.spec.ts` - -### Batch 5 -- Scope: guards, setup flows, and small websocket/helper utilities that do not need runtime seams. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/core/testing/transloco-testing.spec.ts` - - `frontend/src/app/core/security/guards/manage-library.guard.spec.ts` - - `frontend/src/app/core/security/guards/bookdrop.guard.spec.ts` - - `frontend/src/app/core/security/guards/library-stats.guard.spec.ts` - - `frontend/src/app/core/security/guards/user-stats.guard.spec.ts` - - `frontend/src/app/core/security/guards/edit-metdata.guard.spec.ts` - - `frontend/src/app/shared/components/setup/setup.service.spec.ts` - - `frontend/src/app/shared/components/setup/setup.guard.spec.ts` - - `frontend/src/app/shared/components/setup/login.guard.spec.ts` - - `frontend/src/app/shared/components/setup/setup-redirect.guard.spec.ts` - - `frontend/src/app/shared/websocket/rx-stomp.config.spec.ts` - - `frontend/src/app/shared/websocket/rx-stomp-service-factory.spec.ts` - - `frontend/src/app/features/book/components/book-browser/filter-label.helper.spec.ts` - -### Batch 6 -- Scope: lightweight services and observables that can be exercised without runtime code seams. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/shared/service/page-title.service.spec.ts` - - `frontend/src/app/shared/service/settings-helper.service.spec.ts` - - `frontend/src/app/shared/service/icon-picker.service.spec.ts` - - `frontend/src/app/shared/service/metadata-match-weights.service.spec.ts` - - `frontend/src/app/shared/websocket/notification-event.service.spec.ts` - -### Batch 7 -- Scope: shared HTTP-wrapper services with straightforward request/response contracts. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/shared/service/oidc-group-mapping.service.spec.ts` - - `frontend/src/app/shared/service/book-note.service.spec.ts` - - `frontend/src/app/shared/service/book-note-v2.service.spec.ts` - - `frontend/src/app/shared/service/book-mark.service.spec.ts` - - `frontend/src/app/shared/service/annotation.service.spec.ts` - - `frontend/src/app/shared/service/reading-session-api.service.spec.ts` - - `frontend/src/app/shared/service/file-download.service.spec.ts` - - `frontend/src/app/shared/websocket/rx-stomp.service.spec.ts` - - `frontend/src/app/shared/services/dialog-launcher.service.spec.ts` - - `frontend/src/app/shared/service/app-settings.service.spec.ts` - -### Batch 8 -- Scope: metadata utilities and lightweight shared/book HTTP services. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/shared/services/book-cover.service.spec.ts` - - `frontend/src/app/shared/service/file-operations.service.spec.ts` - - `frontend/src/app/features/book/service/metadata-task.spec.ts` - - `frontend/src/app/shared/metadata/metadata-utils.service.spec.ts` - - `frontend/src/app/shared/metadata/metadata-form.builder.spec.ts` - - `frontend/src/app/shared/service/metadata-progress.service.spec.ts` - -### Batch 9 -- Scope: shared utility services, theme helpers, and seam-documented runtime-heavy specs. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/shared/layout/component/theme-palette-extend.spec.ts` - - `frontend/src/app/shared/layout/component/theme-configurator/favicon-service.spec.ts` - - `frontend/src/app/shared/service/pdf-annotation.service.spec.ts` - - `frontend/src/app/shared/service/audiobook-session.service.spec.ts` - - `frontend/src/app/shared/service/custom-font.service.spec.ts` - - `frontend/src/app/shared/service/app-config.service.spec.ts` - -### Batch 10 -- Scope: shared layout, upload, icon, and reader-session services with real browser/service coverage. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/shared/layout/component/layout-main/service/app.layout.service.spec.ts` - - `frontend/src/app/shared/layout/component/theme-configurator/background-upload.service.spec.ts` - - `frontend/src/app/features/readers/audiobook-player/audiobook.service.spec.ts` - - `frontend/src/app/shared/services/icon.service.spec.ts` - - `frontend/src/app/shared/service/reading-session.service.spec.ts` - -### Batch 11 -- Scope: low-friction shared/settings service wrappers plus one explicit dynamic-component seam. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/shared/components/directory-picker/utility.service.spec.ts` - - `frontend/src/app/features/settings/audit-logs/audit-log.service.spec.ts` - - `frontend/src/app/features/library-creator/library-loading.service.spec.ts` - -### Batch 12 -- Scope: book service control-flow surfaces and a query-heavy user-service seam note. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/features/book/service/cbx-reader.service.spec.ts` - - `frontend/src/app/features/book/service/book-patch.service.spec.ts` - - `frontend/src/app/features/settings/user-management/user.service.spec.ts` - -### Batch 13 -- Scope: small shared standalone components with direct behavior or render assertions. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/shared/components/external-doc-link/external-doc-link.component.spec.ts` - - `frontend/src/app/shared/components/empty/empty.component.spec.ts` - - `frontend/src/app/shared/components/tag/tag.component.spec.ts` - -### Batch 14 -- Scope: one pure library-loading component plus local shared components with mocked dialog and websocket behavior. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/features/library-creator/library-loading/library-loading.component.spec.ts` - - `frontend/src/app/shared/components/live-notification-box/live-notification-box.component.spec.ts` - - `frontend/src/app/shared/components/directory-picker/directory-picker.component.spec.ts` - -### Batch 15 -- Scope: runtime-heavy shared and library flows converted from generic placeholders to seam-specific skipped specs. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/features/magic-shelf/service/magic-shelf.service.spec.ts` - - `frontend/src/app/features/library-creator/library-creator.component.spec.ts` - -### Batch 28 -- Scope: next settings, book, metadata, and stats shells converted from generic TODO stubs to explicit seam-documented specs. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Remaining generic TODO stubs: `59` -- Files: - - `frontend/src/app/features/settings/library-metadata-settings/library-metadata-settings.component.spec.ts` - - `frontend/src/app/features/settings/view-preferences-parent/filter-preferences/filter-preferences.component.spec.ts` - - `frontend/src/app/features/book/service/book-menu.service.spec.ts` - - `frontend/src/app/features/book/service/book-file.service.spec.ts` - - `frontend/src/app/features/settings/settings.component.spec.ts` - - `frontend/src/app/features/settings/device-settings/device-settings-component.spec.ts` - - `frontend/src/app/features/bookdrop/component/bookdrop-file-metadata-picker/bookdrop-file-metadata-picker.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/reading-dna-chart/reading-dna-chart.component.spec.ts` - - `frontend/src/app/features/metadata/component/cover-search/cover-search.component.spec.ts` - - `frontend/src/app/features/book/components/book-notes/book-notes-component.spec.ts` - -### Batch 29 -- Scope: KOReader and metadata settings received real coverage where the surfaces were deterministic; the remaining dialog/query-heavy files were converted to explicit seam notes. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Remaining generic TODO stubs: `49` -- Files: - - `frontend/src/app/features/settings/metadata-settings/metadata-persistence-settings/metadata-persistence-settings-component.spec.ts` - - `frontend/src/app/features/settings/device-settings/component/koreader-settings/koreader.service.spec.ts` - - `frontend/src/app/features/settings/device-settings/component/koreader-settings/koreader-settings-component.spec.ts` - - `frontend/src/app/features/metadata/component/multi-book-metadata-editor/multi-book-metadata-editor-component.spec.ts` - - `frontend/src/app/features/metadata/component/bulk-metadata-update/bulk-metadata-update-component.spec.ts` - - `frontend/src/app/features/book/components/book-sender/book-sender.component.spec.ts` - - `frontend/src/app/features/book/components/series-page/series-page.component.spec.ts` - - `frontend/src/app/features/settings/metadata-settings/metadata-settings-component.spec.ts` - - `frontend/src/app/features/bookdrop/component/bookdrop-pattern-extract-dialog/bookdrop-pattern-extract-dialog.component.spec.ts` - - `frontend/src/app/features/settings/user-profile-dialog/user-profile-dialog.component.spec.ts` - -### Batch 30 -- Scope: simple dialog, reader footer, kobo settings, public review settings, and book-card-lite now have real tests; the surrounding shell-heavy reader/email/file-attach surfaces were converted to explicit seam notes. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Remaining generic TODO stubs: `39` -- Files: - - `frontend/src/app/features/bookdrop/component/bookdrop-finalize-result-dialog/bookdrop-finalize-result-dialog.component.spec.ts` - - `frontend/src/app/features/readers/cbx-reader/layout/footer/cbx-footer.component.spec.ts` - - `frontend/src/app/features/settings/device-settings/component/kobo-sync-settings/kobo.service.spec.ts` - - `frontend/src/app/features/settings/metadata-settings/public-reviews-settings/public-reviews-settings-component.spec.ts` - - `frontend/src/app/features/book/components/book-card-lite/book-card-lite-component.spec.ts` - - `frontend/src/app/features/readers/cbx-reader/layout/sidebar/cbx-sidebar.component.spec.ts` - - `frontend/src/app/features/readers/ebook-reader/dialogs/settings-dialog.component.spec.ts` - - `frontend/src/app/features/settings/email-v2/email-v2-recipient/email-v2-recipient.component.spec.ts` - - `frontend/src/app/features/settings/email-v2/email-v2-provider/email-v2-provider.component.spec.ts` - - `frontend/src/app/features/book/components/book-file-attacher/book-file-attacher.component.spec.ts` - - `frontend/src/app/shared/layout/component/layout-topbar/app.topbar.component.spec.ts` - - `frontend/src/app/shared/components/book-uploader/book-uploader.component.spec.ts` - - `frontend/src/app/features/settings/custom-fonts/custom-fonts.component.spec.ts` - -### Batch 16 -- Scope: layout-heavy shells converted from generic placeholders to seam-specific skipped specs. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/shared/layout/component/theme-configurator/theme-configurator.component.spec.ts` - - `frontend/src/app/shared/layout/component/layout-main/app.layout.component.spec.ts` - - `frontend/src/app/shared/layout/component/layout-sidebar/app.sidebar.component.spec.ts` - - `frontend/src/app/shared/layout/component/layout-menu/app.menu.component.spec.ts` - - `frontend/src/app/shared/layout/component/layout-menu/app.menuitem.component.spec.ts` - -### Batch 17 -- Scope: real coverage for shared standalone form and dialog components with direct control-flow assertions. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/shared/components/change-password/change-password.component.spec.ts` - - `frontend/src/app/shared/components/icon-display/icon-display.component.spec.ts` - - `frontend/src/app/shared/components/setup/setup.component.spec.ts` - - `frontend/src/app/shared/layout/component/theme-configurator/upload-dialog/upload-dialog.component.spec.ts` - - `frontend/src/app/shared/layout/component/layout-menu/version-changelog-dialog/version-changelog-dialog.component.spec.ts` - -### Batch 18 -- Scope: one real shared progress widget, one real stats HTTP wrapper, and seam-specific replacements for query-runtime-heavy services/components. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/shared/components/metadata-progress-widget/metadata-progress-widget-component.spec.ts` - - `frontend/src/app/features/settings/user-management/user-stats.service.spec.ts` - - `frontend/src/app/features/book/service/shelf.service.spec.ts` - - `frontend/src/app/features/book/service/library.service.spec.ts` - - `frontend/src/app/shared/components/icon-picker/icon-picker-component.spec.ts` - -### Batch 19 -- Scope: bookdrop API/control-flow coverage plus one seam-specific replacement for a menu-command-heavy service. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/features/bookdrop/service/bookdrop-file-api.service.spec.ts` - - `frontend/src/app/features/bookdrop/service/bookdrop-file.service.spec.ts` - - `frontend/src/app/features/bookdrop/service/bookdrop.service.spec.ts` - - `frontend/src/app/features/book/service/book-metadata.service.spec.ts` - - `frontend/src/app/features/book/service/library-shelf-menu.service.spec.ts` - -### Batch 20 -- Scope: shared utility components with real coverage plus seam-specific replacements for reader/chart-heavy surfaces that still lack clean injectable seams. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/shared/components/cover-generator/cover-generator.component.spec.ts` - - `frontend/src/app/shared/components/unified-notification-popover/unified-notification-popover-component.spec.ts` - - `frontend/src/app/shared/components/file-mover/file-mover-component.spec.ts` - - `frontend/src/app/features/readers/pdf-reader/pdf-reader.component.spec.ts` - - `frontend/src/app/features/readers/cbx-reader/cbx-reader.component.spec.ts` - - `frontend/src/app/features/readers/audiobook-player/audiobook-player.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/genre-stats-chart/genre-stats-chart.component.spec.ts` - -### Batch 21 -- Scope: book cache/control-flow services with real coverage, one real series-card component spec, and seam-specific replacements for query-runtime and invalid-template surfaces. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/features/book/service/book-socket.service.spec.ts` - - `frontend/src/app/features/book/service/book-metadata-manage.service.spec.ts` - - `frontend/src/app/features/series-browser/components/series-card/series-card.component.spec.ts` - - `frontend/src/app/features/book/service/book.service.spec.ts` - - `frontend/src/app/features/series-browser/components/series-scroller/series-scroller.component.spec.ts` - -### Batch 22 -- Scope: reader-preference and naming settings with real control-flow coverage, plus seam-specific replacements for browser-heavy settings shells and dialogs. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/features/settings/reader-preferences/cbx-reader-preferences/cbx-reader-preferences-component.spec.ts` - - `frontend/src/app/features/settings/global-preferences/metadata-match-weights/metadata-match-weights-component.spec.ts` - - `frontend/src/app/features/settings/file-naming-pattern/file-naming-pattern.component.spec.ts` - - `frontend/src/app/features/settings/reader-preferences/pdf-reader-preferences/pdf-reader-preferences-component.spec.ts` - - `frontend/src/app/features/settings/view-preferences-parent/sidebar-sorting-preferences/sidebar-sorting-preferences.component.spec.ts` - - `frontend/src/app/features/settings/global-preferences/global-preferences.component.spec.ts` - - `frontend/src/app/features/settings/custom-fonts/font-upload-dialog/font-upload-dialog.component.spec.ts` - - `frontend/src/app/features/settings/audit-logs/audit-logs.component.spec.ts` - - `frontend/src/app/features/settings/view-preferences-parent/view-preferences/view-preferences.component.spec.ts` - - `frontend/src/app/features/settings/global-preferences/metadata-provider-settings/metadata-provider-settings.component.spec.ts` - -### Batch 23 -- Scope: dashboard and stats visualization surfaces converted from generic placeholders to explicit seam notes where real coverage would require chart, canvas, scroll, or dashboard orchestration adapters. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/features/dashboard/components/dashboard-scroller/dashboard-scroller.component.spec.ts` - - `frontend/src/app/features/dashboard/components/dashboard-settings/dashboard-settings.component.spec.ts` - - `frontend/src/app/features/dashboard/components/main-dashboard/main-dashboard.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/reading-session-timeline/reading-session-timeline.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/session-archetypes-chart/session-archetypes-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/favorite-days-chart/favorite-days-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/book-flow-chart/book-flow-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/completion-timeline-chart/completion-timeline-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/peak-hours-chart/peak-hours-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/reading-session-heatmap/reading-session-heatmap.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/read-status-chart/read-status-chart.component.spec.ts` - - `frontend/src/app/features/notebook/components/notebook/notebook.component.spec.ts` - -### Batch 24 -- Scope: additional user-stats chart placeholders converted into explicit seam notes for chart-runtime, effect, callback, and aggregation boundaries instead of generic TODO stubs. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/features/stats/component/user-stats/charts/page-turner-chart/page-turner-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/reading-progress-chart/reading-progress-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/completion-race-chart/completion-race-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/rating-taste-chart/rating-taste-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/reading-clock-chart/reading-clock-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/personal-rating-chart/personal-rating-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/reading-heatmap-chart/reading-heatmap-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/reading-habits-chart/reading-habits-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/series-progress-chart/series-progress-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/book-length-chart/book-length-chart.component.spec.ts` - -### Batch 25 -- Scope: author-browser, book dialog, user-management, and additional stats surfaces converted from generic placeholders into explicit seam notes where real coverage would require routed dialog stacks, Prime widget runtime, or chart adapters. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/features/author-browser/components/author-photo-search/author-photo-search.component.spec.ts` - - `frontend/src/app/features/author-browser/components/author-card/author-card.component.spec.ts` - - `frontend/src/app/features/author-browser/components/author-browser/author-browser.component.spec.ts` - - `frontend/src/app/features/author-browser/components/author-detail/author-detail.component.spec.ts` - - `frontend/src/app/features/author-browser/components/author-editor/author-editor.component.spec.ts` - - `frontend/src/app/features/author-browser/components/author-match/author-match.component.spec.ts` - - `frontend/src/app/features/book/components/book-searcher/book-searcher.component.spec.ts` - - `frontend/src/app/features/book/components/duplicate-merger/duplicate-merger.component.spec.ts` - - `frontend/src/app/features/book/components/add-physical-book-dialog/add-physical-book-dialog.component.spec.ts` - - `frontend/src/app/features/book/components/shelf-assigner/shelf-assigner.component.spec.ts` - - `frontend/src/app/features/settings/user-management/user-management.component.spec.ts` - - `frontend/src/app/features/settings/user-management/create-user-dialog/create-user-dialog.component.spec.ts` - - `frontend/src/app/features/settings/user-management/content-restrictions-editor/content-restrictions-editor.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/publication-era-chart/publication-era-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/charts/reading-debt-chart/reading-debt-chart.component.spec.ts` - -### Batch 26 -- Scope: simple reader dialogs and header upgraded to real specs, while library-stats, reader-shell, and bookdrop orchestration placeholders were replaced with seam-specific notes. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/features/readers/cbx-reader/dialogs/cbx-shortcuts-help.component.spec.ts` - - `frontend/src/app/features/readers/cbx-reader/dialogs/cbx-note-dialog.component.spec.ts` - - `frontend/src/app/features/readers/ebook-reader/dialogs/note-dialog.component.spec.ts` - - `frontend/src/app/features/readers/ebook-reader/dialogs/metadata-dialog.component.spec.ts` - - `frontend/src/app/features/readers/cbx-reader/layout/header/cbx-header.component.spec.ts` - - `frontend/src/app/features/stats/component/library-stats/library-stats.component.spec.ts` - - `frontend/src/app/features/bookdrop/component/bookdrop-bulk-edit-dialog/bookdrop-bulk-edit-dialog.component.spec.ts` - - `frontend/src/app/features/series-browser/components/series-browser/series-browser.component.spec.ts` - - `frontend/src/app/features/stats/component/library-stats/charts/metadata-score-chart/metadata-score-chart.component.spec.ts` - - `frontend/src/app/features/bookdrop/component/bookdrop-files-widget/bookdrop-files-widget.component.spec.ts` - - `frontend/src/app/features/readers/ebook-reader/ebook-reader.component.spec.ts` - - `frontend/src/app/features/stats/component/library-stats/charts/book-formats-chart/book-formats-chart.component.spec.ts` - -### Batch 27 -- Scope: remaining library-stats chart placeholders plus ebook and CBX shell surfaces converted from generic TODO stubs into explicit chart/runtime seam notes. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Files: - - `frontend/src/app/features/stats/component/library-stats/charts/top-items-chart/top-items-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/library-stats/charts/page-count-chart/page-count-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/library-stats/charts/language-chart/language-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/library-stats/charts/publication-timeline-chart/publication-timeline-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/library-stats/charts/reading-journey-chart/reading-journey-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/library-stats/charts/author-universe-chart/author-universe-chart.component.spec.ts` - - `frontend/src/app/features/stats/component/library-stats/charts/publication-trend-chart/publication-trend-chart.component.spec.ts` - - `frontend/src/app/features/readers/ebook-reader/dialogs/shortcuts-help.component.spec.ts` - - `frontend/src/app/features/readers/ebook-reader/layout/header/header.component.spec.ts` - - `frontend/src/app/features/readers/cbx-reader/layout/quick-settings/cbx-quick-settings.component.spec.ts` - -### Batch 31 -- Scope: branch-heavy book helper/services upgraded to real specs, while book filter/table and upload dialog placeholders were replaced with explicit component seam notes. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Remaining generic TODO stubs after batch: `29` -- Files: - - `frontend/src/app/features/book/components/book-reviews/book-review-service.spec.ts` - - `frontend/src/app/features/book/components/book-browser/book-dialog-helper.service.spec.ts` - - `frontend/src/app/features/book/components/book-browser/book-filter-orchestration.service.spec.ts` - - `frontend/src/app/features/book/components/book-browser/book-card-overlay-preference.service.spec.ts` - - `frontend/src/app/features/book/components/book-browser/book-filter/book-filter.service.spec.ts` - - `frontend/src/app/features/book/components/book-browser/book-filter/book-filter.component.spec.ts` - - `frontend/src/app/features/book/components/book-browser/book-table/book-table.component.spec.ts` - - `frontend/src/app/features/book/components/book-reviews/book-reviews.component.spec.ts` - - `frontend/src/app/features/book/components/additional-file-uploader/additional-file-uploader.component.spec.ts` - - `frontend/src/app/features/book/components/bulk-isbn-import-dialog/bulk-isbn-import-dialog.component.spec.ts` - -### Batch 32 -- Scope: finished the remaining generic frontend coverage stubs by adding direct class or HTTP tests for the cheap service surfaces and replacing the heavy Angular or PrimeNG or reader-shell placeholders with explicit seam-noted skipped specs. -- Status: completed. -- Validation: - - `just ui typecheck` - - `just ui lint` - - `just ui test` -- Remaining generic TODO stubs after batch: `0` -- Files: - - `frontend/src/app/features/settings/device-settings/component/hardcover-settings/hardcover-sync-settings.service.spec.ts` - - `frontend/src/app/features/book/components/book-browser/filters/sidebar-filter-toggle-pref.service.spec.ts` - - `frontend/src/app/features/readers/ebook-reader/features/annotations/annotation.service.spec.ts` - - `frontend/src/app/features/readers/ebook-reader/index.spec.ts` - - `frontend/src/app/features/readers/ebook-reader/shared/icon.component.spec.ts` - - `frontend/src/app/features/settings/reader-preferences/reader-preferences.component.spec.ts` - - `frontend/src/app/features/stats/component/user-stats/user-stats.component.spec.ts` - - `frontend/src/app/features/book/components/book-browser/book-browser.component.spec.ts` - - `frontend/src/app/features/book/components/book-browser/lock-unlock-metadata-dialog/lock-unlock-metadata-dialog.component.spec.ts` - - `frontend/src/app/features/book/components/book-browser/sorting/multi-sort-popover/multi-sort-popover.component.spec.ts` - - `frontend/src/app/features/book/components/shelf-creator/shelf-creator.component.spec.ts` - - `frontend/src/app/features/book/components/shelf-edit-dialog/shelf-edit-dialog.component.spec.ts` - - `frontend/src/app/features/metadata/component/book-metadata-center/book-metadata-center.component.spec.ts` - - `frontend/src/app/features/metadata/component/book-metadata-center/metadata-editor/metadata-editor.component.spec.ts` - - `frontend/src/app/features/metadata/component/book-metadata-center/metadata-searcher/metadata-searcher.component.spec.ts` - - `frontend/src/app/features/metadata/component/book-metadata-center/metadata-viewer/metadata-tabs/metadata-tabs.component.spec.ts` - - `frontend/src/app/features/readers/ebook-reader/core/view-manager.service.spec.ts` - - `frontend/src/app/features/readers/ebook-reader/layout/footer/footer.component.spec.ts` - - `frontend/src/app/features/readers/ebook-reader/layout/header/quick-settings.component.spec.ts` - - `frontend/src/app/features/readers/ebook-reader/layout/panel/panel.component.spec.ts` - - `frontend/src/app/features/readers/ebook-reader/layout/sidebar/sidebar.component.spec.ts` - - `frontend/src/app/features/readers/ebook-reader/shared/selection-popup.component.spec.ts` - - `frontend/src/app/features/settings/device-settings/component/hardcover-settings/hardcover-settings-component.spec.ts` - - `frontend/src/app/features/settings/device-settings/component/kobo-sync-settings/kobo-sync-settings-component.spec.ts` - - `frontend/src/app/features/settings/email-v2/create-email-provider-dialog/create-email-provider-dialog.component.spec.ts` - - `frontend/src/app/features/settings/email-v2/create-email-recipient-dialog/create-email-recipient-dialog.component.spec.ts` - - `frontend/src/app/features/settings/email-v2/email-v2.component.spec.ts` - - `frontend/src/app/features/settings/opds-settings/opds-settings.spec.ts` - - `frontend/src/app/features/settings/reader-preferences/epub-reader-preferences/epub-reader-preferences-component.spec.ts` - -## Proposed Commit Shapes - -These are controller-friendly Conventional Commit shapes for the logged batches. Each body is grouped markdown that can be used directly or merged into larger follow-up commits. - -### Batch 1 -- Subject: `test(frontend): cover pure models and config contracts` -- Body: - - `- Coverage: add type-level specs for pure frontend config, model, and enum surfaces under core, author-browser, book, metadata, readers, and shared.` - - `- Intent: replace placeholder specs with cheap deterministic assertions that lock down static contract behavior without runtime seams.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 2 -- Subject: `test(frontend): cover request payload and contract models` -- Body: - - `- Coverage: add specs for additional book, metadata, notebook, readers, series-browser, and shared request or model contracts.` - - `- Intent: keep the stub-replacement pass moving through deterministic type-bearing files before shifting into heavier service and component surfaces.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 3 -- Subject: `test(frontend): cover query keys and barrel exports` -- Body: - - `- Coverage: add tests for shared and settings query keys, email contracts, metadata exports, and audiobook barrel exports.` - - `- Intent: close out low-risk placeholder specs where real value comes from locking contract shape and export stability.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 4 -- Subject: `test(frontend): cover larger model defaults and dashboard contracts` -- Body: - - `- Coverage: add specs for the main app-settings, dashboard, and book models.` - - `- Intent: finish the remaining pure model stubs before shifting toward control-flow and service behavior.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 5 -- Subject: `test(frontend): cover setup and guard utilities` -- Body: - - `- Coverage: add deterministic tests for setup services, setup guards, security guards, websocket helpers, and small filter helpers.` - - `- Intent: replace placeholder coverage with branch-bearing guard and bootstrap assertions that do not require runtime code changes.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 6 -- Subject: `test(frontend): cover lightweight shared services` -- Body: - - `- Coverage: add tests for page title, settings helper, icon picker, metadata-match weights, and notification event services.` - - `- Intent: convert low-friction service placeholders into real control-flow coverage before moving to HTTP-heavy wrappers.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 7 -- Subject: `test(frontend): cover shared HTTP service wrappers` -- Body: - - `- Coverage: add request and response tests for shared annotation, note, bookmark, reading-session, websocket, and group-mapping services.` - - `- Intent: replace generic HTTP-wrapper stubs with real endpoint-shape coverage that can fail honestly when request contracts drift.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 8 -- Subject: `test(frontend): cover metadata utilities and book HTTP helpers` -- Body: - - `- Coverage: add tests for metadata form and utility services, file operations, book cover helpers, metadata progress, and metadata-task behavior.` - - `- Intent: push coverage into utility and helper layers that affect metadata control flow without needing heavy component harnesses.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 9 -- Subject: `test(frontend): cover shared utilities and document seam-heavy specs` -- Body: - - `- Coverage: add real tests for theme, PDF annotation, audiobook session, and config helpers while converting the remaining runtime-heavy shared stubs into explicit seam notes.` - - `- Intent: separate deterministic coverage wins from surfaces that still need browser or runtime harnesses later.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 10 -- Subject: `test(frontend): cover layout upload and reader-session services` -- Body: - - `- Coverage: add real tests for layout service, background upload, audiobook service, icon service, and reading-session behavior.` - - `- Intent: grow coverage through shared layout and reader utilities without changing runtime code.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 11 -- Subject: `test(frontend): cover lightweight settings wrappers` -- Body: - - `- Coverage: add tests for directory-picker utilities, audit-log service behavior, and the low-friction library-loading path.` - - `- Intent: keep the pass focused on cheap deterministic seams while documenting the remaining dynamic component seam explicitly.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 12 -- Subject: `test(frontend): cover book service control flow` -- Body: - - `- Coverage: add real service tests for CBX reader and book patch flows and replace the user-service placeholder with a seam-aware spec.` - - `- Intent: increase branch coverage in book service layers while acknowledging the query-heavy user-service runtime boundary.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 13 -- Subject: `test(frontend): cover small shared standalone components` -- Body: - - `- Coverage: add direct component behavior tests for external links, empty states, and tag rendering.` - - `- Intent: clear straightforward standalone component stubs without spending time on decorative template-only churn.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 14 -- Subject: `test(frontend): cover library loading and local shared components` -- Body: - - `- Coverage: add tests for library-loading, live-notification, and directory-picker components using mocked local dependencies.` - - `- Intent: pick off component surfaces that have real behavior but do not require heavy application orchestration.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 15 -- Subject: `test(frontend): document shared runtime seams` -- Body: - - `- Coverage: replace remaining shared and library runtime-heavy placeholders with explicit seam-noted skipped specs.` - - `- Intent: make the remaining blocker surfaces auditable instead of leaving generic TODO stubs behind.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 16 -- Subject: `test(frontend): document layout shell seams` -- Body: - - `- Coverage: convert layout-heavy shell placeholders into seam-specific skipped specs.` - - `- Intent: record the need for mounted layout harnesses without spending time on brittle shallow shell tests.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 17 -- Subject: `test(frontend): cover shared forms and dialogs` -- Body: - - `- Coverage: add real tests for shared standalone form and dialog components with direct control-flow assertions.` - - `- Intent: capture meaningful component behavior where the harness cost is still low enough to justify real tests.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 18 -- Subject: `test(frontend): cover progress and stats wrappers` -- Body: - - `- Coverage: add real tests for a shared progress widget and a stats HTTP wrapper while documenting heavier query-driven seams.` - - `- Intent: keep coverage growth honest by splitting easy wrappers from runtime-heavy component and service surfaces.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 19 -- Subject: `test(frontend): cover bookdrop API branches` -- Body: - - `- Coverage: add bookdrop API and control-flow coverage and replace the remaining menu-command-heavy service stub with a seam note.` - - `- Intent: grow branch coverage in bookdrop services while avoiding low-yield template churn.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 20 -- Subject: `test(frontend): cover shared utility components` -- Body: - - `- Coverage: add real tests for shared utility components and convert heavier reader or chart placeholders into explicit seam-noted skips.` - - `- Intent: continue replacing generic placeholders while keeping runtime-heavy chart and reader shells out of the main path.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 21 -- Subject: `test(frontend): cover book cache and series card behavior` -- Body: - - `- Coverage: add real tests for book cache and control-flow services plus the series-card component, and document the remaining query-runtime seams.` - - `- Intent: prioritize behavior-bearing book surfaces instead of spreading effort over decorative render-only coverage.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 22 -- Subject: `test(frontend): cover reader preference settings flows` -- Body: - - `- Coverage: add real tests for reader-preference and naming settings while replacing browser-heavy settings shells and dialogs with seam notes.` - - `- Intent: move settings coverage upward without inventing runtime seams for the stubborn UI-heavy surfaces.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 23 -- Subject: `test(frontend): document dashboard and stats visualization seams` -- Body: - - `- Coverage: replace dashboard and stats visualization placeholders with explicit chart, canvas, scroll, and orchestration seam notes.` - - `- Intent: make the expensive visualization blockers explicit instead of keeping them as generic unowned TODO stubs.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 24 -- Subject: `test(frontend): document remaining user stats chart seams` -- Body: - - `- Coverage: convert another wave of user-stats chart placeholders into explicit runtime seam notes.` - - `- Intent: keep the coverage pass honest by documenting chart-runtime blockers without pretending that render smoke tests would help.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 25 -- Subject: `test(frontend): document author-browser and dialog seams` -- Body: - - `- Coverage: replace author-browser, book-dialog, user-management, and additional stats placeholders with routed dialog or widget seam notes.` - - `- Intent: record the real blocker surfaces cleanly and avoid low-yield retries on complex dialog stacks.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 26 -- Subject: `test(frontend): cover reader dialogs and note library-stats seams` -- Body: - - `- Coverage: add real tests for simple reader dialogs and header behavior and document the remaining library-stats, reader-shell, and bookdrop orchestration seams.` - - `- Intent: combine cheap reader wins with explicit notes for surfaces that still need mounted runtime harnesses.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 27 -- Subject: `test(frontend): document remaining library stats and reader shell seams` -- Body: - - `- Coverage: replace the remaining library-stats chart placeholders and ebook or CBX shell stubs with explicit chart and runtime seam notes.` - - `- Intent: finish the chart-heavy placeholder cleanup in a durable, auditable way.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 28 -- Subject: `test(frontend): document settings and metadata shell seams` -- Body: - - `- Coverage: convert another wave of settings, book, metadata, and stats shells from generic TODO stubs into explicit seam-documented specs.` - - `- Intent: keep the pass moving through high-friction surfaces without faking useful coverage.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 29 -- Subject: `test(frontend): cover deterministic settings services` -- Body: - - `- Coverage: add real tests for KOReader and metadata settings surfaces where the behavior is deterministic, and document the remaining dialog-heavy seams.` - - `- Intent: take the cheap service and settings wins while isolating the harder modal and query-driven blockers.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 30 -- Subject: `test(frontend): cover selected reader and settings widgets` -- Body: - - `- Coverage: add real tests for a simple dialog, the CBX footer, kobo settings service behavior, public review settings, and book-card-lite.` - - `- Intent: harvest another set of low-friction component and service wins while documenting the surrounding reader and email shell seams.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 31 -- Subject: `test(frontend): cover book helper and review services` -- Body: - - `- Coverage: add real tests for book review, dialog helper, orchestration, and overlay-preference services, and convert the remaining book browser and upload shells into explicit seam notes.` - - `- Intent: push branch coverage into real book control flow instead of spreading effort over decorative component smoke tests.` - - `- Validation: run just ui typecheck, just ui lint, and just ui test.` - -### Batch 32 -- Subject: `test(frontend): finish replacing generic spec stubs` -- Body: - - `- Coverage: close out the remaining generic TODO stubs with real HTTP or class-level specs where cheap, and explicit seam-noted skipped specs where heavier Angular, PrimeNG, or reader-shell harnesses are still required.` - - `- Result: bring the generic TODO stub count under frontend src app to zero while preserving the no-runtime-change rule.` - - `- Validation: run just ui typecheck, just ui lint, just ui test, and finish with just ui check.` diff --git a/docs/plans/semantic-release-migration.md b/docs/plans/semantic-release-migration.md deleted file mode 100644 index e5a045d84..000000000 --- a/docs/plans/semantic-release-migration.md +++ /dev/null @@ -1,49 +0,0 @@ -# Semantic-Release Migration for Stable Releases - -## Summary - -Step 0: write this plan to `docs/plans/semantic-release-migration.md`. - -Replace Release Drafter and the manual bump-based stable release flow with `semantic-release` as the single source of truth for stable versioning and release notes. Stable releases are computed automatically from conventional commit history on `main`, nightly builds remain on `develop`, and the first semantic-release-managed stable release must be `v2.2.2`. - -## Key Changes - -- Add dedicated release tooling under `tools/release/` with its own `package.json`, lockfile, and `release.config.cjs`. -- Remove Release Drafter and the manual stable bump workflow. -- Introduce a push-to-`main` semantic-release workflow that: - - runs migration checks and the shared test suite, - - updates `CHANGELOG.md`, - - creates the release commit and `vX.Y.Z` tag, - - and opens a draft GitHub release with grouped notes. -- Introduce a tag-driven stable image workflow on `v*` tags that publishes Docker Hub and GHCR images and finalizes the matching draft GitHub release. -- Keep nightly publication on `develop` and manual preview image builds unchanged. -- Enforce semantic PR titles on PRs targeting `develop` and `main`. -- Treat release bumps as: - - `BREAKING CHANGE` => major - - `feat` => minor - - `fix`, `perf`, `refactor` => patch - - `docs`, `ci`, `build`, `chore`, `test`, `style` => notes only -- Group release notes and `CHANGELOG.md` sections by type, including non-triggering categories. - -## Bootstrap - -- Seed the release history with an annotated `v2.2.1` tag on commit `384512534fe5a2f42d8482a0646337e28ef54e52`. -- Push the seed tag only. Do not create a public historical GitHub release for `v2.2.1`. -- Merge the semantic-release migration as a patch-triggering commit so the first semantic-release-managed stable release becomes `v2.2.2`. - -## Test Plan - -- Verify semantic-release dry run computes `2.2.2` from the seeded history. -- Verify `feat`, `fix`, `perf`, `refactor`, and breaking-change behavior matches the configured release rules. -- Verify `docs`, `ci`, `build`, `chore`, `test`, and `style` appear in notes but do not trigger releases by themselves. -- Verify semantic PR title linting blocks invalid squash-merge titles. -- Verify the stable semantic-release workflow skips `[skip ci]` release commits and does not loop. -- Verify the tag-driven image workflow publishes `vX.Y.Z` and `latest` and finalizes the matching GitHub release. - -## Assumptions - -- `develop` remains the integration branch and nightly source. -- `main` remains the stable release branch. -- Feature PRs are squash-merged into `develop` with conventional PR titles. -- Promotions from `develop` to `main` preserve cleaned commit history and are not squash merges. -- A release bot or PAT-backed identity can push release commits and tags back to `main`. diff --git a/docs/plans/ui-api-two-service-split.md b/docs/plans/ui-api-two-service-split.md deleted file mode 100644 index be2fd5ec9..000000000 --- a/docs/plans/ui-api-two-service-split.md +++ /dev/null @@ -1,170 +0,0 @@ -# UI/API Runtime Split Plan - -## Summary - -Step 0: write this plan to `docs/plans/ui-api-two-service-split.md`. - -After the first stable Grimmory release that stays faithful to the original Booklore deployment shape, evaluate a runtime split that stops serving the Angular SPA from the Spring Boot jar. - -The target shape is: - -- one container that serves the prebuilt frontend and acts as the reverse proxy, -- one container that runs the Spring Boot API, -- no requirement to support a three-container `ui + api + proxy` deployment model, -- and no requirement to split repositories or release cadence immediately. - -This is intentionally a phase-two simplification plan, not a first-release blocker. - -## Why Consider It - -- The frontend is already a precompiled Angular SPA, not a server-rendered Node application. -- The current packaging path is brittle because the frontend bundle must be injected into the backend jar at build time. -- Spring is currently doing two jobs: - - serving API and websocket traffic, - - and pretending to be the static web server for the SPA. -- A proxy-plus-static-frontend container is a more conventional place to handle: - - SPA fallback, - - caching headers, - - compression, - - and static asset delivery. - -## What This Is Not - -- Not a repo split. -- Not a forced `ui + api + proxy` topology. -- Not a first-release requirement. -- Not a decision to abandon the existing all-in-one image immediately. - -## Proposed Target Architecture - -### Runtime Topology - -- `grimmory-web` - - serves the compiled Angular frontend - - handles SPA fallback to `index.html` - - proxies `/api/**`, `/komga/**`, and `/ws` to the API service -- `grimmory-api` - - runs the Spring Boot application - - exposes backend endpoints only - - no longer owns static SPA asset serving - -### Likely Technology Choice - -- Prefer `caddy` or `nginx` inside the `grimmory-web` image. -- Do not introduce `pm2` unless the frontend becomes a real Node runtime application later. -- Keep the frontend static. - -## Pros - -- Removes a fake coupling between the UI artifact and the backend jar. -- Makes frontend packaging failures easier to isolate. -- Simplifies the backend responsibility to API, websocket, auth, and domain logic. -- Makes the frontend delivery path more conventional for caching, compression, and routing. -- Reduces the need for Gradle to know anything about frontend build artifacts. -- Creates a cleaner base for future CDN or edge caching if that ever matters. - -## Cons - -- Changes the deployment contract for self-hosters. -- Introduces an extra service for operators to understand. -- Requires careful websocket and auth proxy behavior. -- Requires documentation updates for Compose, Helm, and Podman examples. -- Risks mixing an architectural cleanup into the same milestone as the first Grimmory continuation release. - -## Validation Against Current App Shape - -This split is feasible because the production frontend already behaves like a separate SPA: - -- it uses `window.location.origin` for API calls, -- it derives websocket URLs from the browser origin, -- and the browser OIDC callback route already lives in the frontend. - -That means the system already wants a same-origin reverse proxy setup. The main issue is packaging and delivery, not application semantics. - -## What Would Need To Change - -### Backend - -- Remove SPA static resource fallback from Spring MVC. -- Keep only API, websocket, auth callback, OPDS, and Komga endpoints. -- Verify same-origin or explicit-origin CORS behavior for split deployments. - -### Frontend - -- Build the Angular app as a standalone static artifact. -- Ship that artifact inside a web/proxy image. -- Keep the current `window.location.origin` production behavior unless there is a strong reason to externalize API base URLs. - -### Proxy/Web Image - -- Serve static files. -- Route unknown frontend paths to `index.html`. -- Proxy: - - `/api/**` - - `/komga/**` - - `/ws` -- Handle websocket upgrades correctly. - -### Deployment Surfaces - -- Add two-service Compose examples. -- Add two-service Helm values and templates. -- Decide whether Podman examples should keep parity or stay all-in-one. - -## Packaging and Release Strategy Options - -### Option A: Replace the Single Image - -- Publish `grimmory-web` and `grimmory-api` only. -- Simplest architecture. -- Highest operator-facing change. - -### Option B: Keep a Compatibility Image - -- Publish: - - `grimmory` - - `grimmory-web` - - `grimmory-api` -- The compatibility image keeps the existing single-container story alive while the split deployment matures. -- Higher maintenance burden, but smoother migration path. - -### Recommended Direction - -- Do not change the first Grimmory release shape. -- After that release, evaluate whether: - - the split should become the default deployment shape, - - and whether a compatibility image is worth the extra maintenance. - -## Sequencing Recommendation - -1. Ship the first Grimmory release in the current all-in-one shape. -2. Stabilize the current Docker and Gradle packaging path enough that the release is trustworthy. -3. Prototype the split runtime in a branch: - - separate API image, - - separate web/proxy image, - - updated Compose example. -4. Validate: - - login and OIDC callback flow, - - websocket behavior, - - SPA deep-link refreshes, - - healthchecks, - - and upgrade ergonomics for self-hosters. -5. Decide whether the split becomes: - - the new default, - - or an optional deployment mode with a compatibility image retained. - -## Test Plan - -- Confirm the frontend loads through the proxy/web container with deep-link refresh support. -- Confirm `/api/**`, `/komga/**`, and `/ws` proxy correctly to the backend. -- Confirm websocket connections survive proxying. -- Confirm OIDC login, callback, and logout still work with the split topology. -- Confirm the existing database and volume layout do not need to change for operators. -- Confirm a self-hoster can move from the all-in-one image to the split deployment with a documented, low-friction path. - -## Assumptions - -- The first Grimmory release should remain close to the original Booklore operational model. -- Self-hosters are the primary audience, so deployment simplicity still matters more than architectural purity. -- A two-service model is acceptable; a mandatory three-container model is not the target. -- The frontend remains a static SPA rather than a server-rendered Node application.