Add tickets and ideas
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
# 099 — Remove `test_handle`'s duplicate-of-`spawn` test stub
|
||||
|
||||
## Summary
|
||||
|
||||
`test_handle` is a `#[cfg(test)]` production-file function that exists
|
||||
only to give tests access to the engine's internal `mpsc::Receiver` —
|
||||
it duplicates `spawn()` almost line-for-line rather than exposing that
|
||||
receiver through `spawn()`/`EngineHandle` itself. Per this repo's
|
||||
`IDEAS.md` guidance: prefer changing a function's scope/visibility (or
|
||||
the tests) over maintaining a parallel stub.
|
||||
|
||||
## Where
|
||||
|
||||
- `src/engine/handle.rs:113-128` — `#[cfg(test)] pub(crate) fn
|
||||
test_handle(channel_capacity: usize) -> (EngineHandle,
|
||||
mpsc::Receiver<EngineMessage>)`, duplicating `spawn()`
|
||||
(`src/engine/handle.rs:103-111`) except that `spawn()` discards the
|
||||
receiver after wiring the actor loop, while `test_handle` returns it
|
||||
raw.
|
||||
- Re-exported at `src/engine/mod.rs:21`: `pub(crate) use
|
||||
handle::test_handle;`.
|
||||
- Consumed only by tests in `src/engine/ingest.rs:228` (`use
|
||||
crate::engine::test_handle;`) and called at lines 248, 264, 281, 302
|
||||
inside `#[cfg(test)] mod tests`.
|
||||
|
||||
## Scope
|
||||
|
||||
- Remove `test_handle` and instead give tests access via `spawn()`
|
||||
itself — e.g. have `spawn()` take an optional channel-capacity
|
||||
override and always hand back the receiver alongside the handle (or
|
||||
the actor join handle), with production call sites (`main.rs`)
|
||||
simply ignoring what they don't need, rather than keeping a second
|
||||
constructor whose only difference is what it returns.
|
||||
- Update the four call sites in `src/engine/ingest.rs`'s test module
|
||||
to use the adjusted `spawn()` signature.
|
||||
- Out of scope: the other test-fixture helpers in `src/engine/tests.rs`
|
||||
(`metric_request`, `declare_test_param`, `ingest_log`, `logs_query`,
|
||||
`logs_query_sorted`, etc.) are ordinary test-data builders, not
|
||||
visibility workarounds — leave those alone. Also leave the
|
||||
`#[allow(dead_code)]` items (`src/engine/message.rs:11,29`,
|
||||
`src/api/mcp_server.rs:254`, `src/config/mod.rs:27`, and similar in
|
||||
`metric_primitive.rs`/`data_value.rs`/`timestamp.rs`/`index_key.rs`)
|
||||
untouched — they weren't confirmed to be test-visibility stubs and
|
||||
need individual inspection before deciding whether they're even
|
||||
related to this ticket's pattern.
|
||||
Reference in New Issue
Block a user