Skip to content

Commit 2213160

Browse files
committed
Add shared noise foundation
1 parent 147ad35 commit 2213160

11 files changed

Lines changed: 615 additions & 334 deletions

docs_build/dev/BUILD_PR.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,44 @@
1-
# PR_26177_001-shared-hash-foundation
1+
# PR_26177_002-shared-noise-foundation
22

33
## Purpose
44

5-
Add a small shared non-cryptographic hash foundation.
5+
Add a small shared deterministic noise foundation.
66

77
## Source Of Truth
88

9-
This `BUILD_PR.md`, `PLAN_PR.md`, and the user request are the source of truth for `PR_26177_001-shared-hash-foundation`.
9+
This `BUILD_PR.md`, `PLAN_PR.md`, and the user request are the source of truth for `PR_26177_002-shared-noise-foundation`.
10+
11+
## Stack
12+
13+
- Base branch: `PR_26177_001-shared-hash-foundation`
14+
- This PR builds on PR_001 hash utilities.
1015

1116
## Exact Scope
1217

13-
- Add `src/shared/hash/` foundation.
14-
- Include deterministic non-crypto hash helpers.
15-
- No browser-owned product data.
16-
- No runtime UI changes.
17-
- Add targeted tests for the shared hash area.
18+
- Add `src/shared/noise/` foundation.
19+
- Build on existing `Random`/`RandomSeed` and PR_001 hash utilities.
20+
- Include deterministic Value, Perlin-style, Simplex-style, and Fractal-style helpers only where practical.
21+
- Keep API small and documented.
22+
- Add targeted tests for the shared noise area.
1823
- Create required Codex reports under `docs_build/dev/reports/`.
1924
- Create repo-structured delta ZIP under `tmp/`.
2025

2126
## Exact Targets
2227

2328
- `docs_build/dev/PLAN_PR.md`
2429
- `docs_build/dev/BUILD_PR.md`
25-
- `src/shared/hash/hash.js`
26-
- `tests/shared/HashFoundation.test.mjs`
27-
- `docs_build/dev/reports/PR_26177_001-shared-hash-foundation.md`
28-
- `docs_build/dev/reports/PR_26177_001-shared-hash-foundation_branch-validation.md`
29-
- `docs_build/dev/reports/PR_26177_001-shared-hash-foundation_requirement-checklist.md`
30-
- `docs_build/dev/reports/PR_26177_001-shared-hash-foundation_validation-lane.md`
31-
- `docs_build/dev/reports/PR_26177_001-shared-hash-foundation_manual-validation-notes.md`
30+
- `src/shared/noise/noise.js`
31+
- `tests/shared/NoiseFoundation.test.mjs`
32+
- `docs_build/dev/reports/PR_26177_002-shared-noise-foundation.md`
33+
- `docs_build/dev/reports/PR_26177_002-shared-noise-foundation_branch-validation.md`
34+
- `docs_build/dev/reports/PR_26177_002-shared-noise-foundation_requirement-checklist.md`
35+
- `docs_build/dev/reports/PR_26177_002-shared-noise-foundation_validation-lane.md`
36+
- `docs_build/dev/reports/PR_26177_002-shared-noise-foundation_manual-validation-notes.md`
3237
- `docs_build/dev/reports/codex_review.diff`
3338
- `docs_build/dev/reports/codex_changed_files.txt`
3439

3540
## Out Of Scope
3641

37-
- No cryptographic hashing.
3842
- No browser-owned product data.
3943
- No runtime UI changes.
4044
- No browser storage changes.
@@ -49,9 +53,9 @@ This `BUILD_PR.md`, `PLAN_PR.md`, and the user request are the source of truth f
4953
Run exactly:
5054

5155
```powershell
52-
node ./scripts/run-node-test-files.mjs tests/shared/HashFoundation.test.mjs
53-
node --check src/shared/hash/hash.js
54-
node --check tests/shared/HashFoundation.test.mjs
56+
node ./scripts/run-node-test-files.mjs tests/shared/NoiseFoundation.test.mjs tests/shared/HashFoundation.test.mjs
57+
node --check src/shared/noise/noise.js
58+
node --check tests/shared/NoiseFoundation.test.mjs
5559
git diff --check
5660
```
5761

@@ -60,5 +64,5 @@ git diff --check
6064
Create repo-structured delta ZIP:
6165

6266
```text
63-
tmp/PR_26177_001-shared-hash-foundation_delta.zip
67+
tmp/PR_26177_002-shared-noise-foundation_delta.zip
6468
```

docs_build/dev/PLAN_PR.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
1-
# PLAN_PR: PR_26177_001-shared-hash-foundation
1+
# PLAN_PR: PR_26177_002-shared-noise-foundation
22

33
## Purpose
44

5-
Add a small shared non-cryptographic hash foundation.
5+
Add a small shared deterministic noise foundation.
66

77
## Scope
88

9-
- Add `src/shared/hash/` foundation.
10-
- Include deterministic non-crypto hash helpers.
11-
- Add targeted unit tests.
9+
- Add `src/shared/noise/` foundation.
10+
- Build on existing `RandomSeed` and PR_001 hash utilities.
11+
- Include deterministic Value, Perlin-style, Simplex-style, and Fractal-style helpers where practical.
12+
- Keep API small and documented.
13+
- Add targeted tests.
1214
- No browser-owned product data.
1315
- No runtime UI changes.
1416
- No unrelated cleanup.
1517

1618
## Implementation Plan
1719

