[APMSVLS-501] refactor(bottlecap): preparatory work for a new "test-mode" binary - #1344
Conversation
|
🔗 Commit SHA: 1976b21 | Docs | View more details | Give us feedback! |
There was a problem hiding this comment.
Pull request overview
Prepares Bottlecap for a future lifecycle-free test-mode binary.
Changes:
- Adds a feature-gated no-op invocation processor with default responses.
- Adds an extensible TraceAgent router seam.
- Adds focused unit tests for both additions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
bottlecap/Cargo.toml |
Defines the test-mode feature. |
bottlecap/src/lifecycle/invocation/processor_service.rs |
Adds and tests the no-op processor handle. |
bottlecap/src/traces/trace_agent.rs |
Adds and tests router extensions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
b7bfcb6 to
abb35a3
Compare
|
@codex review |
Codex Review SummaryThis 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. |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
abb35a3 to
211d68c
Compare
901ea64 to
e852fe4
Compare
…omments Add a clippy step covering the test-mode feature to the GitHub Actions and GitLab pipelines so the feature is compiled on every CI run instead of only on the follow-up binary PR. Also document that Router::merge panics on duplicate paths in the RouterExtension docs and correct the stale test-mode feature comment in Cargo.toml.
e49b50d to
1976b21
Compare
TL;DR: refactoring here first to prepare for #1216 and keep that PR slightly smaller.
Part of a PR stack:
bottlecap-test-modebinary #1216Overview
Preparatory refactors for the upcoming
bottlecap-testmodebinary (APMSVLS-501), which reusesTraceAgent/handle_tracesbut has no Lambda lifecycle to drive. Two logical changes:The
bottlecap::startupextraction (build_trace_agentand the publicstartupmodule) lands in #1216 alongside thebottlecap-test-modebinary that consumes it, where it has a caller; this PR keeps its scope to the two seams below and leavesmain.rsandlib.rsuntouched.1.
InvocationProcessorHandle::noop()Constructor backed by a background task that acknowledges every
ProcessorCommandwith a sensible default so callers never block on their response oneshots:GetReparentingInfo,UpdateReparenting,SetColdStartSpanTraceId,PlatformRuntimeDone,PlatformReport) reply with empty/default values.The
matchis exhaustive: adding a newProcessorCommandvariant will cause a compile error here, forcing test-mode behavior to be decided explicitly. A response-carrying variant placed in the fire-and-forget arm would silently drop its sender, causing the caller to receiveProcessorError::ChannelReceiveinstead of the intended default.The noop channel capacity matches the real
InvocationProcessorServiceto avoid backpressure surprises.2.
RouterExtensionseam onTraceAgentAdds a generic extension point that lets a caller merge additional axum routes into the trace-agent's HTTP router without
TraceAgentknowing what those routes do. When no caller attaches an extension (the Lambda binary case), the HTTP surface on port 8126 is unchanged.pub trait RouterExtension: Send + Sync { fn extend(&self, router: Router) -> Result<Router, Box<dyn Error>>; }defined intraces::trace_agent. ReturningErraborts agent startup and surfaces the error in the existing log path, preventing silent failures from a panicking or misconfigured extension.TraceAgentholdsrouter_extension: Option<Arc<dyn RouterExtension>>with a consuming builder methodwith_router_extension(self, ext: Arc<dyn RouterExtension>) -> Self.make_routercallsextension.extend(router)?when the field is set, before applying the outer fallback and body-limit layers.#[cfg(test)]-onlySpyExtensionvalidates the seam end-to-end: the trait shape compiles, state is carried viaArc, and merged routes are reachable through the composedRouterreturned bymake_router.Any concrete flush/drain/diagnostic endpoint lives behind an impl of this trait in the consumer crate, not in
trace_agent.rs.Testing
cargo check --bin bottlecapcargo check --libcargo test --libcargo clippy --workspace --all-targets --features default -- -D warningscargo fmt --all -- --checkcargo nextest run --workspace(532/532 passed)InvocationProcessorHandle::noop():noop_request_response_methods_return_defaults,noop_fire_and_forget_commands_do_not_panic,noop_platform_runtime_done_and_report_respond_without_blocking,noop_request_response_variants_complete_within_timeoutRouterExtensionseam:with_router_extension_adds_reachable_route_to_make_router,make_router_returns_404_for_extension_route_when_none_attached