Skip to content

Commit 2dd496d

Browse files
authored
Merge pull request #209 from ToolboxAid/PR_26177_001-shared-hash-foundation
PR_26177_001-shared-hash-foundation
2 parents 8cdd87b + 147ad35 commit 2dd496d

11 files changed

Lines changed: 614 additions & 447 deletions

docs_build/dev/BUILD_PR.md

Lines changed: 25 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,64 @@
1-
# PR_26177_DELTA_056-shared-validation-assertions
1+
# PR_26177_001-shared-hash-foundation
22

33
## Purpose
44

5-
Move generic validation/assertion helpers out of random helper code into a shared validation module.
5+
Add a small shared non-cryptographic hash foundation.
66

77
## Source Of Truth
88

9-
This `BUILD_PR.md`, `PLAN_PR.md`, the user request, and `docs_build/dev/ProjectInstructions.zip` are the source of truth for `PR_26177_DELTA_056-shared-validation-assertions`.
10-
11-
## OWNER Override And Team Assignment
12-
13-
OWNER override approved: Continue Team Delta random utility stack with `PR_26177_DELTA_056-shared-validation-assertions`.
14-
15-
Team Delta owns Shared JS, runtime utilities, technical debt remediation, and runtime test coverage.
16-
17-
## Stack
18-
19-
- Base branch: `PR_26177_DELTA_055-random-seed-enhancements`
20-
- This PR depends on the random helper module from PR_053, `Random` from PR_054, and `RandomSeed` enhancements from PR_055.
9+
This `BUILD_PR.md`, `PLAN_PR.md`, and the user request are the source of truth for `PR_26177_001-shared-hash-foundation`.
2110

2211
## Exact Scope
2312

24-
- Create `src/shared/validation/assert.js`.
25-
- Move generic assertion helpers from random helper code into `assert.js`.
26-
- Include only generic reusable validation functions needed by current random helpers:
27-
- `assertArray`
28-
- `assertFiniteNumber`
29-
- `assertOrderedRange`
30-
- Update random helper code to import from `src/shared/validation/assert.js`.
31-
- Preserve existing `Random` and `RandomSeed` behavior.
32-
- Do not change public API.
33-
- Do not expand into unrelated validation functions yet.
34-
- Add/update targeted unit tests if needed.
35-
- No UI changes.
36-
- No API/database changes.
37-
- No unrelated cleanup.
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.
3818
- Create required Codex reports under `docs_build/dev/reports/`.
3919
- Create repo-structured delta ZIP under `tmp/`.
4020

4121
## Exact Targets
4222

4323
- `docs_build/dev/PLAN_PR.md`
4424
- `docs_build/dev/BUILD_PR.md`
45-
- `docs_build/dev/ProjectInstructions/team_assignments/TEAM_ASSIGNMENTS.md`
46-
- `docs_build/dev/ProjectInstructions/team_assignments/ACTIVE_TEAM_REGISTRY.md`
47-
- `src/shared/validation/assert.js`
48-
- `src/shared/math/randomHelpers.js`
49-
- `docs_build/dev/reports/PR_26177_DELTA_056-shared-validation-assertions.md`
50-
- `docs_build/dev/reports/PR_26177_DELTA_056-shared-validation-assertions_branch-validation.md`
51-
- `docs_build/dev/reports/PR_26177_DELTA_056-shared-validation-assertions_requirement-checklist.md`
52-
- `docs_build/dev/reports/PR_26177_DELTA_056-shared-validation-assertions_validation-lane.md`
53-
- `docs_build/dev/reports/PR_26177_DELTA_056-shared-validation-assertions_manual-validation-notes.md`
54-
- `docs_build/dev/reports/PR_26177_DELTA_056-shared-validation-assertions_instruction-compliance-checklist.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`
5532
- `docs_build/dev/reports/codex_review.diff`
5633
- `docs_build/dev/reports/codex_changed_files.txt`
5734

5835
## Out Of Scope
5936

