|
| 1 | +# BUILD_PR_SHARED_EXTRACTION_45_READ_HOST_STATUS_SNAPSHOT_BATCH |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Centralize duplicated dashboard/inspector host reader helpers across the exact engine batch identified in the duplicate report. |
| 5 | + |
| 6 | +## Single PR Purpose |
| 7 | +Normalize ONLY these helpers: |
| 8 | + |
| 9 | +- `readHostStatus(host)` |
| 10 | +- `readHostSnapshot(host)` |
| 11 | + |
| 12 | +## Exact Files Allowed |
| 13 | + |
| 14 | +### New shared file |
| 15 | +1. `src/engine/debug/network/shared/hostReadUtils.js` |
| 16 | + |
| 17 | +### Consumer files |
| 18 | +2. `src/engine/debug/inspectors/commands/registerInspectorCommands.js` |
| 19 | +3. `src/engine/debug/network/dashboard/registerDashboardCommands.js` |
| 20 | + |
| 21 | +Do not edit any other file. |
| 22 | + |
| 23 | +## Source of Truth |
| 24 | +This exact scope comes from the provided duplicate report entries for: |
| 25 | +- `function readHostStatus(host)` |
| 26 | +- `function readHostSnapshot(host)` |
| 27 | + |
| 28 | +Only the 2 listed consumer files are in scope. |
| 29 | + |
| 30 | +## Exact Shared Helper Creation |
| 31 | +Create: |
| 32 | + |
| 33 | +`src/engine/debug/network/shared/hostReadUtils.js` |
| 34 | + |
| 35 | +Export exactly: |
| 36 | +- `readHostStatus` |
| 37 | +- `readHostSnapshot` |
| 38 | + |
| 39 | +Implementation rules: |
| 40 | +- use ONE existing local implementation as source-of-truth for each helper |
| 41 | +- do NOT merge logic |
| 42 | +- do NOT generalize behavior |
| 43 | +- preserve signatures exactly: |
| 44 | + - `readHostStatus(host)` |
| 45 | + - `readHostSnapshot(host)` |
| 46 | + |
| 47 | +## Exact Consumer Changes |
| 48 | +For each of the 2 listed consumer files: |
| 49 | + |
| 50 | +If the file contains local function definitions matching: |
| 51 | +```js |
| 52 | +function readHostStatus(host) |
| 53 | +function readHostSnapshot(host) |
| 54 | +``` |
| 55 | +then: |
| 56 | +- remove the local function definition(s) |
| 57 | +- import the helper(s) from the correct relative path to: |
| 58 | + - `src/engine/debug/network/shared/hostReadUtils.js` |
| 59 | +- if the file already imports from that module, add the needed helper(s) with the minimum safe edit |
| 60 | +- do not duplicate imports |
| 61 | +- do not touch unrelated helpers |
| 62 | +- do not change logic |
| 63 | + |
| 64 | +If a listed file already imports and uses shared versions, leave it unchanged. |
| 65 | + |
| 66 | +## Relative Import Rule |
| 67 | +Use the correct relative path from each consumer file to: |
| 68 | + |
| 69 | +`src/engine/debug/network/shared/hostReadUtils.js` |
| 70 | + |
| 71 | +Do not use aliases. |
| 72 | +Do not change `.js` extension usage. |
| 73 | + |
| 74 | +## Hard Constraints |
| 75 | +- no files outside the 2 listed consumers plus the one new shared file |
| 76 | +- no repo-wide dashboard/inspector cleanup |
| 77 | +- no behavior changes |
| 78 | +- keep one PR purpose only |
| 79 | + |
| 80 | +## Validation Checklist |
| 81 | +1. Confirm no more than the 3 listed files changed |
| 82 | +2. Confirm `src/engine/debug/network/shared/hostReadUtils.js` exists and exports: |
| 83 | + - `readHostStatus` |
| 84 | + - `readHostSnapshot` |
| 85 | +3. Confirm local function definitions no longer exist in changed listed consumer files |
| 86 | +4. Confirm changed consumer files import the helpers from the correct relative path to `src/engine/debug/network/shared/hostReadUtils.js` |
| 87 | +5. Confirm no unrelated files changed |
| 88 | +6. Confirm no behavior changes were made |
| 89 | + |
| 90 | +## Non-Goals |
| 91 | +- no cleanup of other dashboard or inspector helpers |
| 92 | +- no cleanup outside the 2 listed consumer files |
| 93 | +- no refactor beyond this exact duplicate-removal batch |
0 commit comments