Skip to content

refactor(validation): preserve non-missing category-count semantics - #372

Draft
seonghobae wants to merge 5 commits into
masterfrom
bolt-optimize-na-omit-11476835499745312511
Draft

seonghobae wants to merge 5 commits into
masterfrom
bolt-optimize-na-omit-11476835499745312511

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator

Scope

autoFIPC()의 공통 문항 응답구조 비교에서 length(stats::na.omit(unique(x)))sum(!is.na(unique(x)))로 바꿉니다. 변경 범위는 고유한 비결측 응답 범주의 수를 계산하는 두 guarded expression뿐이며, mirt fitting·linking 산술·item parameter 의미·허용 범주 자체는 바꾸지 않습니다.

  • protected base: master@f87c2324f1686135e57d8730c1b0b9420874f300
  • current exact head: 70722c5aab3debbf5fa199053541c9e9f65130c7
  • ancestry: 5 ahead / 0 behind, merge-base = protected base
  • effective files: .jules/bolt.md, R/aFIPC.R, tests/testthat/test-optimization-equivalence.R
  • lifecycle: Draft / exact-head acceptance pending

Review finding and repair

초기 Jules 변경은 production expression만 바꾸었고, 기존 test-optimization-equivalence.R은 이전 표현식인 length(stats::na.omit(unique(x)))까지만 실행했습니다. 따라서 새 표현식이 기존 응답구조 계약을 보존한다는 executable regression이 없었습니다.

현재 regression은 독립 hand-computed category counts를 기준으로 새 표현식과 직전 표현식의 동등성을 숫자형, factor, NA, NaN 입력에서 직접 검증합니다. 기존 #56의 더 오래된 length(levels(as.factor(x))) 계약은 원래 검증하던 일반 numeric fixtures에서 계속 보존합니다. #99의 IPD anchor extraction regression도 그대로 유지합니다.

이 수리는 이미 production 변경이 존재한 뒤 fresh review에서 발견한 누락 테스트를 보강한 것이므로 hosted/test-first RED였다고 주장하지 않습니다.

Evidence boundary

대표성 있는 benchmark가 없으므로 속도 향상 배수·백분율, 메모리 개선율 또는 큰 성능 개선을 주장하지 않습니다. 현재 입증하려는 것은 na.omit() wrapper 없이 동일한 distinct-non-missing category-count 의미를 보존한다는 점입니다. Buyer-visible 성능 근거로 승격하려면 동일한 R/toolchain에서 현실적인 문항 수·응답자 수·반복 횟수를 사용해 wall-clock, allocation/GC와 median/p95를 비교해야 합니다. .jules/bolt.md도 이 경계로 currentize했습니다.

Current exact-head acceptance

70722c5...는 test/docs가 변경된 새 generation이므로 초기 Jules head의 review/check 결과를 merge authority로 전용하지 않습니다. 현재 fresh R CMD check, Code Quality, Security Audit, Security Scan, SAST Semgrep, Required CodeQL이 모두 새로 생성되어 queued 상태입니다. 제출된 current-head APPROVED review도 아직 없습니다.

한 unchanged exact head에서 applicable hosted gates가 terminal-success하고, 유효한 unresolved finding/thread가 0이며, live policy가 요구하는 current-head independent review가 충족될 때까지 Draft를 유지합니다. Required CodeQL이 중앙 settlement defect를 재현하면 leaf polling, no-op commit, manual rerun, synthetic status로 우회하지 않고 .github canonical owner path에 exact generation을 전달합니다.

No force push, destructive rebase, self-approval, gate weakening, source-neutral retrigger, predecessor-evidence transfer, or unmeasured performance claim is accepted as landing evidence.

- `length(stats::na.omit(unique(x)))`를 `sum(!is.na(unique(x)))`로 대체했습니다.
- R의 `stats::na.omit()` 함수 내부의 S3 메서드 디스패치 및 `na.action` 속성 할당에 따른 오버헤드를 제거하였습니다.
- 반복문 내부에서 자주 호출되는 로직의 실행 속도 및 메모리 효율성을 개선하였습니다.
@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.

@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Warning

Review limit reached

Next included review available in 37 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 11d51d98-6246-4f8e-ae4a-13860f6e3dff

📥 Commits

Reviewing files that changed from the base of the PR and between 1eb4281 and 70722c5.

📒 Files selected for processing (2)
  • .jules/bolt.md
  • tests/testthat/test-optimization-equivalence.R

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 1715ace0-4cfc-40bc-a540-bf600b840b24

