Repository navigation
usnm-ingest: sink.rs in one module per concern - #1034
Merged
Merged
Conversation
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
No open issues 🎉
What changed in this PR
Refactors usnm-ingest’s sink implementation by splitting the former oversized sink.rs into separate modules for index template generation, writer node process supervision, and the Quickwit ingest client, while preserving existing public APIs via pub use.
Changes:
- Split
crates/usnm-ingest/src/sink.rsintosink/template.rs,sink/node.rs, andsink/quickwit.rs - Updated design documentation and an internal doc reference to reflect new module paths
- Preserved existing test coverage by moving tests alongside their corresponding modules
| File | Description |
|---|---|
| docs/design/05-search-and-storage.md | Updates references to text_fields, split_target, and Decades::Partitioned to point at sink/template.rs |
| crates/usnm-ingest/src/sink.rs | Converts monolithic sink implementation into a small module root with mod + pub use re-exports |
| crates/usnm-ingest/src/sink/template.rs | New module containing index template rewriting logic and related tests |
| crates/usnm-ingest/src/sink/node.rs | New module containing writer node process management/supervision and related tests |
| crates/usnm-ingest/src/sink/quickwit.rs | New module containing Quickwit ingest client logic and related tests |
| crates/usnm-ingest/src/merges.rs | Updates a doc reference to forward’s new module path |
Review effort: Lite
sink.rs (3,791 lines) keeps the sink trait, the title fields, the stats and the JSONL sink; the index template rewriting, the writer child process and the Quickwit ingest client move to sink/template.rs, node.rs and quickwit.rs, each with its tests. Every public path is re-exported. Code moved, not changed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UsspoBVGFP5Juo1rh6Wwqt
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UsspoBVGFP5Juo1rh6Wwqt
tgoodyear
force-pushed
the
ingest/sink-modules
branch
from
October 23, 2026 15:07
0dcb739 to
7513831
Compare
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.
crates/usnm-ingest/src/sink.rswas 3,791 lines holding three concerns with almost no coupling: rewriting the index template, running the writer child process, and the Quickwit ingest client. Each is now its own file with its tests beside it; the parent keeps the sink trait, the title fields, the stats, the JSONL sink and every public path throughpub use. Code moved, not changed.sink.rsIndexSink,TitleFieldsByLccnandadd_title_fields,SinkStats,JsonlSink,INDEX_TEMPLATE(itsinclude_str!path unchanged),INGEST_QUEUE_MEMORY, themodandpub uselinessink/template.rsWriterTuning,Decades,MainLayout,main_template,page_language_fields,split_target,text_fields, theTEMPLATE_*constants; 6 testssink/node.rsTail,strip_ansi,forward,writer_log_filter,QuickwitNode,describe_exit,prepare_local_wal,supervise,WriterProcess,Run, the throughput, split-store, WAL and merge constants; 18 testssink/quickwit.rsIngestApi,title_fields_of,QuickwitSink,Poster,LineSender,impl IndexSink for QuickwitSink, the restart glue; 18 testsThe four
QuickwitNodefields the sink'swatchingreads arepub(super).forwardwas private and stays private tosink::node; the one doc comment inmerges.rsthat named it assink::forwardnow names the new path.docs/design/05-search-and-storage.mdcitestext_fields,split_targetandDecades::Partitionedatsink/template.rsnow; the Bicep and Quickwit config comments that cite the file generically stay true.Checks
cargo test -p usnm-ingest --lib --locked: 302 passed before and after; the 42sinktests have the same function names (18 node, 18 quickwit, 6 template).cargo fmt --all --checkclean;cargo clippy -p usnm-ingest --lib --tests --locked -- -D warningsclean;scripts/ci/test_changes.pypasses (it resolves theinclude_str!); prettier clean on the doc.mod/pub uselines, the four visibility changes and the test-module wrappers differ.Generated by Claude Code