Split TicketFixture into a value-only fixture and TicketScenario #1459

Closed
opened 2026-10-28 15:40:20 +00:00 by jared · 1 comment
Owner

Split TicketFixture into a value-only fixture and TicketScenario [capture]

Problem

TicketFixture mixes value methods with disk writes. TicketFixture.seed calls write_config and write_ticket_file, so a fixture does I/O, and 20 test files call it. A test that wants only a body must go through a class that writes files.

Approach

Required work:

  1. Strip ticket_fixture.rb to value methods complete_body(**sections), without(section), and with_required_work(item). The last method replaces the .sub in body_with_item at plugins/os-sdlc/tests/implementation/open_ticket_shape_test.rb:177 — check: absent File in plugins/os-sdlc/tests/support/ticket_fixture.rb
  2. Create plugins/os-sdlc/tests/support/ticket_scenario.rb that holds seed, write_config, and write_ticket_file (now lines 11-38 of ticket_fixture.rb) with the same keyword signature — check: present class TicketScenario in plugins/os-sdlc/tests/support/ticket_scenario.rb
  3. Change every caller found by grep -rln 'TicketFixture\.seed' plugins/os-sdlc/tests (20 files) to call TicketScenario.seed — check: absent TicketFixture.seed in plugins/os-sdlc/tests/**/*.rb

Route: fast-batch.

Acceptance criteria

  1. Given the suite before and after the split, when it runs, then it stays green with no assertion change.
  2. Given ticket_fixture.rb, when a reader opens it, then it has no File or FileUtils call.
  3. Given TicketScenario.seed(dir, tickets:, body:), when called, then it writes the same config file and ticket files as TicketFixture.seed wrote before.
  4. Given TicketFixture.with_required_work(item), when called, then it returns the complete body with its Required work item replaced by item.

Owner sketch

module TicketFixture
  def self.complete_body(**sections); end
  def self.without(section); end
  def self.with_required_work(item); end
end

class TicketScenario
  def self.seed(dir, tickets: %w[442], body: "fixture ticket body"); end
end

Non-goals

  • Do not replace hand-built bodies in other tests. Ticket 4 does that.

Origin

  • Trigger: fixture survey re-verified 2026-10-28 for #1019
  • Improvised this session: none
  • Chain: hand-built test records ← no fixture convention and no delivery to the test-writer ← DESIGN (#1019 memo comment 2026-10-28)
  • Root candidate: none found; searched per skeptic (see VERDICT)
  • Where: plugins/os-sdlc/tests/support/ticket_fixture.rb
  • Session: 2dd497e0-555e-4518-9cdd-c68461c32463
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/2dd497e0-555e-4518-9cdd-c68461c32463.jsonl

VERDICT: CREATE

Parent: #1019
Depends on: #1458

# Split TicketFixture into a value-only fixture and TicketScenario [capture] ## Problem `TicketFixture` mixes value methods with disk writes. `TicketFixture.seed` calls `write_config` and `write_ticket_file`, so a fixture does I/O, and 20 test files call it. A test that wants only a body must go through a class that writes files. ## Approach Required work: 1. Strip `ticket_fixture.rb` to value methods `complete_body(**sections)`, `without(section)`, and `with_required_work(item)`. The last method replaces the `.sub` in `body_with_item` at `plugins/os-sdlc/tests/implementation/open_ticket_shape_test.rb:177` — check: absent `File` in `plugins/os-sdlc/tests/support/ticket_fixture.rb` 2. Create `plugins/os-sdlc/tests/support/ticket_scenario.rb` that holds `seed`, `write_config`, and `write_ticket_file` (now lines 11-38 of `ticket_fixture.rb`) with the same keyword signature — check: present `class TicketScenario` in `plugins/os-sdlc/tests/support/ticket_scenario.rb` 3. Change every caller found by `grep -rln 'TicketFixture\.seed' plugins/os-sdlc/tests` (20 files) to call `TicketScenario.seed` — check: absent `TicketFixture.seed` in `plugins/os-sdlc/tests/**/*.rb` Route: fast-batch. ## Acceptance criteria 1. Given the suite before and after the split, when it runs, then it stays green with no assertion change. 2. Given `ticket_fixture.rb`, when a reader opens it, then it has no `File` or `FileUtils` call. 3. Given `TicketScenario.seed(dir, tickets:, body:)`, when called, then it writes the same config file and ticket files as `TicketFixture.seed` wrote before. 4. Given `TicketFixture.with_required_work(item)`, when called, then it returns the complete body with its Required work item replaced by `item`. ## Owner sketch ```ruby module TicketFixture def self.complete_body(**sections); end def self.without(section); end def self.with_required_work(item); end end class TicketScenario def self.seed(dir, tickets: %w[442], body: "fixture ticket body"); end end ``` ## Non-goals - Do not replace hand-built bodies in other tests. Ticket 4 does that. ## Origin - Trigger: fixture survey re-verified 2026-10-28 for #1019 - Improvised this session: none - Chain: hand-built test records ← no fixture convention and no delivery to the test-writer ← DESIGN (#1019 memo comment 2026-10-28) - Root candidate: none found; searched per skeptic (see VERDICT) - Where: plugins/os-sdlc/tests/support/ticket_fixture.rb - Session: 2dd497e0-555e-4518-9cdd-c68461c32463 - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/2dd497e0-555e-4518-9cdd-c68461c32463.jsonl VERDICT: CREATE Parent: #1019 Depends on: #1458
Author
Owner

Resolution

Done: TicketFixture is a value-only module (complete, with_required_work, with_section, without; constants private, no File/FileUtils). TicketScenario owns seed/write_config/write_ticket_file byte-for-byte. 20 seed callers changed receiver only; 2 body: args use TicketFixture.complete. New tests/support_ticket_fixture_test.rb.

Evidence: fast-batch-21 commits de84efd9 + fix-list b06e78ce/5fe189df, merged to main 70ecc103; grep -c File ticket_fixture.rb = 0; full suite 2903 runs 0 failures; memo docs/crc/os-sdlc/fast-batch-21/finding-b-ticket-fixture-split.md; review ruling R2 removed the unused without("Required work") branch

Follow-ups: none

## Resolution **Done:** TicketFixture is a value-only module (complete, with_required_work, with_section, without; constants private, no File/FileUtils). TicketScenario owns seed/write_config/write_ticket_file byte-for-byte. 20 seed callers changed receiver only; 2 body: args use TicketFixture.complete. New tests/support_ticket_fixture_test.rb. **Evidence:** fast-batch-21 commits de84efd9 + fix-list b06e78ce/5fe189df, merged to main 70ecc103; grep -c File ticket_fixture.rb = 0; full suite 2903 runs 0 failures; memo docs/crc/os-sdlc/fast-batch-21/finding-b-ticket-fixture-split.md; review ruling R2 removed the unused without("Required work") branch **Follow-ups:** none
jared closed this issue 2026-10-28 16:46:19 +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#1459
No description provided.