Skip to content

refactor(storage): remove dead HoleGranularityCoarse helper#89

Merged
HardcoreMonk merged 1 commit into
mainfrom
chore/remove-dead-hole-coarse
Jul 19, 2026
Merged

refactor(storage): remove dead HoleGranularityCoarse helper#89
HardcoreMonk merged 1 commit into
mainfrom
chore/remove-dead-hole-coarse

Conversation

@HardcoreMonk

@HardcoreMonk HardcoreMonk commented Jul 19, 2026

Copy link
Copy Markdown
Owner

요약

D3 리뷰(PR #88)에서 발견한 dead code 정리: storage.HoleGranularityCoarse 헬퍼를 제거한다. behavior 변경 없음.

근거

HoleGranularityCoarse(dir) boolproduction 호출자가 0이었다 — D3 가드 두 곳(판독측 overlaySparseDiff, 창설측 snapshotsDirCoarse)은 진단 메시지에 granularity 값 g가 필요해 holeGranularityFn/ProbeHoleGranularity를 직접 호출하고 predicate(err != nil || g > HoleGranularityFine)를 inline으로 적용한다. bool 헬퍼는 그 자리에 맞지 않는다. 유일한 참조는 테스트의 중복 assertion 2건(각각 바로 위의 직접 g/err assertion이 이미 커버) — 함께 제거해도 커버리지 손실 없음.

변경

  • internal/storage/hole_granularity.go: HoleGranularityCoarse 함수 제거. holeGranularityFn(production 사용 + 테스트 주입 seam, snapshot.go:437)은 유지, doc 갱신.
  • internal/storage/hole_granularity_test.go: 중복 HoleGranularityCoarse assertion 2건 제거(직접 g/err assertion으로 대체 주석).

검증

go build ./... OK, go vet OK, go test ./internal/storage/ PASS, gofmt -l . empty. lifecycle: Lightweight(dead-code 제거, behavior/contract 무변경, 1-2 파일).

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of storage capability checks, including cases where probing fails or storage uses fine-grained support.
    • Ensured read-side safeguards consistently apply safe behavior when storage characteristics cannot be determined.
  • Refactor

    • Simplified internal storage capability evaluation without changing expected user-facing behavior.

…w finding)

HoleGranularityCoarse had no production caller — both D3 guard sites (read-side
overlaySparseDiff, creation-side snapshotsDirCoarse) call holeGranularityFn/
ProbeHoleGranularity directly because they need the granularity value g for their
diagnostics, not the bool. The only references were two redundant test assertions
(each already covered by the direct g/err assertion above it). holeGranularityFn
(the production-used, test-injectable seam) is retained. build/vet/storage tests green.
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 851e0429-f5e5-4e26-9fd4-b90a90b11e91

📥 Commits

Reviewing files that changed from the base of the PR and between 42d78c4 and 05a562c.

📒 Files selected for processing (2)
  • internal/storage/hole_granularity.go
  • internal/storage/hole_granularity_test.go

📝 Walkthrough

Walkthrough

The exported HoleGranularityCoarse helper was removed and replaced by the holeGranularityFn probe seam. Tests now validate fine and probe-error cases directly through returned granularity and error semantics.

Changes

Hole granularity probing

Layer / File(s) Summary
Probe seam and regression assertions
internal/storage/hole_granularity.go, internal/storage/hole_granularity_test.go
The coarse helper was replaced with holeGranularityFn, while tests now assert fine and probe-failure behavior using probe results directly.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: removing the unused HoleGranularityCoarse helper.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/remove-dead-hole-coarse

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@HardcoreMonk
HardcoreMonk merged commit e7a6d16 into main Jul 19, 2026
2 checks passed
@HardcoreMonk
HardcoreMonk deleted the chore/remove-dead-hole-coarse branch July 19, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant