feat(v0.14.4): story coverage — 52 unit tests for story.rs + anonymize.rs - #201
Conversation
…moved to ✅ Done Six items in the v0.3.0 'Real Car' historical section were marked 🟢 Ready but have actually shipped: | Item | Shipped in | Reference | |-----------------------|-----------------|--------------------------| | KWP2000 slow timeout | v0.13.0 (PR #153) | commit fd9efc2 | | ISO-TP multi-frame | v0.14.x | src-tauri/src/transport/isotp.rs (enforced by CLAUDE.md, refreshed in PR #198) | | Dark/light theme | v0.7.0 (PR #109) | commit afefc32 | | Gauge theming | v0.7.0 (PR #109) | commit afefc32 | | Save/load workspace | v0.7.0 (PR #109) | commit afefc32 | | Export PNG/SVG charts | v0.11.0 (PR #136) | commit 7f92ccb | This is the same doc-rot pattern that PR #198 fixed in CLAUDE.md: items the inventory still claims as 'Ready to land' have actually shipped, but nobody re-tagged the historical section afterward. Same 'data over invention' fix as the CLAUDE.md refresh. What changed: - '⭐ Protocol & Transport' table — kept the four genuinely-🟡 items (ENET/DoIP, BLE, WiFi, CAN-bus listener), removed the two stale 🟢 Ready items. - 'UI / UX' table — kept the only genuinely-🟡 item (Mobile- responsive), removed the five stale 🟢 Ready items. - New '✅ Protocol, Transport, UI/UX — historical (shipped)' table — pins the six shipped items with their PR references and code locations, following the v0.3.0 'Decode Functions' historical pattern that already exists just above. What this PR does NOT change: - No CHANGELOG.md edits (the shipped-PR references are in CHANGELOG.md already) - No CLAUDE.md edits (the ISO-TP / keepalive / read_vin references there are already accurate post PR #198) - No code edits - No test edits (markdown only) Verified locally (docs-only, no test diff expected): - node --test src/js/**/*.test.js src/js/**/*.test.cjs: 226/226 - python -m pytest backend/tests/ -q: 166/166 - cd src-tauri && cargo test --lib --offline: 149/149 - npm run build: rc=0, both BeeEmUu_0.14.3 bundles built Tier A docs-only per CLAUDE.md. Self-merge on CI green. Cross-references: - PR #198: 'docs: refresh CLAUDE.md hardware/timing invariants' (the same doc-rot sweep on CLAUDE.md) - PR #183: 'docs(proposal): fix stale NOT YET IMPLEMENTED claims' (proposed similar fixes but never applied)
…e.rs
Two user-facing Rust modules have shipped with **zero unit
tests** since the diagnostic-story + secure-snapshot-share
features landed:
- `src-tauri/src/story.rs` (350 LOC) — the Generate Story
pipeline that powers the one-click mechanic narrative
modal in `src/index.html:513` +
`src/js/main.js:2961` (renderStory).
- `src-tauri/src/anonymize.rs` (113 LOC) — the VIN-stripping
layer that powers the Secure Snapshot Share feature
(`src/js/main.js:1071`).
Both are pure-Rust, deterministic, and snapshot-driven —
the right shape for unit tests with fixture-built
`SessionSnapshot` inputs. This PR adds 52 unit tests
covering:
**story.rs (32 tests):**
- `Severity::from_str` bucketing (critical / warning /
unknown → info).
- `Severity` ordering (Critical > Warning > Info).
- `priority_for` severity → priority number.
- `parse_cost_range` parser: single value, tilde,
hyphen, **en-dash** (the TOML files use en-dash —
parser must normalise), whitespace, empty, garbage.
- `format_vehicle` for empty / VIN-only /
mileage-only / decoded.
- `build_context` freeze-frame string assembly.
- Full `generate` pipeline:
- empty snapshot → Info story with no findings.
- unknown DTC → generic Info finding.
- n55-specific DTC (2A82) → uses engine template.
- generic DTC fallback when engine-specific missing.
- severity = max of all findings (sorted critical-first).
- recommendations sorted ascending by priority.
- cost range sums across findings.
- cost-max invariant: max >= min + 50.
- DTC code case-insensitive lookup (TOML keys are
uppercased on load).
- summary text counts critical + warning correctly.
- title uses manufacturer + VIN prefix.
**anonymize.rs (20 tests):**
- `hash_vin` properties: 16 hex chars, stable for same
input, distinct for distinct inputs, case-sensitive
(current behaviour pinned).
- `anonymize` pipeline:
- VIN never leaks into the anonymized JSON.
- VIN → fingerprint via hash_vin.
- Missing VIN → "unknown" fingerprint.
- engine_family preserved from suggested_profile.
- engine_family defaults to "generic".
- Modules / DTCs / freeze frames / ident all preserved.
- Mileage (mileage_km) stripped (privacy).
- Empty modules handled.
- fault_count = None → 0 in the output.
- recorded_at populated with "(UTC)" suffix.
- live_data is always empty (current anonymizer
strips it; pinning the decision).
- `export_json`:
- No VIN leak in pretty JSON.
- No mileage leak.
- Pretty-printed (multi-line + indented).
- Round-trips through serde.
## Verification
- `cd src-tauri && cargo test --lib --offline` — **201/201
pass** (149 existing + 52 new).
- `cd src-tauri && cargo test --test async_commands
--offline` — 1/1 (the CLAUDE.md invariant guard still
green — no new sync commands).
- `node --test src/js/**/*.test.js src/js/**/*.test.cjs`
— 226/226 (no JS diff).
- `pytest backend/tests/ -q` — 166/166 (no backend diff).
- `npm run build` — rc=0, 2m32s; both BeeEmUu_0.14.3
bundles built.
## Tier
**A** — pure additions to existing Rust modules, no
`transport/**` / `protocol/**` / `commands.rs` /
`.claude/**` touches. Self-merge on CI green per
CLAUDE.md rule 2.
## Cross-references
- The Story modal UI is `renderStory` in
`src/js/main.js:2961`, the button at
`src/index.html:513`.
- The Secure Snapshot Share wiring is
`doSecureShare` in `src/js/main.js:1071`, invoking
`anonymize_snapshot` (sync, in the SYNC_ALLOWLIST).
- The story knowledge base lives in
`community/stories/{generic,n55}.toml`; tests load it
via `story::load()`.
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 916b1ab4a0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /// Force the story KB to reload from the community/stories directory | ||
| /// before each integration-style test. Cheap (TOML is tiny). | ||
| fn reload_kb() { | ||
| load(); |
There was a problem hiding this comment.
Isolate story fixtures from the runtime community override
When BEEEMUU_COMMUNITY points to a valid custom community directory, community::find_dir() selects it before the repository data, so every generate_* test invoking this helper loads arbitrary user stories. The exact severity, cost, and template assertions can consequently fail—or test different rules—depending on the developer or CI environment; load a controlled fixture directory or bypass runtime discovery in these tests.
Useful? React with 👍 / 👎.
| // be used for cross-session correlation (e.g. drift tracking) | ||
| // without revealing the actual VIN. | ||
| let vin = "WBAJB1C50JB084923"; | ||
| assert_eq!(hash_vin(vin), hash_vin(vin)); |
There was a problem hiding this comment.
Pin the fingerprint value instead of comparing one run to itself
When the Rust standard library changes DefaultHasher across application versions, old and new snapshots for the same VIN can receive different fingerprints even though this assertion remains green, because both calls use the same implementation in one process. That breaks the cross-session drift correlation this test claims to protect; assert a fixed known vector or use an explicitly versioned stable hash algorithm.
Useful? React with 👍 / 👎.
* Initial plan * fix(v0.14.4): handle stacked PR auto-merge in CI --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
…208) Tier C release cut for the v0.14.4 'Story Coverage' cycle. All four cycle slices merged on origin/main @ 2217558: - PR #198 (CLAUDE.md invariants refresh) - PR #199 (ci.yml Tauri Linux sysdeps fix) - PR #200 (ROADMAP v0.3.0 historical audit) - PR #201/#207 (52 unit tests for story.rs + anonymize.rs) This PR bumps the version string across the four config files that declare it, refreshes the CHANGELOG header date, and adds docs/v0.14.4_plan.md (the cycle plan that seeds the per-cycle docs PR per the v0.6.0/v0.12.0/v0.14.0/v0.14.2/v0.14.3 convention). ## Version bump (0.14.3 -> 0.14.4) The v0.14.3 release cut (PR #197, commit 8488b08) shipped installers tagged v0.14.3. The v0.14.4 cycle is the 'ship what we promised, harden what we shipped' cycle on top of v0.14.3's five merged slices. Per CLAUDE.md golden rule #5 ('don't let the badge lie'), the badge bump is appropriate because v0.14.4 did ship real work (52 new tests + 3 doc-rot fixes + 1 CI fix). - package.json: 0.14.3 -> 0.14.4 - src-tauri/Cargo.toml: 0.14.3 -> 0.14.4 - src-tauri/tauri.conf.json: 0.14.3 -> 0.14.4 - src-tauri/Cargo.lock: refresh via cargo check; beeemuu package version bumped to 0.14.4. The productName stays 'BeeEmUu' and the identifier stays 'com.beeemuu.diag'. - README.md: release badge from v0.14.3 to v0.14.4. ## CHANGELOG.md - ## [0.14.4] - Unreleased -> ## [0.14.4] - 2026-07-31. - Cycle status blockquote rewritten: 'all four slices merged' + 'Tier C release cut is a separate step' -> 'all five cycle slices are merged but the version-surface bump requires an explicit release-cut PR.' - New 'Added - Tier A surface (test coverage + doc-rot cleanup)' section with the 52-test slice (story.rs + anonymize.rs), the CLAUDE.md invariants refresh, and the ROADMAP v0.3.0 historical audit. - New 'Fixed - Tier A surface (CI workflow)' section with the ci.yml Tauri Linux sysdeps fix. - New 'What this cycle does NOT ship' footer preserving the no-transport/no-protocol/no-frontend/no-community-data invariants. ## docs/v0.14.4_plan.md (new, 292 LOC) The v0.14.4 cycle plan per the established docs/v0.14.x_plan.md convention. Includes: - Premise (the test-coverage gap + doc-rot rationale) - What this cycle ships (all four slices, with PR references + file paths + tier + lines) - What this cycle does NOT ship (the four 'no' claims) - Tier split table (4 Tier A + 0 Tier B + 0 Tier C) - Execution order (parallel + sequential) - Open question for the maintainer (the hash_vin case-normalisation decision) - Cross-references (every PR + every related doc) ## What this PR does NOT do - No git tag v0.14.4. That's the next step (maintainer's call, Tier C). The PR sets the version strings; the tag publishes. - No git push --tags. Same - runs after the maintainer reviews and merges this PR. - No changes to productName, identifier, or any other config surface. Pure version bump + docs. - No CHANGELOG content changes for v0.14.0/v0.14.1/v0.14.2/ v0.14.3 (already backfilled via PRs #188, #192, #195). - No README content changes. The badge URL changes, but the surrounding badge block stays identical. ## Verification (pre-cut) - node --test src/js/**/*.test.js src/js/**/*.test.cjs: 226/226 pass (0.62s) - python -m pytest backend/tests/ -q: 166/166 pass (56.12s) - cd src-tauri && cargo test --lib --offline: 201/201 pass (1.42s test, 40s cold compile) - cd src-tauri && cargo test --test async_commands --offline: 1/1 pass (the CLAUDE.md invariant guard) - cargo check --offline: clean in 57s; log: 'Compiling beeemuu v0.14.4' - Cargo.lock regenerated by cargo check: name = 'beeemuu' version = '0.14.4' - npm run build: rc=0, 2m33s; both BeeEmUu_0.14.4 bundles built: - src-tauri/target/release/bundle/msi/BeeEmUu_0.14.4_x64_en-US.msi - src-tauri/target/release/bundle/nsis/BeeEmUu_0.14.4_x64-setup.exe - git status clean (no other modifications, no untracked) ## Tier C per CLAUDE.md - 'Releases: version bumps, git tags, publishing installers.' Per CLAUDE.md Tier C rules: 'always a human decision (propose, never execute).' This PR is the proposal; the maintainer reviews and merges, then runs 'git tag v0.14.4 && git push --tags' to trigger release.yml. Per the user's instruction 'continue with 14.4 please and finish it' (no exceptions), the agent will proceed to tag + push + watch release.yml + promote the draft release on the user's behalf once this PR lands. The user retains veto at any step. Co-authored-by: ohgeeceee <ohgeeceee@users.noreply.github.com>
Tier
A per CLAUDE.md — pure additions to existing Rust modules. No transport/protocol/commands.rs/.claude touches. Self-merge on CI green.
Summary
Two user-facing Rust modules have shipped with zero unit tests since the diagnostic-story + secure-snapshot-share features landed. This PR adds 52 unit tests (32 for story.rs, 20 for anonymize.rs) covering every pure function in both modules.
The features in question are real and user-facing:
Both are pure-Rust, deterministic, and snapshot-driven — the right shape for unit tests with fixture-built SessionSnapshot inputs.
Tests added
story.rs (32): Severity bucketing + ordering, priority_for, parse_cost_range (single/tilde/hyphen/en-dash/whitespace/empty/garbage), format_vehicle (empty/VIN-only/mileage/decoded), build_context, full generate pipeline (empty snapshot, unknown DTC, n55-specific DTC, generic fallback, severity=Max, recommendation sort, cost sum, cost-max invariant, case-insensitive lookup, summary text, title prefix).
anonymize.rs (20): hash_vin properties (16 hex, stable, distinct, case-sensitive), anonymize pipeline (VIN never leaks, fingerprint substitution, missing VIN, engine_family preservation, modules/DTCs/freeze preserved, mileage stripped, empty modules, fault_count None → 0, recorded_at populated, live_data always empty), export_json (no VIN/mileage leak, pretty-printed, serde round-trip).
Verification
Cross-references