Repository navigation
Build the packdb client binary - #37
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds
packdb, PackDB's command-line client, from this repository. Thepackdb-clipackage gains a[[bin]] packdbwhosemainparses the library'sCommandand exits with the statusrunreturns. The library is unchanged and stays the shared API (Command,run,Io).The client never starts a server
packdbprints help to stderr and exits2, before any runtime or connection exists.--versionand usage errors are output like any other.packdbparses withtry_parseand writes and flushes what clap renders itself. If that fails, it exits8, as the contract promises for every output; clap's ownexitwould ignore the failure and exit0or2. No subcommand starts a server; the single-node server ispackdb-server, built from the server repository.packdb-cli's normal and build dependency closure, with all features, must bepackdb-cli,packdb-clientorpackdb-otel. Any otherpackdborpackdb-*package fails the gate.Tests
packdb-cli-test-harnesstocrates/packdb-cli/tests/process.rsand run the real binary. They are unchanged apart from the executable they start (Git shows the move as a rename).--versionprintspackdb <version>.--helpworks for every command.packdbexits2promptly in an empty working directory, with a temporaryHOMEand XDG directories, and creates no files.--versionwith stdout unwritable, and two usage errors and barepackdbwith stderr unwritable, all exit8. 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.packdb, the test-onlypackdb-cli-test-harnessis removed.Cargo.lockchanges only by dropping it.Docs
The README, the crate README,
COMPATIBILITY.md,RELEASING.md,CHANGELOG.mdandscripts/oss-ci.shnow describe the binary instead of "no executable".RELEASING.mdsays that binary distribution is decided separately; this change ships no binaries.Local checks
Against the pinned SDK commit
522c0d951a495e3dddb0a6387256f7ace430fadc:scripts/oss-ci.sh checkswithOSS_CHECK_SCOPE=fullpasses. 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 andflight-sql, doc tests and package contents.process.rspasses all 19 tests (15 moved, 4 new), and 180 of 180 concurrent runs of the suite (12 at a time) pass.Cli::parse()binary,--helpwith stdout unwritable exits0, and the unwritable-stream test fails.cargo treelists exactlypackdb-cli,packdb-clientandpackdb-otel. Withpackdb-oteltaken out of the allowed list, the check reports it.scripts/oss-ci.sh coverageagainstmainpasses.src/main.rsis at 89.1% (49/55 lines) andsrc/lib.rsat 100%; the per-file threshold is 80%.