refactor(context): extract embed_prepass_dyn to eliminate inline duplication#4670
Merged
Conversation
d414cf5 to
529f707
Compare
…ication The concurrent embed pipeline (~35 lines: filter, truncate, buffer_unordered, timeout, error handling) was duplicated between the public embed_prepass<F> and the inline block inside FidelityScorer::score_and_apply. Introduce private embed_prepass_dyn that accepts &dyn LlmProviderDyn directly, with two lightweight adapters (ClosureEmbed<F>, ProviderEmbed<'p>) so both callers delegate to a single implementation. Unified behavior: - warn on embed_concurrency == 0 now emitted once in the shared helper - both error and timeout arms use tracing::warn consistently - span name context.fidelity.embed_prepass used in all callers Closes #4646
529f707 to
ba56946
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.
Summary
embed_prepass_dynhelper incrates/zeph-context/src/fidelity.rsto eliminate ~35 lines of duplicated concurrent embed pipeline logic betweenembed_prepass<F>andFidelityScorer::score_and_applyClosureEmbed<F>,ProviderEmbed<'p>) to bridge the'staticbound gap without changing public APIwarnonembed_concurrency == 0, consistentwarnfor both embed errors and timeouts, single span namecontext.fidelity.embed_prepassTest plan
cargo +nightly fmt --check— cleancargo clippy --workspace --features desktop,ide,server,chat,pdf,scheduler -- -D warnings— 0 warningsRUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler --locked— cleancargo nextest run --workspace --lib --bins— 10304/10304 PASScargo test --doc -p zeph-context— 23/23 PASSembed_prepass_*tests and 25+score_and_applytests pass unchangedCloses #4646