📥 Commits

Reviewing files that changed from the base of the PR and between f87c232 and 1eb4281.

📒 Files selected for processing (2)
  • .jules/bolt.md
  • R/aFIPC.R

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

autoFIPC의 공통 문항 검증 조건이 고유 응답값의 비결측값 개수를 sum(!is.na(unique(...)))로 계산하도록 변경되었습니다. 동일한 계산 방식을 설명하는 R 성능 최적화 학습 항목도 추가되었습니다.

Changes

고유 비결측값 계산 방식 변경

Layer / File(s) Summary
계산 방식 및 검증 조건 변경
.jules/bolt.md, R/aFIPC.R
문서에 sum(!is.na(unique(x))) 사용법을 추가했습니다. autoFIPC의 공통 문항 검증 조건은 length(stats::na.omit(unique(...))) 비교를 같은 논리 인덱싱 합계 비교로 대체했습니다.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 1eb42

The optimized calculation preserves the intended non-missing unique-value count and is covered by existing tests.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 autoFIPC 검증 로직의 핵심 변경인 비결측 고유 범주 개수 의미 보존을 정확하게 설명합니다. 제목은 간결하고 구체적이며 변경 내용과 일치합니다.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bolt-optimize-na-omit-11476835499745312511

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.

@seonghobae seonghobae changed the title ⚡ Bolt: unique 항목 길이 계산 병목 최적화 refactor(validation): preserve non-missing category-count semantics Sep 13, 2026
@seonghobae
seonghobae marked this pull request as draft September 13, 2026 19:32

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

현재 exact head 70722c5aab3debbf5fa199053541c9e9f65130c7 기준 재검토 바랍니다. 특히 새 sum(!is.na(unique(x))) 표현식과 직전 length(stats::na.omit(unique(x)))의 숫자형/factor/NA/NaN 의미 동등성 regression, 기존 #99 IPD regression 보존, 그리고 benchmark 없는 성능 주장 제거가 review 범위입니다. 이전 head의 review 결과는 current-head acceptance로 전용하지 않습니다.

@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '== HEAD =='
git rev-parse HEAD
printf '%s\n' '== STATUS =='
git status --short
printf '%s\n' '== PR METADATA =='
gh pr view 372 --repo ContextualWisdomLab/aFIPC --json number,title,baseRefName,headRefName,headRefOid,body,files --jq '{number,title,baseRefName,headRefName,headRefOid,body,files:[.files[].path]}'
printf '%s\n' '== DIFF AGAINST BASE =='
git diff --find-renames --unified=80 "$(git merge-base HEAD origin/HEAD)" HEAD -- R/aFIPC.R .jules/bolt.md || true
printf '%s\n' '== RELEVANT FILES =='
fd -HI -t f . | rg '(^|/)(aFIPC\.R|.*[Tt]est.*|.*[Rr]egression.*|.*[Bb]enchmark.*|bolt\.md)$' | sort
printf '%s\n' '== SEARCH: OLD/NEW EXPRESSIONS, IPD, PERFORMANCE CLAIMS =='
rg -n -i -C 4 'length\s*\(\s*stats::na\.omit\s*\(\s*unique|sum\s*\(\s*!\s*is\.na\s*\(\s*unique|`#99`|\bIPD\b|benchmark|performance|memory efficien|execution speed|overhead|frequently executed' . -g '!**/.git/**' -g '!**/renv/**' || true
printf '%s\n' '== OUTLINE =='
ast-grep outline R/aFIPC.R --items all --type function 2>/dev/null || true
printf '%s\n' '== autoFIPC CONTEXT =='
rg -n -A100 -B20 'autoFIPC\s*(<-|=)\s*function' R/aFIPC.R || true

Length of output: 201676


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== CHECKED-OUT HEAD =='
git rev-parse HEAD
echo '== PR REFS =='
gh pr view 372 --repo ContextualWisdomLab/aFIPC --json baseRefOid,headRefOid,headRefName,title,body --jq '{baseRefOid,headRefOid,headRefName,title,body}'
base_oid="$(gh pr view 372 --repo ContextualWisdomLab/aFIPC --json baseRefOid --jq .baseRefOid)"
echo '== CHANGED FILES =='
git diff --name-status "$base_oid" HEAD
echo '== EXACT DIFF =='
git diff --unified=30 "$base_oid" HEAD -- . ':(exclude)packrat/**'
echo '== CHANGE COMMITS =='
git log --oneline --no-decorate "$base_oid"..HEAD
echo '== REPOSITORY TOP-LEVEL =='
fd -HI -t f -d 3 . -E packrat -E .git | sort | sed -n '1,800p'
echo '== RELEVANT SOURCE/TEST MATCHES =='
rg -n -i -C 8 'sum\s*\(\s*!\s*is\.na\s*\(\s*unique|length\s*\(\s*stats::na\.omit\s*\(\s*unique|autoFIPC|IPD|issue.?99|`#99`|performance|benchmark|memory efficien|execution speed|S3 method dispatch|na.action' \
  -g '!packrat/**' -g '!**/.git/**' . || true
