Share CodeShape lexical scope with the InwardDependency and AdapterBuiltOutsideEntry cops #1734

Open
opened 2026-11-12 21:37:46 +00:00 by jared · 1 comment
Owner

Problem

The cops InwardDependency::ConstantReference and AdapterBuiltOutsideEntry::AdapterConstant each hold their own nesting rule, and each fails to resolve about 1,160 names that exist in lib. A cop cannot flag a name that it cannot resolve (#1718). Blocked by #1729.

Observed

The cops missed 1,169 and 1,156 sites in the comparison of 2026-11-12. AdapterConstant matches file names without case (adapter_constant.rb:35-40 checks File.file? after it lowercases the name), so the constant WORD resolves to census/word.rb (7 sites of this kind). The nesting rules are at cops/structural/inward_dependency/constant_reference.rb:21-40, adapter_built_outside_entry/adapter_constant.rb:46-77, and dry/owned_message.rb:39.

Reproduce

n/a: design finding from the resolver comparison of 2026-11-12.

Approach

Not decided; the takedown designs it. The cops stay on the RuboCop tree (docs/crc/os-sdlc/detector-cop-memo.md advised against a move onto Prism) and share CodeShape::LexicalScope on plain strings. AdapterConstant resolves through definitions, not file names.

Required work: none beyond the acceptance criteria.

Origin

  • Trigger: split of #1718 by Jared (rulings 145 and 146 in docs/decisions/rulings.tsv, 2026-11-12) after takedown run docs/takedown/1718-20261112-160038/ failed green-suite; parent #1718
  • Improvised this session: none
  • Chain: the cops miss about 1,160 names; WORD resolves to census/word.rb ← no object owns facts read from parsed Ruby code, so each detector, lint check, and cop writes its own copy ← DESIGN (#1718; docs/system-design-format/README.md:242)
  • Root candidate: none found; searched InwardDependency, AdapterConstant, AdapterBuiltOutsideEntry, ConstantReference, OwnedMessage, lexical scope
  • Where: plugins/os-sdlc/lib/os_sdlc/cops/structural/inward_dependency/constant_reference.rb, adapter_built_outside_entry/adapter_constant.rb
  • Session: 784c0808-1e40-4296-8f93-77c40ca419c2
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os-plugins-os-sdlc/784c0808-1e40-4296-8f93-77c40ca419c2.jsonl

VERDICT: CREATE
REASON: Jared ruled the split of #1718 (ruling 146); the backlog search found no open ticket with the same mechanism.

## Problem The cops `InwardDependency::ConstantReference` and `AdapterBuiltOutsideEntry::AdapterConstant` each hold their own nesting rule, and each fails to resolve about 1,160 names that exist in `lib`. A cop cannot flag a name that it cannot resolve (#1718). Blocked by #1729. ## Observed The cops missed 1,169 and 1,156 sites in the comparison of 2026-11-12. `AdapterConstant` matches file names without case (`adapter_constant.rb:35-40` checks `File.file?` after it lowercases the name), so the constant `WORD` resolves to `census/word.rb` (7 sites of this kind). The nesting rules are at `cops/structural/inward_dependency/constant_reference.rb:21-40`, `adapter_built_outside_entry/adapter_constant.rb:46-77`, and `dry/owned_message.rb:39`. ## Reproduce n/a: design finding from the resolver comparison of 2026-11-12. ## Approach Not decided; the takedown designs it. The cops stay on the RuboCop tree (`docs/crc/os-sdlc/detector-cop-memo.md` advised against a move onto Prism) and share `CodeShape::LexicalScope` on plain strings. `AdapterConstant` resolves through definitions, not file names. Required work: none beyond the acceptance criteria. ## Origin - Trigger: split of #1718 by Jared (rulings 145 and 146 in `docs/decisions/rulings.tsv`, 2026-11-12) after takedown run `docs/takedown/1718-20261112-160038/` failed green-suite; parent #1718 - Improvised this session: none - Chain: the cops miss about 1,160 names; `WORD` resolves to `census/word.rb` ← no object owns facts read from parsed Ruby code, so each detector, lint check, and cop writes its own copy ← DESIGN (#1718; `docs/system-design-format/README.md:242`) - Root candidate: none found; searched InwardDependency, AdapterConstant, AdapterBuiltOutsideEntry, ConstantReference, OwnedMessage, lexical scope - Where: `plugins/os-sdlc/lib/os_sdlc/cops/structural/inward_dependency/constant_reference.rb`, `adapter_built_outside_entry/adapter_constant.rb` - Session: 784c0808-1e40-4296-8f93-77c40ca419c2 - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os-plugins-os-sdlc/784c0808-1e40-4296-8f93-77c40ca419c2.jsonl VERDICT: CREATE REASON: Jared ruled the split of #1718 (ruling 146); the backlog search found no open ticket with the same mechanism.
Author
Owner

Occurrence: One owner for the enclosing namespace of a node in the Sdlc cops
Seen: plugins/os-sdlc/lib/os_sdlc/cops/dry/library_outside_owner/reference.rb:34-40
Run: implementation 287 (#1744), session 4ee81bfb-d577-49b1-a9cf-617e4d2dae5f
Adds: a fifth copy of the nesting rule. The contract-auditor reported lens A12: under? and namespace_path repeat OwnedMessage#inside? (owned_message.rb:38-42). Include Sdlc/Dry/LibraryOutsideOwner in the cops that share CodeShape::LexicalScope.

Occurrence: One owner for the enclosing namespace of a node in the Sdlc cops Seen: plugins/os-sdlc/lib/os_sdlc/cops/dry/library_outside_owner/reference.rb:34-40 Run: implementation 287 (#1744), session 4ee81bfb-d577-49b1-a9cf-617e4d2dae5f Adds: a fifth copy of the nesting rule. The contract-auditor reported lens A12: `under?` and `namespace_path` repeat `OwnedMessage#inside?` (owned_message.rb:38-42). Include `Sdlc/Dry/LibraryOutsideOwner` in the cops that share `CodeShape::LexicalScope`.
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#1734
No description provided.