crc os-adr wave 5: split CliInvocationHelpers: assert_* methods leave #930

Closed
opened 2026-10-04 16:37:13 +00:00 by jared · 2 comments
Owner

Problem

Split CliInvocationHelpers: extract assert_* methods into a separate Assertions module. CliInvocationHelpers currently does two jobs: invoking CLI commands in-process (run_new, run_init) and asserting record properties (four assert_* methods). Separate data and vocabulary split this cleanly per R15 and R16.

Reproduce

n/a: structure-only refactor, no behavior change

Approach

Required work:

  1. Extract four assert methods from plugins/os-adr/tests/support/cli_invocation_helpers.rb into plugins/os-adr/tests/support/cli_invocation_assertions.rb (name per R15 *Assertions convention). Extracted methods: assert_postgres_record_fields, assert_postgres_record_indexed, assert_supersession_recorded, assert_old_record_superseded. Constant: CliInvocationAssertions.
  2. Keep invocation methods run_new, run_init, StatusResult in the original module, renamed per R15 so the name ends in Invocations (Helpers leaves the vocabulary): plugins/os-adr/tests/support/cli_invocation_invocations.rb, constant CliInvocationInvocations; the wave 2 re-run confirms the names. This module uses Invocation, StringIO, and the commands.
  3. Update plugins/os-adr/tests/cli_test.rb to include both CliInvocationInvocations and CliInvocationAssertions.

Recipe from R16:
The four methods assert_postgres_record_fields, assert_postgres_record_indexed, assert_supersession_recorded, assert_old_record_superseded leave to a new module in tests/support/ whose name ends in Assertions; StatusResult, run_new, run_init stay.

Governed by rulings: R15, R16
Rejected: none (R16 governs the split)

Acceptance criteria

  • Four assert_* methods extracted to cli_invocation_assertions.rb
  • run_new, run_init, StatusResult remain in the module renamed per R15 (*Invocations)
  • tests/cli_test.rb includes both modules in correct order
  • Separate data and vocabulary confirmed: assert methods use Record.parse and Repository; run methods use Invocation and StringIO
  • No method calls between the two modules
  • ruby plugins/os-adr/tests/all.rb passes with 0 failures
  • ruby -e 'require "./plugins/os-adr/lib/adr"; Adr.loader.eager_load' runs silently
  • All existing callers in cli_test.rb updated to include both modules as needed

Owner sketch

Familiar with Ruby and os-adr test support. Understand the two jobs: in-process command invocation (helpers) and record property assertions (assertions). Both modules are test support; one calls commands and collects results, the other inspects those results.

Non-goals

No behavior change; no new tests; no deletion of code that has callers.

Origin

Session: a20defa9-036a-415a-9dde-2ed833c727cb
Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os--claude-worktrees-crc-refactor-docs/a20defa9-036a-415a-9dde-2ed833c727cb.jsonl
Where: crc-refactor run on plugins/os-adr, worktree crc-os-adr-2026-10-04, ledger docs/crc/os-adr/ledger.tsv

## Problem Split CliInvocationHelpers: extract assert_* methods into a separate Assertions module. CliInvocationHelpers currently does two jobs: invoking CLI commands in-process (run_new, run_init) and asserting record properties (four assert_* methods). Separate data and vocabulary split this cleanly per R15 and R16. ## Reproduce n/a: structure-only refactor, no behavior change ## Approach Required work: 1. Extract four assert methods from plugins/os-adr/tests/support/cli_invocation_helpers.rb into plugins/os-adr/tests/support/cli_invocation_assertions.rb (name per R15 *Assertions convention). Extracted methods: assert_postgres_record_fields, assert_postgres_record_indexed, assert_supersession_recorded, assert_old_record_superseded. Constant: CliInvocationAssertions. 2. Keep invocation methods run_new, run_init, StatusResult in the original module, renamed per R15 so the name ends in Invocations (Helpers leaves the vocabulary): plugins/os-adr/tests/support/cli_invocation_invocations.rb, constant CliInvocationInvocations; the wave 2 re-run confirms the names. This module uses Invocation, StringIO, and the commands. 3. Update plugins/os-adr/tests/cli_test.rb to include both CliInvocationInvocations and CliInvocationAssertions. Recipe from R16: The four methods `assert_postgres_record_fields`, `assert_postgres_record_indexed`, `assert_supersession_recorded`, `assert_old_record_superseded` leave to a new module in `tests/support/` whose name ends in `Assertions`; `StatusResult`, `run_new`, `run_init` stay. Governed by rulings: R15, R16 Rejected: none (R16 governs the split) ## Acceptance criteria - Four assert_* methods extracted to cli_invocation_assertions.rb - run_new, run_init, StatusResult remain in the module renamed per R15 (*Invocations) - tests/cli_test.rb includes both modules in correct order - Separate data and vocabulary confirmed: assert methods use Record.parse and Repository; run methods use Invocation and StringIO - No method calls between the two modules - ruby plugins/os-adr/tests/all.rb passes with 0 failures - ruby -e 'require "./plugins/os-adr/lib/adr"; Adr.loader.eager_load' runs silently - All existing callers in cli_test.rb updated to include both modules as needed ## Owner sketch Familiar with Ruby and os-adr test support. Understand the two jobs: in-process command invocation (helpers) and record property assertions (assertions). Both modules are test support; one calls commands and collects results, the other inspects those results. ## Non-goals No behavior change; no new tests; no deletion of code that has callers. ## Origin Session: a20defa9-036a-415a-9dde-2ed833c727cb Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os--claude-worktrees-crc-refactor-docs/a20defa9-036a-415a-9dde-2ed833c727cb.jsonl Where: crc-refactor run on plugins/os-adr, worktree crc-os-adr-2026-10-04, ledger docs/crc/os-adr/ledger.tsv
Author
Owner

9f19810d; rows applied 1/1; rows deviated 0; rows blocked 0

9f19810d; rows applied 1/1; rows deviated 0; rows blocked 0
Author
Owner

Resolution

Done: CliInvocationHelpers split per R16: CommandInvocations and the assertions module (later RecordCreationAssertions by #933)

Evidence: 9f19810d on branch crc-os-adr-2026-10-04 (not merged; user review pending); suite: 51 runs, 168 assertions, 0 failures, 0 errors, 0 skips; eager load silent; inward lint: none (os-adr has none)

Follow-ups: none for this ticket; run-level follow-ups filed as #934 and #935; dropped items listed in docs/crc/os-adr/HANDOFF.md Review

## Resolution **Done:** CliInvocationHelpers split per R16: CommandInvocations and the assertions module (later RecordCreationAssertions by #933) **Evidence:** 9f19810d on branch crc-os-adr-2026-10-04 (not merged; user review pending); suite: 51 runs, 168 assertions, 0 failures, 0 errors, 0 skips; eager load silent; inward lint: none (os-adr has none) **Follow-ups:** none for this ticket; run-level follow-ups filed as #934 and #935; dropped items listed in docs/crc/os-adr/HANDOFF.md Review
jared closed this issue 2026-10-04 17:15:06 +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#930
No description provided.