Skip to content

Bridge Sighthouse library corpus into a BSimVis reference collection - #48

Draft
rdmmf wants to merge 3 commits into
devfrom
worktree-sighthouse-bridge
Draft

Bridge Sighthouse library corpus into a BSimVis reference collection#48
rdmmf wants to merge 3 commits into
devfrom
worktree-sighthouse-bridge

Conversation

@rdmmf

@rdmmf rdmmf commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Corpus side of standard-library identification (no issue open yet — discussed as strategy #2: a reference collection matched via a pool with only_cross_collection).

scripts/sighthouse_bridge.py reads Sighthouse's S3 repo, takes every job that reached the Ghidra Analyzer success state, and stages its compiled artifacts on disk grouped by (library, version, compiler variant). Each group becomes one bsimvis-upload run so the group's tags (stdlib, lib:*, ver:*, variant:*) land on every file in it.

Notes

  • Keeps .o, not just .so. Only openssl and glibc emit shared objects in this corpus; zlib, zstd, lz4, upx and mbedtls are object-files-only, so a .so-only bridge would silently drop most of the libraries.
  • Excludes test/, fuzz/, doc/, demos/, examples/, benchmark/ — harness code, not library code. Trims openssl from 2215 to 1894 objects.
  • --skip-sim on every upload, since a reference collection is only compared across collections.
  • Defaults to printing the upload commands; --upload runs them.

Checks

  • --selftest covers the selection filter and variant parsing.
  • Live dry run against the local rustfs: 23 job records → 3 groups → 2183 files extracted, metadata CSVs written with real MD5s.
  • ./scripts/wt-test.sh: 278/278 passed.

Not run end-to-end into a live BSimVis — no API instance was up, so the --upload path is unexercised.

🤖 Generated with Claude Code

rdmmf and others added 3 commits July 29, 2026 19:46
…nce collection

Sighthouse compiles library sources under several compiler variants and
analyses them with Ghidra. This pulls the resulting build artifacts out of
its S3 repo and stages them for upload as a BSimVis reference collection,
which is the corpus side of standard-library identification: a pool with
only_cross_collection can then match unknown binaries against known library
code without computing similarities inside the reference set.

Keeps object files as well as shared libraries -- only openssl and glibc
emit .so in this corpus, so a .so-only bridge would silently drop zlib,
zstd, lz4, upx and mbedtls. Test, fuzz and demo paths are excluded.

Uploads pass --skip-sim: a reference collection is only ever compared
against other collections, so intra-collection similarities are wasted work.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Testing the bridge end-to-end against a live BSimVis turned up four
defects in the previously unexercised --upload path:

- There is no `bsimvis-upload` binary; uploading is a subcommand of the
  single `bsimvis` entrypoint.
- bsimvis resolves bsimvis_config.toml relative to the working directory,
  which is not necessarily where the bridge runs from. Added --bsimvis-config.
- bsimvis rejects a bare directory as a target ("Target path is not a
  file"); its "directory/*" help means a shell-expanded glob. Pass the
  extracted files individually.
- bsimvis upload exits 0 even when every file fails, so the exit code was
  reporting uploads that never happened. Parse the printed success rate
  instead, and report extracted and uploaded counts separately.

Also adds --only to bridge a single group, which is what makes a small
end-to-end run practical.

Verified: zlib v1.2.13 x86_64-O1, 19/19 files uploaded to a live instance,
tags stdlib/lib:zlib/ver:v1.2.13/variant:x86_64-O1 present on each, and 0
similarities built in the collection confirming --skip-sim takes effect.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The usage example described an invocation that cannot work: it used the
wrong port and omitted --bsimvis-bin and --bsimvis-config, both of which
are needed in practice. Replace it with the form actually verified
end-to-end, and document the prerequisite that rustfs must be running and
does not publish port 9000 to the host.

Drop DEFAULT_REPO and make --repo required. A default pointing at
127.0.0.1:9000 could never connect, so it only produced an obscure failure.

Also records the collection the corpus lands in (stdlib-ref), the tags each
file carries, and the known limitation that top-level demo programs such as
zlib's example.o are not caught by the path-based noise filter.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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