Skip to content

⚡ Bolt: HexFormat을 사용한 16진수 변환 최적화#34

Closed
seonghobae wants to merge 3 commits into
mainfrom
bolt-optimize-hex-conversion-4085506425954280717
Closed

⚡ Bolt: HexFormat을 사용한 16진수 변환 최적화#34
seonghobae wants to merge 3 commits into
mainfrom
bolt-optimize-hex-conversion-4085506425954280717

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

💡 What: DefaultDocumentConversionService에서 바이트 배열을 16진수 문자열로 변환할 때 사용하던 String.format("%02x", b) 루프를 Java 17+의 java.util.HexFormat.of().formatHex(raw)로 교체했습니다.
🎯 Why: 루프 내에서 String.format을 사용하는 것은 불필요한 String 객체 할당을 발생시켜 메모리 사용량 증가와 성능 저하를 일으키는 병목점(anti-pattern)이기 때문입니다. 특히 SHA-256 해시 생성과 같은 작업에서 성능 영향이 큽니다.
📊 Impact: 불필요한 String 객체 생성을 제거하여 메모리 할당량을 대폭 줄이고 변환 속도를 개선했습니다.
🔬 Measurement: 코드 변경 후 JaCoCo 테스트 커버리지를 측정하여 100%를 유지하는지 검증했습니다. .jules/bolt.md에 관련된 성능 개선 내용을 기록했습니다.


PR created automatically by Jules for task 4085506425954280717 started by @seonghobae

@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings June 26, 2026 21:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Optimizes SHA-256 byte-array-to-hex conversion in DefaultDocumentConversionService by replacing a String.format("%02x", b) loop with Java’s HexFormat, and records the optimization guidance in the project’s Jules notes.

Changes:

  • Replaced per-byte String.format hex conversion with HexFormat.of().formatHex(raw) in document content hashing.
  • Added .jules/bolt.md note documenting the rationale/pattern for future similar optimizations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/main/java/com/clearfolio/viewer/service/DefaultDocumentConversionService.java Uses HexFormat for faster/cleaner SHA-256 digest hex encoding during submit/dedupe flow.
.jules/bolt.md Documents the hex conversion optimization guidance for future reference.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@opencode-agent

opencode-agent Bot commented Jun 26, 2026

Copy link
Copy Markdown

OpenCode Review Overview

  • Head SHA: 9fd72e1f8cb4a9203709bf88d8a36e39100fd420
  • Workflow run: 28266292380
  • Workflow attempt: 1
  • Gate result: REQUEST_CHANGES (approval step)

Pull request overview

OpenCode reviewed the current-head evidence but found unresolved human review threads before approval.

Findings

1. HIGH .github/workflows/opencode-review.yml:1 - Unresolved human review thread blocks automated approval

  • Problem: OpenCode reached an APPROVE control result, but the approval step found unresolved, non-outdated human review thread evidence on the current pull request.
  • Root cause: Human review feedback can arrive after bounded model evidence is prepared, so the approval step must re-query GitHub immediately before publishing an approval.
  • Fix: Address or resolve the listed human review thread(s), then re-run OpenCode on the current head.
  • Regression test: Keep the approval gate querying reviewThreads(first: 100) after model output and before create_pull_review APPROVE.

Review thread evidence

Latest unresolved human review thread evidence

src/main/java/com/clearfolio/viewer/service/DefaultDocumentConversionService.java line 125

  • Latest human comment: @copilot-pull-request-reviewer at 2026-06-26T21:31:10Z
  • Comment URL: ⚡ Bolt: HexFormat을 사용한 16진수 변환 최적화 #34 (comment)
  • Comment excerpt: Switching to HexFormat canonicalizes the hex encoding to exactly 2 hex chars per byte. If any content hashes were previously persisted/used for dedupe with the String.format loop, this will change the computed contentHash value (and therefore repository deduplication behavior) for the same document bytes, which can lead to duplicate jobs after deployment unless legacy hashes are migrated or backward-compat lookup is added.

