Skip to content

Implement phased modernization baseline: contract hardening, cart/order flow fixes, and documentation inventory#2

Open
Copilot wants to merge 7 commits intomasterfrom
copilot/improve-project-implementation-plan
Open

Implement phased modernization baseline: contract hardening, cart/order flow fixes, and documentation inventory#2
Copilot wants to merge 7 commits intomasterfrom
copilot/improve-project-implementation-plan

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 28, 2026

This PR executes the missing implementable parts of the multi-phase modernization plan: locking a concrete frontend baseline, hardening frontend↔backend contract handling, and fixing critical cart/order flow issues that were still inconsistent with expected behavior.

  • Baseline + scope artifacts

    • Added explicit baseline snapshot with current runtime/dependency/tooling state and known issues:
      • docs/baseline-snapshot.md
    • Added full frontend surface inventory (routes, components, services, directives, models, styles, assets):
      • docs/frontend-inventory.md
    • Added tracked mismatch register for contract gaps and remediation state:
      • docs/contract-mismatch-register.md
    • Updated documentation index and contract/testing docs to reflect current reality:
      • README.md
      • docs/api-contract-matrix.md
      • docs/testing-strategy.md
  • Build/tooling stabilization

    • Added missing production environment replacement target:
      • src/environments/environment.prod.ts
    • Updated Angular production optimization config to avoid brittle external font inlining in constrained/offline environments:
      • angular.json
  • Contract alignment + runtime guardrails

    • Hardened buy payload normalization to handle partial/legacy responses consistently (itemId + legacy itemid, safe defaults):
      • src/app/services/buy.service.ts
    • Refactored cart state mutation to deterministic ID-based behavior for add/remove/delete-all:
      • src/app/services/client.service.ts
  • Critical cart/order flow remediation

    • Order submission now includes only user-selected cart items (not entire cart unconditionally).
    • Selection tracking now keys by buy.id instead of index, preventing desync after removals/reordering.
    • Cart checkbox state is synchronized after destructive operations.
    • Replaced alert/debug-driven UX in key paths with component status messaging:
      • src/app/components/cart.component.ts
      • src/app/components/htmls/cart.component.html
  • Lifecycle and stability cleanup

    • Added explicit subscription lifecycle cleanup and safer document access in root component:
      • src/app/components/app.component.ts
    • Improved cleanup/status handling in creation flow:
      • src/app/components/creating.component.ts
      • src/app/components/htmls/creating.component.html
    • Removed residual debug-only console noise in directives/components:
      • src/app/components/buys.component.ts
      • src/app/components/htmls/buys.component.html
      • src/app/directives/check-page.directive.ts
      • src/app/directives/scroll.directive.ts
  • Targeted test expansion (valuable logic)

    • Added coverage for cart selection semantics and checkbox sync after item removal:
      • src/app/components/cart.component.spec.ts
    • Extended service tests for defensive backend payload handling and ID-based full-remove behavior:
      • src/app/services/buy.service.spec.ts
      • src/app/services/client.service.spec.ts

Example of the key behavioral change (selection-safe order payload composition):

private getSelectedBuys(): Buy[] {
  const selectedById = new Map((this.checks.subchecks ?? []).map((check) => [check.name, check.set]));
  return Array.from(this.buysfororder).filter((buy) => selectedById.get(buy.id) ?? true);
}

Copilot AI and others added 7 commits April 28, 2026 18:03
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.

2 participants