chore: workspace-wide cleanup — clippy::pedantic baseline + auto-fix #181
Reference in New Issue
Block a user
Delete Branch "chore/workspace-wide-cleanup-pre-v0-18"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
요약
cut PR v0.18.0 전 마지막 정리. 사용자 요청: "전체 코드베이스를 깔끔하고 알아보기 쉽게".
clippy::pedanticgroup 활성화 + 의도적 allow-list +cargo clippy --fixauto-apply. behavior 회귀 0 (mechanical refactor only). post-cleanup dogfood retest 가 PR-9d 와 byte-identical 결과.설계: docs/superpowers/specs/2026-05-25-p9-fb-41-finalize-spec.md
계획: docs/superpowers/plans/2026-05-25-p9-fb-41-finalize-plan.md
변경 사항
Workspace lints (commit 1)
Cargo.toml의[workspace.lints.clippy]신규 + 24 crateCargo.toml에[lints] workspace = true.pedantic = "warn"(priority -1) + 의도적 allow-list 약 30개:각 allow 의 rationale 은 inline comment 로 trace.
Auto-fix (commit 1 의 일부)
cargo clippy --workspace --all-targets --fix --allow-dirty --allow-staged -j 1적용. 128 files changed, +552 / -472. 주로:format!("{}", x)→format!("{x}")..map(|x| x.foo())→.map(T::foo).Post-cleanup dogfood retest (commit 2)
docs/dogfood/v0.18.0/SUMMARY.md에 "Post-cleanup retest" section 추가. PR-9d 와 byte-identical:nli_verification_failed, 0.0035389824770390987nli_verification_failed, 0.058334656059741974nli_verification_failed, 0.0027875436935573816nli_model_unavailablecleanup 가 mechanical refactor only — behavior 회귀 0, NLI score deterministic 확인.
검증
cargo clippy --workspace --all-targets -j 1 -- -D warningsclean (pedantic 활성 + 전체 lint group).cargo test --workspace --no-fail-fast -j 1→ 1293 tests pass + 1 pre-existing flaky fail (kebab-mcp::tools_call_ask_multi_hop::ask_tool_routes_multi_hop_true_to_decompose_first— HOTFIX candidate, cleanup 무관).cargo build --release통과 (274 MB binary).비범위
nli_model_unavailableroot cause 진단 (HOTFIXES.md 의 fb-41 PR-9 closure entry 의 follow-up subsection 참조 — v0.18.1).시험 항목 (Test Plan)
Assisted-by: Claude Code
cut PR v0.18.0 전 마지막 정리. 사용자 요청: "전체 코드베이스를 깔끔하고 알아보기 쉽게". ## Workspace lints - `Cargo.toml` 의 `[workspace.lints.clippy]` 에 `pedantic = "warn"` (priority -1) + 의도적 allow-list 추가: - cast_possible_truncation / cast_possible_wrap / cast_sign_loss / cast_precision_loss — ONNX i64 / hash modular reduction 등 의도적 truncation. - doc_markdown / missing_errors_doc / missing_panics_doc — cosmetic doc style. - too_many_lines / module_name_repetitions / must_use_candidate / needless_pass_by_value / manual_let_else / items_after_statements / similar_names — informational only. - format_collect / match_wildcard_for_single_variants / trivially_copy_pass_by_ref / unnecessary_wraps — intentional patterns (exhaustive match, future Result variants 등). - default_trait_access — `Foo::default()` 가 idiomatic. - float_cmp — NLI / RRF score 의 explicit threshold 비교 의도. - struct_excessive_bools / case_sensitive_file_extension_comparisons / naive_bytecount / ignore_without_reason — domain-specific 의도. - format_push_string / return_self_not_must_use / match_same_arms — builder / wire-label / hot-path 패턴 보존. - needless_continue / used_underscore_binding / nonminimal_bool / unreadable_literal / many_single_char_names / doc_link_with_quotes / assigning_clones / collapsible_str_replace / trivial_regex / elidable_lifetime_names / range_plus_one / explicit_iter_loop / implicit_hasher / ref_option — remaining low-value style. - 각 24 crate `Cargo.toml` 에 `[lints] workspace = true` 추가. ## Auto-fix `cargo clippy --workspace --all-targets --fix` 적용 — 128 files changed, 552 insertions / 472 deletions. 주로: - uninlined_format_args (~18): `format!("{}", x)` → `format!("{x}")`. - redundant_closure_for_method_calls (~33): `.map(|x| x.foo())` → `.map(T::foo)`. - 그 외 mechanical refactor. ## 검증 - `cargo clippy --workspace --all-targets -j 1 -- -D warnings` clean (pedantic + 모든 lint group). - `cargo test --workspace --no-fail-fast -j 1` — **1293 tests pass + 1 pre-existing flaky fail** (`kebab-mcp::tools_call_ask_multi_hop::ask_tool_routes_multi_hop_true_to_decompose_first`, HOTFIX candidate, cleanup 무관). 회귀 0. Wire 영향: 없음. Behavior 영향: 없음 (mechanical refactor only). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>회차 1 — workspace-wide cleanup PR 검토.
칭찬 (산문, inline 안 함):
모든 allow 의 rationale inline trace — 약 30개 allow 의 각 inline comment 가 왜 의도된 패턴 (예: "ONNX i64 inputs from tokenizer u32 ids", "NLI / RRF score 의 explicit threshold 비교", "wire-label tables 의 fanned-out match arms") 인지 명시. 미래 작업자가 allow 제거 / 추가 시 trade-off 명확.
clippy --fix 의 mechanical 변경 + workspace.lints 의 single source of truth — 24 crate Cargo.toml 의
[lints] workspace = true패턴 일관. 새 crate 추가 시 forget 위험 있지만 production excellence baseline 확립.post-cleanup dogfood retest 의 byte-identical evidence — S7/S1/S10 의 NLI score 가 PR-9d 와 완전히 동일 한 17 digit f64 precision (
0.0035389824770390987,0.058334656059741974,0.0027875436935573816). cleanup 가 mechanical refactor only + deterministic computation 명확 증명.S3 의
nli_model_unavailable도 identical — cleanup 가 S3 root cause 와 무관함 명시적 확인. v0.18.1 follow-up scope 보존.fb-41 cut PR 직전 baseline 확립 —
cargo clippy -D warnings(pedantic 활성) +cargo test --workspace -j 1(1293 pass + 1 pre-existing flaky) — production excellence baseline 위에 v0.18.0 cut.추가 actionable 없음. PR-9 시퀀스 (9a/9b/9c-1/9c-2/9d) + 본 cleanup 위에 cut PR 진행 가능 baseline.
머지 OK. 다음 step: v0.18.0 cut PR (version bump + cascading docs + frozen design §3.8 + spec/plan status completed + release notes draft).
OMC team `post-pr9-refactor` 의 architectural cleanup. architect priorities 분석 후 executor + test-engineer 가 file edits, system-architect 가 component-level review 로 *pre-cut nothing — all v0.18.1+ defer* 결론. ## Executor 작업 (H1/H2/H3/D/E) - **H1** (kebab-nli/src/onnx.rs): `[models.nli]` config wire 활성화. `DEFAULT_MODEL_ID` const 제거 (kebab-config 의 NliCfg::defaults 가 single source). OnnxNliVerifier::new 가 config.models.nli.model 읽고 config.models.nli.provider 가 "onnx" 아니면 anyhow::bail. 3 stale "PR-9c-1 will wire this" 코멘트 제거. 2 unit test 추가 (`new_uses_config_model_id`, `new_rejects_unsupported_provider`). - **H2** (kebab-rag/src/pipeline.rs): `truncate_for_nli(premise: &str, _hypothesis: &str)` → `truncate_for_nli(premise: &str)`. v0.18.1 placeholder doc 제거. 4 callsite (tests/multi_hop.rs) 갱신 + test rename `multi_hop_truncate_for_nli_preserves_hypothesis` → `multi_hop_truncate_for_nli_char_budget` (contract 정합). - **H3** (kebab-rag/src/pipeline.rs:1041): `was_truncated` 가 tracing::debug! 으로 surface (observability 추가, signature 보존 — caller logging contract). - **D** (kebab-mcp/tests/tools_call_ask_multi_hop.rs): request_timeout_secs 2 → 5 (slow CI 안정성), `mh_code` discriminator 제거. dispatch contract = `mh.is_error.unwrap_or(false)` (기존 assertion 으로 충분). - **E** (tasks/HOTFIXES.md + pipeline.rs:1633-1638): fb-41 PR-9 closure entry 의 sibling 으로 "### PR-9 NLI refusal: terminal Synthesize hop omitted from hops trace" subsection 추가. pipeline 의 "cleanup deferred to a follow-up" → "// See tasks/HOTFIXES.md ... for follow-up" cross-link. ## Test-engineer 작업 (T1/T2/T3/T4, 9 new tests) - **T1** (kebab-nli/src/onnx.rs::tests): sanitize_model_id 3 unit (replaces_slash / idempotent / leaves_other_chars). - **T2** (kebab-rag/tests/multi_hop_nli_panic.rs 신규): 2 panic-path tests — facade invariant (`expect("verifier must be Some when nli_threshold > 0.0")`) 의 #[should_panic] + threshold=0 의 companion. - **T3** (kebab-rag/tests/multi_hop_nli_stream.rs 신규): 2 StreamEvent::Final tests — refuse_nli_verification + refuse_nli_model_unavailable 의 stream_sink Final 분기 wire shape pinning. - **T4** (kebab-app/tests/open_with_config_nli.rs 신규): 2 NLI failure path — model_dir 가 unwritable 일 때 App::open_with_config 의 Result<App> Err (with "OnnxNliVerifier" in chain) + threshold=0 일 때 graceful skip. ## System-architect 결론 3 lenses (absorption / duplication / under-engineered interface) 분석 결과 — *pre-cut nothing*. Top-3 items 모두 v0.18.1+ defer: - Lens 1: kebab-normalize + kebab-parse-types 흡수 가능 (parse-md 만 사용, 5 parsers 우회) → v0.18.1+. - Lens 3: Extractor + Chunker trait 의 dead polymorphism (모든 callsite 가 hardcoded) → v0.18.1+. - Lens 1 bundled: kebab-source-fs 가 kebab-parse-code 의 9 tree-sitter grammars drag → low-risk dep-graph win, v0.18.1+ bundled. - Defer-with-intent: LanguageModel async refactor (cloud-LLM 시), NliVerifier::score_batch + typed NliError (2nd impl 시), compute_stale → kebab-core::stale. 보고서: /build/cache/tmp/post-pr9-refactor-priorities.md, /build/cache/tmp/system-architecture-priorities.md (둘 다 repo 외 — analysis 보존). ## 검증 - cargo test -p kebab-nli -j 1 → 11/11 pass. - cargo test -p kebab-rag -j 1 → 75/75 pass (5 NLI multi-hop + 4 신규 T2/T3 포함). - cargo test -p kebab-app -j 1 → 23 pass + 2 ignored (T4 의 2 포함). - cargo test -p kebab-mcp --test tools_call_ask_multi_hop -j 1 → 1 pass + 1 pre-existing flaky (HOTFIX #15, no_chunks short-circuit, executor D fix 와 무관 — line 86 의 base assertion 이 fixture 없어서 fail). - cargo clippy --workspace --all-targets -j 1 -- -D warnings clean. - cargo test --workspace --no-fail-fast -j 1 → 1304 passed (+11 new) + 1 pre-existing flaky 동일. - **Post-refactor dogfood retest byte-identical** (PR-9d / post-cleanup / post-refactor 3번 모두): S7 0.0035389824770390987, S1 0.058334656059741974, S10 0.0027875436935573816, S3 nli_model_unavailable. docs/dogfood/v0.18.0/SUMMARY.md 에 "Post-architectural-refactor retest" section 추가. Wire 영향: 없음. Behavior 영향: 없음 (H1 의 config wiring 가 default 와 같은 model → byte-identical). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>회차 2 — OMC team
post-pr9-refactor결과 review (commit7c27633).추가 적용된 변경:
Executor 작업 (architect priorities H1/H2/H3/D/E):
_hypothesisstub 제거 (CLAUDE.md "no premature abstraction" 정합).Test-engineer 작업 (9 new tests):
System-architect 결론: pre-cut nothing — 모든 architectural items (kebab-normalize 흡수, Extractor dispatch unification, source-fs dep lightening 등) v0.18.1+ defer. dogfood-tested fb-41 happy path 보존이 우선.
검증:
작은 nit 후보 (advisory):
#[should_panic]가 panic message string match 의존 — 만약 미래에 panic 메시지 wording 정정 시 test 갱신 필요. 그러나 facade invariant 의 documented message 명시적 pin 가 의도 — accept.bail!("kebab-nli: unsupported provider {provider:?} (only 'onnx' is implemented in v0.18)")— v0.18 자체 hardcoded 라 v0.19 에서 갱신 필요. 그러나 오류 메시지에 명시 — readable.추가 substantive actionable 없음. PR-9 + cleanup + refactor 의 production excellence baseline 도달.
머지 OK. 다음 step: v0.18.0 cut PR (version bump + cascading docs + release notes).