Skip to content

superseded: lavaan type-stable row-count change consolidated in #90 - #113

Closed
seonghobae wants to merge 3 commits into
masterfrom
bolt/optimize-vapply-18059334529014186926
Closed

superseded: lavaan type-stable row-count change consolidated in #90#113
seonghobae wants to merge 3 commits into
masterfrom
bolt/optimize-vapply-18059334529014186926

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Superseded by #90

Fresh effective-delta audit at 7b9d3a89c14d567d86b23b26bf61e1d4d1ed64eb found one valid product semantic: replace max(sapply(mispatts, nrow)) with max(vapply(mispatts, nrow, numeric(1))) in the list-shaped llcont.lavaan() missing-pattern path.

Canonical Draft #90@ddaa04ad6a157c2f09a5f33496a63e28d2013ee3 carries that exact type-stable computation on the current protected-base lineage. #90 also repairs later unrelated GLM/workflow/doctrine contamination by a normal fast-forward descendant while preserving history.

The only remaining #113 delta is generated .jules/bolt.md guidance and wording that presents an uncommitted ~20% microbenchmark as general performance evidence. Neither is a unique statistical/test/fixture contract, and neither is required to preserve the lavaan likelihood behavior. No focused regression exists only on #113; the repository's existing lavaan missing='ml' path remains the behavior check in the canonical lane.

Every valid semantic contract from #113 is therefore present in #90. This closure transfers neither predecessor GREEN evidence nor merge authority, and #90 remains Draft pending its own unchanged exact-head checks and qualifying independent review.

Replaced `sapply` with `vapply` in `R/llcont.R` when iterating over `mispatts` to find the maximum number of rows.
In R codebases, `sapply` involves significant overhead to deduce and simplify the return type dynamically. Using `vapply` with a predefined return type avoids this overhead.
@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 1, 2026

Copy link
Copy Markdown

Review Change Stack

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: 75588436-edf9-4c20-bc9d-29f5175af9bb

📥 Commits

Reviewing files that changed from the base of the PR and between 807e940 and fbef762.

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

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


📝 Walkthrough

Walkthrough

목록형 누락 패턴의 행 수 계산에 vapply(..., FUN.VALUE = numeric(1))을 적용했습니다. 알려진 반환 타입과 길이에서는 vapply를 사용하도록 R 성능 지침도 추가했습니다.

Changes

누락 패턴 행 수 계산 최적화

Layer / File(s) Summary
명시적 반환 타입 반복 적용
.jules/bolt.md, R/llcont.R
llcont.lavaan은 각 누락 패턴의 행 수를 vapply로 계산합니다. 관련 문서는 알려진 반환 타입과 길이에서 vapply를 사용하도록 설명합니다.

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

Merge Risk: ⚪ Minimal · up to fbef7

This is a localized performance optimization that preserves the intended iteration result; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 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 제목은 sapplyvapply로 대체하여 리스트 반복을 최적화하는 PR의 주요 변경 사항을 정확하고 간결하게 설명합니다.
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.
Full details: Docstring Coverage

Explanation

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 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bolt/optimize-vapply-18059334529014186926

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.

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 potential issue.

Devin Review

Comment thread R/llcont.R
if(any(class(mispatts) == "list")){
npatts <- max(sapply(mispatts, nrow))
## Bolt: replaced sapply with vapply to avoid type deduction overhead
npatts <- max(vapply(mispatts, nrow, numeric(1)))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📝 Info: Numeric template preserves row counts

vapply safely promotes integer results from nrow to the numeric template. The maximum and subsequent missing-data validation remain unchanged.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Replaced `sapply` with `vapply` in `R/llcont.R` when iterating over `mispatts` to find the maximum number of rows.
In R codebases, `sapply` involves significant overhead to deduce and simplify the return type dynamically. Using `vapply` with a predefined return type avoids this overhead.
Replaced `sapply` with `vapply` in `R/llcont.R` when iterating over `mispatts` to find the maximum number of rows.
In R codebases, `sapply` involves significant overhead to deduce and simplify the return type dynamically. Using `vapply` with a predefined return type avoids this overhead.

@cwl-noema-review cwl-noema-review 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.

Noema LLM review

The PR optimizes a list iteration in llcont.lavaan by replacing sapply with vapply. This aligns with the project's performance guidelines (Bolt) to avoid type deduction overhead when the return type is known. The use of numeric(1) as the template for nrow is correct and safe.

Reviewed changed lines

  • .jules/bolt.md:18 (RIGHT): Added a new performance guideline to avoid sapply in favor of vapply when return types are known.
  • R/llcont.R:411 (RIGHT): Replaced sapply(mispatts, nrow) with vapply(mispatts, nrow, numeric(1)). Since nrow always returns a single integer/numeric value, this is a safe and more efficient replacement.

Adversarial validation

  • R/llcont.R:411 (RIGHT) falsified: The use of numeric(1) might cause a type mismatch if nrow returns an integer, leading to a runtime error in vapply. — In R, vapply allows the return value to be coerced to the template type. nrow returns an integer, which is a subtype of numeric; numeric(1) safely accepts integer returns.
  • R/llcont.R:411 (RIGHT) falsified: If mispatts is an empty list, max() on the result of vapply might return -Inf or error, differing from sapply behavior. — Both sapply(list(), nrow) and vapply(list(), nrow, numeric(1)) return numeric(0). max(numeric(0)) returns -Inf with a warning in both cases. Behavioral parity is maintained.
  • Residual risk: None. The change is a localized performance optimization with no change to logic.

Findings

  • No blocking findings.

  • Result: APPROVE

  • Head SHA: 7b9d3a89c14d567d86b23b26bf61e1d4d1ed64eb

  • Reviewer credential: noema-review-github-app

  • Actor: cwl-noema-review[bot]

@seonghobae seonghobae changed the title ⚡ Bolt: Optimize list iteration with vapply superseded: lavaan type-stable row-count change consolidated in #90 Sep 6, 2026
@seonghobae seonghobae closed this Sep 6, 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