|
| 1 | +# PR_26175_CHARLIE_003-r2-storage-standardization |
| 2 | + |
| 3 | +Team: Charlie |
| 4 | + |
| 5 | +Purpose: Standardize R2 project asset storage around `GAMEFOUNDRY_STORAGE_PROJECTS_PREFIX` and the approved project prefix set. |
| 6 | + |
| 7 | +## Branch Validation |
| 8 | + |
| 9 | +| Check | Expected | Actual | Status | |
| 10 | +|---|---|---|---| |
| 11 | +| Active branch | `PR_26172_CHARLIE_repository-compliance-stack` | `PR_26172_CHARLIE_repository-compliance-stack` | PASS | |
| 12 | +| Worktree before BUILD | clean | clean | PASS | |
| 13 | +| Local/origin sync before BUILD | `0 0` | `0 0` | PASS | |
| 14 | +| Team ownership | Charlie storage/infrastructure | R2 storage configuration standardization | PASS | |
| 15 | + |
| 16 | +## Implementation Summary |
| 17 | + |
| 18 | +- Added `STORAGE_PROJECTS_PREFIX_LANES` and `STORAGE_PROJECTS_ALLOWED_PREFIXES` as the shared approved project prefix contract. |
| 19 | +- Restricted `loadStorageConfig()` to normalized prefixes matching: |
| 20 | + - `/dev/projects/` |
| 21 | + - `/ist/projects/` |
| 22 | + - `/uat/projects/` |
| 23 | + - `/prod/projects/` |
| 24 | +- Updated Admin Infrastructure and Local API storage path status to use `/prod/projects/` for the PRD lane. |
| 25 | +- Kept R2 list/read/write/delete behavior unchanged and still routed through the configured project prefix. |
| 26 | +- Updated `.env.example` comments and `scripts/validate-storage-config.mjs` safe output to name approved prefixes. |
| 27 | +- Added focused `node:test` coverage for prefix normalization, allow-list validation, missing prefix handling, and safe config secret masking. |
| 28 | + |
| 29 | +## Files Changed |
| 30 | + |
| 31 | +- `.env.example` |
| 32 | +- `admin/infrastructure.html` |
| 33 | +- `assets/theme-v2/js/admin-infrastructure.js` |
| 34 | +- `scripts/validate-storage-config.mjs` |
| 35 | +- `src/dev-runtime/server/local-api-router.mjs` |
| 36 | +- `src/dev-runtime/storage/storage-config.mjs` |
| 37 | +- `tests/dev-runtime/StorageConfig.test.mjs` |
| 38 | +- `tests/playwright/tools/AdminPlatformToolsWireframes.spec.mjs` |
| 39 | + |
| 40 | +## Scope Guardrails |
| 41 | + |
| 42 | +| Requirement | Status | Notes | |
| 43 | +|---|---:|---| |
| 44 | +| Preserve R2 list/read/write/delete behavior | PASS | Connectivity action code paths were not changed. | |
| 45 | +| Preserve System Health safe status surface | PASS | Existing Admin Health Operations test and page spec passed. | |
| 46 | +| Preserve Infrastructure safe status surface | PASS | Storage path status rows now use the shared approved prefix list. | |
| 47 | +| Do not expose secrets | PASS | Safe config excludes access key and secret key values; validation output printed no secret values. | |
| 48 | +| Do not implement telemetry | PASS | No telemetry code was added. | |
| 49 | +| Do not implement configurable runtime ports | PASS | Runtime port logic was not changed. | |
| 50 | +| Do not edit local ignored `.env` files | PASS | Only `.env.example` was updated. | |
| 51 | + |
| 52 | +## Validation Lane Report |
| 53 | + |
| 54 | +| Command | Result | |
| 55 | +|---|---:| |
| 56 | +| `git diff --check` | PASS | |
| 57 | +| `node --test tests/dev-runtime/StorageConfig.test.mjs` | PASS, 5 tests | |
| 58 | +| `node --test tests/dev-runtime/AdminHealthOperations.test.mjs` | PASS, 4 tests | |
| 59 | +| `npx playwright test tests/playwright/tools/AdminPlatformToolsWireframes.spec.mjs --grep "Infrastructure storage path status"` | PASS, 4 tests | |
| 60 | +| `npx playwright test tests/playwright/tools/AdminHealthOperationsPage.spec.mjs` | PASS, 3 tests | |
| 61 | +| `node scripts/validate-storage-config.mjs` | FAIL due local Node certificate trust error before code changes were needed | |
| 62 | +| `node --use-system-ca scripts/validate-storage-config.mjs` | PASS; R2 list/readiness succeeded for `/dev/projects/` with 0 objects | |
| 63 | + |
| 64 | +## Validation Notes |
| 65 | + |
| 66 | +- The first `validate-storage-config` run loaded `.env`, confirmed all storage keys were present, and printed only safe endpoint, bucket, and prefix values. It failed on `UNABLE_TO_VERIFY_LEAF_SIGNATURE`. |
| 67 | +- The rerun with `--use-system-ca` passed and confirmed the R2 list/readiness behavior under the approved `/dev/projects/` prefix. |
| 68 | +- Active code, config, Admin UI, and targeted tests no longer use `/prd/projects/`. |
| 69 | +- Historical report references to `/prd/projects/` were left untouched as report history. |
| 70 | + |
| 71 | +## Skipped Lanes |
| 72 | + |
| 73 | +- Full samples smoke: skipped; out of scope for R2 prefix standardization. |
| 74 | +- Broad Playwright: skipped; targeted Admin Infrastructure and System Health specs passed. |
| 75 | +- Telemetry validation: skipped; telemetry is explicitly out of scope. |
| 76 | +- Configurable runtime port validation: skipped; runtime ports are explicitly out of scope. |
| 77 | + |
| 78 | +## BUILD Result |
| 79 | + |
| 80 | +BUILD status: PASS. |
| 81 | + |
| 82 | +Recommendation: Keep this commit on the Charlie stack for owner review. |
0 commit comments