Skip to content

refactor(r): preserve observed category count without na.omit - #336

Draft
seonghobae wants to merge 11 commits into
masterfrom
bolt-opt-na-omit-13167333535658435100
Draft

refactor(r): preserve observed category count without na.omit#336
seonghobae wants to merge 11 commits into
masterfrom
bolt-opt-na-omit-13167333535658435100

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

Current exact authority — 2026-09-06

  • protected base: master@f87c2324f1686135e57d8730c1b0b9420874f300
  • exact head: 8ed423b1acdfa527a25503a17c3c590cfbe9d39a
  • lifecycle: Draft / behavior-equivalence evidence added / performance claim unproven

Scope

autoFIPC() currently counts the distinct observed non-missing response categories of paired common items with length(stats::na.omit(unique(x))). This branch expresses the same protected contract as sum(!is.na(unique(x))).

The original PR described this as a measured runtime optimization even though no representative benchmark, allocation profile, or buyer-path latency evidence was attached. Unit/coverage success can establish semantic compatibility; it cannot establish a meaningful speedup, GC/allocation reduction, or an O(N) constant-factor benefit in the actual calibration workload. Those claims have therefore been removed from the merge authority for this lane.

Regression boundary

tests/testthat/test-optimization-equivalence.R now directly compares the candidate expression with the protected na.omit(unique(...)) expression over:

  • ordinary dichotomous/trichotomous/four-category numeric responses;
  • missing-only input;
  • NA plus NaN input;
  • factor input containing a declared-but-unused level.

The hand-computed contract is distinct observed non-missing categories. The unused factor level is intentionally not counted because the protected #56 behavior is observation-based; the older length(levels(as.factor(x))) expression is compared only on ordinary response vectors where its semantics coincide. This prevents the regression test from silently rewriting current product semantics back to declared factor levels.

The generated .jules/bolt.md addition was unrelated repository-wide doctrine. Normal descendants restored that file to the exact protected blob 7d3c603f9991196ce123271a6c1e129156f24fd8; no force push or destructive rebase was used.

Performance acceptance

Do not promote this refactor as a performance improvement unless one unchanged exact head has a reproducible benchmark/profile using representative autoFIPC() category vectors and form/item cardinalities, with the same R version, platform, package state and warm-up policy. At minimum record repeated wall-time distribution and allocation evidence for the expression or containing buyer-relevant path. Synthetic microtiming alone must not be extrapolated to end-to-end calibration speed.

Until then the admissible claim is only: behavior-preserving expression simplification with explicit edge-case equivalence coverage.

Merge gate

Keep Draft until exact-head repository/security/SAST/current-review gates are terminal-valid. Predecessor results do not transfer after the head moved. Do not self-approve, create a no-op retrigger, weaken coverage/security gates, reintroduce generated Bolt doctrine, force-push, or destructively rebase.

@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 5, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: e6d83716-793e-4d77-ada7-428c3f249771

📥 Commits

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

📒 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의 공통 문항 검증에서 고유 비-NA 값 개수 계산식을 변경했습니다. 관련 최적화 학습 문서에 새 계산식을 설명했습니다.

Changes

고유 비-NA 값 개수 계산

Layer / File(s) Summary
검증 조건 및 최적화 설명
R/aFIPC.R, .jules/bolt.md
공통 문항 검증이 length(stats::na.omit(unique(...))) 대신 sum(!is.na(unique(...)))를 사용합니다. 학습 문서는 이 계산 방식과 오버헤드를 설명합니다.

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

Merge Risk: ⚪ Minimal · up to ed092

The common-item validation now counts unique non-missing values with an equivalent lower-overhead expression. Existing NA and calibration-path coverage supports unchanged behavior, with no remaining merge-blocking risk.

🚥 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 제목은 na.omit 없이 관측된 범주 수를 보존하는 리팩터링을 명확하게 설명하며, PR의 주요 변경 사항과 일치합니다.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bolt-opt-na-omit-13167333535658435100

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 marked this pull request as draft September 5, 2026 19:21
@seonghobae seonghobae changed the title ⚡ Bolt: R 언어에서 na.omit 대신 논리 인덱싱(sum(!is.na()))을 통한 고유값 계산 최적화 refactor(r): preserve observed category count without na.omit Sep 5, 2026
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