src/main/java/com/clearfolio/viewer/service/DefaultDocumentConversionService.java line 125

  • Latest human comment: @copilot-pull-request-reviewer at 2026-06-26T21:31:10Z

  • Comment URL: ⚡ Bolt: HexFormat을 사용한 16진수 변환 최적화 #34 (comment)

  • Comment excerpt: This change updates the content-hash encoding; there isn’t a regression test asserting the exact SHA-256 hex output for a known payload. Adding a unit test that submits a file with bytes "hello" and asserts the candidate ConversionJob contentHash equals the known SHA-256 hex (2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824) would prevent accidental algorithm/encoding regressions.

  • Result: REQUEST_CHANGES

  • Reason: unresolved human review thread(s) were present before approval.

  • Head SHA: 9fd72e1f8cb4a9203709bf88d8a36e39100fd420

  • Workflow run: 28266292380

  • Workflow attempt: 1

Change Flow DAG

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Changed file (2 files)"]
  S1 --> I1["repository behavior"]
  I1 --> R1["Review risk: Changed file (2 files)"]
  R1 --> V1["required checks"]
Loading

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

OpenCode reviewed the current-head evidence but found unresolved human review threads before approval.

Findings

1. HIGH .github/workflows/opencode-review.yml:1 - Unresolved human review thread blocks automated approval

  • Problem: OpenCode reached an APPROVE control result, but the approval step found unresolved, non-outdated human review thread evidence on the current pull request.
  • Root cause: Human review feedback can arrive after bounded model evidence is prepared, so the approval step must re-query GitHub immediately before publishing an approval.
  • Fix: Address or resolve the listed human review thread(s), then re-run OpenCode on the current head.
  • Regression test: Keep the approval gate querying reviewThreads(first: 100) after model output and before create_pull_review APPROVE.

Review thread evidence

Latest unresolved human review thread evidence

src/main/java/com/clearfolio/viewer/service/DefaultDocumentConversionService.java line 125

  • Latest human comment: @copilot-pull-request-reviewer at 2026-06-26T21:31:10Z
  • Comment URL: #34 (comment)
  • Comment excerpt: Switching to HexFormat canonicalizes the hex encoding to exactly 2 hex chars per byte. If any content hashes were previously persisted/used for dedupe with the String.format loop, this will change the computed contentHash value (and therefore repository deduplication behavior) for the same document bytes, which can lead to duplicate jobs after deployment unless legacy hashes are migrated or backward-compat lookup is added.

src/main/java/com/clearfolio/viewer/service/DefaultDocumentConversionService.java line 125

  • Latest human comment: @copilot-pull-request-reviewer at 2026-06-26T21:31:10Z

  • Comment URL: #34 (comment)

  • Comment excerpt: This change updates the content-hash encoding; there isn’t a regression test asserting the exact SHA-256 hex output for a known payload. Adding a unit test that submits a file with bytes "hello" and asserts the candidate ConversionJob contentHash equals the known SHA-256 hex (2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824) would prevent accidental algorithm/encoding regressions.

  • Result: REQUEST_CHANGES

  • Reason: unresolved human review thread(s) were present before approval.

  • Head SHA: 9fd72e1f8cb4a9203709bf88d8a36e39100fd420

  • Workflow run: 28266292380

  • Workflow attempt: 1

@seonghobae

Copy link
Copy Markdown
Collaborator Author

중복 정리(2차): 'HexFormat 변환' 클러스터 중복 → 정본 #80 유지. 동일 목적/파일로 동시 병합 불가. 고유 변경은 #80에 반영하거나 재오픈.

@seonghobae seonghobae closed this Jul 7, 2026
@google-labs-jules

Copy link
Copy Markdown

중복 정리(2차): 'HexFormat 변환' 클러스터 중복 → 정본 #80 유지. 동일 목적/파일로 동시 병합 불가. 고유 변경은 #80에 반영하거나 재오픈.

Understood. Acknowledging that this work is a duplicate and is now obsolete. Stopping work on this task.

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.

2 participants