Collapse Implementation#fail! and #escalate! onto one private terminate! method #661

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

Problem

lib/os_sdlc/model/implementation/instance_methods.rb:33 and :38 differ by one symbol. Both methods call stamp! with the same position/reason transformation and then lifecycle.close(root). The rule "close the LSP daemon on a terminal state" (ADR-0201) is written twice. flay reports Similar, mass 46.

Reproduce

n/a: refactor ticket, no runtime defect

Approach

Add a private terminate!(column, position:, reason:, root: nil, lifecycle: Pipeline::LspDaemonLifecycle) holding the sequence. fail! and escalate! become one-line delegations that pass :failed_at or :escalated_at. Public signatures unchanged.

Required work:

  1. add private terminate!
  2. fail! and escalate! delegate
  3. tests/model/implementation_test.rb green

Acceptance criteria

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

Owner sketch

A private terminate! in lib/os_sdlc/model/implementation/instance_methods.rb owns the terminal-state sequence: stamp the column, record the reason, close the LSP daemon.

def fail!(**opts) = terminate!(:failed_at, **opts)
def escalate!(**opts) = terminate!(:escalated_at, **opts)

private

def terminate!(column, position:, reason:, root: nil, lifecycle: Pipeline::LspDaemonLifecycle)
  stamp!(column, position: Model::NodeName.parse(position).to_s, failed_reason: reason)
  lifecycle.close(root)
end

Public signatures of fail! and escalate! are unchanged.

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/model/implementation/instance_methods.rb
Source: flay duplication sweep (bin/dup-sweep) run 2026-09-23 on plugins/os-sdlc; lib+bin score 726.

## Problem lib/os_sdlc/model/implementation/instance_methods.rb:33 and :38 differ by one symbol. Both methods call stamp! with the same position/reason transformation and then lifecycle.close(root). The rule "close the LSP daemon on a terminal state" (ADR-0201) is written twice. flay reports Similar, mass 46. ## Reproduce n/a: refactor ticket, no runtime defect ## Approach Add a private `terminate!(column, position:, reason:, root: nil, lifecycle: Pipeline::LspDaemonLifecycle)` holding the sequence. fail! and escalate! become one-line delegations that pass :failed_at or :escalated_at. Public signatures unchanged. Required work: 1. add private terminate! 2. fail! and escalate! delegate 3. tests/model/implementation_test.rb green ## Acceptance criteria 1. flay no longer lists the pair 2. tests/model green 3. rubocop clean on touched file ## Owner sketch A private `terminate!` in `lib/os_sdlc/model/implementation/instance_methods.rb` owns the terminal-state sequence: stamp the column, record the reason, close the LSP daemon. ```ruby def fail!(**opts) = terminate!(:failed_at, **opts) def escalate!(**opts) = terminate!(:escalated_at, **opts) private def terminate!(column, position:, reason:, root: nil, lifecycle: Pipeline::LspDaemonLifecycle) stamp!(column, position: Model::NodeName.parse(position).to_s, failed_reason: reason) lifecycle.close(root) end ``` Public signatures of `fail!` and `escalate!` are unchanged. ## 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/model/implementation/instance_methods.rb 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-661 (session 24f1de09), coding.yaml map: behavior-preserving refactor, no red test.

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

Resolution

Done: fail! and escalate! are one-line delegations to a private terminate!(column, ...) that stamps, records the reason, and closes the LSP daemon. Public signatures unchanged.

Evidence: Pipeline impl 1 on coding.yaml: programmer gates test+lint green twice, reviewer fail then pass. flay lib+bin 598 -> 552; pair no longer listed. Branch ticket-661.

Follow-ups: none

## Resolution **Done:** fail! and escalate! are one-line delegations to a private terminate!(column, ...) that stamps, records the reason, and closes the LSP daemon. Public signatures unchanged. **Evidence:** Pipeline impl 1 on coding.yaml: programmer gates test+lint green twice, reviewer fail then pass. flay lib+bin 598 -> 552; pair no longer listed. Branch ticket-661. **Follow-ups:** none
jared closed this issue 2026-09-24 01:52:11 +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#661
No description provided.