Repository navigation
Rename to bv-server; switch wire magics with legacy compatibility; record answering backend - #8
Conversation
The project is a bit-vector expression service: it solves, optimizes and simplifies QF_BV expressions. "smt-server" made people think it was only an SMT solver front-end. Mechanical rename only; behaviour and the wire format are unchanged: - crates: smt-server -> bv-server, smt-wire -> bv-wire, smt-qfbv-smtlib -> bv-smtlib (qfbvsmtrs keeps its name) - Python: smt_wire -> bv_wire (examples use `import bv_wire as bv`), smt_z3_server.py -> bv_z3_server.py - C++: header, namespace and CMake package smt_wire -> bv_wire, base exception smt_error -> bv_error - environment variables SMT_SERVER_* -> BV_SERVER_* - default data directory ~/.smt-server -> ~/.bv-server - docs/smt-wire-protocol.md -> docs/bv-wire-protocol.md
New magics: BVSQ (request), BVSR (response), BV\0\0 (expression buffer). Clients emit only these. Legacy compatibility (bv_wire::raw::legacy): - The server accepts SMTQ requests: it upgrades the request and embedded expression magics, dispatches normally, and downgrades the response (and the expression magic in a HAS_EXPR simplify block) back to SMTR/SMT\0, so already-built clients keep working. The Python Z3 server does the same. - The cache and recordings only ever see current magics, so legacy and current clients share cache entries and recorded rows. Recordings: - If ~/.bv-server/recordings.db does not exist but ~/.smt-server/recordings.db does, copy it into place on startup (read-only VACUUM INTO + no-clobber hard link); the old file is never modified. - Versioned upgrade via PRAGMA user_version, run once at startup before accepting connections: v0 (smt-server) rows are rewritten to the new magics and re-keyed; v2 adds a nullable `backend` column. - migrate-recordings accepts legacy-magic file trees and defaults to ~/.smt-server/requests again. - SMT_SERVER_RECORD_DB is still honoured (with a deprecation warning) when BV_SERVER_RECORD_DB is unset. Backend attribution: - QueryResult gains `backend`, filled in by wrapper backends (router, pool, racing) via `attributed_to`, so it names the leaf that answered: the race winner (z3/binbit/qfbvsmtrs) or the simplifier (rumba). - Recorded in the new `backend` column for binary and SMT-LIB text requests; NULL for errors and pre-existing rows. First recording wins. Docs: README "Upgrading from smt-server" section and new project description; protocol doc documents the legacy magics.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
CI runs clippy with -D warnings on the latest stable, which added two diagnostics in existing code: - clippy::chunks_exact_to_as_chunks in bv-smtlib's annotation parsing: use `as_chunks::<2>()` and destructure the keyword/value pair. - `AtomicUsize::fetch_update` is deprecated in favour of `try_update`, which older toolchains lack; use an equivalent compare_exchange_weak loop.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c70d7f9ad5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…s to start On Windows the server exits with STATUS_DLL_NOT_FOUND and an empty stderr, which says nothing about where the test looked for libz3.dll.
Newer Cargo puts build-script output in target/debug/build/<pkg>/<hash>/out instead of target/debug/build/<pkg>-<hash>/out. The live-server test and the C++ CI step only globbed the old layout, so on Windows (the one platform where z3 is a DLL that must be on PATH) they found nothing and the server exited with STATUS_DLL_NOT_FOUND. Match both layouts.
handle_connection replaced an over-limit response with a BVSR error after dispatch had already downgraded it, so SMTQ clients got a frame they could not parse.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4516e5afbb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…clients Same bug as the Rust server: the size-limit replacement used BVSR. Also run the legacy-magic tests from the script's main(), which had skipped them.
Renames the project to bv-server. It's a bit-vector expression service (solve, optimize, simplify) for lifting-based binary analysis, and "smt-server" made people assume it was only an SMT solver front-end.
The two commits are easier to review separately:
bv-server/bv-wire/bv-smtlib(qfbvsmtrskeeps its name), Pythonbv_wireandbv_z3_server.py, C++bv_wire(header, namespace, CMake package;smt_error→bv_error), env varsBV_SERVER_*, data dir~/.bv-server.Wire magics
New:
BVSQ/BVSR/BV\0\0. Clients emit only these.The server still accepts
SMTQrequests from already-built clients and answers withSMTR(andSMT\0inside simplify responses). Conversion happens at the dispatch boundary (bv_wire::raw::legacy), so the backends, the cache and the recordings only ever see current magics, and old and new clients share cache entries and recorded rows. The Python Z3 server does the same.Recordings carry over
~/.bv-server/recordings.dbis missing but~/.smt-server/recordings.dbexists, the server copies the old database in at startup. It uses a read-onlyVACUUM INTOfollowed by a no-clobber hard link, and the old file is never modified.PRAGMA user_versionand upgraded once at startup, before accepting connections. v0 rows are rewritten to the new magics and re-keyed; v2 adds thebackendcolumn.SMT_SERVER_RECORD_DBis still honoured (with a warning).SMT_SERVER_ADDRESSandSMT_SERVER_TEXT_QFBVSMTRS_BUDGET_MSmust be renamed.Backend attribution
New nullable
recordings.backendcolumn: the race winner (z3/binbit/qfbvsmtrs) or the simplifier (rumba). Wrapper backends fill it in viaQueryResult::attributed_to, so it names the backend that actually answered. It's NULL for errors and existing rows. The first recording of a query wins, and the wire protocol is unchanged.Testing
cargo test --workspace: 159 tests pass. The rename commit passes on its own (149 tests).tests/legacy_magic.rs), upgrading a real smt-server-schema database, importing the old default database without modifying it (including rows still in the WAL), legacy file-tree import, v1 → v2 upgrade, and attribution through the router and racing backends.rumba, SMT-LIB text attributed too.Heads-up
Open PRs #7 (CoBRA) and #3 (bitwuzla) will conflict, since everything moved from
crates/smt-servertocrates/bv-server. New backends constructingQueryResultshould keep using the constructors; the new field defaults toNone.CI fixes (also broken on
master)CI hadn't run since August, and the toolchain moved on in the meantime.
mastercurrently fails at clippy too.c70d7f9: Rust 1.100 clippy. Fixed the newchunks_exact_to_as_chunkslint inbv-smtlib, and replaced the now-deprecatedAtomicUsize::fetch_updatewith acompare_exchange_weakloop. (Its suggested replacement,try_update, doesn't exist on older toolchains.)fd51ac5: newer Cargo writes build-script output tobuild/<pkg>/<hash>/outinstead ofbuild/<pkg>-<hash>/out. The live-server test and the C++ CI step looked for the z3 DLL only in the old layout, so on Windows the server exited withSTATUS_DLL_NOT_FOUND. Both now search both layouts.b7e2eda: when the server fails to start, the live-server test now reports which z3 directories it searched.