crc os-adr wave 4: Repository, Index, Invocation, RootFlag into role directories; cli/ dissolves; AdrTestHelpers to AdrFixtures #927

Closed
opened 2026-10-04 16:37:02 +00:00 by jared · 2 comments
Owner

Problem

Move lib files into role directories by their job (verb), and update the loader to collapse them. Implement Repository, Index, Invocation, and RootFlag movements under their roles; dissolve cli/ directory; rename AdrTestHelpers to AdrFixtures.

Reproduce

n/a: structure-only refactor, no behavior change

Approach

Required work:

  1. plugins/os-adr/lib/adr/repository.rb: move to plugins/os-adr/lib/adr/adapter/repository.rb, constant Adr::Repository, test plugins/os-adr/tests/adapter/repository_test.rb
  2. plugins/os-adr/lib/adr/cli/init.rb: move to plugins/os-adr/lib/adr/command/repository/initialization.rb, constant Adr::Repository::Initialization
  3. plugins/os-adr/lib/adr/index.rb: move to plugins/os-adr/lib/adr/presenter/index.rb, constant Adr::Index, test plugins/os-adr/tests/presenter/index_test.rb
  4. plugins/os-adr/lib/adr/invocation.rb: move to plugins/os-adr/lib/adr/model/invocation.rb, constant Adr::Invocation
  5. plugins/os-adr/lib/adr/cli/root_flag.rb: move to plugins/os-adr/lib/adr/parser/root_flag.rb, constant Adr::RootFlag
  6. plugins/os-adr/tests/support/adr_test_helpers.rb: rename to plugins/os-adr/tests/support/adr_fixtures.rb, constant AdrFixtures
  7. plugins/os-adr/lib/adr.rb: update the loader to collapse the six role directories model/, query/, presenter/, parser/, command/, adapter/ (R1, Proposed ADR-0271); drop the 'cli' => 'CLI' inflection once cli/ is empty (R2)

Governed by rulings: R1, R2, R4, R5, R9, R10, R12, R14, R15
Rejected: none (all rows apply)

Acceptance criteria

  • All six lib/test files moved to their role directories or renamed
  • Loader plugins/os-adr/lib/adr.rb collapses the six role directories model/, query/, presenter/, parser/, command/, adapter/
  • 'cli' => 'CLI' inflection removed from loader
  • tests/adapter/repository_test.rb, tests/presenter/index_test.rb mirror the lib paths
  • ruby plugins/os-adr/tests/all.rb passes with 0 failures
  • ruby -e 'require "./plugins/os-adr/lib/adr"; Adr.loader.eager_load' runs silently
  • All existing callers updated (bin/adr-find, bin/adr-init, bin/adr-migrate, lib files, tests)
  • cli/ directory is empty after moves

Owner sketch

Familiar with Ruby, Zeitwerk, and os-adr architecture. Move files in order: Repository and Index (independent), Invocation and RootFlag (both core), then rename AdrTestHelpers. Update loader systematically and verify tests and lint.

Non-goals

No behavior change; no new tests; no deletion of code that has callers.

Origin

Session: a20defa9-036a-415a-9dde-2ed833c727cb
Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os--claude-worktrees-crc-refactor-docs/a20defa9-036a-415a-9dde-2ed833c727cb.jsonl
Where: crc-refactor run on plugins/os-adr, worktree crc-os-adr-2026-10-04, ledger docs/crc/os-adr/ledger.tsv

