Load cc-architect through Zeitwerk (ADR-0302) #1462

Open
opened 2026-10-28 15:43:00 +00:00 by jared · 0 comments
Owner

Problem

cc-architect loads its Ruby files through a hand-ordered require_relative list. plugins/cc-architect/scripts/plugin_config/plugin_config.rb has 28 require_relative lines, and Sdlc RequireRelativeDensity allows 15 (hit at line 4). ADR-0302 (supersedes ADR-0241, ruled by Jared 2026-10-28) states that every Ruby plugin loads through Zeitwerk, and it names cc-architect.

Observed

cc-architect has 70 Ruby files (35 under test/) and 92 require_relative lines: plugin_config.rb 28, operations/validate.rb 6, operations/audit.rb 5. No file mentions Zeitwerk. The constants already match their paths, for example PluginConfig::Operations::Enable and PluginConfig::Cli. #1385 counts only project-local requires, so it does not clear this hit.

Reproduce

n/a: structure change; the RequireRelativeDensity offense at plugin_config.rb:4 is the signal.

Approach

Load scripts/plugin_config/ through one Zeitwerk loader, as os-me does at plugins/os-me/lib/os_me.rb:21:

require "zeitwerk"
loader = Zeitwerk::Loader.new
loader.push_dir(__dir__, namespace: PluginConfig)
loader.setup

Remove the require_relative lines that the loader replaces. Add an eager-load test like the other Ruby plugins have. Behavior is unchanged; the existing cc-architect suite is the proof.

Required work:

  1. Set up a Zeitwerk loader for PluginConfig — check: present Zeitwerk::Loader in plugins/cc-architect/scripts/plugin_config/plugin_config.rb
  2. Remove the hand-ordered requires — check: absent require_relative 'key_check' in plugins/cc-architect/scripts/plugin_config/plugin_config.rb
  3. Add an eager-load test — check: present eager_load in plugins/cc-architect/test/**/*.rb

Rejected: split plugin_config.rb into smaller manifests — operations.rb would still hold 19 lines, so the offense moves. Rejected: a cop Exclude or baseline — forbidden.

Origin

  • Trigger: handoff 2026-10-28-1359 ruling 5; RequireRelativeDensity hit at plugins/cc-architect/scripts/plugin_config/plugin_config.rb:4
  • Improvised this session: none
  • Chain: RequireRelativeDensity offense ← 28 hand-ordered require_relative lines ← cc-architect not on Zeitwerk ← DESIGN (ADR-0241 listed four plugins only; ADR-0302 now names cc-architect)
  • Root candidate: none found; searched cc-architect, Zeitwerk, RequireRelativeDensity, plugin_config, require_relative, autoload, #1385, #1418
  • Where: plugins/cc-architect/scripts/plugin_config/plugin_config.rb
  • Session: 6ee3ad76-39ea-405d-983c-55d6b3559cee
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/6ee3ad76-39ea-405d-983c-55d6b3559cee.jsonl

VERDICT: CREATE — no open ticket converts cc-architect to Zeitwerk; #1385 is a cop-matcher fix and #1418 is a gate sweep.

## Problem cc-architect loads its Ruby files through a hand-ordered `require_relative` list. `plugins/cc-architect/scripts/plugin_config/plugin_config.rb` has 28 `require_relative` lines, and `Sdlc` RequireRelativeDensity allows 15 (hit at line 4). ADR-0302 (supersedes ADR-0241, ruled by Jared 2026-10-28) states that every Ruby plugin loads through Zeitwerk, and it names cc-architect. ## Observed cc-architect has 70 Ruby files (35 under `test/`) and 92 `require_relative` lines: `plugin_config.rb` 28, `operations/validate.rb` 6, `operations/audit.rb` 5. No file mentions Zeitwerk. The constants already match their paths, for example `PluginConfig::Operations::Enable` and `PluginConfig::Cli`. #1385 counts only project-local requires, so it does not clear this hit. ## Reproduce n/a: structure change; the RequireRelativeDensity offense at `plugin_config.rb:4` is the signal. ## Approach Load `scripts/plugin_config/` through one Zeitwerk loader, as os-me does at `plugins/os-me/lib/os_me.rb:21`: ```ruby require "zeitwerk" loader = Zeitwerk::Loader.new loader.push_dir(__dir__, namespace: PluginConfig) loader.setup ``` Remove the `require_relative` lines that the loader replaces. Add an eager-load test like the other Ruby plugins have. Behavior is unchanged; the existing cc-architect suite is the proof. Required work: 1. Set up a Zeitwerk loader for `PluginConfig` — check: present `Zeitwerk::Loader` in `plugins/cc-architect/scripts/plugin_config/plugin_config.rb` 2. Remove the hand-ordered requires — check: absent `require_relative 'key_check'` in `plugins/cc-architect/scripts/plugin_config/plugin_config.rb` 3. Add an eager-load test — check: present `eager_load` in `plugins/cc-architect/test/**/*.rb` Rejected: split `plugin_config.rb` into smaller manifests — `operations.rb` would still hold 19 lines, so the offense moves. Rejected: a cop Exclude or baseline — forbidden. ## Origin - Trigger: handoff 2026-10-28-1359 ruling 5; RequireRelativeDensity hit at `plugins/cc-architect/scripts/plugin_config/plugin_config.rb:4` - Improvised this session: none - Chain: RequireRelativeDensity offense ← 28 hand-ordered `require_relative` lines ← cc-architect not on Zeitwerk ← DESIGN (ADR-0241 listed four plugins only; ADR-0302 now names cc-architect) - Root candidate: none found; searched cc-architect, Zeitwerk, RequireRelativeDensity, plugin_config, require_relative, autoload, #1385, #1418 - Where: plugins/cc-architect/scripts/plugin_config/plugin_config.rb - Session: 6ee3ad76-39ea-405d-983c-55d6b3559cee - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/6ee3ad76-39ea-405d-983c-55d6b3559cee.jsonl VERDICT: CREATE — no open ticket converts cc-architect to Zeitwerk; #1385 is a cop-matcher fix and #1418 is a gate sweep.
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#1462
No description provided.