Skip to content

Cluster E shared scaffold: DRY the path/name disambiguation specs - #1287

Merged
mkarlesky merged 1 commit into
next_versionfrom
test/cluster-e-shared-scaffold
Sep 14, 2026
Merged

mkarlesky merged 1 commit into
next_versionfrom
test/cluster-e-shared-scaffold

Conversation

@mkarlesky

Copy link
Copy Markdown
Member

Summary

PR 2 of 5 in the system-test redesign (Stage 2 plan, following the "System Test Duplication Assessment" report's Finding 3). Pure structural refactor across the 15-file path/name disambiguation cluster — same coverage, same 44 examples, same example descriptions before and after (verified by diffing --dry-run output).

Changes

Adds three helpers to spec/support/system/spec_system_helper.rb:

  • in_project(&block) — collapses the @c.with_context { Dir.chdir(@proj_name) { ... } } triple-nesting repeated at 80+ call sites across this cluster into one call.
  • copy_fixture(fixture_relative_path, dest_dir) — collapses the FileUtils.mkdir_p + FileUtils.cp test_asset_path(...) pair repeated identically in the 11 test_asset_path-based files.
  • RSpec.shared_context "a fresh ceedling gem project", proj_prefix — collapses the verbatim before(:all)/after(:all)/@proj_name/ceedling new scaffold sequence, identical across all 15 files, into one include_context line.

Also extracts copy_duplicate_dup_pairs — a byte-for-byte identical private method that existed independently in both implicit_source_header_correspondence_disambiguation_spec.rb and test_source_file_directive_spec.rb — into one shared helper both files call.

sibling_header_collision_spec.rb and bracket_path_handling_spec.rb keep their inline C-fixture content untouched, per the plan's investigation (collapsing to shared fixtures would scatter documentation the inline content carries, or trade a runtime-generated bracket-named directory for a more fragile checked-in one) — only their outer scaffolding skeleton changes.

16 files changed, 774 insertions(+), 1180 deletions(-) — net -406 lines.

Verification

  • All 15 changed files, --dry-run: identical 44 examples, identical descriptions before/after.
  • All 15 changed files, real run: 44/44 pass, host (macOS) and the madsciencelab-plugins Docker image (Linux).
  • sibling_header_collision_spec.rb's transform was scripted (regex-based skeleton unwrap) and diffed line-by-line against the pre-transform file to confirm only re-indentation and the intended skeleton lines changed — no C-fixture content drift (squiggly heredocs are indentation-independent regardless).
  • Full-suite validation (all 16 CI matrix jobs) is CI's job per the Stage 2 plan's process — not duplicated locally.

This is PR 2 of 5; the plan calls for a go-ahead before starting PR 3 (Cluster A battery trim).

🤖 Generated with Claude Code

PR 2 of the system-test redesign (Stage 2 plan, Finding 3). Pure
structural refactor -- same coverage, same 44 examples, same example
descriptions across all 15 files (verified by diffing --dry-run output
before/after).

Adds three helpers to spec_system_helper.rb:
- in_project(&block): collapses the @c.with_context { Dir.chdir(@proj_name)
  { ... } } triple-nesting repeated at 80+ call sites across this cluster.
- copy_fixture(fixture_relative_path, dest_dir): collapses the
  FileUtils.mkdir_p + FileUtils.cp test_asset_path(...) pair repeated
  identically in the 11 test_asset_path-based files.
- RSpec.shared_context "a fresh ceedling gem project", proj_prefix:
  collapses the verbatim before(:all)/after(:all)/@proj_name/`ceedling new`
  scaffold sequence, identical across all 15 files, into one include_context
  line.

Also extracts copy_duplicate_dup_pairs -- a byte-for-byte identical private
method that existed independently in both
implicit_source_header_correspondence_disambiguation_spec.rb and
test_source_file_directive_spec.rb -- into one shared helper both files
call, matching the same pattern.

sibling_header_collision_spec.rb and bracket_path_handling_spec.rb keep
their inline C-fixture content untouched (per the investigation: collapsing
either to shared fixtures would scatter documentation the inline content
carries, or trade a runtime-generated bracket-named directory for a more
fragile checked-in one) -- only their outer scaffolding skeleton changes,
verified by diffing old/new content to confirm only re-indentation and the
intended skeleton lines moved.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mkarlesky
mkarlesky merged commit 9a58fde into next_version Sep 14, 2026
19 checks passed
@mkarlesky
mkarlesky deleted the test/cluster-e-shared-scaffold branch September 14, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant