1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//! Reindex orchestration with SSE progress tracking.
//!
//! Why: a full reindex of a project may touch hundreds or thousands of files.
//! The CLI wants to render a progress bar; the daemon wants to fire-and-forget.
//! This module bridges the two via `tokio::sync::broadcast` channels and a
//! per-index `ReindexProgress` snapshot stored on `SearchAppState`.
//!
//! What: thin re-export facade over the focused submodules below.
//! All external paths (`crate::service::reindex::*`) resolve unchanged.
//!
//! Submodule layout (added in issue #1175):
//! - `progress` — `ReindexProgress`, `ReindexStatus`, broadcast/replay constants.
//! - `semaphore` — interactive + background semaphores, queue-depth counter.
//! - `hash` — per-batch content hashing (SHA-256 fingerprints).
//! - `stages` — stage-transition helpers (lexical→semantic→graph pipeline).
//! - `batch` — single-batch parse/embed/commit cycle.
//! - `completion` — KG rebuild + terminal `complete` SSE event builder.
//! - `corpus_swap` — atomic `index.redb.tmp` → `index.redb` swap.
//! - `guard` — `ReindexTerminationGuard` RAII safety guard.
//! - `orchestrator`— top-level `spawn_reindex` / `spawn_reindex_with_cleanup` + file walk.
//! - `pollers` — background RSS poller tasks (daemon + embedderd sidecar).
//! - `runner` — Phase 1 (walk) + Phase 2 (batch loop) async body (`run_reindex`).
//! - `finish` — post-loop completion: prune, KG rebuild, swap, terminal event.
//!
//! Pre-existing sibling modules (not modified by #1175):
//! - `defer_embed` — background embedding pass for `defer_embed=true` indexes.
//! - `hash_cache` — persist/load/clear the SHA-256 content-hash cache.
//! - `prune` — delete stale chunks from files removed on disk.
//! - `quarantine` — `ReindexQuarantine` consecutive-failure circuit-breaker.
//! - `staging` — decide whether to stage the rebuilt corpus.
//! - `validate` — `ReindexOutcome`, `canonical_walk_root`, path-relativization.
//! - `tests` — integration / unit tests (test-file cap: 1 500 SLOC).
//!
//! Test: see `tests.rs`; the primary coverage is
//! `reindex_walks_directory_and_emits_events`.
// ── new submodules (issue #1175 split) ──────────────────────────────────────
// ── pre-existing sibling modules ─────────────────────────────────────────────
// ── public re-exports (external crate::service::reindex::* paths) ────────────
/// Re-export `ReindexProgress` and `ReindexStatus` so callers that import
/// `crate::service::reindex::ReindexProgress` / `ReindexStatus` keep working.
///
/// Why: `server::state`, `server::status`, `server::reindex_handlers`, and
/// `server::tests_state` all import these types directly from this module.
/// What: re-exports from `progress` submodule.
/// Test: compilation of the consumer files is the gate.
pub use ;
/// Re-export `ReindexQuarantine` (was `pub mod quarantine; pub use quarantine::…`).
///
/// Why: the quarantine type is used by the server router and the discover loop.
/// What: re-exports the public-module type.
/// Test: quarantine tests in `tests.rs`.
pub use ReindexQuarantine;
/// Re-export `background_reindex_queue_depth` so `health.rs` can call it.
///
/// Why: `GET /health` surfaces the queue depth as a metric for operators.
/// What: delegates to `semaphore::background_reindex_queue_depth`.
/// Test: `background_reindex_queue_depth_increments_and_decrements` in `tests.rs`.
pub use background_reindex_queue_depth;
/// Re-export the two public entry points for kicking off a reindex task.
///
/// Why: `reindex_handlers.rs` calls `spawn_reindex_with_cleanup`; a handful of
/// test helpers call `spawn_reindex`.
/// What: re-exports from `orchestrator` submodule.
/// Test: `reindex_walks_directory_and_emits_events` (primary integration test).
pub use ;
// ── internal re-exports used by tests (via `use super::*` in tests.rs) ───────
// Gated under #[cfg(test)] so clippy does not flag them as unused in release
// builds. The test glob `use super::*` picks them up when running `cargo test`.
pub use inprocess_embedder_ever_ready_for_tests;
pub use reset_inprocess_embedder_flag_for_tests;
pub use ReindexTerminationGuard;
pub use ;
pub use ;
pub use Semaphore;
// ── test module ──────────────────────────────────────────────────────────────