Skip to content

Tune ruby rails explainers - #78

Merged
dejo1307 merged 3 commits into
mainfrom
tune-ruby-rails-explainers
Jul 8, 2026
Merged

Tune ruby rails explainers#78
dejo1307 merged 3 commits into
mainfrom
tune-ruby-rails-explainers

Conversation

@dejo1307

@dejo1307 dejo1307 commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

dejo1307 added 3 commits July 8, 2026 19:52
Rails snapshots produced noisy, often-wrong findings: Ruby modules are
directories and coupling is synthesized from autoloaded constant
references, so the module graph is nearly complete and bidirectional and
the generic OOP/hexagonal explainers over-fire.

- layers: re-level the Rails pattern to two tiers (delivery=controllers/
  views, domain=everything else) so idiomatic model->service/job/helper
  references are no longer "violations"; only domain->delivery smells
  fire. Also classify interactors/presenters/serializers/notifiers/types.
- god-class, hotspots: dedupe candidates by symbol name (a constant
  reopened across N files no longer yields N identical findings, e.g.
  RailsAdmin::Config::Actions x50) and cap god-class output at 25.
- cycles: report SCCs larger than 8 modules as one low-confidence
  "highly coupled module cluster" note instead of a confidence-1.0
  cyclic-dependency alarm; in autoloaded Rails a giant SCC is expected.
- ruby extractor: tag synthetic coupling edges with coupling_kind and
  exclude ActiveRecord associations from cycle detection (has_many/
  belongs_to pairs are bidirectional by nature); add framework constants
  (I18n, Rails, Logger, GlobalID, Mime) to the fan-in ignore list.
- bump cacheVersion v94->v95 (+ cachecov coverage entry).
… hotspots)

Follow-up to the layers/cycles tuning: three explainers still misfired on
autoloaded, framework-heavy, public-by-default codebases.

- dependency-depth: count an oversized coupling cluster (SCC) as one logical
  layer instead of its full size, so a giant autoload cluster no longer reports
  every chain through it as an extreme depth.
- god-class, hotspots: exclude framework/base scaffolding classes (Application*,
  *BaseController, *::Base) via a Ruby-gated helper -- high fan-in through
  inheritance isn't a god class.
- exported-surface: skip Ruby symbols; public-by-default makes the
  exported/total ratio ~100% and uninformative.
- explain hotspots: compute module blast radius over the module graph instead of
  an all-node reverse count that saturates in a densely-coupled graph.

Explainer-only, no extractor change, so no cacheVersion bump.
The depth explainer condenses SCCs and takes the longest path. After the
earlier tuning an oversized autoload cluster counted as one node, so chains
were honest but low-value: their length came mostly from threading through
the one giant cluster (already reported by the cycles explainer), and they
were near-duplicates sharing that cluster spine.

Make an oversized cluster a weight-0 sink: drop its outgoing edges in the
condensation and count it as 0 depth, so a chain earns depth only from
genuine, distinct-module layering above/outside the cluster. Real deep
layering still reports; cluster-manufactured depth no longer does.
@dejo1307
dejo1307 merged commit f2384df into main Jul 8, 2026
4 checks passed
@dejo1307
dejo1307 deleted the tune-ruby-rails-explainers branch July 18, 2026 06: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.

1 participant