|
| 1 | +# PR_26160_079 Browser Storage Product Data Audit |
| 2 | + |
| 3 | +Generated: 2026-06-09 |
| 4 | + |
| 5 | +## Branch Validation |
| 6 | + |
| 7 | +| Check | Expected | Actual | Status | |
| 8 | +| --- | --- | --- | --- | |
| 9 | +| Current branch | `main` | `main` | PASS | |
| 10 | + |
| 11 | +## Scope |
| 12 | + |
| 13 | +Audited active `localStorage` and `sessionStorage` usage for product data, with focus on Toolbox, Admin, and Colors paths. Deprecated archive paths, reports, generated artifacts, and `node_modules` were excluded from the active-code decision. |
| 14 | + |
| 15 | +## Requirement Checklist |
| 16 | + |
| 17 | +| Requirement | Status | Evidence | |
| 18 | +| --- | --- | --- | |
| 19 | +| Audit `localStorage` / `sessionStorage` usage for product data | PASS | Static audits listed below. | |
| 20 | +| Report anything that should move behind API/DB adapter | PASS | `toolboxaid.projectSystem.activeManifest` is identified as a product-shaped Workspace manifest persistence path that should move in a future Workspace/API migration. | |
| 21 | +| Do not remove runtime-only UI state | PASS | Runtime-only handoff, dirty-session, live preview, inspector, and header state were preserved. | |
| 22 | +| Migrate only safe Toolbox/Admin/Colors product data if found | PASS | No safe scoped Toolbox/Admin/Colors storage migration was found; no runtime changes made. | |
| 23 | +| Produce per-PR reports, diff, changed files, validation notes, ZIP | PASS | Report and package artifacts generated for this PR. | |
| 24 | + |
| 25 | +## Active Storage Findings |
| 26 | + |
| 27 | +| File | Storage | Key / Data | Classification | Runtime Effect | Recommendation | |
| 28 | +| --- | --- | --- | --- | --- | --- | |
| 29 | +| `src/shared/toolbox/projectSystem.js` | `localStorage` | `toolboxaid.projectSystem.activeManifest` via `ACTIVE_PROJECT_STORAGE_KEY` | Product-shaped Workspace manifest persistence | Stores active workspace manifest and tool state snapshots between interactions. | MIGRATE in a dedicated Workspace/API PR. Not migrated here because it crosses Workspace lifecycle, tool adapters, dirty-state, save/open, and manifest validation behavior. | |
| 30 | +| `src/tools/common/WorkspaceDirtyNotifier.js` | `sessionStorage` | `workspace.tools.<toolId>` and host context id | Runtime-only unsaved workspace dirty handoff | Marks hosted Workspace Manager tool payload dirty inside the browser session. | KEEP. This is temporary draft/dirty state allowed by governance. | |
| 31 | +| `src/tools/common/GameManifestLoader.js` | `sessionStorage` | `hostContextId` Workspace launch context | Runtime-only launch handoff | Loads a manifest passed by Workspace Manager for hosted tool launches. | KEEP for now; consider API-backed hosted-launch context during Workspace migration. | |
| 32 | +| `src/shared/toolbox/toolHostSharedContext.js` | `sessionStorage`, fallback `localStorage` | `toolboxaid.toolHost.context.<contextId>` | Runtime-only hosted tool context | Stores temporary context for tool-to-tool hosted launches. | KEEP. Not durable product SSoT. | |
| 33 | +| `src/shared/toolbox/platformShell.js` | `localStorage` | `toolboxaid.toolsPlatform.headerExpanded` | UI preference | Remembers tool header expanded/collapsed state. | KEEP. UI state only. | |
| 34 | +| `src/shared/toolbox/platformShell.js` | `localStorage` / `sessionStorage` through storage services | `toolboxaid.toolsPlatform.launchSignature` and `toolboxaid.*` cleanup | Runtime launch cleanup / UI state | Clears stale transient launch/tool state when entering a new workspace launch. | KEEP. Not product SSoT. | |
| 35 | +| `src/shared/toolbox/livePreviewSyncChannel.js` | `localStorage` fallback | `__toolboxaid_live_preview_sync_v1__` | Runtime message bridge fallback | Broadcasts live preview state when `BroadcastChannel` is unavailable. | KEEP. Transient sync bridge only. | |
| 36 | +| `src/shared/toolbox/debugInspectorData.js` | None directly | Reads passed local/session storage entries into diagnostics | Diagnostic display | Displays storage snapshots supplied by caller. | KEEP. Diagnostic only. | |
| 37 | +| `src/dev-runtime/persistence/mock-db-store.js` | `localStorage` | `gamefoundry.mockDb.v1`, `gamefoundry.mockDb.sessionUser.v1`, `gamefoundry.mockDb.sessionMode.v1` | Dev-runtime Local Mem persistence and local session state | Persists Local Mem DB/session mode/session user for local development. | KEEP within `src/dev-runtime/` for this PR. It is the configured Local Mem persistence mechanism, not a page-local Toolbox/Admin/Colors product array. | |
| 38 | +| `src/shared/contracts/*.js` | None directly | Contract terms include `localStorage` / `sessionStorage` | Contract metadata | Defines allowed storage labels in product contracts. | KEEP. No runtime storage read/write. | |
| 39 | +| `src/engine/persistence/*.js` | Generic storage adapters | Browser storage service classes | Shared infrastructure | Storage abstraction used by multiple runtime features. | KEEP. Engine migration is out of scope. | |
| 40 | + |
| 41 | +## Toolbox/Admin/Colors Result |
| 42 | + |
| 43 | +Targeted scan of `toolbox/colors`, `admin`, and `assets/theme-v2/js` found no direct `localStorage` or `sessionStorage` use. No safe active Toolbox/Admin/Colors product-data migration was available in this PR. |
| 44 | + |
| 45 | +## Deferred Migration Item |
| 46 | + |
| 47 | +`src/shared/toolbox/projectSystem.js` still stores the active Workspace manifest in `localStorage`. That is product-shaped state and should move to an API/service contract backed by a DB adapter. The safe path should be a dedicated Workspace persistence PR because the current code coordinates: |
| 48 | + |
| 49 | +- active workspace manifest load/save/close |
| 50 | +- dirty-state detection |
| 51 | +- tool adapter state capture/apply |
| 52 | +- external preset application |
| 53 | +- shared asset/palette handoff cleanup |
| 54 | +- Workspace Manager hosted launch behavior |
| 55 | + |
| 56 | +## Validation |
| 57 | + |
| 58 | +| Lane | Status | Command | Evidence | |
| 59 | +| --- | --- | --- | --- | |
| 60 | +| Branch guard | PASS | `git branch --show-current` | Returned `main`. | |
| 61 | +| Active Colors/Admin/theme storage scan | PASS | `rg -n "localStorage\|sessionStorage" toolbox/colors admin assets/theme-v2/js --glob '!**/node_modules/**'` | No matches. | |
| 62 | +| Active toolbox/runtime storage scan | PASS | `rg -n "localStorage\|sessionStorage" src/shared/toolbox src/tools/common src/dev-runtime/persistence/mock-db-store.js --glob '!**/node_modules/**'` | Findings classified above. | |
| 63 | +| Static diff validation | PASS | `git diff --check` | No whitespace errors. | |
| 64 | + |
| 65 | +## Skipped Lanes |
| 66 | + |
| 67 | +| Lane | Status | Reason | |
| 68 | +| --- | --- | --- | |
| 69 | +| Playwright | SKIP | Audit/report-only PR with no runtime or UI behavior changes. | |
| 70 | +| Full samples validation | SKIP | Samples and shared sample loaders were not changed. | |
| 71 | + |
| 72 | +## Manual Test Notes |
| 73 | + |
| 74 | +No manual browser walkthrough was required because PR_079 only documents storage ownership and does not change runtime behavior. |
0 commit comments