CopSource resolves the target Ruby version once for a run, not once for each file #1670
Labels
No labels
P0
P1
P2
P3
bug
category/code-change
category/cross-repo
category/eval-run
category/investigation
category/no-test-target
category/owner-ruling
category/prose-artifact
category/recurring-chore
category/structure
category/umbrella
crc-refactor
create
delete
enhancement
filed-by/agent
filed-by/user
frozen
lint-rule
needs-info
needs-triage
next
plugin/cc-architect
plugin/os
plugin/os-adr
plugin/os-aidd-lint
plugin/os-backlog
plugin/os-context
plugin/os-doc-hygiene
plugin/os-sdlc
plugin/os-vault
project/cc-os
ready-for-agent
ready-for-human
recurring
review
rule-proposal
update
waiting
wayfinder:grilling
wayfinder:map
wayfinder:map
wayfinder:research
wayfinder:task
wayfinder:task
wontfix
worklist/deviations
worklist/lint-rule
worklist/new-implement-build
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jared/cc-os#1670
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
CopSource.target_versionmakes a newRuboCop::ConfigStorefor each file. Each new store finds and loads.rubocop.ymlagain. RuboCop itself makes one store for a run, and that store keeps the loaded configuration for later files. The per-file store makes every os-sdlc detector that reads files throughCopSourceslow: the lookup takes about 14 ms for each file, and it is about 92% of the time for each file.Observed
A profile of 300
lib/files throughCopSource.from_filegave these times (session 56a999f3, 2026-11-10, load 4.4 to 6.0).target_version(RuboCop configuration lookup)The collaborator-pass
inwardsource overlib/takes about 10.4 s, throughCopSites, for the same reason.Reproduce
n/a: a speed defect; the profile above is the evidence.
Approach
Resolve the target Ruby version once for a run. Two candidate designs: the caller that walks many files holds one
ConfigStoreand passes the version toCopSource.from_file(path, version), which already takes a version argument; or the caller passes a fixed version, asreach_through.rbdoes withRUNNING_RUBY. The implementing agent selects one after it reads the callers.Required work: none beyond the acceptance criteria.
Acceptance criteria
CopSource, when the run completes, then it made one RuboCop configuration lookup for each configuration directory, not one for each file.Non-goals
The two cop tests and the collaborator-pass tests that were slow because of this call. #1665 changed their input and does not depend on this ticket.
Origin
lib/input from the slow tests; it did not changeCopSource.CopSource←CopSource.target_versionmakes a newConfigStorefor each file (cop_source.rb) ← DESIGN (plugins/os-sdlc/lib/os_sdlc/cops/structural/cop_source.rb).RuboCop::Cop::Sdlc::Structural::CopSource,plugins/os-sdlc/lib/os_sdlc/cops/structural/cop_source.rbVERDICT: CREATE (ticket-skeptic, backlog search only; the user approved the ticket in the #1665 plan)