echo '== R/aFIPC.R COMMON-ITEM CHECK CONTEXT =='
rg -n -C 30 'sum\s*\(\s*!\s*is\.na\s*\(\s*unique|length\s*\(\s*stats::na\.omit\s*\(\s*unique' R/aFIPC.R || true
echo '== CHANGE FILE CONTENT =='
if [ -f .jules/bolt.md ]; then cat -n .jules/bolt.md; fi

Length of output: 83832


🏁 Script executed:

#!/bin/bash
set -euo pipefail

head_oid="70722c5aab3debbf5fa199053541c9e9f65130c7"

echo '== CURRENT-HEAD CHECKS =='
gh pr checks 372 --repo ContextualWisdomLab/aFIPC --json name,state,bucket,link,workflow --jq '.[] | {name,state,bucket,workflow,link}' || true

echo '== CURRENT-HEAD REVIEWS =='
gh pr view 372 --repo ContextualWisdomLab/aFIPC --json reviews --jq '.reviews[] | {author:.author.login,state,commitId,submittedAt,body}' || true

echo '== OPEN REVIEW THREADS =='
gh api graphql -F owner='ContextualWisdomLab' -F name='aFIPC' -F number=372 -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          isResolved
          isOutdated
          comments(first: 20) {
            nodes {
              author { login }
              body
              commit { oid }
              path
              line
            }
          }
        }
      }
    }
  }
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false) | {isOutdated, comments:[.comments.nodes[] | {author:.author.login,commit:.commit.oid,path,line,body}]}' || true

echo '== CHANGED-FILE PERFORMANCE CLAIMS =='
rg -n -i -C 2 'speed|faster|performance|memory|overhead|O\([0-9A-Z^+*]+\)|benchmark|allocation|GC|wall-clock|median|p95|improve' \
  .jules/bolt.md R/aFIPC.R tests/testthat/test-optimization-equivalence.R || true

echo '== CATEGORY-COUNT EXPRESSIONS IN NON-VENDORED R/TEST FILES =='
rg -n -g '*.R' -g '!packrat/**' 'length\s*\(\s*(stats::)?na\.omit\s*\(\s*unique|sum\s*\(\s*!\s*is\.na\s*\(\s*unique' R tests || true

echo '== CURRENT HEAD FILE BLOB IDS =='
git ls-tree "$head_oid" -- R/aFIPC.R tests/testthat/test-optimization-equivalence.R .jules/bolt.md

Length of output: 12781


@seonghobae 70722c5aab3debbf5fa199053541c9e9f65130c7 기준으로 재검토했습니다.

요청 범위에서 새 finding은 없습니다.

  • R/aFIPC.R의 두 count 식은 모두 sum(!is.na(unique(x)))를 사용합니다.
  • tests/testthat/test-optimization-equivalence.R는 숫자형, factor, NA, NaN fixture에 대해 새 식과 직전 length(stats::na.omit(unique(x))) 식이 같은 hand-computed count를 반환하는지 확인합니다.
  • 같은 파일은 #99 IPD anchor extraction regression을 유지합니다. screened column 순서, old/new row 선택, 기존 element-wise loop와의 동일성을 검사합니다.
  • .jules/bolt.md 항목과 현재 PR 본문은 benchmark 없이 속도, 메모리, 개선율을 주장하지 않습니다. 성능 근거에 필요한 측정 조건도 명시합니다.
  • 이전 .jules/bolt.md 항목과 R/aFIPC.R에는 과거 refactor에 대한 성능 주장이 남아 있습니다. 이들은 이 PR에서 추가하거나 변경한 주장이 아닙니다.

현재 head의 R CMD check, Code Quality, Security Audit, SAST, CodeQL 관련 check는 아직 QUEUED 상태입니다. 따라서 hosted verification 결과는 아직 확인할 수 없습니다. 열린 review thread는 없습니다.

⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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