Skip to content

fix(doctor): address four review findings from #31 (closes #107) - #110

Merged
tonydzi merged 2 commits into
tonydzi:mainfrom
Kaap10:fix-doctor-review-findings
Nov 11, 2026
Merged

tonydzi merged 2 commits into
tonydzi:mainfrom
Kaap10:fix-doctor-review-findings

Conversation

@Kaap10

@Kaap10 Kaap10 commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #107.

Addresses the four review findings in src/sqlite_graph_memory/doctor.py:

Changes

  1. Module-top import decoupled: Removed top-level from sqlite_graph_memory import brain_ask and replaced FEEDBACK with a literal string. Imported brain_ask lazily inside check_embeddings, check_models, and check_index so a missing or broken NumPy reports a clean [FAIL] rather than an unhandled traceback.
  2. Transitive dependency classification: In check_embeddings, except ModuleNotFoundError checks exc.name in ('torch', 'sentence_transformers') so that only absent top-level extras report [warn]; missing transitive dependencies (e.g. safetensors, tokenizers) report [FAIL] with reinstall instructions.
  3. HF cache isolation & XDG support: _hf_cache_dirs() now respects XDG_CACHE_HOME and isolates custom caches (HF_HUB_CACHE, HF_HOME) without mixing in the default ~/.cache/huggingface/hub.
  4. Index validation: check_index() now unpickles metadata and checks numpy.load array shape (emb.shape[0] == len(meta)). Empty, truncated, or row/chunk-mismatched index files report [FAIL] with rebuild guidance.

Verification

  • Red run on main:
    • Item 1 reproducer: python -c "import sys; sys.modules['numpy']=None; import sqlite_graph_memory.doctor" raised ModuleNotFoundError: No module named 'numpy'.
    • Item 4 reproducer: empty index files previously passed with [ok] Index found.
    • Items 2 & 3: new tests in tests/test_doctor.py fail against main.
  • Green run on this branch:
    • pytest tests/test_doctor.py -v: 18 passed.
    • pytest tests/test_changelog_released.py -v: 8 passed.
    • Repro 1 prints: [FAIL] numpy: numpy is not installed. -> pip install sqlite-graph-memory.
    • Repro 4 prints: [FAIL] Index: The index is empty: _brain_e5_meta.pkl is 0 bytes. -> Rebuild it: sgm-index /path/to/your/notes.
    • Base install (no extras) and healthy [lite] ONNX install exit 0 with 0 failures.

AI Disclosure

Code and tests written with AI assistance (Antigravity / Gemini) and verified locally.

@Kaap10
Kaap10 requested a review from tonydzi November 10, 2026 14:18
@tonydzi

tonydzi commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Hi, Mycroft here, Anton's synthetic AI co-founder. I read this before the human did, which is the one race I always win.

Logged your pull request ("fix(doctor): address four review findings from #31 (closes #107)") after 2 h of silence, which is on us. What a machine can already tell: 3 file(s) touched, +160/-15, CI green. A human from the lab reads it within 48 hours, as CONTRIBUTING.md promises; if that clock runs out, ping the thread, it is not rude.

— TonyDzi, Palo Alto AI Research Lab · more of the machine this came from (second brain + fleet coordination) lives at github.com/tonydzi, DMs open.

@tonydzi tonydzi left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mycroft again (Anton's synthetic AI co-founder). Here is the substantive review, not just the receipt.

Read the diff and ran tests/test_doctor.py on your branch against current main (which now includes #108): 17 passed, 1 skipped. CI is green on all three workflows.

All four findings from #107 are addressed, and the tests are the right kind: the 0-byte and row-count-mismatch index cases fail on main and pass here, and test_doctor_importable_when_numpy_is_none exercises the actual traceback path in a subprocess instead of mocking around it.

One non-blocking observation: FEEDBACK is now a string literal in doctor.py while brain_ask.FEEDBACK_URL holds the same URL, so the two can drift. It does not affect behavior today and is not worth another round.

You claimed #107 first and the PR is clean, so I am merging it. Thank you, @Kaap10, for coming back to a finding from #31 and closing it properly.

@tonydzi
tonydzi merged commit 78766da into tonydzi:main Nov 11, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sgm-doctor: four review findings from #31 are still open (import order, transitive deps, HF cache, empty index files)

2 participants