Skip to content

feat(platform): macOS Intel support via graph-only mode (PR-MI1..MI4)#382

Merged
HumanBean17 merged 4 commits into
masterfrom
feat/add-mac-intel-support
Jul 6, 2026
Merged

feat(platform): macOS Intel support via graph-only mode (PR-MI1..MI4)#382
HumanBean17 merged 4 commits into
masterfrom
feat/add-mac-intel-support

Conversation

@HumanBean17

Copy link
Copy Markdown
Owner

Summary

java-codebase-rag was uninstallable on Intel Mac by accident of its dependency tree: torch ≥2.3 and lancedb ≥0.26 dropped macOS x86_64 wheels (the former permanently). cocoindex, ladybug/kuzu, pyarrow, numpy all still ship Intel wheels — so the graph layer works; only vector/semantic search is unavailable.

This PR makes Intel Mac install graph-only automaticallypip install java-codebase-rag just works, the graph layer (find/describe/neighbors/resolve) is fully usable, and the search tool reports it is unavailable rather than failing. Apple Silicon, Linux, and Windows are unchanged (full semantic + graph search).

Mechanism: PEP 508 environment markers (sys_platform != 'darwin' or platform_machine != 'x86_64') exclude the vector trio only on Intel Mac — non-breaking for every other platform.

This is not purely a deps change: server.py/mcp_v2.py eagerly imported the vector stack at module load, and init hard-failed when cocoindex was absent — so small refactors were needed so the graph-only install actually boots and builds.

Commits (PR-MI1..MI4)

  • PR-MI1 pyproject.toml — PEP 508 markers gate cocoindex[lancedb], lancedb, sentence-transformers.
  • PR-MI2 mcp_v2.py / server.py / pipeline.py — lazy/optional vector imports so the MCP server boots graph-only; search degrades cleanly. Centralized the preflight-blocker detector in pipeline.py.
  • PR-MI3 cli.py / installer.pyinit/increment/install/update treat a cocoindex preflight blocker as skip-vectors-and-build-graph instead of failure (mirrors the existing erase/reprocess --graph-only degrade patterns).
  • PR-MI4 tests + CI + docs — importorskip/@needs_vectors guards; macos-13 (Intel) added to the CI matrix; README corrected.

Verification

  • Graph-only boot (simulated by blocking the vector modules): server imports with zero vector modules loaded, all 5 tools register, search returns the unavailable envelope. CLI --help renders. Collection: 1075 tests, 0 errors.
  • Graph-only test_mcp_v2: 96 passed, 11 skipped (search tests skip cleanly).
  • Full mode: test_mcp_v2 106 passed; full suite 1065 passed, 15 skipped, no regressions.
  • Detector unit test classifies all 4 cases (127 stub / 126 stub / real failure / success); ruff clean; workflow YAML valid.

Out of scope / follow-ups

  • ONNX embedder swap to restore semantic search on Intel (additive future work; not needed for graph-only).
  • Pre-existing (not addressed here): the HEAVY-gated test_lancedb_ignore_file_reduces_indexed_java_files fails locally because a .java-codebase-rag dir is committed inside tests/fixtures/lancedb_ignore_smoke/ (AGENTS.md says never commit those). It's skipped in CI (HEAVY=0) and unrelated to this change. Worth a separate cleanup PR.

🤖 Generated with Claude Code

HumanBean17 and others added 4 commits July 6, 2026 09:18
…-MI1)

torch >=2.3 and lancedb >=0.26 dropped macOS x86_64 wheels, so the full vector
stack is uninstallable on Intel Mac. Gate cocoindex[lancedb], lancedb, and
sentence-transformers behind `sys_platform != 'darwin' or platform_machine !=
'x86_64'` so `pip install java-codebase-rag` resolves graph-only there.
Apple Silicon / Linux / Windows are unchanged (every other dep ships an Intel
wheel or is pure-Python).

Co-Authored-By: Claude <noreply@anthropic.com>
The MCP server eagerly imported lancedb/torch (via search_lancedb and
sentence_transformers) at module load, so it could not start on a graph-only
install. Make those imports optional:
- mcp_v2: SentenceTransformer imported lazily in _get_sentence_transformer
  (TYPE_CHECKING guard); search_lancedb via a guarded module-level try/except
  so mcp_v2.run_search/TABLES stay as attributes (tests monkeypatch them) and
  become None sentinels when the stack is absent; search_v2 returns a clean
  SearchOutput(success=False, "vector search unavailable") on graph-only.
- server: TABLES imported lazily in list_code_index_tables_payload() (CLI-only)
  with an empty-tables fallback.
- pipeline: centralize is_cocoindex_preflight_blocker / is_graph_preflight_blocker
  next to the stub CompletedProcess shapes they match (fixes the prior "must
  stay aligned" duplication hazard); cli/installer consume them in PR-MI3.

The 4 graph tools (find/describe/neighbors/resolve) and ScopeManager keep
working; only `search` degrades. No tool signatures change.

Co-Authored-By: Claude <noreply@anthropic.com>
…all (PR-MI3)

init/increment/install/update previously hard-failed when cocoindex was absent
(the graph-only reality on macOS Intel). Treat a cocoindex preflight blocker
(returncode 126/127 stub from pipeline) as "skip the vectors phase, proceed to
the graph build" rather than failure — mirroring the existing erase lancedb
guard and reprocess --graph-only patterns. A genuine non-zero cocoindex exit
still fails. Graph-only installs now build/refresh the graph and exit 0.

Co-Authored-By: Claude <noreply@anthropic.com>
… (PR-MI4)

- tests: importorskip the two files that import the vector stack at module
  scope (test_search_lancedb, test_search_lancedb_capability) so they skip
  cleanly instead of erroring at collection on a graph-only runner;
  @needs_vectors skipif on the 10 search tests in test_mcp_v2 that load the
  SentenceTransformer model. Graph tests run unconditionally.
- CI: add macos-13 (Intel x86_64) to the OS matrix (continue-on-error, like
  the other non-ubuntu legs) so the graph-only install/boot path is exercised
  on real Intel hardware; skip the HuggingFace cache step there.
- README: correct the false "every native dependency ships a wheel" claim —
  document Intel Mac graph-only mode (auto via PEP 508 markers); replace the
  dead `pip install -r requirements.txt` with the editable install.

Co-Authored-By: Claude <noreply@anthropic.com>
@HumanBean17 HumanBean17 merged commit 60a5065 into master Jul 6, 2026
3 of 4 checks passed
@HumanBean17 HumanBean17 deleted the feat/add-mac-intel-support branch July 6, 2026 07:02
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.

1 participant