Gate server code and dependencies behind Cargo features for minimal local builds - #595
Merged
Merged
Conversation
decode_stdio_ai_response was replaced by the multiplexed IPC reader (start_stdin_reader) in commit abf87a1 and marked as dead code. Remove the function and its unit tests. Signed-off-by: Aleksei Vetrov <vetaleha@gmail.com>
Rename src/api.rs to src/server.rs and temporarily re-export server as api in src/lib.rs to allow git to track most of the file history across the module split. Signed-off-by: Aleksei Vetrov <vetaleha@gmail.com>
Split the api module into HTTP protocol request and response types in src/api.rs and server implementation in src/server.rs. This allows sashiko-cli and other api users to import protocol types without pulling in server dependencies. Make AnalyzeBugPayload, RequestLinkRequest, VerifyLinkQuery, and their fields public so server handlers can access them and to match other API types. Add #[allow(clippy::items_after_test_module)] on mod tests in src/server.rs. The warning was previously suppressed implicitly by the serde derive macros on RequestLinkRequest and VerifyLinkQuery located after mod tests. Signed-off-by: Aleksei Vetrov <vetaleha@gmail.com>
BugInput and BugOutcome are the request and response payloads for POST /analyze-bug. Moving them from workflows::linux_bug into api.rs decouples the api module and its users from server implementation modules. Signed-off-by: Aleksei Vetrov <vetaleha@gmail.com>
…uilds Introduce server and cache Cargo features, enabled by default. With --no-default-features, sashiko local review (sashiko init, sashiko review) and sashiko-cli can be built without server or database dependencies. These dependencies are now marked as optional in Cargo.toml. The cache feature can be enabled separately to allow local review with SQLite AI response caching, pulling only SQLite dependencies without the rest of the server dependencies. Enable the uuid v4 feature explicitly. It was implicitly enabled through the libsql dependency, but now that libsql is optional, the Ollama provider needs v4 enabled unconditionally. Server-specific and cache-specific code is now gated behind the new features: * Cargo.toml: benchmark requires server, because it drives a running server and reads results from its database. * src/ai/mod.rs: the response cache is an SQLite database, so it and its test live under cache, and ai.response_cache = true without it is rejected with an error instead of being silently ignored; vector_search is server-only, as it deduplicates bugs stored in the server database, and so is proxy, an axum handler not mounted by local review. * src/ai/openai.rs: the temperature fallback tests need an HTTP mock server, which they build with axum, so they run only with server. * src/auth.rs: JWT sessions and request extractors, with their tests, are server-only, as they authenticate users of the server API; LocalToken stays, as sashiko-cli uses it. * src/db.rs: Database, its SQL helpers and its tests are server-only, because local review stores nothing; the bug, patchset and message types stay, as api.rs uses them in requests and responses shared with sashiko-cli. * src/lib.rs: ingestion (NNTP, mbox, forges, patchwork), HTTP API, email delivery and review pipeline modules are server-only; local review takes commits from git and prints results to the terminal. * src/main.rs: move server startup from main into run_daemon and gate it, the ingestion helpers and their tests under server; the init, review and worker subcommands stay, and without server main returns an error where it would have started the server. * src/patch.rs: parse_email and its tests are server-only, as they handle raw mailing list messages, which local review never uses, since it reads patches from git. * src/worker/mod.rs: background workers (bug analysis, email, forge, patchwork, compression, repository sync and repack) are server-only; prefetch and prompts stay for local review. * src/workflows/mod.rs: linux_bug is server-only, as it analyzes bugs reported to the server and stores them in its database. * tests/integration_tests.rs: all modules except cli_tests and prefetch_e2e_test are server-only, because they test ingestion and the server database, which local review does not use. Add lint-local, lint-local-cache, test-local, and test-local-cache targets to Makefile to test different feature combinations, and run them from make check-pr and GitHub Actions workflows. Document the server and cache features in GEMINI.md and README.md. Signed-off-by: Aleksei Vetrov <vetaleha@gmail.com>
Sashiko review✓ No issues found across 5 commits. |
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.
Every sashiko build compiles all server code and its dependencies, even when installed only for
sashiko revieworsashiko-cli, which doesn't use it. This series moves these dependencies behind Cargo features enabled by default, so existing builds are not changed.Building with
--no-default-featuresdrops the dependency graph from 368 to 210 crates and third-party sources from 320 MB to 200 MB. A clean release build takes 40 seconds instead of 116 on a 96-core machine, and thesashikobinary shrinks from 45 MB to 22 MB. With--features cache, which keeps the local AI response cache, the numbers are 298 crates, 80 seconds and 30 MB.The first commits are refactoring that is useful on its own: it removes dead code and splits the api module from server code, so API clients no longer depend on server internals. The last commit adds the features to Cargo and marks all server code, modules and test to be compiled conditionally. It also adds CI integration to test all new feature combinations in presubmit.