Files
EpicNext-Cms/docs/superpowers/plans/2026-09-06-catalog-refactor.md
Simo 193b6686a9
CI / check (push) Successful in 1m16s
CI / deploy (push) Successful in 28s
refactor(catalog): unify commands and embed guarded catalog workspace
2026-09-06 19:40:52 +02:00

3.5 KiB

Catalog refactor implementation plan

For agentic workers: use superpowers:subagent-driven-development for independent changes and review each deliverable.

Goal: deliver the approved progressive catalog refactor while preserving current features. Architecture: shared domain validation and transactional commands behind existing action contracts; unified editor reuses current views and tools. Stack: Next, React, Drizzle/MariaDB, Zod, Vitest, Playwright; no added dependencies. Spec: docs/CATALOG_REFACTOR_PLAN.md Constraints: preserve normal/BC differences, direct save, real icons, permissions, existing routes, no favorites. No production data mutations for testing.

  • Characterize compatibility and command rules with tests; capture baseline source map.
  • Domain hierarchy/reorder validation and transactional page commands (normal/BC), deterministic locking, common updates/deletion.
  • Offer update/reorder atomicity and safe numeric normalization, shared mutation contracts.
  • Editor cancellation/dirty state protection (agent catalog_editor_state), review and browser verification.
  • Promote editor as an in-page view with reversible classic view, URL context, responsive panels and coherent tool access.
  • Sync outcomes/diagnostics/history integration; safe retry and explicit limits.
  • Verify unit tests, database integration if runtime available, browser, typecheck, lint/i18n, full suite; review final scope and remaining environment-only checks.

Execution notes: changes are progressive, no destructive migration. Existing UI adapters stay until functional parity is tested. Whole-program completion must not be claimed from the first deliverable.

First implementation delivery (2026-09-06)

Completed: shared normal/BC page and offer commands; transactional page reorder/delete/move and offer create/update/reorder; hierarchy validation and optimistic page-save checks; embedded default manager with classic views retained; request cancellation, editor unsaved-change guards and URL selection; bounded global category/offer/furniture search; separate hotel/Git status and hotel retry; export-finalization failures no longer mask committed server actions. Existing permissions and direct-save behavior retained. No added dependency or DB migration.

Verification: full unit suite 1308 passed / 5 skipped before final retry-classification regression; final focused catalog suite 96 passed. TypeScript, i18n static validation, Knip and Biome on all 54 changed source files pass. Browser fixtures cover editor loading races, retry failures, unsaved changes, URL history, read-only, normal/BC, search and 375px layout. Database calls and mutations are mocked in those fixtures. Full-repository formatter check reports pre-existing Windows CRLF formatting differences; unrelated files were not reformatted.

Remaining roadmap: per-operation durable dispatch/outbox, category/offer snapshot history and conflict-aware undo, contextual maintenance diagnosis, pagination/performance measurement against representative real data, further decomposition of retained legacy views. Existing coarse audit/export infrastructure remains; the new status file is not a durable outbox and RCON socket success does not prove client application. External furni importer mutation internals remain outside shared editor commands.

Environment checks still required: real MariaDB locking/rollback integration, staff-authenticated end-to-end smoke test and pipeline/deployment health. No production mutations performed; no production deployment claimed.