Find why DetectorEntryPointsTest#test_bin_script_maps_to_its_first_constant takes 11.8 s #1338

Closed
opened 2026-10-25 19:49:03 +00:00 by jared · 1 comment
Owner

Problem

DetectorEntryPointsTest#test_bin_script_maps_to_its_first_constant (plugins/os-sdlc/tests/detector/entry_points_test.rb:12) takes 11.8 s. It starts no subprocess. It appears to load and parse the whole codebase. The os-sdlc suite runs 65.8 s against a 60 s budget.

Approach

Investigate first. Find which step takes the time (file discovery, parse, or constant resolution) and why the test needs the whole codebase. Then make the test fast without losing what it proves: a bin script maps to its first constant. A small fixture tree is one option. A narrower input to the entry-point mapper is another.

Required work:

  1. Profile the test and record the slow step in the ticket comment.
  2. Change the test or the code under test so the test runs in under 1 s and keeps the same assertion.

Acceptance criteria

  1. Given the changed test, when it runs, then it takes less than 1 s.
  2. Given a bin script with a first constant, when the entry-point mapper runs on it, then the test asserts that the script maps to that constant.
  3. Given the os-sdlc suite, when it runs, then its total time falls by about 10 s.

Owner sketch

The entry-point mapper tested in plugins/os-sdlc/tests/detector/entry_points_test.rb.

Non-goals

The conversion of the detector bin tests to in-process calls. Another ticket covers it (#1330).

Origin

  • Trigger: ruby plugins/os-sdlc/tests/all.rb took 65.8 s against a 60 s budget. About 70% of summed test time is tests that start our own bin scripts with Open3.
  • Improvised this session: none
  • Chain: suite over budget ← test takes 11.8 s with no subprocess ← test loads and parses the whole codebase (unverified; the investigation confirms it)
  • Root candidate: none found; searched DetectorEntryPointsTest, test_bin_script_maps_to_its_first_constant, 11.8 s
  • Where: plugins/os-sdlc/tests/detector/entry_points_test.rb:12
  • Session: 01c29715-c945-43b4-86fc-6c5fc6c4dd3f
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/01c29715-c945-43b4-86fc-6c5fc6c4dd3f.jsonl
## Problem `DetectorEntryPointsTest#test_bin_script_maps_to_its_first_constant` (`plugins/os-sdlc/tests/detector/entry_points_test.rb:12`) takes 11.8 s. It starts no subprocess. It appears to load and parse the whole codebase. The os-sdlc suite runs 65.8 s against a 60 s budget. ## Approach Investigate first. Find which step takes the time (file discovery, parse, or constant resolution) and why the test needs the whole codebase. Then make the test fast without losing what it proves: a bin script maps to its first constant. A small fixture tree is one option. A narrower input to the entry-point mapper is another. Required work: 1. Profile the test and record the slow step in the ticket comment. 2. Change the test or the code under test so the test runs in under 1 s and keeps the same assertion. ## Acceptance criteria 1. Given the changed test, when it runs, then it takes less than 1 s. 2. Given a bin script with a first constant, when the entry-point mapper runs on it, then the test asserts that the script maps to that constant. 3. Given the os-sdlc suite, when it runs, then its total time falls by about 10 s. ## Owner sketch The entry-point mapper tested in `plugins/os-sdlc/tests/detector/entry_points_test.rb`. ## Non-goals The conversion of the detector bin tests to in-process calls. Another ticket covers it (#1330). ## Origin - Trigger: `ruby plugins/os-sdlc/tests/all.rb` took 65.8 s against a 60 s budget. About 70% of summed test time is tests that start our own bin scripts with Open3. - Improvised this session: none - Chain: suite over budget ← test takes 11.8 s with no subprocess ← test loads and parses the whole codebase (unverified; the investigation confirms it) - Root candidate: none found; searched DetectorEntryPointsTest, test_bin_script_maps_to_its_first_constant, 11.8 s - Where: plugins/os-sdlc/tests/detector/entry_points_test.rb:12 - Session: 01c29715-c945-43b4-86fc-6c5fc6c4dd3f - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/01c29715-c945-43b4-86fc-6c5fc6c4dd3f.jsonl
Author
Owner

Resolution

Done: Investigated; the 11.8 s no longer reproduces. DetectorEntryPointsTest#test_bin_script (plugins/os-sdlc/tests/detector/entry_points_test.rb:12) takes 0.15-0.33 s alone and 0.62 s in the full suite. No code change.

Evidence: 2026-10-27 measurements: full suite 51.9 s for 2728 runs (ticket recorded 65.8 s). EntryPoints#entries (lib/os_sdlc/detector/entry_points.rb:26-36) calls Prism.parse_file 44 times (42 bin scripts + boot/commands.rb), 0.118 s cold, 0.04 s warm; no subprocess, no RuboCop, no whole-repo parse. The old outlier was most likely load from the Open3 bin tests that #1337/f4cfb8fb moved in-process.

Follow-ups: none: optional class-level memo of entries saves about 0.1 s and is dropped; a slowest-tests report ticket is dropped as speculative.

## Resolution **Done:** Investigated; the 11.8 s no longer reproduces. DetectorEntryPointsTest#test_bin_script (plugins/os-sdlc/tests/detector/entry_points_test.rb:12) takes 0.15-0.33 s alone and 0.62 s in the full suite. No code change. **Evidence:** 2026-10-27 measurements: full suite 51.9 s for 2728 runs (ticket recorded 65.8 s). EntryPoints#entries (lib/os_sdlc/detector/entry_points.rb:26-36) calls Prism.parse_file 44 times (42 bin scripts + boot/commands.rb), 0.118 s cold, 0.04 s warm; no subprocess, no RuboCop, no whole-repo parse. The old outlier was most likely load from the Open3 bin tests that #1337/f4cfb8fb moved in-process. **Follow-ups:** none: optional class-level memo of entries saves about 0.1 s and is dropped; a slowest-tests report ticket is dropped as speculative.
jared closed this issue 2026-10-27 16:07:49 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#1338
No description provided.