PrecedenceInEdge: entry role must not cover a class inside an entry script (false hit) #1512

Closed
opened 2026-11-02 22:13:23 +00:00 by jared · 2 comments
Owner

Problem

Sdlc/Structural/PrecedenceInEdge reports a false hit at plugins/os-context/audit/bin/extract:74. The line input["file_path"] || input["path"] is in ToolCall, a pure value class inside an entry script. It translates one record's schema. It does not choose between two sources. The cop gives the entry role to the whole file, so the role reaches into the class.

Reproduce

cd plugins/os-sdlc && bundle exec rubocop --config .rubocop.yml --only Sdlc/Structural/PrecedenceInEdge ../os-context/audit/bin/extract

Approach

In an entry file, a site inside a class or module body takes the role of that body: adapter when the body holds an effect call, otherwise no edge role. Only a site outside every class or module takes the entry role. Tighten by value; no exclude list.

Required work:

  1. Scope the entry role to code outside class and module bodies in EdgeScope — check: present EdgeScope in plugins/os-sdlc/lib/os_sdlc/cops/structural/edge_scope.rb

Acceptance criteria

  1. Given an entry script (path bin/tool) that defines a class with no effect call whose method returns input["file_path"] || input["path"], when the cop runs, then it reports no offense.
  2. Given an entry script with no class whose top-level code returns a stored value or falls back to a value built from a resource read, when the cop runs, then it reports one offense.
  3. Given an entry script whose class calls File.read and returns ENV["X"] or else a file found with File.exist?, when the cop runs, then it reports one offense.

Owner sketch

class RuboCop::Cop::Sdlc::Structural::EdgeScope
  def edge?(node)
end

Origin

  • Trigger: whole-tree run of PrecedenceInEdge for #1509 (orchestrator work), 2026-11-02
  • Improvised this session: none
  • Chain: false hit at extract:74 ← entry role covers the whole file ← DESIGN plugins/os-sdlc/lib/os_sdlc/cops/structural/edge_scope.rb
  • Root candidate: #1509 (parent; the false hit blocks its zero-false-hit criterion)
  • Where: plugins/os-sdlc/lib/os_sdlc/cops/structural/edge_scope.rb
  • Session: 394c0068-e8aa-449e-95d1-dad679bda47d
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/394c0068-e8aa-449e-95d1-dad679bda47d.jsonl

VERDICT: CREATE — false hit from the lesson's escape path; part of #1509's zero-false-hit criterion, which the user asked to implement.

## Problem `Sdlc/Structural/PrecedenceInEdge` reports a false hit at `plugins/os-context/audit/bin/extract:74`. The line `input["file_path"] || input["path"]` is in `ToolCall`, a pure value class inside an entry script. It translates one record's schema. It does not choose between two sources. The cop gives the entry role to the whole file, so the role reaches into the class. ## Reproduce ``` cd plugins/os-sdlc && bundle exec rubocop --config .rubocop.yml --only Sdlc/Structural/PrecedenceInEdge ../os-context/audit/bin/extract ``` ## Approach In an entry file, a site inside a `class` or `module` body takes the role of that body: adapter when the body holds an effect call, otherwise no edge role. Only a site outside every class or module takes the entry role. Tighten by value; no exclude list. Required work: 1. Scope the entry role to code outside class and module bodies in `EdgeScope` — check: present `EdgeScope` in `plugins/os-sdlc/lib/os_sdlc/cops/structural/edge_scope.rb` ## Acceptance criteria 1. Given an entry script (path `bin/tool`) that defines a class with no effect call whose method returns `input["file_path"] || input["path"]`, when the cop runs, then it reports no offense. 2. Given an entry script with no class whose top-level code returns a stored value or falls back to a value built from a resource read, when the cop runs, then it reports one offense. 3. Given an entry script whose class calls `File.read` and returns `ENV["X"]` or else a file found with `File.exist?`, when the cop runs, then it reports one offense. ## Owner sketch ```ruby class RuboCop::Cop::Sdlc::Structural::EdgeScope def edge?(node) end ``` ## Origin - Trigger: whole-tree run of PrecedenceInEdge for #1509 (orchestrator work), 2026-11-02 - Improvised this session: none - Chain: false hit at extract:74 ← entry role covers the whole file ← DESIGN plugins/os-sdlc/lib/os_sdlc/cops/structural/edge_scope.rb - Root candidate: #1509 (parent; the false hit blocks its zero-false-hit criterion) - Where: plugins/os-sdlc/lib/os_sdlc/cops/structural/edge_scope.rb - Session: 394c0068-e8aa-449e-95d1-dad679bda47d - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/394c0068-e8aa-449e-95d1-dad679bda47d.jsonl VERDICT: CREATE — false hit from the lesson's escape path; part of #1509's zero-false-hit criterion, which the user asked to implement.
Author
Owner

Work started on branch ticket-1509 (same worktree as #1509, which this false hit blocks) through /os-sdlc:implement.

Work started on branch ticket-1509 (same worktree as #1509, which this false hit blocks) through /os-sdlc:implement.
Author
Owner

Resolution

Done: EdgeScope gives the entry role only to code outside class and module bodies; a class inside an entry script takes its own role. Commit on branch ticket-1509 (implementation 218).

Evidence: Pipeline implementation 218 complete: 12 dispatches, suite gate pass, contract-auditor pass. Whole-tree rerun of Sdlc/Structural/PrecedenceInEdge over plugins/: plugins/os-context/audit/bin/extract:74 no longer reported; 10 hits, all previously classified TRUE.

Follow-ups: none

## Resolution **Done:** EdgeScope gives the entry role only to code outside class and module bodies; a class inside an entry script takes its own role. Commit on branch ticket-1509 (implementation 218). **Evidence:** Pipeline implementation 218 complete: 12 dispatches, suite gate pass, contract-auditor pass. Whole-tree rerun of Sdlc/Structural/PrecedenceInEdge over plugins/: plugins/os-context/audit/bin/extract:74 no longer reported; 10 hits, all previously classified TRUE. **Follow-ups:** none
jared closed this issue 2026-11-02 22:25:30 +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#1512
No description provided.