Commit Graph

75 Commits

Author SHA1 Message Date
Hartmut ed9827aa16 ci: fix architecture guardrails and document QNAP runner setup
CI / Architecture Guardrails (push) Failing after 5m46s
CI / Typecheck (push) Failing after 6m20s
CI / Build (push) Has been skipped
CI / E2E Tests (push) Has been skipped
CI / Unit Tests (push) Has been cancelled
CI / Assistant Split Regression (push) Has started running
CI / Lint (push) Has started running
Release Image / Build And Push Images (push) Has been cancelled
Docker Deploy Test / Fresh-Linux Docker Deploy (push) Has started running
- release-image.yml: add guardrail anchor comments for runner/migrator target markers
- useTimelineSSE.ts: trim JSDoc to stay under 120-line limit
- timelineDragCleanup.ts: bump guardrail to 115 lines (type defs are cohesive, splitting would not reduce complexity)
- .gitea/gitea_compose_qnap_all_in_one.md: full QNAP Container Station setup with absolute /share/Container/gitea paths, explicit act_runner register step, and $$-escaped env vars

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-12 12:11:24 +02:00
Hartmut f3fa902773 fix(web): make invalidation hooks async with Promise.all and fix cross-view staleness
- useInvalidateTimeline and useInvalidatePlanningViews now return
  Promise.all instead of fire-and-forget void calls
- Timeline mutations now use useInvalidatePlanningViews to also
  invalidate allocation list views, preventing stale data
- AllocationsClient sequential awaits replaced with single
  invalidatePlanningViews() call (parallel invalidation)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 08:24:33 +02:00
Hartmut 9bd7172018 test(web): add 162 tests for animation components and hooks
Components: AnimatedNumber (14), InfiniteScrollSentinel (16),
FadeIn (22), StaggerList (26).

Hooks: useUrlFilters (32), useWidgetFilterOptions (27),
useProjectDragContext (27).

Web test suite: 96 → 103 files, 1076 → 1238 tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 22:45:44 +02:00
Hartmut d3f721ce58 refactor(web): extract ResourcesClient types + inline components, fix test TS errors
Extract types.ts, FilterDropdown.tsx, BooleanBadge.tsx from
ResourcesClient.tsx into resource-client/ subdirectory.
ResourcesClient reduced from 1,613 to 1,507 lines.

Fix TypeScript strict mode errors across 8 test files:
- Add id/order to BlueprintFieldDefinition test objects
- Use FieldType enum instead of string literals in useFilters
- Add non-null assertions for mock.calls array access
- Type ScrollDiv for jsdom scrollLeft workaround
- Fix exactOptionalPropertyTypes violations

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 22:40:24 +02:00
Hartmut dcac9952ca test(web): add 232 tests for catalog, presets, skeleton, hooks
Lib: blueprint-field-catalog (74).

Hooks: useAppPreferences (25), useTheme (19),
useMultiSelectIntersection (12), useTimelineKeyboard (21).

Components: ColumnTogglePanel, DateRangePresets (17, timezone-safe),
ShimmerSkeleton (29), SuccessToast.

Fix ShimmerGroup tests to use plain divs (ShimmerSkeleton doesn't
forward the style prop from cloneElement).
Fix DateRangePresets tests to compute expected dates via toISOString
matching the component's UTC conversion.

Web test suite: 87 → 96 files, 844 → 1076 tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 17:27:35 +02:00
Hartmut a3d75973ee test(web): add 291 tests for parsers, hooks, and UI components
Lib utilities: scopeImportParser (31), status-styles (58),
planningEntryIds (10), uuid (11).

Hooks: useFilters (28), useRowOrder (18), usePermissions (30),
useViewPrefs (24).

Components: AnimatedModal (14), DateInput (22), InfoTooltip (13),
ProgressRing (19).

