Skip to content

perf: drop unused dotenv and lazy-load scaffold templates (remove ActiveSupport from boot) (#30)#80

Merged
igmarin merged 2 commits into
mainfrom
perf/drop-dead-deps-30
Jun 30, 2026
Merged

perf: drop unused dotenv and lazy-load scaffold templates (remove ActiveSupport from boot) (#30)#80
igmarin merged 2 commits into
mainfrom
perf/drop-dead-deps-30

Conversation

@igmarin

@igmarin igmarin commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Summary

Removes two heavy/dead runtime dependencies from the gem's boot path (perf, P2).

  • dotenv was a dead runtime dependency — declared in the gemspec but never required or referenced anywhere in lib/, bin/, or test/. Dropped.
  • ActiveSupport was loaded on every CLI invocation for a single camelize call. lib/skill_bench/rails/skill_templates.rb did require 'active_support/inflector' solely to call String#camelize in a scaffold generator, and that file was require_relative'd at top-level boot. So every skill-bench run paid the cost of loading all of ActiveSupport. Replaced camelize with a tiny local helper and made the scaffold file lazy-loaded, so a normal run no longer touches ActiveSupport at all — and ActiveSupport is removed from the runtime deps.

What I verified (grep)

grep -rniE "activesupport|active_support|\.camelize|\.underscore|\.classify|deep_symbolize|deep_merge|\.blank\?|\.present\?|with_indifferent" lib bin:

  • skill_templates.rb:46,70name.camelize → the only actual ActiveSupport runtime calls.
  • skill_templates.rb:51 (extend ActiveSupport::Concern) and category_data.rb:47,49,50 (ActiveSupport::Concern) — these are string content inside generated templates / template data, not real calls. They stay (the generated Rails code is supposed to contain them).
  • commands/skill_new.rb:69 — a pre-existing local camelize definition, not an ActiveSupport usage.
  • Remaining hits were in README.md docs.

Conclusion: camelize was the sole real ActiveSupport usage → ActiveSupport can be dropped.

grep -rniE "dotenv|Dotenv" lib bin testno matches. dotenv is genuinely unreferenced → dropped.

Deps removed vs kept

  • Removed: activesupport (>= 6.0) (only used for one camelize, now localized) and dotenv (~> 3.2.0) (entirely unused). Both were leaf deps — neither survives in Gemfile.lock as a transitive dependency of anything else, so a chain of sub-gems (i18n, tzinfo, connection_pool, drb, base64, securerandom, …) drops out too.
  • Kept: cgi, faraday, json, parallel — all genuinely used at runtime.

The local camelize helper

Added to SkillBench::Rails::SkillTemplates, replacing String#camelize:

def self.camelize(name)
  name.split(/[-_]/).map { |segment| segment.empty? ? segment : segment[0].upcase + segment[1..] }.join
end

It splits on _ and -, upcases the first letter of each segment, and preserves already-CamelCase input (it does not lowercase the remainder). For the snake_case inputs the scaffold actually uses, this is identical to ActiveSupport's camelize; it additionally handles - (which ActiveSupport's camelize does not), matching the behavior the service_object generator already relied on. All three generators (service_object, concern, active_record_model) now route through this one helper (DRY) — the old inline split(/[-_]/).map(&:capitalize).join in service_object is gone.

The lazy require

skill_templates.rb was loaded at boot via two paths: the top-level require_relative in lib/skill_bench.rb, and require_relative '../rails/skill_templates' at the top of commands/skill_new.rb (which is itself required at boot). Both are removed; the require_relative now happens inside SkillNew.create_rails_skill, the single point where Rails::SkillTemplates is referenced. Verified via grep that nothing else references Rails::SkillTemplates at boot.

Sanity check

$ bundle exec ruby -e 'require "skill_bench"; puts SkillBench::VERSION'
1.2.0
$ bundle exec ruby -e 'require "skill_bench"; puts defined?(ActiveSupport) ? "loaded" : "not-loaded"'
not-loaded

Tests

  • New unit tests for the local helper: user_creatorUserCreator, order-serviceOrderService, already-camel UserCreatorUserCreator, mixed my-cool_skillMyCoolSkill.
  • skill_templates_test.rb now requires the (now lazy-loaded) file explicitly.
  • Existing skill_new / template tests still pass with the lazy require, and the suite covers require 'skill_bench' + skill new output generation.

Gates (all green from repo root)

  • bundle exec rubocop — no offenses
  • bundle exec reek — clean
  • bundle exec rake test — 764 runs, 0 failures, 0 errors (4 pre-existing skips)
  • bundle exec rake yard:coverage — 0 undocumented public objects

Closes #30

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@igmarin, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 15 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: a711330a-6b72-4581-a166-5405533f4934

📥 Commits

Reviewing files that changed from the base of the PR and between ceb8a7c and 4b67825.

⛔ Files ignored due to path filters (1)
  • Gemfile.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • lib/skill_bench.rb
  • lib/skill_bench/commands/skill_new.rb
  • lib/skill_bench/rails/skill_templates.rb
  • ruby-skill-bench.gemspec
  • test/agent_eval/rails/skill_templates_test.rb

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.

@igmarin
igmarin merged commit a52f6ce into main Jun 30, 2026
5 checks passed
@igmarin
igmarin deleted the perf/drop-dead-deps-30 branch June 30, 2026 20:54
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.

Drop dead/heavy deps: remove unused dotenv; replace activesupport camelize; lazy-require templates

1 participant