Dissolve Gate::Violations into StepOutcome#gate_type and the ViolationRecorder parser table so the Violations ledger keeps its name #788

Closed
opened 2026-09-28 01:17:52 +00:00 by jared · 3 comments
Owner

Problem

Two unrelated constants in plugins/os-sdlc share the name Violations.
model/violations.rb is the Sequel-backed mining ledger.
parser/gate/violations.rb is Gate::Violations, moved there in #787.
Inside command/gate/run.rb and command/gate/violation_recorder.rb the bare name resolves to the parser, so both files write OsSdlc::Violations to reach the ledger.
Gate::Violations parses nothing.
It decides lint or test from the step name, then hands the output to Gate::LintViolations or Gate::TestViolations.
Two of its three callers only ask whether the step was a lint step.
Every caller takes a Gate::StepOutcome apart to call it.

Reproduce

n/a: naming defect visible in the two qualified references.

Approach

Dissolve Gate::Violations.
The step-kind decision moves onto Gate::StepOutcome, the model that already holds step and output (lens A11).
The parser table moves into Gate::ViolationRecorder, the only consumer of parsed rows.
The ledger keeps its name.

Required work:

  1. Add LINT_STEPS, TEST_STEPS, #gate_type and #lint? to Gate::StepOutcome (model/gate/step_outcome.rb) — check: ruby -e 'require "./lib/os_sdlc"; p OsSdlc::Gate::StepOutcome.new(step: "lint", exit_status: 1, output: "", duration_ms: 0).lint?' prints true
  2. Move PARSERS into Gate::ViolationRecorder; record_round calls PARSERS.fetch(outcome.gate_type).parse(outcome.output); resolve_open uses outcome.gate_type — check: grep -rn "Gate::Violations\b" lib tests returns nothing
  3. presenter/gate/reply.rb uses outcome.lint?; query/brief/facts.rb and the three tests reading Gate::Violations::LINT_STEPS read Gate::StepOutcome::LINT_STEPS — check: same grep
  4. Delete parser/gate/violations.rb; drop the OsSdlc:: prefix from the three Violations references in command/gate/run.rb and command/gate/violation_recorder.rb — check: grep -rn "OsSdlc::Violations" lib returns nothing
  5. Suite green — check: cd plugins/os-sdlc && ruby tests/all.rb