Web test suite: 75 → 87 files, 553 → 844 tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 17:14:11 +02:00
Hartmut 98dca6126f test(web): add 210 tests for lib utils, hooks, and UI components
Lib utilities: format (38), sanitize (12), project-colors (18),
csv-export (14).

Hooks: useDebounce (8), useTableSort (22), useLocalStorage (18),
useColumnConfig (19).

Components: BatchActionBar (17), SortableColumnHeader (14),
FilterChips (14), ErrorBoundary (16).

Web test suite: 63 → 75 files, 343 → 553 tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 17:11:00 +02:00
Hartmut c0ba062460 test(web): add 57 UI component and hook tests with jsdom cleanup
Fix jsdom environment: add esbuild automatic JSX transform and
afterEach cleanup to prevent DOM leakage between tests.

Components: Badge (8), Button (13), FilterBar (5), EmptyState (8),
ConfirmDialog (8), useSelection hook (15).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 17:06:42 +02:00
Hartmut 82acc56b8d chore: add pre-commit hooks, tighten ESLint, activate Sentry DSN, publish CI coverage (Phase 1)
- Install husky v9 + lint-staged: pre-commit runs eslint --fix and prettier on staged files
- Tighten ESLint base config: no-console→error, ban-ts-comment (ts-ignore banned, ts-expect-error with description allowed), reportUnusedDisableDirectives→error
- Migrate web app from deprecated `next lint` to `eslint src/` with flat config and react-hooks plugin
- Convert all 5 @ts-ignore to @ts-expect-error with descriptions, remove stale disable comments
- Add NEXT_PUBLIC_SENTRY_DSN to docker-compose.prod.yml and .env.example
- Add coverage artifact upload step to CI test job
- Pre-existing violations (102 warnings) downgraded to warn in web config for Phase 2 cleanup

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 14:49:29 +02:00
Hartmut e4bf121b33 feat(ui): weekend/vacation/checkbox colors follow accent theme
- Unify Saturday+Sunday into single isWeekend flag (header + grid lines)
- Replace hardcoded amber vacation bar/tooltip colors with brand-* classes
- Add global accent-color for checkboxes and radio buttons via CSS variable
- Update VACATION_TIMELINE_COLORS/BORDER to use brand palette (SICK stays red)
- Vacation-only tooltip uses neutral dark surface with brand accent border

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 14:06:44 +02:00
Hartmut 5cc177ccf9 fix(dashboard): prevent stale DB data from overwriting newer localStorage layout
Two related fixes:
1. When localStorage has a saved layout, mark it as authoritative so a DB
   response carrying older data (e.g. from a save cancelled by navigating away
   within the 2-second debounce window) cannot overwrite it.
2. Flush any pending debounced DB save immediately on component unmount so
   that navigating away within the window doesn't silently lose changes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 21:14:36 +02:00
Hartmut 43de66e982 feat(api): add audit helpers, tool registry, shared tool manifest types, and UI primitives
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 21:14:26 +02:00
Hartmut 6bf60c8e07 feat(web): persist list-page filters in URL search params
Resources, projects, and allocations filter state now syncs to/from
URL so filters survive refresh and can be shared via link.
Text inputs are debounced (300ms) to avoid URL churn.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 17:00:30 +02:00
Hartmut 1df208dbcc feat(timeline): add pulse animation for in-flight drag mutations
Allocation bars that have active optimistic overrides (post-drag,
awaiting server confirmation) now pulse subtly via animate-pulse.
The pending set is derived from the existing optimisticAllocations
map keys, requiring no additional state.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 13:28:46 +02:00
Hartmut fa54ef4cbd feat(timeline): add keyboard navigation with shortcut overlay
- Arrow left/right scrolls the timeline by 1 day (Shift: 1 week)
- Delete/Backspace deletes selected allocations
- ? toggles a keyboard shortcut overlay
- Floating ? button in bottom-right corner provides persistent access
- (Del) hint added to the FloatingActionBar delete button

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 13:20:32 +02:00
Hartmut 6831e199c6 feat(ux): Sprint 1 — quick wins: EmptyState, DateRangePresets, debounce, save feedback, scenarios nav
- EmptyState shared component; replace AllocationsClient inline empty state
- DateRangePresets (this month/quarter/3 months/year) integrated into AllocationModal
- Debounce conflict-check inputs in AllocationModal (400ms) using existing useDebounce
- Dashboard layout save feedback via SuccessToast after DB write completes
- Scenarios nav item in Planning sidebar + /scenarios list page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 13:08:19 +02:00
Hartmut a16c41e739 fix(dashboard): show skeleton instead of default layout until hydration completes
Root cause: useDashboardLayout initialised React state with createDefaultDashboardLayout()
(1 widget), so the wrong default rendered during the ~100–500ms window while React Query
fetched the user session and DB layout after login. On reload within staleTime the cache
hit resolved instantly, masking the bug.

