Skip to content

Phase 0: safety net & security — lockfile, CI, e2e + characterization tests#216

Merged
HelgaZhizhka merged 9 commits into
developfrom
refactor/phase-0-safety-net
Jun 11, 2026
Merged

Phase 0: safety net & security — lockfile, CI, e2e + characterization tests#216
HelgaZhizhka merged 9 commits into
developfrom
refactor/phase-0-safety-net

Conversation

@HelgaZhizhka

Copy link
Copy Markdown
Owner

Summary

Phase 0 of the refactoring plan (REFACTORING_PLAN.md): the project stops being
unreproducible and gets a full behavior-pinning safety net before any stack
migration starts. No app behavior changes.

  • Harness: CLAUDE.md (agent working contract), docs/refactor/ (plan,
    progress, per-phase checklists), scripts/verify.sh (single verification gate)
  • 0.1 security: switched to a new minimal-scope (SPA template) commercetools
    API client; .env.example added; old 2023 client deactivated in Merchant Center
  • 0.2 reproducibility: package-lock.json committed (was gitignored),
    .nvmrc → Node 22
  • 0.3 cleanup: removed 9 unused dependencies (axios, date-fns, jsdom,
    localforage, match-sorter, sort-by, react-transition-group + types, @mui/joy)
    and 100+ committed build artifacts in public/css
  • 0.4 CI: GitHub Actions — install + tsc + eslint + unit tests on PR
  • 0.5 e2e: Playwright suite, 11 tests pinning current behavior: smoke,
    catalog (listing/pagination/subcategories), size filter + reset, cart
    (add/quantity/remove/clear), promo code, 3-step registration, login/logout,
    profile. Known quirks pinned on purpose ("Sing up" typo, unstable product
    sort, cart-version race) — fix candidates live in phases 3-5 of the plan
  • 0.6 characterization tests: 27 unit tests for cart math, product helpers
    and credential validators (previously zero coverage), bugs marked
    TODO(refactor)
  • Fixes that were required to make gates pass: pre-commit hook broke in
    non-tty environments (exec >/dev/tty), tsc error in Price.test.tsx

Verification

./scripts/verify.sh → exit 0:

=== Install ===
=== Typecheck ===
=== Lint ===
=== Unit tests ===
Test Suites: 18 passed, 18 total
Tests:       69 passed, 69 total
=== E2E (Playwright) ===
  11 passed
=== VERIFY OK ===

E2E suite verified green twice in a row locally (flake check).

- REFACTORING_PLAN.md: full audit + 7-phase migration plan to modern stack
- CLAUDE.md: working contract for agent sessions (rules, verification, landmines)
- docs/refactor/: PROGRESS.md (session handoff) + per-phase checklists
- scripts/verify.sh: single verification gate
…, add CI

- package-lock.json now committed (removed from .gitignore); npm ci reproducible
- remove 9 unused packages: axios, date-fns, jsdom, localforage, match-sorter,
  sort-by, react-transition-group, @types/react-transition-group, @mui/joy
- delete public/css/** (committed build artifacts, referenced nowhere)
- add .nvmrc (Node 22) and GitHub Actions CI: tsc + eslint + unit tests
- fix type error in Price.test.tsx (string passed to number prop)
- fix pre-commit hook: drop 'exec >/dev/tty' (broke commits in non-tty
  environments: CI, GUI clients)
- new client in yes-code-project-0526: token, categories (17), products (110),
  anonymous cart all verified; home + catalog render in dev
- promo code BAGS15-SP exists but expired 2026-03-15 — tracked as human
  follow-up (blocks promo e2e scenario)
- add .claude/launch.json for dev-server preview
- 10 green tests: smoke (home, header), catalog (listing, pagination,
  subcategory), size filter + reset, cart (add/quantity/remove line
  item/clear all), auth (3-step registration wizard, logout, login,
  profile view + edit mode)
- promo spec is test.fixme until BAGS15-SP validity is extended in
  Merchant Center (expired 2026-03-15)
- pins current quirks on purpose: 'Sing up' typo, layout-invisible card
  anchors, unstable product sort, cart-version race guarded via networkidle
- e2e excluded from ESLint 8 until phase 1 flat-config migration
- verify.sh gate: install + tsc + lint + 42 unit + 10 e2e — all green
… credential validators

- 27 new unit tests pinning current behavior before migration:
  getCartProducts (prices/discounts/promo + undefined-string quirks),
  getPriceValue, extractSizesWithVariantId (last-variant dedupe),
  getSku (pinned BUG: TypeError on unknown variant id),
  transformFetchedCategories, sigIn/signUp validators (had zero coverage;
  pinned always-empty errors object and single-char-password bug)
- bugs marked TODO(refactor) for phases 3-4
- full gate: install + tsc + lint + 69 unit + 10 e2e — exit 0
- un-fixme promo.spec.ts; apply button is 'Ok' on the cart page
- full e2e suite: 11/11 green
@HelgaZhizhka HelgaZhizhka merged commit 87654bb into develop Jun 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant