Skip to content

[TST-E3] test: the materialization matrix compiles three source sets instead of eight - #439

Merged
Blind-Striker merged 1 commit into
masterfrom
test/tst-e3a-matrix
Oct 17, 2026
Merged

Blind-Striker merged 1 commit into
masterfrom
test/tst-e3a-matrix

Conversation

@Blind-Striker

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

Copy link
Copy Markdown
Collaborator

📝 Description

What does this PR do?
It is the last PR of TST-E3's first half, the Tools.Tests safety net ahead of GEN-E3's binding refactor. ModelMaterializationMatrixTests now compiles three generated-source sets instead of eight.

Each scenario used to build, bind and compile its own document. Now each group builds one combined ingested document, selection and curation, and binds it once. Every test in the group requests that identical plan, so the existing GeneratedSourceCompiler cache shares one compilation per group.

  • Group B (object and DTO shapes): OpenSettings, the nullable single-key handoff, and the named-array DataLocation list.
  • Group C (container and promotion shapes): the four container responses, the promoted inline stats and handoff, the nullable Data, and the promoted DataLocation list item.
  • Group A (the nullability matrix) is unchanged.

Tests select operations by id, never .Single() over the whole plan.

Two synthetic identities change, for the test assembly only:

  • The container list's colliding operation becomes widget.containerList. Its path /api/widget/list and its GetWidgetListAsync name row are kept.
  • The nullable Data operation becomes widget.nullable at /api/widget/nullable. Two group-C scenarios both declared GET /api/widget, and a combined document keeps one operation per path and method, so one would have overwritten the other.

No test asserts either path. A facet audit shows every asserted facet unchanged: model and type names, nullability, status arms, the client method names the runtime tests invoke, and payloads.

All 10 test names, runtime payloads, helper assertions and all 134 Assert.That sites are unchanged, and every compilation keeps its [ParallelLimiter<RoslynCompilationSlots>]. The file goes from 975 to 925 lines. The compiler, SchemaPresets, PinnedBinding, BindingTestHost, BindingScenarioData, SpecScenario and the files GEN-E3 is editing are unchanged.

The tests clone ratchet keeps a minimum headroom (new rule). The old rule set the ceiling to the measurement rounded up to the next 0.5%. At this PR's 5.48%, that would have dropped the ceiling to 5.5%, leaving 0.02 percentage points of headroom. Every test PR that followed would have gone into a refactor round, whatever its size.

quality-gates.md now reads: the ceiling is the measurement plus 0.25 points, rounded up to the next 0.5%, and it only ever falls. Here that gives 5.48 + 0.25 = 5.73, which rounds up to 6%, so the ceiling stays at 6%, and the headroom is 0.52 points. The maintainer delegated this decision to the lead on 2026-10-17. The rule change and its first application land together in this PR. #409 tracks enforcing the ratchet mechanically, and is updated to the new formula.

🔄 Type of Change

  • 🧪 Test improvements
  • 🔧 Build, CI, or tooling
  • 📚 Documentation update

🎯 Protocol & API Surface

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

🧪 Testing

Compilation count. Each group's content keys were measured with temporary test-side diagnostics in the implementer's worktree, then removed:

  • distinct source sets went 8 → 6 (group B) → 3 (group C);
  • each combined group has one content hash and one loaded assembly across all its calls.

Clone baseline. Four entries are removed and none added. Combining group B first created two clones between it and group C's still-separate operation arms. Combining group C then removed them.

How it was built.

  • The first group-C attempt stopped before editing, because the plan said all paths were distinct and two were not.
  • The new path for nullable Data is a recorded plan amendment, with the facet audit as its condition.
  • The dispatch harness ran the RepositoryGates guards, verify-clones and the whole Tools.Tests project under [(Category!=Packaging)&(Category!=NativeAot)] on each worker's committed tree. All exited 0.

Review. A fresh read-only review found no defects, out-of-scope changes or notes. It checked all 134 ordered assertions, all nine limiters and every reflection target. It expanded all eleven operation declarations and confirmed only the two authorized identity changes and the route amendment. It confirmed that no asserted facet changes, and that runtime reflection invokes the adapters' Adapt, not client methods. It also confirmed that group B's zero-PayloadEntries oracle is still meaningful. It reviewed the earlier 5.5% version; the final head reverts the ceiling values to 6% and changes only the canon sentence, as above.

✅ Completion Gate

Local check (quality-gates.md) on head ca6fb8e0 (the 5.5% version), base 68d8afaf. 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 (tests 5.48%)
  • OpenCode.Sdk.Tools.Tests (all but NativeAot): 2005, 0 failed
  • OpenCode.Sdk.Tests (all but ServiceElection/NativeAot): 8390, 0 failed

The final head 0d260152 restores the ceiling to 6% in CloneScopes.cs and the two test expectations, which now match master, and changes only the quality-gates.md ratchet sentence. On it:

  • Tools.Tests builds with 0 warnings;
  • CloneDetectorTests, VerifyClonesCommandTests and CommentResidueScanTests pass, 56 with 0 failed;
  • verify-clones passes, 0 new, at 5.48% under 6%.

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

…f eight

TST-E3 first half, PRs 4 and 5 together. ModelMaterializationMatrixTests binds its object/DTO scenarios (group B) and its container/promotion scenarios (group C) as one combined document each, so each group's tests request one identical plan and the compiler cache shares one compilation: 8 distinct compilations become 3. Two synthetic operations get collision-free identities (widget.containerList; widget.nullable at /api/widget/nullable); every asserted facet, test name and assertion is unchanged. The tests clone ratchet keeps a minimum headroom: the ceiling is the measurement plus 0.25 points, rounded up to the next 0.5%; at 5.48% it stays 6%.
@Blind-Striker
Blind-Striker added this pull request to the merge queue Oct 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 17, 2026
@Blind-Striker
Blind-Striker added this pull request to the merge queue Oct 17, 2026
Merged via the queue into master with commit 3b23543 Oct 17, 2026
12 checks passed
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