60-
- No public API changes.
61-
- No new unrelated validation helpers.
62-
- No existing game logic adoption changes.
63-
- No UI changes.
37+
- No cryptographic hashing.
38+
- No browser-owned product data.
39+
- No runtime UI changes.
6440
- No browser storage changes.
65-
- No API changes.
66-
- No database changes.
41+
- No API/database changes.
42+
- No engine refactor.
6743
- No `start_of_day` folder changes.
6844
- No unrelated cleanup.
45+
- No full samples smoke by default.
6946

7047
## Validation
7148

7249
Run exactly:
7350

7451
```powershell
75-
node ./scripts/run-node-test-files.mjs tests/shared/RandomHelpers.test.mjs tests/shared/Random.test.mjs tests/shared/RandomSeed.test.mjs
76-
node --check src/shared/validation/assert.js
77-
node --check src/shared/math/randomHelpers.js
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
7855
git diff --check
7956
```
8057

81-
Playwright is not required because this PR does not change UI or browser runtime flows.
82-
8358
## Artifact
8459

8560
Create repo-structured delta ZIP:
8661

8762
```text
88-
tmp/PR_26177_DELTA_056-shared-validation-assertions_delta.zip
63+
tmp/PR_26177_001-shared-hash-foundation_delta.zip
8964
```

docs_build/dev/PLAN_PR.md

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,28 @@
1-
# PLAN_PR: PR_26177_DELTA_056-shared-validation-assertions
1+
# PLAN_PR: PR_26177_001-shared-hash-foundation
22

33
## Purpose
44

5-
Move generic validation/assertion helpers out of random helper code into a shared validation module.
6-
7-
## Owner And Assignment
8-
9-
- Team: Delta
10-
- OWNER override approved: Continue Team Delta random utility stack with `PR_26177_DELTA_056-shared-validation-assertions`.
11-
- Stack base: `PR_26177_DELTA_055-random-seed-enhancements`.
5+
Add a small shared non-cryptographic hash foundation.
126

137
## Scope
148

15-
- Create `src/shared/validation/assert.js`.
16-
- Move generic assertion helpers from random helper code into `assert.js`.
17-
- Include only generic reusable validation functions needed by current random helpers:
18-
- `assertArray`
19-
- `assertFiniteNumber`
20-
- `assertOrderedRange`
21-
- Update random helper code to import from `src/shared/validation/assert.js`.
22-
- Preserve existing `Random` and `RandomSeed` behavior.
23-
- Do not change public API.
24-
- Do not expand into unrelated validation functions yet.
25-
- Add/update targeted unit tests if needed.
26-
- No UI changes.
27-
- No API/database changes.
9+
- Add `src/shared/hash/` foundation.
10+
- Include deterministic non-crypto hash helpers.
11+
- Add targeted unit tests.
12+
- No browser-owned product data.
13+
- No runtime UI changes.
2814
- No unrelated cleanup.
2915

3016
## Implementation Plan
3117

32-
1. Add `src/shared/validation/assert.js` with only the required generic assertion helpers.
33-
2. Remove duplicated generic assertions from `src/shared/math/randomHelpers.js`.
34-
3. Import the shared assertions from `randomHelpers.js`.
35-
4. Run targeted random helper, `Random`, and `RandomSeed` tests.
36-
5. Produce required PR reports and repo-structured ZIP.
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.
21+
4. Produce required Codex reports and repo-structured ZIP.
3722

3823
## Acceptance Criteria
3924