Rejected: renaming the ledger to ViolationLedger (the model is the persisted object and keeps the object's name); renaming the parser (it is not a parser).

Acceptance criteria

  1. Given plugins/os-sdlc/lib, when grepped for OsSdlc::Violations or Gate::Violations, then there are zero hits.
  2. Given a StepOutcome with step "lint" or "test-lint", when lint? is called, then it returns true; for "test", "diff-test", "suite" it returns false.
  3. Given the suite, when run, then it passes with zero failures and Zeitwerk eager load prints nothing.

Owner sketch

StepOutcome = Data.define(:step, :exit_status, :output, :duration_ms) do
  LINT_STEPS = %w[lint test-lint].freeze
  TEST_STEPS = %w[test diff-test suite].freeze
  def gate_type = LINT_STEPS.include?(step) ? "lint" : (TEST_STEPS.include?(step) ? "test" : nil)
  def lint? = gate_type == "lint"
end

Non-goals

Removing the dead nil guard in ViolationRecorder#resolve_open. Changing what ViolationRecorder records.

Origin

  • Trigger: #787 move of GateViolations to Gate::Violations; two references had to be qualified as OsSdlc::Violations
  • Improvised this session: the two qualified references
  • Chain: qualified name <- name collision between ledger and a step-kind lookup mis-filed as a parser <- DESIGN (docs/crc/os-sdlc/roles-pipeline-tests.md move map)
  • Root candidate: this ticket
  • Where: plugins/os-sdlc/lib/os_sdlc/parser/gate/violations.rb, model/gate/step_outcome.rb, command/gate/violation_recorder.rb
  • Session: bb36e383-017d-486e-809f-7ce25d151e61 (rewrite); e64808e4-7c0b-4664-9d13-177acbbc143c (original)
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os--claude-worktrees-crc-pass-os-sdlc/bb36e383-017d-486e-809f-7ce25d151e61.jsonl
## Problem Two unrelated constants in plugins/os-sdlc share the name Violations. model/violations.rb is the Sequel-backed mining ledger. parser/gate/violations.rb is Gate::Violations, moved there in #787. Inside command/gate/run.rb and command/gate/violation_recorder.rb the bare name resolves to the parser, so both files write OsSdlc::Violations to reach the ledger. Gate::Violations parses nothing. It decides lint or test from the step name, then hands the output to Gate::LintViolations or Gate::TestViolations. Two of its three callers only ask whether the step was a lint step. Every caller takes a Gate::StepOutcome apart to call it. ## Reproduce n/a: naming defect visible in the two qualified references. ## Approach Dissolve Gate::Violations. The step-kind decision moves onto Gate::StepOutcome, the model that already holds step and output (lens A11). The parser table moves into Gate::ViolationRecorder, the only consumer of parsed rows. The ledger keeps its name. Required work: 1. Add LINT_STEPS, TEST_STEPS, #gate_type and #lint? to Gate::StepOutcome (model/gate/step_outcome.rb) — check: `ruby -e 'require "./lib/os_sdlc"; p OsSdlc::Gate::StepOutcome.new(step: "lint", exit_status: 1, output: "", duration_ms: 0).lint?'` prints true 2. Move PARSERS into Gate::ViolationRecorder; record_round calls PARSERS.fetch(outcome.gate_type).parse(outcome.output); resolve_open uses outcome.gate_type — check: `grep -rn "Gate::Violations\b" lib tests` returns nothing 3. presenter/gate/reply.rb uses outcome.lint?; query/brief/facts.rb and the three tests reading Gate::Violations::LINT_STEPS read Gate::StepOutcome::LINT_STEPS — check: same grep 4. Delete parser/gate/violations.rb; drop the OsSdlc:: prefix from the three Violations references in command/gate/run.rb and command/gate/violation_recorder.rb — check: `grep -rn "OsSdlc::Violations" lib` returns nothing 5. Suite green — check: `cd plugins/os-sdlc && ruby tests/all.rb` Rejected: renaming the ledger to ViolationLedger (the model is the persisted object and keeps the object's name); renaming the parser (it is not a parser). ## Acceptance criteria 1. Given plugins/os-sdlc/lib, when grepped for OsSdlc::Violations or Gate::Violations, then there are zero hits. 2. Given a StepOutcome with step "lint" or "test-lint", when lint? is called, then it returns true; for "test", "diff-test", "suite" it returns false. 3. Given the suite, when run, then it passes with zero failures and Zeitwerk eager load prints nothing. ## Owner sketch StepOutcome = Data.define(:step, :exit_status, :output, :duration_ms) do LINT_STEPS = %w[lint test-lint].freeze TEST_STEPS = %w[test diff-test suite].freeze def gate_type = LINT_STEPS.include?(step) ? "lint" : (TEST_STEPS.include?(step) ? "test" : nil) def lint? = gate_type == "lint" end ## Non-goals Removing the dead nil guard in ViolationRecorder#resolve_open. Changing what ViolationRecorder records. ## Origin - Trigger: #787 move of GateViolations to Gate::Violations; two references had to be qualified as OsSdlc::Violations - Improvised this session: the two qualified references - Chain: qualified name <- name collision between ledger and a step-kind lookup mis-filed as a parser <- DESIGN (docs/crc/os-sdlc/roles-pipeline-tests.md move map) - Root candidate: this ticket - Where: plugins/os-sdlc/lib/os_sdlc/parser/gate/violations.rb, model/gate/step_outcome.rb, command/gate/violation_recorder.rb - Session: bb36e383-017d-486e-809f-7ce25d151e61 (rewrite); e64808e4-7c0b-4664-9d13-177acbbc143c (original) - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os--claude-worktrees-crc-pass-os-sdlc/bb36e383-017d-486e-809f-7ce25d151e61.jsonl
jared changed title from Rename the mining ledger model OsSdlc::Violations so it does not shadow Gate::Violations to Dissolve Gate::Violations into StepOutcome#gate_type and the ViolationRecorder parser table so the Violations ledger keeps its name 2026-09-28 13:44:17 +00:00
Author
Owner

Rewritten 2026-09-28 after review: the ledger keeps the name Violations; Gate::Violations is dissolved into StepOutcome#gate_type and the recorder's parser table. Implementation in progress on branch crc-pass-os-sdlc.

Rewritten 2026-09-28 after review: the ledger keeps the name Violations; Gate::Violations is dissolved into StepOutcome#gate_type and the recorder's parser table. Implementation in progress on branch crc-pass-os-sdlc.
Author
Owner

Commit: 1ff8bb70 refactor(os-sdlc): StepOutcome owns the step kind; ViolationRecorder owns the parser table (#788)
Final suite: 1306 runs, 2862 assertions, 0 failures, 0 errors, 10 skips
Final inward-lint: exit 0 (61 pre-existing baseline entries, unrelated to this ticket)

Commit: 1ff8bb70 refactor(os-sdlc): StepOutcome owns the step kind; ViolationRecorder owns the parser table (#788) Final suite: 1306 runs, 2862 assertions, 0 failures, 0 errors, 10 skips Final inward-lint: exit 0 (61 pre-existing baseline entries, unrelated to this ticket)
Author
Owner

Resolution

Done: Gate::Violations dissolved: StepOutcome#gate_type and #lint? own the step kind; ViolationRecorder::PARSERS owns the parser table; the Violations ledger keeps its name and the OsSdlc:: qualifications are gone.

Evidence: commit 1ff8bb70 on crc-pass-os-sdlc; suite 1306 runs, 0 failures; Zeitwerk eager load clean; lint-inward-dependencies exit 0; grep for Gate::Violations and OsSdlc::Violations in lib and tests returns nothing

Follow-ups: none

## Resolution **Done:** Gate::Violations dissolved: StepOutcome#gate_type and #lint? own the step kind; ViolationRecorder::PARSERS owns the parser table; the Violations ledger keeps its name and the OsSdlc:: qualifications are gone. **Evidence:** commit 1ff8bb70 on crc-pass-os-sdlc; suite 1306 runs, 0 failures; Zeitwerk eager load clean; lint-inward-dependencies exit 0; grep for Gate::Violations and OsSdlc::Violations in lib and tests returns nothing **Follow-ups:** none
jared closed this issue 2026-09-28 13:51: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#788
No description provided.