Skip to content

[TST-E7] test: Tools test helpers, fixtures and mirrored tests live in the slice that uses them - #406

Merged
Blind-Striker merged 2 commits into
masterfrom
test/tst-e7-3b-tools-slices
Oct 17, 2026
Merged

Blind-Striker merged 2 commits into
masterfrom
test/tst-e7-3b-tools-slices

Conversation

@Blind-Striker

@Blind-Striker Blind-Striker commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

📝 Description

What does this PR do?
It applies the slice-home rule to OpenCode.Sdk.Tools.Tests, the second half of #402. Helpers and embedded fixtures move into the slice whose code uses them, and the mirror-misplaced tests move to their subject's path. It is moves only: no test body, assertion or helper behaviour changes.

  • 77 moves: 40 fixture assets and 37 C# files.
    • Helpers: each was classified at base 78d47a16 by its code consumers only. A helper stays in the root Support/ when more than one slice uses it.
    • Tests: the 14 tests mirror.txt listed move to their subject's path with Internal dropped, so mirror.txt goes from 14 rows to 0.
    • Self-tests: the four Support/Tests self-tests sit beside their subjects.
  • Fixture identity is preserved. Every moved EmbeddedResource keeps its old LogicalName (OpenCode.Sdk.Tools.Tests.Fixtures.<old path with dots>) and is included exactly once. Copied None inputs (spec, profile, curation, SDK source) do not move.
  • Forced edits only:
    • namespaces and using directives;
    • 27 OwnershipPlanData.Models(...) qualifications against the new Binding.Models namespace;
    • the repository-gate site lists (mirror.txt, collapsed-assertions.txt, file-size.txt);
    • the .csproj resource items;
    • the testing-style.md §1 slice sentence, which now covers SDK.Tests and Tools.Tests and names Tools' one deliberate root hold: the Roslyn compiler helpers, GeneratedSourceCompiler and its closure.
  • Plan corrections, each decided by the code-consumer rule:
    • ModelPlacementFixture stays in the root Support/: its extension methods already had consumers in several slices.
    • RefreshScenarioData stays in the root Support/: a newer Commands consumer uses it.
    • TestRosterScenario and TrxContent move with the roster test to Commands/Support/. Their only code consumer is Commands/VerifyTestRosterCommandTests.cs, which this PR moves there; the plan had left them in TestRoster/Support/.

Part of TST-E7 (step 3b). Related: #403 records a cross-slice helper that predates this PR and is outside its inventory (Generator/Refresh/Support/RefreshScenario, also used by Commands).

🔄 Type of Change

  • 🧪 Test improvements

🎯 Protocol & API Surface

  • No change to the public API surface
  • Nothing under external/, spec/ or src/ was touched

🧪 Testing

Clone baseline. The second commit carries only this PR's own tests-baseline delta: 23 using-header fingerprints added and 17 removed, re-paired because the moved files' using blocks now pair differently. There are no count changes, and no method-body pair is baselined.

The delta was derived from empty-set regenerations (quality-gates.md), because --update-baseline merges into the existing file:

Rebase. This branch was rebased onto #402's merge. The testing-style.md §1 conflict was merged hunk by hunk. Consumers of the moved helpers were re-checked on the new base: #398 and #404 added two Tools consumers (EmitterPlanFixture, EmitterSnapshot), both in their helper's own Generator/Emission slice, so no home changed.

Review. A fresh read-only review re-checked:

  • helper ownership by code consumers, including Generator's GEN-E2 and GEN-E8 additions;
  • the mirror moves and MirrorGuard;
  • every moved resource's LogicalName;
  • the baseline delta.

It raised two defects. The roster helpers are moved in this head. The §1 sentence's overclaim is fixed: the compiler-closure exception is named, and the pre-existing RefreshScenario case is #403.

✅ Completion Gate

Local check (quality-gates.md) on head 7c8753b8, base 78d47a16. Every step's own exit code was read:

  • slopwatch: zero findings
  • dotnet build --configuration Release: 0 warnings, 0 errors
  • dotnet format whitespace / dotnet format style --severity warn: no changes
  • verify-clones: passed, 0 new
  • OpenCode.Sdk.Tools.Tests (all but NativeAot): 1794, 0 failed
  • OpenCode.Sdk.Tests (all but ServiceElection/NativeAot): 8203, 0 failed. Its first attempt stopped at discovery because this worktree's pinned server was not yet installed; after bun install in external/opencode, it ran without a rebuild.

The run shared the host with a dispatched worker's read-only phase; no step needed a re-run because of it.

The host runs Bun 1.4.3, a maintainer-named off-pin host (OPENCODE_SDK_TESTS_BUN_MISMATCH=allow); the pin is 1.4.2.

✅ Code Quality Checklist

  • No new suppression
  • No tests skipped, weakened, or deleted to make the suite pass

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

The moved Tools helpers' consumers import their slice's Support namespace, so 23 using-header pairs re-pair and 17 old ones go. Each is a header clone; the ignore-using change removes them.
@Blind-Striker
Blind-Striker added this pull request to the merge queue Oct 16, 2026
Merged via the queue into master with commit b9050aa Oct 17, 2026
12 checks passed
@Blind-Striker

Copy link
Copy Markdown
Collaborator Author

Correction to this PR's description: it says the baseline delta was derived from empty-set regenerations "because --update-baseline merges into the existing file". That reason is wrong. A direct probe shows --update-baseline rewrites each baseline to the current clones and drops entries no clone matches, as quality-gates.md says. The delta itself is correct: an empty-set regeneration yields the same live set.

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