40-
- Existing random helper behavior is preserved.
41-
- Existing `Random` and `RandomSeed` behavior is preserved.
42-
- Public random APIs are unchanged.
43-
- Shared assertion module stays limited to the current reusable validation helpers.
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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# PR_26177_001-shared-hash-foundation
2+
3+
Date: 2026-06-26
4+
Scope: Shared non-cryptographic hash foundation
5+
Status: PASS
6+
7+
## Summary
8+
9+
- Added `src/shared/hash/hash.js`.
10+
- Added deterministic non-cryptographic hash helpers for stable strings, string/value hashes, combined hashes, and normalized hash values.
11+
- Added targeted tests in `tests/shared/HashFoundation.test.mjs`.
12+
- No browser-owned product data, runtime UI, API, database, or unrelated cleanup changes were made.
13+
14+
## Validation
15+
16+
- PASS: `node ./scripts/run-node-test-files.mjs tests/shared/HashFoundation.test.mjs`.
17+
- PASS: `node --check src/shared/hash/hash.js`.
18+
- PASS: `node --check tests/shared/HashFoundation.test.mjs`.
19+
- PASS: `git diff --check`.
20+
21+
## Artifact
22+
23+
- `tmp/PR_26177_001-shared-hash-foundation_delta.zip`
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# PR_26177_001-shared-hash-foundation Branch Validation
2+
3+
Status: PASS
4+
5+
- PASS: Started from clean synchronized `main`.
6+
- PASS: Branch `PR_26177_001-shared-hash-foundation` was created from `main`.
7+
- PASS: One PR purpose only: shared hash 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_001-shared-hash-foundation Manual Validation Notes
2+
3+
Status: PASS
4+
5+
Manual review confirmed the new hash helpers are deterministic, non-cryptographic, isolated to `src/shared/hash/`, and do not add browser product-data ownership or runtime UI behavior.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# PR_26177_001-shared-hash-foundation Requirement Checklist
2+
3+
| Requirement | Status | Notes |
4+
|---|---:|---|
5+
| Add `src/shared/hash/` foundation | PASS | Added `src/shared/hash/hash.js`. |
6+
| Include deterministic non-crypto hash helpers | PASS | Added stable string, string/value hash, combined hash, and normalized helpers. |
7+
| No browser-owned product data | PASS | No storage or product-data files changed. |
8+
| No runtime UI changes | PASS | No UI files changed. |
9+
| One PR purpose only | PASS | Scope is limited to hash foundation. |
10+
| Smallest valid scoped change | PASS | No unrelated exports or integrations added. |
11+
| Add targeted tests | PASS | Added `tests/shared/HashFoundation.test.mjs`. |
12+
| Do not run full samples smoke by default | PASS | Full samples smoke was not run. |
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# PR_26177_001-shared-hash-foundation Validation Lane
2+
3+
Status: PASS
4+
5+
## Commands
6+
7+
```powershell
8+
node ./scripts/run-node-test-files.mjs tests/shared/HashFoundation.test.mjs
9+
node --check src/shared/hash/hash.js
10+
node --check tests/shared/HashFoundation.test.mjs
11+
git diff --check
12+
```
13+
14+
## Results
15+
16+
- PASS: Targeted hash foundation test.
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 & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
docs_build/dev/BUILD_PR.md
22
docs_build/dev/PLAN_PR.md
3-
docs_build/dev/ProjectInstructions/team_assignments/ACTIVE_TEAM_REGISTRY.md
4-
docs_build/dev/ProjectInstructions/team_assignments/TEAM_ASSIGNMENTS.md
5-
docs_build/dev/reports/PR_26177_DELTA_056-shared-validation-assertions.md
6-
docs_build/dev/reports/PR_26177_DELTA_056-shared-validation-assertions_branch-validation.md
7-
docs_build/dev/reports/PR_26177_DELTA_056-shared-validation-assertions_instruction-compliance-checklist.md
8-
docs_build/dev/reports/PR_26177_DELTA_056-shared-validation-assertions_manual-validation-notes.md
9-
docs_build/dev/reports/PR_26177_DELTA_056-shared-validation-assertions_requirement-checklist.md
10-
docs_build/dev/reports/PR_26177_DELTA_056-shared-validation-assertions_validation-lane.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
118
docs_build/dev/reports/codex_changed_files.txt
129
docs_build/dev/reports/codex_review.diff
13-
src/shared/math/randomHelpers.js
14-
src/shared/validation/assert.js
10+
src/shared/hash/hash.js
11+
tests/shared/HashFoundation.test.mjs

0 commit comments

Comments
 (0)