refactor: dedup cleanup (DUP-* issues) #285

Merged
dries merged 6 commits from chore/dup-cleanup into main 2026-07-11 11:54:59 +02:00
Owner

Closes #40 #45 #49 #50 #51 #52.

Six duplication refactors, one commit each. Each verified against current main before touching (four other DUP issues — #38 #39 #41 #44 — were already resolved on main and closed separately with notes).

  • #52 refactor(server) — extract requireMethod factory; requireGET/requirePOST become one-liners.
  • #51 refactor(db) — extract modelKey(provider, model) helper; replace 4 inline provider + "/" + model constructions. Empty-provider now yields model instead of /model (more correct; verified safe at both filter/group call sites).
  • #45 refactor(server) — extract generic writeWithUnsupportedFallback for the ErrUnsupported → empty-shape fallback shared by handleSessionChanges/handleSessionInfo.
  • #49 refactor(frontend) — extract useSidebarCallbacks hook; remove the byte-identical onRefresh/onLoadingChange effects from the 3 sidebar components.
  • #50 refactor(frontend) — migrate activity/models/hourly/hourlyTokens to the existing queryString helper.
  • #40 refactor(frontend) — reimplement useWorkingTreeDiff as a thin wrapper over useDebouncedSessionResource (152→89 lines); notRepo/404 behavior preserved via sentinel-resolve, shared base hook untouched. Tests updated.

Behavior-preserving throughout. go test ./... + vitest pass (via pre-commit on each commit).

Closes #40 #45 #49 #50 #51 #52. Six duplication refactors, one commit each. Each verified against current `main` before touching (four other DUP issues — #38 #39 #41 #44 — were already resolved on main and closed separately with notes). - **#52** `refactor(server)` — extract `requireMethod` factory; `requireGET`/`requirePOST` become one-liners. - **#51** `refactor(db)` — extract `modelKey(provider, model)` helper; replace 4 inline `provider + "/" + model` constructions. Empty-provider now yields `model` instead of `/model` (more correct; verified safe at both filter/group call sites). - **#45** `refactor(server)` — extract generic `writeWithUnsupportedFallback` for the `ErrUnsupported` → empty-shape fallback shared by `handleSessionChanges`/`handleSessionInfo`. - **#49** `refactor(frontend)` — extract `useSidebarCallbacks` hook; remove the byte-identical `onRefresh`/`onLoadingChange` effects from the 3 sidebar components. - **#50** `refactor(frontend)` — migrate `activity`/`models`/`hourly`/`hourlyTokens` to the existing `queryString` helper. - **#40** `refactor(frontend)` — reimplement `useWorkingTreeDiff` as a thin wrapper over `useDebouncedSessionResource` (152→89 lines); `notRepo`/404 behavior preserved via sentinel-resolve, shared base hook untouched. Tests updated. Behavior-preserving throughout. `go test ./...` + vitest pass (via pre-commit on each commit).
refactor(frontend): reimplement useWorkingTreeDiff on useDebouncedSessionResource (#40)
All checks were successful
CI / Build Desktop (macOS arm64) (pull_request) Successful in 1m16s
CI / Frontend (pull_request) Successful in 3m49s
CI / Backend (pull_request) Successful in 4m41s
CI / Coverage Ratchet (pull_request) Successful in 7m28s
CI / Build (pull_request) Successful in 4m44s
CI / Playwright E2E (pull_request) Successful in 7m26s
CI / Semantic Tag (pull_request) Has been skipped
1fcb96bcd5

Coverage ratchet: pass

Suite Baseline This PR Δ
go 72.10% 72.10% +0.00
frontend 62.14% 62.24% +0.10

Tolerance: -0.1%. Baseline stored on gh-pages.

<!-- coverage-ratchet --> ### Coverage ratchet: ✅ pass | Suite | Baseline | This PR | Δ | | |---|---|---|---|---| | go | 72.10% | 72.10% | +0.00 | ✅ | | frontend | 62.14% | 62.24% | +0.10 | ✅ | _Tolerance: -0.1%. Baseline stored on `gh-pages`._
dries merged commit 519c1e1d2d into main 2026-07-11 11:54:59 +02:00
dries deleted branch chore/dup-cleanup 2026-07-11 11:54:59 +02:00
Sign in to join this conversation.
No description provided.