← Back to Pull requests

Pass item indexes to ractor callbacks when requested #380

Closed
unknown closed this pull request without merging on Aug 28, 2026 23:40 UTC
View on GitHub
unknown unknown commented on Aug 28, 2026 00:59 UTC
Author

Summary

Honor with_index when dispatching Ractor callbacks, including map_with_index and each_with_index.

Reproduction and verification

A callback def self.call(item, index); [item, index]; end used with Parallel.map_with_index(["a", "b"], in_ractors: 2, ractor: [Callback, :call]) currently raises ArgumentError because only item is passed. The candidate returns [["a", 0], ["b", 1]] and keeps start/finish hook indexing unchanged.

Three cases with one/two/three Ractors and finish callback evidence fail before/pass after. Twenty-nine existing Ractor examples pass with seven existing pending cases.

The combined installed-release candidate passes 800 model checks across direct, thread, process and Ractor modes. Existing selected suite: 165 examples, zero failures, nine pending, baseline and candidate on rbenv Ruby 4.0.6. Global process-name kill tests and the 200-process stress example were excluded for shared-host safety. SQLite examples use temporary databases. An external verification bundle uses already-installed dependencies; upstream Gemfile/lockfile/tests remain unchanged.

Runtime RuboCop passes. Full upstream RuboCop reports the same pre-existing RSpec/MatchWithSimpleRegex offense in spec/parallel_spec.rb:278 on both versions; no full green-lint claim. Gem packaging retains 2.1.0, Ruby >= 3.3, all four published paths and metadata, with no dependency changes.

Compatibility and limitations

Intentional correction: indexed Ractor calls supply the requested second argument. Non-indexed calls retain their one-argument contract. Direct mode with a Ractor-only callback is not addressed; Ruby 3 Ractor execution awaits upstream CI.

No tests were added or modified under the consuming repository's no-new-tests policy. Reproductions/model checks are external scratch scripts. No production operations or claim of complete concurrency/platform coverage.

Diff: 238 lines (+178 / -60) across 2 files Reviewer: grosser Review duration: 1360m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.37) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 238 lines diff across 2 files
0.37
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
56%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.328
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #380"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 56.8% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 37.2% (MEDIUM) · Higher = larger blast radius
37.2%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 56.8% · Lower = rushed or shallow review
56.8%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 16.1% · Safe to merge
16.1%