Speed up the RSpec suite: parallelize CI, then shrink the JS system-spec slice
Maintainer thường phản hồi trong vòng 18 ngày
@Sufiyan-MSA đang làm issue này rồi.
Từ ngày 11/9/2026.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- ci-cd, performance, testing-qa
Hướng nghiên cứu
Bắt đầu với .github/workflows/rspec.yml và so sánh các lệnh hiện tại của nó với các thiết lập theo từng tiến trình trong config/database.yml, config/storage.yml, spec/rails_helper.rb, spec/support/download_helpers.rb và spec/spec_helper.rb. Chạy baseline đã được ghi lại và kiểm tra cách xử lý SimpleCov cùng log thời gian chạy trước khi chọn một phase. Được xem là hoàn thành khi thay đổi đã chọn về tính song song, cân bằng, coverage hoặc tốc độ spec hoạt động mà không làm suy giảm kết quả CI.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Baseline (measured, not guessed)
The CI rspec step on main takes 8.4 min, in one process, with no parallelism (bundle exec rspec).
Local timings by slice:
| Slice | Examples | Time | Per example |
|---|---|---|---|
spec/system :js |
368 | 498s | 1.35s |
spec/requests |
932 | 50s | 0.05s |
spec/system (rack_test) |
388 | 36s | 0.09s |
spec/models |
666 | 22s | 0.03s |
JS system specs are ~82% of the wall clock for ~16% of the examples, and they ran at 28% CPU — the process sits idle waiting on Chrome. That single fact sets the priority order: parallelize first, then shrink the JS set.
Inside the JS slice:
spec/system/accessibility/axe_spec.rb— 45 examples / 118s (24% of JS time)spec/system/casa_cases/edit_spec.rb— 26 examples / 61sspec/system/typeahead_controls_spec.rb— 1 example / 30sspec/system/layouts/flashes_spec.rb— 4 examples / 18.5s
Two things checked and ruled out as meaningful levers: Prosopite's per-example scan costs only ~4% (measured A/B on spec/models, 28.4s vs 29.7s), and Build App + assets:precompile is 0.2 min. Neither is worth touching early.
Phase 1 — turn on parallelism (config only, no spec edits)
The repo is already fully wired for parallel_tests and just doesn't use it in CI. The gem is in the Gemfile, and every per-process collision point is already parameterized by TEST_ENV_NUMBER:
config/database.yml:17— per-process database nameconfig/storage.yml:3— per-process Active Storage rootspec/rails_helper.rb:132— per-process Capybara server portspec/support/download_helpers.rb:3— per-process download dirspec/spec_helper.rb:18— per-process SimpleCovcommand_name
Someone built this and it fell out of CI. Tasks:
- In
.github/workflows/rspec.yml, replacebundle exec rake db:create db:schema:loadwithbundle exec rake parallel:create parallel:load_schema, andbundle exec rspecwithbundle exec parallel_test spec --type rspec -n 4. - Cache
tmp/parallel_runtime_rspec.logacross runs so--group-by runtimebalances groups. Without it, whichever group holdsaxe_specbecomes the critical path. - Add a SimpleCov merge step — bump
SimpleCov.merge_timeoutand collate the per-process resultsets before theqltyupload, or the reported coverage will silently drop.
ubuntu-latest on a public repo is 4 vCPU. Because the JS specs are browser-wait-bound, 4 processes should scale close to linearly: ~8.4 min → ~3 min. Memory headroom needs a check — 4 concurrent headless Chromes in 16 GB should be fine, but watch it.
Phase 2 — shrink the JS slice
- Audit the
:jstags. 368 JS examples is far more than a Hotwire app of this size needs. Every one converted torack_testgoes 1.35s → 0.09s (15×). Highest-yield item on the list, but it's per-file judgment work, so no payoff number until the audit is done. - Move
spec/system/accessibility/axe_spec.rbinto its own CI job. 118s of full page-load + axe-core runs, independent of everything else. Running it concurrently takes ~2 min off the critical path at zero risk. - Fix the flakes, then cut
retry: 3.spec/support/rspec_retry.rbretries every:jsexample up to 3× in CI, so the slowest specs are also the ones that can triple in cost.spec/system/learning_hours/date_range_spec.rbfailed 3 examples in a local run and is burning retries in CI right now. Fix it, then drop toretry: 1. - Fix
spec/system/typeahead_controls_spec.rb. One example, 30s, ~20let!records, two explicitsleeps and aTimeout.timeout(6)poll loop. Split it per control and replace the manual polling with Capybara's own waiting.
Phase 3 — keep it from regressing
- Add
config.profile_examples = 10behind an env var so the next slow spec is visible without a manual profiling run. - Set
.prosopite_ignoredirectories to:offrather than:log_only.spec/systemis on that list, so its N+1s can never fail the build, yet the slowest 82% of the suite still pays the scan cost. Only worth ~4% though — do it last.
- Ngôn ngữ chính
- Ruby
- Star
- 382
- Fork
- 546
- Merge trung bình
- 12 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 17
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của rubyforgood/casa
-
Bug: Reassigned cases are listed under "Not Assigned" in the Assign a new case dropdownCó thể đã có người làm @Anandb71 đã nhận 6 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
rubyforgood/casa#7241 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 18 ngày
-
Bug: Change password issue?Đang mởHelp Wanted Type: Bug
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 35/100
rubyforgood/casa#7243 ·
Maintainer thường phản hồi trong vòng 18 ngày
-
💡 Add a code-review agent skillĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
rubyforgood/casa#7227 ·
Maintainer thường phản hồi trong vòng 18 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
rubyforgood/casa#7218 ·
Maintainer thường phản hồi trong vòng 18 ngày
-
Include the org in CASA case URLs and finish the switch away from database idsCó thể làm lại được @A-RYAN-1 đã nhận 26 ngày trước và không có pull request nào đang mở. Đang mở✨ New Feature Help Wanted
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 32/100
rubyforgood/casa#7106 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 18 ngày
Tất cả issue của rubyforgood/casa
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
hackclub/hcb#15454 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
voxpupuli/puppet-archive#566 ·
-
area/tech debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 2 ngày
-
verified
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
akitaonrails/ai-book-2026#10 ·