Skip to content

Build the packdb client binary - #37

Merged
aaraujo merged 2 commits into
mainfrom
feat/packdb-binary
Oct 30, 2026
Merged

aaraujo merged 2 commits into
mainfrom
feat/packdb-binary

Conversation

@aaraujo

@aaraujo aaraujo commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Builds packdb, PackDB's command-line client, from this repository. The packdb-cli package gains a [[bin]] packdb whose main parses the library's Command and exits with the status run returns. The library is unchanged and stays the shared API (Command, run, Io).

The client never starts a server

  • Bare packdb prints help to stderr and exits 2, before any runtime or connection exists.
  • Help, --version and usage errors are output like any other. packdb parses with try_parse and writes and flushes what clap renders itself. If that fails, it exits 8, as the contract promises for every output; clap's own exit would ignore the failure and exit 0 or 2. No subcommand starts a server; the single-node server is packdb-server, built from the server repository.
  • The checks gate gains a dependency check. Every PackDB package in packdb-cli's normal and build dependency closure, with all features, must be packdb-cli, packdb-client or packdb-otel. Any other packdb or packdb-* package fails the gate.

Tests

  • The process tests move from packdb-cli-test-harness to crates/packdb-cli/tests/process.rs and run the real binary. They are unchanged apart from the executable they start (Git shows the move as a rename).
  • New cases:
    • --version prints packdb <version>.
    • --help works for every command.
    • Bare packdb exits 2 promptly in an empty working directory, with a temporary HOME and XDG directories, and creates no files.
    • Help, a subcommand's help and --version with stdout unwritable, and two usage errors and bare packdb with stderr unwritable, all exit 8. Each case gets a pipe with no reader. The suite's spawns and pipe closes share one lock, so a child forked at the same moment by another test cannot keep that pipe's reading end open.
  • With every process assertion now made against packdb, the test-only packdb-cli-test-harness is removed. Cargo.lock changes only by dropping it.

Docs

The README, the crate README, COMPATIBILITY.md, RELEASING.md, CHANGELOG.md and scripts/oss-ci.sh now describe the binary instead of "no executable". RELEASING.md says that binary distribution is decided separately; this change ships no binaries.

Local checks

Against the pinned SDK commit 522c0d951a495e3dddb0a6387256f7ace430fadc:

  • scripts/oss-ci.sh checks with OSS_CHECK_SCOPE=full passes. That covers policy, action pins, source headers, the dependency check, fmt, clippy -D warnings, rustdoc -D warnings, the test matrix on 1.94.1 and stable with default features and flight-sql, doc tests and package contents.
  • process.rs passes all 19 tests (15 moved, 4 new), and 180 of 180 concurrent runs of the suite (12 at a time) pass.
  • Control: against the earlier Cli::parse() binary, --help with stdout unwritable exits 0, and the unwritable-stream test fails.
  • Dependency-check control: cargo tree lists exactly packdb-cli, packdb-client and packdb-otel. With packdb-otel taken out of the allowed list, the check reports it.
  • scripts/oss-ci.sh coverage against main passes. src/main.rs is at 89.1% (49/55 lines) and src/lib.rs at 100%; the per-file threshold is 80%.

The packdb-cli package now builds `packdb`, the command-line client. Its
main parses the library's `Command` and exits with the status `run`
returns; the library stays the shared API.

`packdb` is a client only. Bare `packdb` prints help to stderr and exits
2, and no subcommand starts a server. The checks gate now fails if the
package's dependency closure contains a PackDB package other than
packdb-cli, packdb-client and packdb-otel.

The process tests move from packdb-cli-test-harness to the real binary,
unchanged apart from the executable they run, and gain cases for
--version, help for every command, and bare `packdb` exiting promptly
without creating files. The harness is removed.
`Cli::parse()` let clap print help, the version and usage errors and
exit by itself, so a closed or failing stdout or stderr still exited 0
or 2. `packdb` now parses with `try_parse`, writes what clap renders to
the stream clap chose, flushes it, and exits 8 when that fails, as the
contract promises for every output. The runtime-start error is written
the same way.

The process tests run help, `--version`, two usage errors and bare
`packdb` against a stream whose pipe has no reader. Spawns and pipe
closes in the suite now share a lock, so no concurrently forked child
can keep such a pipe's reading end open.
@aaraujo
aaraujo merged commit ce0a426 into main Oct 30, 2026
8 checks passed
@aaraujo
aaraujo deleted the feat/packdb-binary branch October 30, 2026 18:24
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