Skip to content

fix(storage)+feat(cli): lbug truncate SIGBUS + scip-go/python/typescript distribution#177

Merged
theagenticguy merged 2 commits into
mainfrom
fix/scip-distribution-and-lbug-truncate-sigbus
Jun 2, 2026
Merged

fix(storage)+feat(cli): lbug truncate SIGBUS + scip-go/python/typescript distribution#177
theagenticguy merged 2 commits into
mainfrom
fix/scip-distribution-and-lbug-truncate-sigbus

Conversation

@theagenticguy
Copy link
Copy Markdown
Owner

Summary

Two independent fixes. The first is what actually killed codehub analyze; the second is the requested distribution work.

1. fix(storage): lbug truncate SIGBUS

@ladybugdb/core@0.16.1 crashes with SIGBUS when MATCH (n:CodeNode) DELETE n runs during truncate while the och_fts full-text index is live on CodeNode. SIGBUS is an un-catchable native signal, so the bulk-load retry wrapper can't recover it. It only fires at scale on an mmap'd on-disk graph (a real ~11k-node graph crashes every run; a 2-node store never faults). The .lbug file is not corrupt — it opens and replays its WAL fine.

truncateAll() now drops och_fts/och_vec before any delete and resets the rebuild flags so the post-insert ensureFtsIndex/ensureVectorIndex rebuild them.

2. feat(cli): scip-go / scip-python / scip-typescript distribution

The pinned downloader covered clang/ruby/dotnet/kotlin but not the npm/Go indexers (mise use scip-python fails — it's an npm package).

  • scip-go: SHA256-pinned release tarball + node:zlib gunzip + minimal tar extraction.
  • scip-python / scip-typescript: hard deps of @opencodehub/scip-ingest, resolved onto the spawn PATH via a new hostedScipBinDirs() that handles npm-global and pnpm layouts.
  • doctor: reports both as bundled; adds a setup --scip=go hint.

Verification

  • Crash: controlled 6/6 A/B (off → crash, on → clean); full analyze on a real graph exits 0.
  • Distribution: scip-go downloads/extracts/runs; scip-python/typescript spawn by bare name; full analyze on a Python project runs scip-python and emits python.scip.
  • Gate: scip-ingest 83/83, storage 165/166 (1 skip), cli 303/303; lint clean (671 files), typecheck clean, banned-strings PASS.

Note

An older scip-go 0.2.3 on a dev PATH shadows the pinned 0.2.7 in doctor output. Harmless: at analyze time ~/.codehub/bin is prepended, so a setup --scip=go install of 0.2.7 wins.

@ladybugdb/core 0.16.1 crashes with SIGBUS when `MATCH (n:CodeNode) DELETE n`
runs while the och_fts full-text index is live on CodeNode. The crash is an
un-catchable native signal, so the bulk-load retry wrapper cannot recover it,
and it only manifests at scale on an mmap'd on-disk graph.

truncateAll() now drops och_fts (CodeNode) and och_vec (Embedding) before any
delete via a new dropSearchIndexes() helper, swallowing the catchable
no-such-index / extension-not-loaded errors, and resets the *IndexBuilt flags
so the post-insert ensureFtsIndex/ensureVectorIndex rebuild them.

Verified 6/6 A/B against a real ~11k-node graph: crash every run without the
drop, clean every run with it. Adds a regression test asserting the FTS index
is dropped and rebuilt across a replace-truncate.
The pinned downloader covered clang/ruby/dotnet/kotlin but not the
npm/Go-distributed indexers, so scip-python/typescript/go had to be installed
by hand (and `mise use scip-python` fails — it is an npm package, not a mise
tool). This wires all three into codehub's own distribution.

- scip-go: new SCIP_GO_PIN (v0.2.7, SHA256-verified release tarballs;
  darwin-x64 marked unavailable). The downloader gains node:zlib gunzip + a
  minimal tar reader to extract the scip-go binary from the .tar.gz; the pin
  still hashes the tarball bytes, and archive-tool idempotency uses an
  extracted-binary presence check.
- scip-python (@sourcegraph/scip-python@0.6.6) and scip-typescript
  (@sourcegraph/scip-typescript@0.4.0): added as hard dependencies of
  @opencodehub/scip-ingest. withCodehubBinOnPath now resolves their bin shims
  via hostedScipBinDirs(), which walks up from both the resolved package and
  this module to cover npm-global and pnpm layouts, and prepends the .bin dirs
  to the spawn PATH so the runner finds them by bare name.
- doctor: reports scip-typescript/python as bundled (resolved via the same
  hostedScipBinDirs the runner uses) and adds a setup --scip=go hint.

Verified end-to-end: scip-go downloads + extracts + runs; scip-python/typescript
spawn by bare name; a full analyze on a Python project runs scip-python and
emits python.scip. Adds tarball-extraction, SHA-mismatch, idempotency, and
PATH-resolution tests.
@theagenticguy theagenticguy enabled auto-merge (squash) June 2, 2026 02:37
@theagenticguy theagenticguy merged commit 50626bd into main Jun 2, 2026
32 of 34 checks passed
@theagenticguy theagenticguy deleted the fix/scip-distribution-and-lbug-truncate-sigbus branch June 2, 2026 02:39
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