refactor(chunker): drop redundant TierRecursive

TierRecursive and TierLegacy both invoked SplitText with identical
output, but only TierLegacy got the "always-return-on-validation-failure"
safety-net behavior. Auto chains thus ran SplitText twice on the
fallback path and produced two-line debug rejection traces with the same
reason.

Inline TierRecursive into TierLegacy: SelectStrategy and the explicit
StrategyRecursive entry point now emit single-legacy chains. The
StrategyRecursive public constant stays so existing ChunkingConfig rows
keep parsing — it's just an alias for legacy now.

No user-visible behavior change; one fewer SplitText call per failed
auto fallback.
This commit is contained in:
wizardchen
2026-05-06 20:19:42 +08:00
committed by lyingbug
parent 2f86e5b13d
commit 6efe781a50
3 changed files with 13 additions and 11 deletions
+4 -4
View File
@@ -210,7 +210,6 @@ type StrategyTier string
const (
TierHeading StrategyTier = "heading"
TierHeuristic StrategyTier = "heuristic"
TierRecursive StrategyTier = "recursive"
TierLegacy StrategyTier = "legacy"
)
@@ -220,7 +219,7 @@ const (
// a final safety net so callers always receive at least one chunk-set.
func SelectStrategy(p *DocProfile) []StrategyTier {
if p == nil {
return []StrategyTier{TierRecursive, TierLegacy}
return []StrategyTier{TierLegacy}
}
var chain []StrategyTier
@@ -235,7 +234,8 @@ func SelectStrategy(p *DocProfile) []StrategyTier {
chain = append(chain, TierHeuristic)
}
// Always end with recursive (Tier 3) and then legacy as ultimate fallback.
chain = append(chain, TierRecursive, TierLegacy)
// Legacy is the ultimate fallback: always returns chunks even when
// validation fails, so callers never get an empty result.
chain = append(chain, TierLegacy)
return chain
}