|
| 1 | +# BUILD_PR_SHARED_EXTRACTION_49_VECTOR_TO_FINITE_NUMBER_ROUND_BATCH |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Centralize the exact duplicated numeric helpers in the vector lane so the consumer stops carrying local copies and uses the shared implementation instead. |
| 5 | + |
| 6 | +## Single PR Purpose |
| 7 | +Normalize ONLY these helpers: |
| 8 | +- `toFiniteNumber(value, fallback = NaN)` |
| 9 | +- `roundNumber(value)` |
| 10 | + |
| 11 | +## Exact Files Allowed |
| 12 | +1. `tools/shared/vector/vectorGeometryMath.js` |
| 13 | +2. `tools/shared/vector/vectorAssetContract.js` |
| 14 | + |
| 15 | +Do not edit any other file. |
| 16 | + |
| 17 | +## Required Starting Check |
| 18 | +Open both listed files first. |
| 19 | + |
| 20 | +Fail fast and stop with no code edits if any of the following is true: |
| 21 | +- either listed file does not exist |
| 22 | +- `tools/shared/vector/vectorAssetContract.js` does not contain local definitions and also does not need these imports |
| 23 | +- the shared file already exports the exact helpers and the consumer already imports and uses them correctly |
| 24 | +- completing the batch would require touching any file outside the exact 2-file list |
| 25 | + |
| 26 | +## Shared Source Rule |
| 27 | +`tools/shared/vector/vectorGeometryMath.js` is the only allowed shared source for this batch. |
| 28 | + |
| 29 | +Allowed shared-file edits are limited to exactly one of these cases: |
| 30 | +1. **Export-only fix**: the helper implementation already exists in the file, but the helper is not exported correctly. |
| 31 | +2. **Missing-helper add**: copy only the missing helper implementation(s) from `tools/shared/vector/vectorAssetContract.js` into `tools/shared/vector/vectorGeometryMath.js` with no behavior change. |
| 32 | + |
| 33 | +Do not rewrite existing math helpers. |
| 34 | +Do not reorder unrelated exports. |
| 35 | +Do not perform cleanup outside these two helpers. |
| 36 | + |
| 37 | +## Consumer Replacement Rule |
| 38 | +For `tools/shared/vector/vectorAssetContract.js`: |
| 39 | +- remove only the local definitions of: |
| 40 | + - `toFiniteNumber(value, fallback = NaN)` |
| 41 | + - `roundNumber(value)` |
| 42 | +- import the shared helper(s) from: |
| 43 | + - `./vectorGeometryMath.js` |
| 44 | +- if an import from `./vectorGeometryMath.js` already exists, extend that import with the minimum safe edit |
| 45 | +- do not create duplicate import lines |
| 46 | +- do not touch unrelated local helpers |
| 47 | +- do not change call sites except as required to use the imported helpers |
| 48 | + |
| 49 | +## Dead-Code Prevention Rule |
| 50 | +This BUILD is valid only if at least one concrete consumer replacement occurs in: |
| 51 | +- `tools/shared/vector/vectorAssetContract.js` |
| 52 | + |
| 53 | +Do not add or export a shared helper unless the consumer file in this same PR is switched away from its local duplicate. |
| 54 | + |
| 55 | +## Relative Import Rule |
| 56 | +Use exactly: |
| 57 | +- `./vectorGeometryMath.js` |
| 58 | + |
| 59 | +Do not change path style. |
| 60 | +Do not change extension style. |
| 61 | +Do not introduce aliases. |
| 62 | + |
| 63 | +## Hard Constraints |
| 64 | +- no files outside the exact 2-file list |
| 65 | +- no wildcard scope |
| 66 | +- no repo-wide vector cleanup |
| 67 | +- no behavior changes |
| 68 | +- no renames |
| 69 | +- no formatting-only pass |
| 70 | +- keep one PR purpose only |
| 71 | + |
| 72 | +## Validation Checklist |
| 73 | +1. Confirm only these 2 files changed: |
| 74 | + - `tools/shared/vector/vectorGeometryMath.js` |
| 75 | + - `tools/shared/vector/vectorAssetContract.js` |
| 76 | +2. Confirm `tools/shared/vector/vectorGeometryMath.js` exports: |
| 77 | + - `toFiniteNumber` |
| 78 | + - `roundNumber` |
| 79 | +3. Confirm `tools/shared/vector/vectorAssetContract.js` no longer contains local definitions for those helpers |
| 80 | +4. Confirm `tools/shared/vector/vectorAssetContract.js` imports the helpers from `./vectorGeometryMath.js` |
| 81 | +5. Confirm at least one real consumer replacement occurred in `tools/shared/vector/vectorAssetContract.js` |
| 82 | +6. Confirm no unrelated helpers or files changed |
| 83 | +7. Confirm no behavior changes were introduced |
| 84 | + |
| 85 | +## Non-Goals |
| 86 | +- no cleanup outside this exact duplicate-removal batch |
| 87 | +- no additional vector helper extraction |
| 88 | +- no import normalization beyond this exact consumer replacement |
| 89 | +- no follow-on dedupe work |
0 commit comments