test(hrr): harden 2 vacuous-pass cache-persistence assertions (#707) - #709
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR strengthens two HRRStructIndexCache persistence tests by adding explicit verification that the persistence round-trip succeeds: ChangesHRRStructIndexCache Persistence Verification
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related issues🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Sorry @robotrocketscience, you have reached your weekly rate limit of 2500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
[claim:review:Faraday:2026-05-12T02:08:40Z] |
Both `test_cache_loads_from_disk_on_second_construct` and `test_cache_byte_equality_persist_round_trip` previously passed vacuously when persistence was disabled (in-memory rebuild yields equal outputs). Each test now asserts that `struct.npy` exists at the cold/warm boundary and that the warm struct is `np.memmap`-backed, proving a real disk round-trip occurred.
Mirrors PR #701's pattern for the other 4 persist tests in this file: neutralise _EPHEMERAL_PATH_PREFIXES under monkeypatch so tmp_path on Linux CI (where it resolves under /tmp/) traverses the persistence path. Without this, the prior commit's struct.npy / np.memmap assertions fail loudly on Linux because persistence auto-disables.
915a5c4 to
3c7f587
Compare
|
Reviewed by Faraday. Rebased onto current main (2 commits ahead, was 2 behind). Both commits SSH-signed (G). Verification
Closes #707. Adding |
|
[claim:review:pascal:2026-05-12T02:12:43Z] |
|
[release:review:pascal:2026-05-12T02:12:48Z] |
|
merge-train: blocked FF push to The |
|
merge-train: merged 3c7f587 → |
|
[release:review:Faraday:2026-05-12T02:16:23Z] |
Closes #707.
What
Hardens two HRR cache-persistence tests in
tests/test_hrr_struct_index.pythat pass vacuously when persistence is silently disabled:
test_cache_loads_from_disk_on_second_constructtest_cache_byte_equality_persist_round_tripBoth tests previously asserted only
np.testing.assert_array_equal/probe(...)equality between cold and warm caches. Under the in-memoryrebuild path (deterministic seed=7), those equalities hold even when no
disk round-trip happened. A future regression that silently disables
persistence would not be caught.
Hardening shape
Mirrors prior art in the same file (
test_cache_persists_to_disk_after_build,test_cache_load_uses_mmap):(persist_dir / "struct.npy").is_file()— proves the cold path actually wrote to disk.
isinstance(b.struct, np.memmap)—proves the warm path loaded from disk via mmap rather than rebuilding
in-memory.
Two atomic commits
test: harden vacuous-cache persistence assertions (#707)— the twostrict assertions on each test.
test(hrr): isolate #707 hardened tests from ephemeral-path auto-disable— adds
monkeypatch.setattr(hi, "_EPHEMERAL_PATH_PREFIXES", frozenset())to both tests, mirroring PR feat(hrr): ephemeral-path auto-disable for HRR persistence (#695) #701's pattern for the other 4 persist
tests in this file. Required because
tmp_pathon Linux CI resolvesunder
/tmp/, which after PR feat(hrr): ephemeral-path auto-disable for HRR persistence (#695) #701 triggers persist auto-disable —the new strict assertions would then fail loudly in CI without this
neutralisation.
Verification
uv run pytest tests/test_hrr_struct_index.py -q→ 49 passed, 4skipped (Linux-only ephemeral-path tests skipped on macOS).
monkeypatch.setenv("AELFRICE_HRR_PERSIST", "0")into each hardenedtest makes it fail at the new
(pd / "struct.npy").is_file()assertion with the expected message. Reverted before commit.
github/main→ clean.Out of scope
/private/tmpquirk docs — slated fordocs/CONFIG.mdaspart of the [v2.1] HRR integration: persistence default-ON + split-format migration + disk-cost opt-out #553 docs bundle (issue docs(hrr): CONFIG.md + COMMANDS.md + CHANGELOG bundle (#553 sub-task) #699).
Summary by CodeRabbit