fix(config): [ingest.chunking] budget floor 검증 #211

Merged
altair823 merged 1 commits from fix/config-chunking-floor-validation into main 2026-06-24 05:44:46 +00:00
Owner

요약

Config::from_filevalidate_chunking() 을 추가해 청킹 budget 의 명백히 깨진 조합을 load 시점에 reject 한다(validate_sources 와 동일 패턴, ConfigInvalid). 동기: md-heading-v2(PR #209)의 max_chunk_tokens 는 검증이 없어 0 같은 오설정이 청커 내부 budget.max(1) 클램프에 흡수돼 3-byte 청크 폭주(인덱스 bloat, 무에러)를 냈다 — reviewer 지적. 기존 target_tokens/overlap_tokens 도 미검증이었어서 세 필드를 한 번에 막는다.

변경

  • validate_chunking(): target_tokens ≥ 16(MIN_CHUNK_TOKENS), overlap_tokens < target_tokens, max_chunk_tokens ≥ target_tokens. 각각 명확한 cause 메시지.
  • from_file 에서 validate_sources 직후 호출.

비범위

  • 코드 동작 변경 없음(valid config 무영향). 새 config 키·migration 없음 → patch-level. 버전 bump 은 후속 follow-up 들과 함께 배치 릴리스에서 일괄.

검증

  • kebab-config 전체 테스트 green(83 + 신규 6: defaults_pass_chunking_validation, rejects_{target_below_floor,zero_target,overlap_ge_target,max_chunk_below_target}, from_file_rejects_invalid_chunking e2e). clippy -D warnings 0.
  • from_file 경로의 기존 config fixture(user_v2, cli_ingest_*, cli/common)는 전부 valid(target≥16·overlap<target·max_chunk(default 4000)≥target) — 무영향 확인.
## 요약 `Config::from_file` 에 `validate_chunking()` 을 추가해 청킹 budget 의 명백히 깨진 조합을 **load 시점에 reject** 한다(`validate_sources` 와 동일 패턴, `ConfigInvalid`). 동기: md-heading-v2(PR #209)의 `max_chunk_tokens` 는 검증이 없어 `0` 같은 오설정이 청커 내부 `budget.max(1)` 클램프에 흡수돼 **3-byte 청크 폭주**(인덱스 bloat, 무에러)를 냈다 — reviewer 지적. 기존 `target_tokens`/`overlap_tokens` 도 미검증이었어서 세 필드를 한 번에 막는다. ## 변경 - `validate_chunking()`: `target_tokens ≥ 16`(`MIN_CHUNK_TOKENS`), `overlap_tokens < target_tokens`, `max_chunk_tokens ≥ target_tokens`. 각각 명확한 cause 메시지. - `from_file` 에서 `validate_sources` 직후 호출. ## 비범위 - 코드 동작 변경 없음(valid config 무영향). 새 config 키·migration 없음 → patch-level. 버전 bump 은 후속 follow-up 들과 함께 배치 릴리스에서 일괄. ## 검증 - kebab-config 전체 테스트 green(83 + 신규 6: `defaults_pass_chunking_validation`, `rejects_{target_below_floor,zero_target,overlap_ge_target,max_chunk_below_target}`, `from_file_rejects_invalid_chunking` e2e). clippy `-D warnings` 0. - from_file 경로의 기존 config fixture(user_v2, cli_ingest_*, cli/common)는 전부 valid(target≥16·overlap<target·max_chunk(default 4000)≥target) — 무영향 확인.
altair823 added 1 commit 2026-06-24 02:12:59 +00:00
`Config::from_file` 에 `validate_chunking()` 추가 — 청킹 budget 의 명백히 깨진
조합을 load 시점에 reject(`validate_sources` 와 동일 패턴, `ConfigInvalid`):

- `target_tokens ≥ 16` (`MIN_CHUNK_TOKENS`)
- `overlap_tokens < target_tokens`
- `max_chunk_tokens ≥ target_tokens`

동기: md-heading-v2(PR #209)의 `max_chunk_tokens` 는 검증이 없어 `0` 같은
오설정이 청커 내부 `budget.max(1)` 클램프에 흡수돼 3-byte 청크 폭주(인덱스
bloat, 무에러)를 냈다 — reviewer 지적. 기존 `target_tokens`/`overlap_tokens`
도 미검증이라 세 필드를 한 번에 floor + 상호 제약으로 막는다.

valid config 무영향(동작·결과 불변), 깨진 config 만 명확한 메시지로 load 실패.
새 config 키·migration·동작 변경 없음 → patch-level. 테스트 6종(defaults pass +
reject 4 + e2e from_file).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012Mc6W1fgsrbFKTsqA6P8La
altair823 merged commit 5c45c384a0 into main 2026-06-24 05:44:45 +00:00
altair823 deleted branch fix/config-chunking-floor-validation 2026-06-24 05:44:47 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: altair823-org/kebab#211