Move BriefComposer construction to one owner instead of two pipeline copies #660

Closed
opened 2026-09-24 01:15:17 +00:00 by jared · 2 comments
Owner

Problem

lib/os_sdlc/pipeline/brief_lookup.rb:47 and lib/os_sdlc/pipeline/start_subagent.rb:41 contain byte-identical code for the composer method. Both classes know how to derive map_dir from an implementation and build a BriefComposer. That knowledge is duplicated. flay reports IDENTICAL, mass*2 = 64.

Reproduce

n/a: refactor ticket, no runtime defect

Approach

Add a class method BriefComposer.for(implementation, node:, handoff:, facts:) in lib/os_sdlc/pipeline/brief_composer.rb that derives map_dir itself. Both callers delegate to it and drop their private composer method.

Required work:

  1. add BriefComposer.for
  2. BriefLookup and StartSubagent call it
  3. delete both composer methods
  4. existing tests green

Acceptance criteria

  1. flay no longer lists the pair
  2. tests/pipeline green
  3. rubocop clean on touched files

Owner sketch

OsSdlc::Pipeline::BriefComposer.for in lib/os_sdlc/pipeline/brief_composer.rb owns the derivation of map_dir from an implementation.

def self.for(implementation, node:, handoff:, facts:)
  new(node: node, handoff: handoff, facts: facts, map_dir: File.dirname(implementation.map_path))
end

BriefLookup and StartSubagent call BriefComposer.for(implementation, node: node, handoff: handoff, facts: facts) and delete their private composer methods.

Origin

Session: 24f1de09-c081-4958-902b-0512a5d86e04
Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/24f1de09-c081-4958-902b-0512a5d86e04.jsonl
Where: lib/os_sdlc/pipeline/
Source: flay duplication sweep (bin/dup-sweep) run 2026-09-23 on plugins/os-sdlc; lib+bin score 726.

## Problem lib/os_sdlc/pipeline/brief_lookup.rb:47 and lib/os_sdlc/pipeline/start_subagent.rb:41 contain byte-identical code for the composer method. Both classes know how to derive map_dir from an implementation and build a BriefComposer. That knowledge is duplicated. flay reports IDENTICAL, mass*2 = 64. ## Reproduce n/a: refactor ticket, no runtime defect ## Approach Add a class method `BriefComposer.for(implementation, node:, handoff:, facts:)` in lib/os_sdlc/pipeline/brief_composer.rb that derives map_dir itself. Both callers delegate to it and drop their private composer method. Required work: 1. add BriefComposer.for 2. BriefLookup and StartSubagent call it 3. delete both composer methods 4. existing tests green ## Acceptance criteria 1. flay no longer lists the pair 2. tests/pipeline green 3. rubocop clean on touched files ## Owner sketch `OsSdlc::Pipeline::BriefComposer.for` in `lib/os_sdlc/pipeline/brief_composer.rb` owns the derivation of `map_dir` from an implementation. ```ruby def self.for(implementation, node:, handoff:, facts:) new(node: node, handoff: handoff, facts: facts, map_dir: File.dirname(implementation.map_path)) end ``` `BriefLookup` and `StartSubagent` call `BriefComposer.for(implementation, node: node, handoff: handoff, facts: facts)` and delete their private `composer` methods. ## Origin Session: 24f1de09-c081-4958-902b-0512a5d86e04 Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/24f1de09-c081-4958-902b-0512a5d86e04.jsonl Where: lib/os_sdlc/pipeline/ Source: flay duplication sweep (bin/dup-sweep) run 2026-09-23 on plugins/os-sdlc; lib+bin score 726.
Author
Owner

Work started via /os-sdlc:implement on branch ticket-660 (session 24f1de09), coding.yaml map: behavior-preserving refactor, no red test.

Work started via /os-sdlc:implement on branch ticket-660 (session 24f1de09), coding.yaml map: behavior-preserving refactor, no red test.
Author
Owner

Resolution

Done: BriefComposer.for(implementation, node:, handoff:, facts:) derives map_dir; BriefLookup and StartSubagent delegate to it and their private composer methods are deleted.

Evidence: Pipeline impl 1 on coding.yaml: programmer gate test+lint green, reviewer pass. flay lib+bin 662 -> 598; pair no longer listed. Branch ticket-660.

Follow-ups: none

## Resolution **Done:** BriefComposer.for(implementation, node:, handoff:, facts:) derives map_dir; BriefLookup and StartSubagent delegate to it and their private composer methods are deleted. **Evidence:** Pipeline impl 1 on coding.yaml: programmer gate test+lint green, reviewer pass. flay lib+bin 662 -> 598; pair no longer listed. Branch ticket-660. **Follow-ups:** none
jared closed this issue 2026-09-24 01:41:49 +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#660
No description provided.