feat(doctor): HRR persist/build reporter rows (#696) - #704
Conversation
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
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 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 |
PR-size soft capThis PR is over the advisory size threshold:
Bigger PRs collide with more open work, which under the parallel-session workflow tends to produce repeated This is advisory only — nothing is blocked. If the size is intentional (large refactor, module removal, generated code), apply the |
|
[claim:review:noether:2026-05-12T00:18:36Z] |
Verdict: BLOCKED — single self-inflicted test failureThree atomic commits, all signed (G), discretion clean, FF on Real blocker — The test calls Fix: add Other (non-blocking) notes:
Holding [release:review:noether:2026-05-12T00:20:02Z] |
|
[release:review:noether:2026-05-12T00:20:04Z] |
|
[claim:review:noether:2026-05-12T00:24:40Z] |
|
Request changes — pytest (3.13) red on Linux runner.
Root cause: The PR body's macOS-vs-Linux note caught the symlink direction ( Two fix paths, your call:
Path 2 is more honest about what the doctor row should report — a developer running CI status besides pytest:
Holding |
|
[release:review:noether:2026-05-12T00:26:13Z] |
|
[claim:review:faraday:2026-05-12T00:34:16Z] |
|
[claim:review:pascal:2026-05-12T00:34:33Z] |
|
[release:review:pascal:2026-05-12T00:34:38Z] |
Request changes — pytest 3.13 fails on
|
|
[release:review:faraday:2026-05-12T00:34:57Z] |
5a4fd54 to
cebaefb
Compare
|
merge-train: blocked branch is not fast-forward on The |
cebaefb to
96fb3ee
Compare
|
[claim:review:pascal:2026-05-12T01:03:48Z] |
96fb3ee to
c2ae6dd
Compare
|
[release:review:pascal:2026-05-12T01:19:25Z] |
|
merge-train: blocked required check(s) failed: The |
|
Follow-up fix pushed for the CI |
|
merge-train: blocked FF push to The |
|
merge-train: blocked branch is not fast-forward on The |
) Add module-level _HRR_BUILD_STATS dict updated by HRRStructIndex.build() with wall-clock duration. Expose last_build_seconds() and persist_disk_bytes() as module-level helpers for doctor. Add resolve_persist_state() method on HRRStructIndexCache that returns a doctor-facing dict {enabled, dir, on_disk_bytes, reason} without firing any one-shot WARNING logs. Add log_on_ephemeral parameter (no-op on main) to _resolve_persist_dir() as a slot for PR #701.
Add hrr_persist_state field to DoctorReport and hrr_store_path/hrr_dim params to diagnose(). Add _diagnose_hrr_persist() helper that probes HRRStructIndexCache.resolve_persist_state() read-only. Add _format_hrr_section() rendering three rows (persist_enabled, on_disk_bytes, last_build_seconds) under an HRR block in aelf doctor output. Wire hrr_store_path into the _cmd_doctor path. Add _format_hrr_persist_status_line() and wire it into aelf status output.
Cover: last_build_seconds None before build / positive after; persist_disk_bytes zero when no files / correct after build; resolve_persist_state for no-store-path / env-0 / enabled paths; no WARNING from resolve_persist_state on ephemeral store path; doctor integration test asserting HRR block appears in format_report. Also fix format_report early-return path to render HRR section when no settings.json is scanned (needed for the doctor integration test).
resolve_persist_state's ephemeral-path check was a method-local tuple, so the test that exercises the enabled=True path on Linux (where pytest tmp_path lives under /tmp/) had no monkeypatch surface to override the predicate. Hoisting to module scope adds the surface and aligns shape with PR #701's _EPHEMERAL_PATH_PREFIXES (will collapse onto a single constant when #701 rebases through). Signed-off-by: rrs <276464689+robotrocketscience@users.noreply.github.com>
CI runs pytest with tmp_path under /tmp/pytest-of-runner/..., which trips _EPHEMERAL_PATH_PREFIXES detection from #695 and disables persistence — so cache.get() doesn't write struct.npy and the os.path.getsize() assertion fails. Monkeypatch _EPHEMERAL_PATH_PREFIXES to empty (matching the pattern used by sibling disk-write tests in the same file) so the test runs against the persisted-on path regardless of where pytest's tmp_path lives.
9503012 to
093c1e4
Compare
|
merge-train: blocked FF push to The |
|
merge-train: blocked FF push to The |
|
merge-train: merged 093c1e4 → |
Closes 696 (sub-task of 553).
Summary
Adds operator-facing visibility for the HRR persistence work shipped by PR 693.
aelf doctorgains an HRR block reporting three rows;aelf statusgains a one-line summary. Build-duration capture is added toHRRStructIndex.build(); on-disk byte accounting and a read-only persist-state probe are added to the cache.Third of the 553 sub-tasks (after 693 and 701).
What changed
src/aelfrice/hrr_index.py_HRR_BUILD_STATS: dict[str, float | None]module-level slot;Noneuntil the firstbuild()completes.last_build_seconds() -> float | Noneandpersist_disk_bytes(persist_dir) -> intmodule helpers. The latter catchesFileNotFoundError/OSErrorand maps to0so doctor never errors on a half-populated persist dir.HRRStructIndex.build()wraps wall-clock timing on both the empty-store early return path and the normal build path.HRRStructIndexCache._resolve_persist_dir()grows alog_on_ephemeral: bool = Truekeyword-only parameter. No-op today; slot for PR 701 to suppress the one-shot ephemeral WARNING when called from doctor.HRRStructIndexCache.resolve_persist_state() -> dictreturns{enabled, dir, on_disk_bytes, reason}. Read-only — does not mutate cache or fire any log. Reason is one ofNone(enabled),"no store path","AELFRICE_HRR_PERSIST=0","ephemeral path". The ephemeral check mirrors 701's predicate but is evaluated independently so doctor reports correctly before 701 merges.src/aelfrice/doctor.pyDoctorReportgains anhrr_persist_state: dictfield.diagnose(...)acceptshrr_store_path: str | Noneandhrr_dim: int | Noneand runs_diagnose_hrr_persist()when both are provided. Lazy import ofhrr_indexkeeps doctor cheap when HRR isn't in use._format_hrr_section()renders the HRR block under existing per-subsystem rows:src/aelfrice/cli.py_cmd_doctornow passeshrr_store_path=str(db_path())and the defaultdimintodiagnose()._format_hrr_persist_status_line()renders theaelf statusone-liner:Test plan
9 new tests in
tests/test_hrr_struct_index.py:last_build_seconds()returnsNonebefore any buildlast_build_seconds()returns a positive float aftercache.get()persist_disk_bytes(None)and missing-files paths return0persist_disk_bytes(dir)after build equals sum ofstruct.npy+meta.npzsizesresolve_persist_statewithstore_path=None→enabled=False, reason="no store path"resolve_persist_statewithAELFRICE_HRR_PERSIST=0→enabled=False, reason="AELFRICE_HRR_PERSIST=0"resolve_persist_statewith normal path →enabled=True, reason=None, on_disk_bytes>=0resolve_persist_statedoes NOT trigger the ephemeral one-shot log (read-only contract)diagnose()populateshrr_persist_stateand_format_hrr_sectionrenders the 3 rowsPytest: 71 pass / 2 skip across
tests/test_hrr_struct_index.pyandtests/test_doctor.py.Out of scope
The remaining 553 follow-ups (TOML key, cold-start bench gate, docs bundle) are filed as separate sub-issues. See the 553 umbrella for the cross-reference list.
macOS-vs-Linux note
On macOS,
Path("/tmp/x").resolve()returns/private/tmp/x(symlink).resolve_persist_statechecks rawPath(self.store_path).parentwithstartswith, so it WILL report"ephemeral path"for a/tmp/...macOS store. PR 701's resolver, by contrast, calls.resolve(strict=False)first and so will NOT auto-disable that same/tmp/...store on macOS. This means on macOS dev hosts the doctor row may say "off (ephemeral path)" while the cache actually persists. Acceptable for now — production target is Linux containers; once 701 lands, the standalone check here can be collapsed to call the resolver.