Give a superclass reference its class as the source in ConceptCycleCheck::References #1746

Closed
opened 2026-11-12 22:56:27 +00:00 by jared · 1 comment
Owner

Problem

Lint::ConceptCycleCheck::References gives the wrong source to a superclass reference. It records the reference with the scope outside the class as its source. When the class is the root of a concept, that scope is the library root, so the edge has no source concept and the check drops it. The cop Sdlc/Structural/ConceptCycle gives the class as the source of the same reference. Thus the cop and the index disagree: the cop can report a loop edge that is not in the graph it reads the route from, and bin/lint-concept-cycles does not print that loop.

Observed

  • lib/os_sdlc/lint/concept_cycle_check/references.rb:149-150 visits node.superclass with the outer @scope, and located and resolved use that scope as the source.
  • lib/os_sdlc/cops/structural/concept_cycle/reference.rb (owner) gives the class that contains the reference.
  • test/os_sdlc/lint/concept_cycle_check/references_test.rb:9-12 expects ["Zed", "Zed::Beta"] for a superclass reference, so the suite keeps the current answer.
  • A lens challenge on implementation 290 (ticket #1742) found this from the contract-auditor line LENS: A12 broken at lib/os_sdlc/cops/structural/concept_cycle/reference.rb:38.

Reproduce

  1. Write a.rb with module CycleFx; class A < B; end; end and b.rb with module CycleFx; class B; A; end; end in one library directory.
  2. Call OsSdlc::Lint::ConceptCycleCheck::References.new(dir).resolved.
  3. Result: [["CycleFx", "CycleFx::B"], ["CycleFx::B", "CycleFx::A"]]. Expected: the first pair has the source CycleFx::A.

Origin

  • Trigger: lens challenge of the contract-auditor LENS line of implementation 290 (#1742), 2026-11-12
  • Improvised this session: none
  • Chain: the cop reports an A to B superclass edge that the index does not hold ← the index uses the lookup scope as the source of a superclass reference ← CODE (plugins/os-sdlc/lib/os_sdlc/lint/concept_cycle_check/references.rb:149-150)
  • Root candidate: none found; searched superclass, ConceptCycleCheck, References, concept cycle, lint-concept-cycles, visit_class_node, owner, source scope, 1729, 1741
  • Where: plugins/os-sdlc/lib/os_sdlc/lint/concept_cycle_check/references.rb
  • Session: 4ee81bfb-d577-49b1-a9cf-617e4d2dae5f
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os--claude-worktrees-ticket-1743/4ee81bfb-d577-49b1-a9cf-617e4d2dae5f.jsonl

VERDICT: CREATE (ticket-skeptic, 2026-11-12, full gauntlet): References gives a superclass reference the outer scope as its source, so the batch check misses a loop that the cop reports; no open ticket owns this fault.

## Problem `Lint::ConceptCycleCheck::References` gives the wrong source to a superclass reference. It records the reference with the scope outside the class as its source. When the class is the root of a concept, that scope is the library root, so the edge has no source concept and the check drops it. The cop `Sdlc/Structural/ConceptCycle` gives the class as the source of the same reference. Thus the cop and the index disagree: the cop can report a loop edge that is not in the graph it reads the route from, and `bin/lint-concept-cycles` does not print that loop. ## Observed - `lib/os_sdlc/lint/concept_cycle_check/references.rb:149-150` visits `node.superclass` with the outer `@scope`, and `located` and `resolved` use that scope as the source. - `lib/os_sdlc/cops/structural/concept_cycle/reference.rb` (`owner`) gives the class that contains the reference. - `test/os_sdlc/lint/concept_cycle_check/references_test.rb:9-12` expects `["Zed", "Zed::Beta"]` for a superclass reference, so the suite keeps the current answer. - A lens challenge on implementation 290 (ticket #1742) found this from the contract-auditor line `LENS: A12 broken at lib/os_sdlc/cops/structural/concept_cycle/reference.rb:38`. ## Reproduce 1. Write `a.rb` with `module CycleFx; class A < B; end; end` and `b.rb` with `module CycleFx; class B; A; end; end` in one library directory. 2. Call `OsSdlc::Lint::ConceptCycleCheck::References.new(dir).resolved`. 3. Result: `[["CycleFx", "CycleFx::B"], ["CycleFx::B", "CycleFx::A"]]`. Expected: the first pair has the source `CycleFx::A`. ## Origin - Trigger: lens challenge of the contract-auditor LENS line of implementation 290 (#1742), 2026-11-12 - Improvised this session: none - Chain: the cop reports an A to B superclass edge that the index does not hold ← the index uses the lookup scope as the source of a superclass reference ← CODE (`plugins/os-sdlc/lib/os_sdlc/lint/concept_cycle_check/references.rb:149-150`) - Root candidate: none found; searched superclass, ConceptCycleCheck, References, concept cycle, lint-concept-cycles, visit_class_node, owner, source scope, 1729, 1741 - Where: plugins/os-sdlc/lib/os_sdlc/lint/concept_cycle_check/references.rb - Session: 4ee81bfb-d577-49b1-a9cf-617e4d2dae5f - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os--claude-worktrees-ticket-1743/4ee81bfb-d577-49b1-a9cf-617e4d2dae5f.jsonl VERDICT: CREATE (ticket-skeptic, 2026-11-12, full gauntlet): References gives a superclass reference the outer scope as its source, so the batch check misses a loop that the cop reports; no open ticket owns this fault.
Author
Owner

Resolution

Done: References records a superclass reference with the class as its source; the index and the cop agree. StartingCode::Evidence#inherited workaround removed.

Evidence: 362618281 merged to main 51a5613db; references_test CycleFx case; suite 5567 runs 0 failures; ConceptCallsItsCaller 7 to 9: the two new reports (dispatch/settlement.rb:10, implementation/completion_intake/unknown_dispatch_error.rb:6) are a true loop the index did not see before

Follow-ups: none: the cop now reports the UnknownDispatchError loop; it is one of the open concept-loop offenses

## Resolution **Done:** References records a superclass reference with the class as its source; the index and the cop agree. StartingCode::Evidence#inherited workaround removed. **Evidence:** 362618281 merged to main 51a5613db; references_test CycleFx case; suite 5567 runs 0 failures; ConceptCallsItsCaller 7 to 9: the two new reports (dispatch/settlement.rb:10, implementation/completion_intake/unknown_dispatch_error.rb:6) are a true loop the index did not see before **Follow-ups:** none: the cop now reports the UnknownDispatchError loop; it is one of the open concept-loop offenses <!-- os-backlog kind: resolution -->
jared closed this issue 2026-11-14 15:24:31 +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#1746
No description provided.