skara-brae-common/docs/openup/test/test-report-wi-1-injectable-rng.md
Jan-Peter von Hunnius 2343d5e154 docs(openup): migrate WI-1 artifacts from unversioned project-top docs/
work-items.md (project-management/), design-wi-1-injectable-rng.md
(analysis-design/), test-report-wi-1-injectable-rng.md (test/) move into
the canonical OpenUP home per the 2026-10-03 decision reversal. Verbatim,
no content changes; project-top docs/ husk removed.
2026-10-03 17:18:04 +02:00

36 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# WI-1 Test Report — Injectable RNG (skara-brae-server#1, PSP1)
Date: 2026-10-02 · Phase: TST · Executor: agent (PM session, Kilo/glm-5.3)
## Scope under test
Branch `wi-1-injectable-rng` (uncommitted working tree vs base `64e081a`):
`sb-core/src/character.rs` (create_character signature + new determinism test),
`sb-api/src/routes/mod.rs` (request_rng helper, create handler, run_adventure
consolidation).
## Test cases
| # | Test | Purpose | Result |
|---|---|---|---|
| 1 | `create_character_is_deterministic_under_seeded_rng` (NEW) | Two `StdRng::seed_from_u64(42)` runs yield identical stats (Debug-string) and equal hp/max_hp/energy/nerve — proves RNG injectability end-to-end | **pass** |
| 2 | Existing sb-core suite (44 tests: character 20, combat 8, services 17 -1 overlap after adding #1) | No regression from signature change / rng threading | **pass** |
| 3 | Acceptance audit: `grep -rn "rand::rng()" crates/` | Zero occurrences in the whole repo (incl. tests) — acceptance criterion | **pass** (only remaining entropy: `sb-auth/src/hash.rs:8` `getrandom::fill`, excluded by design) |
| 4 | `cargo clippy --all-targets -- -D warnings` | Zero-warning standard | **pass** (clean) |
| 5 | `cargo build --workspace` | Compile integrity | **pass** |
| 6 | `rustfmt --check` (touched lines) | Coding standard on new/rewritten code | **pass** (repo-wide pre-existing fmt debt documented, not touched — see CMP log) |
## Evidence
- `cargo test --workspace`: **45 passed, 0 failed** (sb-core lib target; remaining targets empty)
- Determinism test present and green: `test character::tests::create_character_is_deterministic_under_seeded_rng ... ok`
- Full output captured in session log (PSP time log, TST phase, 2026-10-02 22:17)
## Defects found in test phase
None. (All defects D1–D11 were found in Design Review / Code / Code Review phases; see defect log.)
## Notes
- The new test replaced a whole-struct `Debug` comparison after D8 (HashMap iteration order instability) — comparison now covers the random-dependent state exactly.
- No behavioral change expected from ThreadRng→StdRng: same distributions, one OS-entropy seeding per request (design rev 2, D1 correction).