## Problem Move lib files into role directories by their job (verb), and update the loader to collapse them. Implement Repository, Index, Invocation, and RootFlag movements under their roles; dissolve cli/ directory; rename AdrTestHelpers to AdrFixtures. ## Reproduce n/a: structure-only refactor, no behavior change ## Approach Required work: 1. plugins/os-adr/lib/adr/repository.rb: move to plugins/os-adr/lib/adr/adapter/repository.rb, constant Adr::Repository, test plugins/os-adr/tests/adapter/repository_test.rb 2. plugins/os-adr/lib/adr/cli/init.rb: move to plugins/os-adr/lib/adr/command/repository/initialization.rb, constant Adr::Repository::Initialization 3. plugins/os-adr/lib/adr/index.rb: move to plugins/os-adr/lib/adr/presenter/index.rb, constant Adr::Index, test plugins/os-adr/tests/presenter/index_test.rb 4. plugins/os-adr/lib/adr/invocation.rb: move to plugins/os-adr/lib/adr/model/invocation.rb, constant Adr::Invocation 5. plugins/os-adr/lib/adr/cli/root_flag.rb: move to plugins/os-adr/lib/adr/parser/root_flag.rb, constant Adr::RootFlag 6. plugins/os-adr/tests/support/adr_test_helpers.rb: rename to plugins/os-adr/tests/support/adr_fixtures.rb, constant AdrFixtures 7. plugins/os-adr/lib/adr.rb: update the loader to collapse the six role directories model/, query/, presenter/, parser/, command/, adapter/ (R1, Proposed ADR-0271); drop the 'cli' => 'CLI' inflection once cli/ is empty (R2) Governed by rulings: R1, R2, R4, R5, R9, R10, R12, R14, R15 Rejected: none (all rows apply) ## Acceptance criteria - All six lib/test files moved to their role directories or renamed - Loader plugins/os-adr/lib/adr.rb collapses the six role directories model/, query/, presenter/, parser/, command/, adapter/ - 'cli' => 'CLI' inflection removed from loader - tests/adapter/repository_test.rb, tests/presenter/index_test.rb mirror the lib paths - ruby plugins/os-adr/tests/all.rb passes with 0 failures - ruby -e 'require "./plugins/os-adr/lib/adr"; Adr.loader.eager_load' runs silently - All existing callers updated (bin/adr-find, bin/adr-init, bin/adr-migrate, lib files, tests) - cli/ directory is empty after moves ## Owner sketch Familiar with Ruby, Zeitwerk, and os-adr architecture. Move files in order: Repository and Index (independent), Invocation and RootFlag (both core), then rename AdrTestHelpers. Update loader systematically and verify tests and lint. ## Non-goals No behavior change; no new tests; no deletion of code that has callers. ## Origin Session: a20defa9-036a-415a-9dde-2ed833c727cb Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os--claude-worktrees-crc-refactor-docs/a20defa9-036a-415a-9dde-2ed833c727cb.jsonl Where: crc-refactor run on plugins/os-adr, worktree crc-os-adr-2026-10-04, ledger docs/crc/os-adr/ledger.tsv
Author
Owner

cf2bc54d; rows applied 6/6 plus loader; rows deviated 0; rows blocked 0

cf2bc54d; rows applied 6/6 plus loader; rows deviated 0; rows blocked 0
Author
Owner

Resolution

Done: Repository, Repository::Initialization, Index, Invocation, RootFlag into role directories; cli/ and its inflection removed; AdrTestHelpers renamed AdrFixtures

Evidence: cf2bc54d, 37f933ea on branch crc-os-adr-2026-10-04 (not merged; user review pending); suite: 51 runs, 168 assertions, 0 failures, 0 errors, 0 skips; eager load silent; inward lint: none (os-adr has none)

Follow-ups: none for this ticket; run-level follow-ups filed as #934 and #935; dropped items listed in docs/crc/os-adr/HANDOFF.md Review

## Resolution **Done:** Repository, Repository::Initialization, Index, Invocation, RootFlag into role directories; cli/ and its inflection removed; AdrTestHelpers renamed AdrFixtures **Evidence:** cf2bc54d, 37f933ea on branch crc-os-adr-2026-10-04 (not merged; user review pending); suite: 51 runs, 168 assertions, 0 failures, 0 errors, 0 skips; eager load silent; inward lint: none (os-adr has none) **Follow-ups:** none for this ticket; run-level follow-ups filed as #934 and #935; dropped items listed in docs/crc/os-adr/HANDOFF.md Review
jared closed this issue 2026-10-04 17:15:02 +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#927
No description provided.