mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-08 00:18:12 +08:00
Collapses three duplicated/dead code smells in the canvas debug-result path of `internal/ingestion/task` (remaining findings #2/#3/#4 from the package CTO review): - **#2 — vector-key stripping duplication.** `isVectorKey` (the full stripper: fixed legacy keys `vector`/`embedding`/`feature`/`q_vec` plus the `q_<dim>_vec` pattern) was re-implemented as a weaker inline copy in the golden-compare tool (`tool/compare_pipeline_golden.go`) that only matched `q_<dim>_vec` and let real vectors leak into the diff. Exported as `IsVectorKey` and reused by the tool. - **#3 — near-duplicate deep copy.** `deepCopy` and `deepCopyStrip` were identical walkers differing only in vector stripping. Parameterized `deepCopy(v any, stripVector bool) any` and deleted `deepCopyStrip`. - **#4 — redundant switch.** `lookupComponentOutput` had two switch cases with identical bodies (both the `map[string]map[string]any` and `map[string]any` state shapes). Unified into a single `found`/`ok` resolution; nested-state and flat-fallback semantics unchanged.