Fix: add isHydrated boolean state that becomes true only once localStorage OR DB
hydration has settled; DashboardClient renders a GridLayoutSkeleton until then.
Also adds router.refresh() in the sign-in handler to bust the Next.js Router Cache
so the post-login navigation always lands on a fresh server component tree.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 10:20:50 +02:00
Hartmut bc0bb5bdb8 test: add coverage for gitlooper ticket sweep
- useFocusTrap.test.ts: 7 unit tests covering rAF-deferred focus,
  Tab/Shift+Tab wrapping, empty-list guard, and cleanup (#56)
- nextConfig.test.ts: 3 tests for /login and /blueprints redirects (#51 #52);
  5 tests for COMPLETED demand exclusion filter logic (#66)

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-03 17:33:27 +02:00
Hartmut 65db330a4d fix(ux): resolve tickets #55 #56 — resource modal stability and success feedback
#55: Add SuccessToast after new resource is created. ResourceModal gains an
optional onSuccess(displayName) prop; ResourcesClient wires it to a toast
that auto-dismisses after 2.5 s.

#56: Fix useFocusTrap stale-closure bug. Focusable elements are now queried
dynamically inside handleKeyDown (not captured once at mount), so Tab
navigation stays correct as the form re-renders. Initial focus is deferred
via requestAnimationFrame so the browser layout is stable before focus() fires.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-03 15:43:12 +02:00
Hartmut e7e525df49 fix(timeline): clear multi-select on drag start and lock in SSE edge-case coverage
- useTimelineDrag: onProjectBarMouseDown and single-alloc drag path now reset
  multiSelectRef + multiSelectState before starting a new drag, so the
  FloatingActionBar is dismissed immediately when an unrelated drag begins
- FloatingActionBar.test.tsx: 4 regression tests for the null-render guard
  (count=0) and all three label variants
- useTimelineSSE.test.ts: 2 new tests — tab hides during pending reconnect
  timer (clears timer, resyncs on next open) and first-ever connection fails
  before any open (retry open still resyncs correctly)
- assistant-tools-user-admin-inventory-read.test.ts: add isActive to expected
  findMany select shape (already in production, test was stale)

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-02 21:16:10 +02:00
Hartmut 8d9e26872b fix(timeline): stabilize popovers on internal scroll + expand test coverage
B-1: useViewportPopover — ignoreScrollContainers option; scroll events
originating inside the timeline canvas no longer close point-anchor popovers
B-2: AllocationPopover, DemandPopover, NewAllocationPopover — thread
scrollContainerRef through so horizontal timeline scroll is ignored
B-3: AllocationPopover — staleTime 0 so SSE reconnect triggers immediate refetch
B-4: useViewportPopover.test.ts — 6 new tests (scroll close, ignore container,
resize close, style clamping)
B-5: AllocationPopover.test.tsx — loading state + happy-path tests added

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-02 20:49:08 +02:00
Hartmut 745be7ee8b fix(dashboard): scope localStorage key by userId to prevent cross-user layout bleed (#27)
New users on a shared device were picking up a previous user's stale
(potentially empty) dashboard layout from localStorage because the key
"capakraken_dashboard_v1" was not user-scoped.

- useDashboardLayout: key is now capakraken_dashboard_v1_{userId};
  userId is resolved via trpc.user.me before touching localStorage
- Initial state falls back to createDefaultDashboardLayout() until
  userId resolves, then hydrates from the user-scoped key
- DB layout still wins over localStorage when it has data (unchanged)
- E2E test suite covers: new-user flow, modal widget list, add widget
  persists after reload, cross-user localStorage isolation
- plan.md: added ticket #27 implementation plan

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-01 22:44:41 +02:00
Hartmut 4b14db9dc6 fix(timeline): pause sse while hidden 2026-04-01 15:05:34 +02:00
Hartmut 3258b59e21 fix(timeline): resync after sse reconnect 2026-04-01 15:04:00 +02:00
Hartmut d4652b7a42 fix(timeline): cancel stranded drag interactions 2026-04-01 14:57:56 +02:00
Hartmut a71bbeb640 fix(timeline): stabilize overlay lifecycle 2026-04-01 14:41:03 +02:00
Hartmut e103174d39 refactor(web): extract preview target setup 2026-04-01 11:59:10 +02:00
Hartmut 2a7769a0de refactor(web): extract range release resolution 2026-04-01 11:53:11 +02:00
Hartmut 1e2bd3d4eb refactor(web): extract project drag finalize 2026-04-01 11:49:14 +02:00
Hartmut 463caedcfd refactor(web): extract touch event forwarding 2026-04-01 11:39:39 +02:00
Hartmut 37c6e03d23 refactor(web): extract allocation release effects 2026-04-01 11:35:17 +02:00
Hartmut f4e9831dea refactor(web): extract allocation drag session 2026-04-01 11:27:03 +02:00
Hartmut 510459fbff refactor(web): extract allocation multi-drag session 2026-04-01 11:22:18 +02:00
Hartmut 5402189158 refactor(web): extract drag position helpers 2026-04-01 11:18:31 +02:00
Hartmut 3fe3a5fb2a refactor(web): extract project drag session 2026-04-01 11:16:15 +02:00
Hartmut 0181f2b304 refactor(web): extract multi-select session 2026-04-01 11:14:28 +02:00
Hartmut b14be80e32 refactor(web): extract timeline drag cleanup 2026-04-01 11:12:20 +02:00
Hartmut 922394c56a refactor(web): split touch canvas adapters 2026-04-01 11:09:26 +02:00
Hartmut a4789d718b refactor(web): centralize multi-select release handling 2026-04-01 10:50:21 +02:00
Hartmut ca947befde refactor(web): extract allocation release classification 2026-04-01 10:48:47 +02:00
Hartmut 0ab1374853 refactor(web): centralize touch mouse adapters 2026-04-01 10:43:38 +02:00
Hartmut eda8722d83 refactor(web): extract document drag listeners 2026-04-01 10:39:28 +02:00
Hartmut 84c5760392 refactor(web): extract range selection bootstrap 2026-04-01 10:17:39 +02:00
Hartmut c941b1e5cf refactor(web): extract allocation drag action plans 2026-04-01 10:15:54 +02:00
Hartmut 203bb8751d refactor(web): extract allocation drag bootstrap 2026-04-01 10:10:06 +02:00
Hartmut 892a9c5ccf refactor(web): extract project drag helpers 2026-04-01 10:06:32 +02:00
Hartmut c32f56ba89 refactor(web): extract allocation multi-drag helpers 2026-04-01 10:03:16 +02:00
Hartmut 6dac993521 refactor(web): extract allocation drag finalize helpers 2026-04-01 09:57:29 +02:00
Hartmut 54c6cf2e2d refactor(web): extract optimistic timeline reconciliation 2026-04-01 09:53:40 +02:00
Hartmut 848797b4d2 refactor(web): extract timeline range selection helpers 2026-04-01 09:51:18 +02:00