18-
1. Add `src/shared/hash/hash.js` with deterministic stable string and FNV-1a based helpers.
19-
2. Add `tests/shared/HashFoundation.test.mjs`.
20-
3. Validate determinism, object key ordering, seed variation, combination, and normalized hash output.
20+
1. Add `src/shared/noise/noise.js`.
21+
2. Add `tests/shared/NoiseFoundation.test.mjs`.
22+
3. Validate deterministic output, seed variation, practical ranges, and permutation determinism.
2123
4. Produce required Codex reports and repo-structured ZIP.
22-
23-
## Acceptance Criteria
24-
25-
- Hash helpers are deterministic for identical values.
26-
- Object hashing is stable regardless of property insertion order.
27-
- Helpers are documented as non-cryptographic.
28-
- No browser storage, UI, API, database, or sample smoke changes are introduced.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# PR_26177_002-shared-noise-foundation
2+
3+
Date: 2026-06-26
4+
Scope: Shared deterministic noise foundation
5+
Status: PASS
6+
7+
## Summary
8+
9+
- Added `src/shared/noise/noise.js`.
10+
- Added deterministic value, Perlin-style, Simplex-style, fractal, and seeded permutation helpers.
11+
- Built on PR_001 hash utilities and existing `RandomSeed`.
12+
- Added targeted tests in `tests/shared/NoiseFoundation.test.mjs`.
13+
- No browser-owned product data, runtime UI, API, database, or unrelated cleanup changes were made.
14+
15+
## Validation
16+
17+
- PASS: `node ./scripts/run-node-test-files.mjs tests/shared/NoiseFoundation.test.mjs tests/shared/HashFoundation.test.mjs`.
18+
- PASS: `node --check src/shared/noise/noise.js`.
19+
- PASS: `node --check tests/shared/NoiseFoundation.test.mjs`.
20+
- PASS: `git diff --check`.
21+
22+
## Artifact
23+
24+
- `tmp/PR_26177_002-shared-noise-foundation_delta.zip`
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# PR_26177_002-shared-noise-foundation Branch Validation
2+
3+
Status: PASS
4+
5+
- PASS: Branch `PR_26177_002-shared-noise-foundation` was created from `PR_26177_001-shared-hash-foundation`.
6+
- PASS: Stack base was clean before branch creation.
7+
- PASS: One PR purpose only: shared noise foundation.
8+
- PASS: No `start_of_day` files changed.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# PR_26177_002-shared-noise-foundation Manual Validation Notes
2+
3+
Status: PASS
4+
5+
Manual review confirmed the noise helpers are deterministic, small, documented, stacked on the hash foundation, and isolated from UI, browser product-data ownership, API, and database behavior.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# PR_26177_002-shared-noise-foundation Requirement Checklist
2+
3+
| Requirement | Status | Notes |
4+
|---|---:|---|
5+
| Add `src/shared/noise/` foundation | PASS | Added `src/shared/noise/noise.js`. |
6+
| Build on Random/RandomSeed and PR_001 hash utilities | PASS | Uses `RandomSeed` and hash helpers. |
7+
| Include deterministic Value helpers where practical | PASS | Added `valueNoise2D`. |
8+
| Include deterministic Perlin helpers where practical | PASS | Added `perlinNoise2D`. |
9+
| Include deterministic Simplex helpers where practical | PASS | Added `simplexNoise2D`. |
10+
| Include deterministic Fractal helpers where practical | PASS | Added `fractalNoise2D`. |
11+
| Keep API small and documented | PASS | Added a compact documented helper set. |
12+
| Add targeted tests | PASS | Added `tests/shared/NoiseFoundation.test.mjs`. |
13+
| No runtime UI changes | PASS | No UI files changed. |
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# PR_26177_002-shared-noise-foundation Validation Lane
2+
3+
Status: PASS
4+
5+
## Commands
6+
7+
```powershell
8+
node ./scripts/run-node-test-files.mjs tests/shared/NoiseFoundation.test.mjs tests/shared/HashFoundation.test.mjs
9+
node --check src/shared/noise/noise.js
10+
node --check tests/shared/NoiseFoundation.test.mjs
11+
git diff --check
12+
```
13+
14+
## Results
15+
16+
- PASS: Targeted noise and hash tests.
17+
- PASS: Changed JS syntax checks.
18+
- PASS: `git diff --check`.
19+
20+
## Not Run
21+
22+
- Full samples smoke was not run by default.
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
docs_build/dev/BUILD_PR.md
22
docs_build/dev/PLAN_PR.md
3-
docs_build/dev/reports/PR_26177_001-shared-hash-foundation.md
4-
docs_build/dev/reports/PR_26177_001-shared-hash-foundation_branch-validation.md
5-
docs_build/dev/reports/PR_26177_001-shared-hash-foundation_manual-validation-notes.md
6-
docs_build/dev/reports/PR_26177_001-shared-hash-foundation_requirement-checklist.md
7-
docs_build/dev/reports/PR_26177_001-shared-hash-foundation_validation-lane.md
3+
docs_build/dev/reports/PR_26177_002-shared-noise-foundation.md
4+
docs_build/dev/reports/PR_26177_002-shared-noise-foundation_branch-validation.md
5+
docs_build/dev/reports/PR_26177_002-shared-noise-foundation_manual-validation-notes.md
6+
docs_build/dev/reports/PR_26177_002-shared-noise-foundation_requirement-checklist.md
7+
docs_build/dev/reports/PR_26177_002-shared-noise-foundation_validation-lane.md
88
docs_build/dev/reports/codex_changed_files.txt
99
docs_build/dev/reports/codex_review.diff
10-
src/shared/hash/hash.js
11-
tests/shared/HashFoundation.test.mjs
10+
src/shared/noise/noise.js
11+
tests/shared/NoiseFoundation.test.mjs

0 commit comments

Comments
 (0)