{
  "generatedAt": "2026-07-09T19:18:09.286Z",
  "repo": {
    "branch": "reports",
    "ref": "84170ae"
  },
  "prd": {
    "sourceFound": true,
    "title": "InventoryReconciliation - PRD",
    "pages": 12,
    "bytes": 492525,
    "created": "2026-07-03 06:01:08 +0000",
    "extractionNote": "PDF text was not available with installed local tools; report treats the PRD as a referenced input, not as extracted scope."
  },
  "features": {
    "sourceFound": true,
    "kpis": {
      "Feature workstreams delivered": "10",
      "Feature commits · FE 27 / BE 12": "39",
      "Files changed · +18.3K lines": "278"
    },
    "cards": [
      {
        "id": "BE-T01-T08 / Platform View",
        "title": "Fourth Planning Tier - \"Platform\"",
        "detail": "A new Platform level was inserted between Brick and Fit end-to-end - schema, DTOs, calc engine, Redux, API, grid and export - giving planners a new \"Platform View\" tab and a full `GenCat->Brick->Platform->Fit` drill-down."
      },
      {
        "id": "SPEC-14",
        "title": "Width-Led Planning Model",
        "detail": "The editable lever was inverted so Width is edited and Depth is derived (`Depth = Sell-In ÷ Width`). Width edits cascade down to children by ratio and roll up to parents as the sum of child widths, with offering-count constraints validated per level."
      },
      {
        "id": "F005",
        "title": "Automatic Distribution % Normalization",
        "detail": "Editing a distribution % auto-adjusts sibling values so each group always totals 100% (proportional, equal, or zero-out strategies via `decimal.js`). Adjusted cells flash briefly and a debounced toast confirms the change."
      },
      {
        "id": "F006",
        "title": "Navy & Red Design System",
        "detail": "The planning grid was rebuilt on a token-driven Navy `#10233f` + Red `#c41230` system: source-coded zone bands (Structure / Actuals / Recommendation / Input), a floating-cell table look, red editable-cell text, and 10 reusable styled primitives."
      },
      {
        "id": "F007 / F012",
        "title": "Focused Grid & Collapsible Bands",
        "detail": "Reference column bands (Historical & AI) collapse in place to a narrow strip while User Inputs stays visible, with state remembered per view. Columns were reduced to the four most relevant per zone with Level/Assortment pinned."
      },
      {
        "id": "S13-F-003",
        "title": "Per-View Search",
        "detail": "A search box on each planning view flattens the grid to only the matching rows at that view's editable level, with an ancestor breadcrumb shown above results. It is display-only - it never alters saved data or edit state."
      },
      {
        "id": "Admin",
        "title": "Engagement & Finalization Dashboard",
        "detail": "A new admin dashboard surfaces the headline Levi's metric - \"downloaded but not edited\" - alongside login recency and store-finalization KPIs, plus a searchable, paginated franchisee table with lazy per-store drill-down."
      },
      {
        "id": "S13-F-005",
        "title": "User Management & Profiles",
        "detail": "A full user directory replaced the previous placeholder: create / edit / delete, a 6-role model , franchise-code assignment with exclusive-ownership handling, one-time password display, onboarding email, and a self-service profile / change-password area for every role."
      },
      {
        "id": "Planning",
        "title": "Reset to AI Recommendations",
        "detail": "A guarded, confirm-gated action that atomically restores a store's entire plan to the AI baseline across all levels, clears edit-audit flags, and un-finalizes the store - available from all four planning views."
      },
      {
        "id": "FE-T12 / BE-T08",
        "title": "Multi-Level Excel Export",
        "detail": "The workbook export was extended to a dedicated Platform sheet (5 sheets total), with Depth on every sheet and client-facing header terminology (e.g. GenCat, PC9 Count, Sell Through %)."
      }
    ],
    "apiRows": [
      {
        "method": "GET",
        "path": "/planning/platform (+ /:gencat, /:gencat/:brick) new",
        "purpose": "Platform-view drill-down (summary -> brick -> platform rows)"
      },
      {
        "method": "PUT",
        "path": "/planning/platform new",
        "purpose": "Save a platform-level plan (GenCat / Brick / Platform / Fit arrays)"
      },
      {
        "method": "GET",
        "path": "/planning/brickfit/:gencat/:brick/:platform new",
        "purpose": "Fit-level rows under a platform"
      },
      {
        "method": "GET",
        "path": "/planning/brickfit/:gencat/:brick changed",
        "purpose": "Now returns platform_rows (was fit_rows) - hierarchy realignment"
      },
      {
        "method": "POST",
        "path": "/stores/:store_code/planning/reset new",
        "purpose": "Reset a store to AI recommendations (confirm-gated, atomic)"
      },
      {
        "method": "GET",
        "path": "/admin/dashboard/summary new",
        "purpose": "Engagement & finalization KPIs"
      },
      {
        "method": "GET",
        "path": "/admin/dashboard/franchisees (+ /:id/stores) new",
        "purpose": "Paginated, searchable franchisee list + per-store drill-down"
      },
      {
        "method": "GET",
        "path": "/admin/users/stats new",
        "purpose": "User counts by role & recent signups"
      },
      {
        "method": "POST",
        "path": "/admin/users/:id/password-reset changed",
        "purpose": "Admin password reset (was `PATCH .../password`)"
      },
      {
        "method": "GET",
        "path": "/auth/profile · PUT /auth/profile new",
        "purpose": "Self-service profile read / update"
      },
      {
        "method": "PUT",
        "path": "/auth/password now functional",
        "purpose": "Change own password (was a non-functional stub)"
      }
    ],
    "dbRows": [
      "Planning schema deepened for Platform - a `platform` column was added to `som_inputs`, `buy_plan_recommendations` and both historical-season tables; uniqueness keys widened to a 6-part composite; the category column widened to `VARCHAR(100)`; and the level constraint / indexes extended to include `PLATFORM`.",
      "New `exports` table tracks asynchronous export jobs (storage key, type, status, expiry) - this powers the dashboard's \"downloaded\" engagement signal.",
      "`users.last_login_at` and `users.is_active` columns added - enabling login tracking and the engagement KPIs.",
      "Applied via the tenant schema template, not a versioned migration. New environments provision correctly; existing tenant databases require the two idempotent backfill scripts (exports table, user columns) to be run once. See follow-ups."
    ],
    "fixes": [
      "Standard users could not log in high - login now resolves the active environment; previously only super-admins authenticated.",
      "Change-password was a non-functional stub high - now fully implemented with current-password verification.",
      "Platform View showed empty / zero values med - a type cast dropped the new level; fixed so Platform data renders.",
      "Store \"Segment\" mapped to the wrong field med - corrected in both the API response and the planning header.",
      "Multi-store export skipped the Platform level med - export now drills the full hierarchy.",
      "Pinned columns hidden on horizontal scroll - sticky headers rendered over the pinned Level / Assortment columns; z-index layering corrected.",
      "Grid visual defects - mislabeled Historical band color, cell-pill misalignment, and off-center grouped headers all corrected.",
      "Frontend test tooling repaired. Thirteen test files still called the old `jest.*` API under the Vitest runner (\"`jest is not defined`\"); these were migrated to `vi.*`, the missing `msw` test dependency was installed, and two broken import paths were corrected - clearing the tooling errors that were stopping those files from running."
    ],
    "source": "Saved feature artifact parsed during report generation",
    "liveUrlNote": "Live Claude artifact fetch is Cloudflare-protected for unattended automation; saved local artifact was parsed."
  },
  "testing": {
    "sourceFound": true,
    "command": "npm run test:coverage",
    "suites": {
      "passed": 192,
      "total": 192
    },
    "tests": {
      "skipped": 1,
      "passed": 3986,
      "total": 3987
    },
    "timeSeconds": 147.999,
    "coverage": {
      "statements": {
        "pct": 60.47,
        "covered": 9056,
        "total": 14976
      },
      "branches": {
        "pct": 51.69,
        "covered": 2824,
        "total": 5463
      },
      "functions": {
        "pct": 57.74,
        "covered": 1290,
        "total": 2234
      },
      "lines": {
        "pct": 60.72,
        "covered": 8739,
        "total": 14390
      }
    },
    "warnings": [
      "watchman recrawl warning",
      "ts-jest globals config deprecation warning",
      "AWS SDK Node version support warning",
      "Jest forceExit notice"
    ],
    "sourcePath": "evidence/test_coverage.log"
  },
  "sonar": {
    "sourceFound": true,
    "sourcePath": "evidence/sonar_scan.md",
    "screenshotPath": "assets/SonarQubeReport.png",
    "dashboard": {
      "source": "Fallback screenshot, visually transcribed from SonarQubeReport.png",
      "qualityGate": "Passed",
      "linesOfCode": "42k",
      "securityIssues": 0,
      "reliabilityIssues": 0,
      "maintainabilityIssues": 235,
      "acceptedIssues": 0,
      "coverage": "59.2%",
      "linesToCover": "14k",
      "duplications": "4.1%",
      "duplicatedLinesBasis": "67k",
      "securityHotspots": 0,
      "ratings": {
        "security": "A",
        "reliability": "A",
        "maintainability": "A",
        "securityHotspots": "A"
      }
    },
    "scan": {
      "command": "npm run sonar:scan",
      "projectKey": "levis-bp-be",
      "serverVersion": "26.7.0",
      "scannerVersion": "4.3.8",
      "indexedFiles": 608,
      "analyzedFiles": 595,
      "ignoredFiles": 381,
      "analysisUrl": "http://localhost:9000/dashboard?id=levis-bp-be",
      "taskUrl": "http://localhost:9000/api/ce/task?id=a12b5787-0b43-47b4-ba99-81ee26d02147",
      "totalTime": "59.689 s",
      "lcovImported": true,
      "warnings": [
        "ScannerEngine: Invalid character encountered in file src/modules/planning/repositories/som.repository.ts at line 2657 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.",
        "ScannerEngine: Invalid character encountered in file src/modules/planning/__tests__/audit-columns-database.integration.spec.ts at line 4 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.",
        "ScannerEngine: Invalid character encountered in file src/modules/shared/__tests__/email-templates.spec.ts at line 229 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.",
        "ScannerEngine: Invalid character encountered in file src/modules/shared/__tests__/transaction-performance.integration.spec.ts at line 156 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.",
        "ScannerEngine: Could not resolve 9 file paths in [coverage/lcov.info]",
        "ScannerEngine: First unresolved path: src/modules/environment/tests/schema-isolation-helper.ts (Run in DEBUG mode to get full list of unresolved paths)",
        "ScannerEngine: Missing blame information for the following files:",
        "ScannerEngine:   * src/modules/auth/dto/login.dto.ts",
        "ScannerEngine: This may lead to missing/broken features in SonarQube"
      ]
    },
    "note": "Local SonarQube API returned 401 without credentials during generation; report uses bundled scan notes plus supplied dashboard screenshot."
  }
}
