Skip to content

[TST-E4] test: fourteen more declared-error doors become table rows in five new slices - #474

Merged
Blind-Striker merged 2 commits into
masterfrom
test/tst-e4a-p05b-door-rows
Oct 18, 2026
Merged

Blind-Striker merged 2 commits into
masterfrom
test/tst-e4a-p05b-door-rows

Conversation

@Blind-Striker

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

Copy link
Copy Markdown
Collaborator

📝 Description

What does this PR do?
It is TST-E4a's P05b, the second half of P05: fourteen more declared-error door methods become rows of the door table. LanguageModels has 4, the root OpenCodeClientContractTests 2, Permissions 2, Projects 4 and Server 2. Each method proved only "door D answers declared status S with error type T" on one spine.

  • Each becomes a row that runs on both spines. On the throwing spine it asserts OpenCodeApiException, the exact status and the exact type. On the NoThrow spine it asserts IsError, the exact status and the exact type. The one-way guard checks every row against its declaration in the pinned spec/openapi.json.
  • Five new slices, one per source class's slice: LanguageModels/, Permissions/, Projects/, Server/, and a root OpenCodeClientDeclaredErrors.cs (because the area follows the source class). Their Rows() are 19 to 35 lines long. DeclaredErrorTests.EveryDoor() appends them.
  • Each distinct door is one shared field. The two deleted UpdateProjectAsync methods call it with "prj_9" (404) and "prj_1" (401), so they get two fields, UpdateProjectPrj9Door and UpdateProjectPrj1Door. No argument is normalized.
  • Every other method in the touched classes is byte-identical. Two using OpenCode.Sdk.Models; directives are removed from Permissions and Server, because nothing there uses them any more (IDE0005).
  • The clone baseline is regenerated, and the tests ceiling falls to 5%. Tests go from 571 clones (4.87%) to 551 (4.72%). Under quality-gates.md, 4.72 + 0.25 rounds up to 5%. CloneScopes, its two Tools test expectations and the canon sentence change together.

Net line delta: +242 / −177 = +65 in Sdk test code, from five slice files' boilerplate. Over the whole PR it is +260 / −215, including the baseline and the ceiling.

🔄 Type of Change

  • 🧪 Test improvements

🎯 Protocol & API Surface

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

🧪 Testing

Test mapping (mechanical: e4_test_map.py over git diff a323b4d3 8007a4f8, the worker's commit; the conversion commit here is tree-identical)

File Base test method At head Target
tests/OpenCode.Sdk.Tests/LanguageModels/LanguageModelsClientContractTests.cs GetDefaultAsync_Should_Throw_The_Declared_400_Error row model.default:400:InvalidRequestError
tests/OpenCode.Sdk.Tests/LanguageModels/LanguageModelsClientContractTests.cs GetDefaultAsync_Should_Return_The_401_Error_On_The_NoThrow_Spine row model.default:401:UnauthorizedError
tests/OpenCode.Sdk.Tests/LanguageModels/LanguageModelsClientContractTests.cs ListModelsAsync_Should_Throw_The_Declared_400_Error row model.list:400:InvalidRequestError
tests/OpenCode.Sdk.Tests/LanguageModels/LanguageModelsClientContractTests.cs ListModelsAsync_Should_Return_The_401_Error_On_The_NoThrow_Spine row model.list:401:UnauthorizedError
tests/OpenCode.Sdk.Tests/OpenCodeClientContractTests.cs GetLocationAsync_Should_Throw_The_Declared_400_Error row location.get:400:InvalidRequestError
tests/OpenCode.Sdk.Tests/OpenCodeClientContractTests.cs GetLocationAsync_Should_Return_The_401_Error_On_The_NoThrow_Spine row location.get:401:UnauthorizedError
tests/OpenCode.Sdk.Tests/Permissions/PermissionsClientContractTests.cs ListSavedAsync_Should_Throw_The_Declared_400_Error row permission.saved.list:400:InvalidRequestError
tests/OpenCode.Sdk.Tests/Permissions/PermissionsClientContractTests.cs ListSavedAsync_Should_Return_The_401_Error_On_The_NoThrow_Spine row permission.saved.list:401:UnauthorizedError
tests/OpenCode.Sdk.Tests/Projects/ProjectsClientContractTests.cs ListProjectsAsync_Should_Throw_The_Declared_400_Error row project.list:400:InvalidRequestError
tests/OpenCode.Sdk.Tests/Projects/ProjectsClientContractTests.cs ListProjectsAsync_Should_Return_The_401_Error_On_The_NoThrow_Spine row project.list:401:UnauthorizedError
tests/OpenCode.Sdk.Tests/Projects/ProjectsClientContractTests.cs UpdateProjectAsync_Should_Throw_The_Declared_404_Error row project.update:404:ProjectNotFoundError
tests/OpenCode.Sdk.Tests/Projects/ProjectsClientContractTests.cs UpdateProjectAsync_Should_Return_The_401_Error_On_The_NoThrow_Spine row project.update:401:UnauthorizedError
tests/OpenCode.Sdk.Tests/Server/ServerClientContractTests.cs GetInfoAsync_Should_Throw_The_Declared_400_Error row server.info:400:InvalidRequestError
tests/OpenCode.Sdk.Tests/Server/ServerClientContractTests.cs GetInfoAsync_Should_Return_The_401_Error_On_The_NoThrow_Spine row server.info:401:UnauthorizedError

Unmapped: 0

File Assert.That at base at head delta
tests/OpenCode.Sdk.Tests/Common/Errors/DeclaredErrorTests.cs 12 12 +0
tests/OpenCode.Sdk.Tests/LanguageModels/LanguageModelsClientContractTests.cs 28 16 -12
tests/OpenCode.Sdk.Tests/LanguageModels/LanguageModelsDeclaredErrors.cs 0 0 +0
tests/OpenCode.Sdk.Tests/OpenCodeClientContractTests.cs 80 74 -6
tests/OpenCode.Sdk.Tests/OpenCodeClientDeclaredErrors.cs 0 0 +0
tests/OpenCode.Sdk.Tests/Permissions/PermissionsClientContractTests.cs 22 16 -6
tests/OpenCode.Sdk.Tests/Permissions/PermissionsDeclaredErrors.cs 0 0 +0
tests/OpenCode.Sdk.Tests/Projects/ProjectsClientContractTests.cs 31 19 -12
tests/OpenCode.Sdk.Tests/Projects/ProjectsDeclaredErrors.cs 0 0 +0
tests/OpenCode.Sdk.Tests/Server/ServerClientContractTests.cs 9 3 -6
tests/OpenCode.Sdk.Tests/Server/ServerDeclaredErrors.cs 0 0 +0

The negative deltas are the deleted methods' assertions. The rows assert the same status and exact type on both spines.

Equivalence and row mutants (scratch only; restored from saved Git blobs; net10.0, analyzers on)

Mutant (src/OpenCode.Sdk/…) Base: old method Head: row
LanguageModels/Internal/ModelDefaultResponseAdapter.cs:9, the 400 tag replaced GetDefaultAsync_Should_Throw_The_Declared_400_Error red model.default:400:InvalidRequestError red on both spines
Location/Internal/LocationResponseAdapter.cs:9, the 400 tag replaced GetLocationAsync_Should_Throw_The_Declared_400_Error red location.get:400:InvalidRequestError red on both spines
Permissions/Internal/PermissionSavedListResponseAdapter.cs:9, the 400 tag replaced ListSavedAsync_Should_Throw_The_Declared_400_Error red permission.saved.list:400:InvalidRequestError red on both spines
Projects/Internal/ProjectUpdateResponseAdapter.cs:11, the project tag removed UpdateProjectAsync_Should_Throw_The_Declared_404_Error red project.update:404:ProjectNotFoundError red on both spines
Server/Internal/ServerInfoResponseAdapter.cs:9, the 400 tag replaced GetInfoAsync_Should_Throw_The_Declared_400_Error red server.info:400:InvalidRequestError red on both spines
Row: wrong expected CLR type on model.default:400 n/a red on both spines
Row: pointer at model.list's 400 response n/a the provenance guard red

The five adapter mutants ran in one scratch build. Each one breaks a different adapter, and each old method and each row exercises only its own adapter, so every red is still attributable. Base: 0 passed, 5 failed. Head: 10 failed, that is 5 rows × 2 spines.

Clones: 13 regrouped pairs, 0 new duplicates

Deleting the methods removes the fragment that jscpd had paired several other locations with. Those locations now pair with each other, which gives them new fingerprints for code that was already duplicated. For each of the 13 pairs below, both ends were clones, on master a323b4d, of the same fragment in a deleted LanguageModels method. None touches a file this PR changes. Master's report was taken from its own worktree. The baseline diff is +13 (these pairs) and −33 (stale).

Tokens Pair (untouched files) Shared partner on master (deleted)
50 PersistentPtysClientContractTests:168–176 ↔ PersistentPtysClientContractTests:436–443 LanguageModelsClientContractTests:48–56
50 PersistentPtysClientContractTests:168–176 ↔ SessionClientContractTests:1344–1352 LanguageModelsClientContractTests:48–56
50 PersistentPtysClientContractTests:168–176 ↔ SessionsClientContractTests:326–334 LanguageModelsClientContractTests:48–56
59 SessionClientContractTests:814–822 ↔ SessionClientContractTests:866–874 LanguageModelsClientContractTests:60–68
59 SessionClientContractTests:814–822 ↔ SessionClientContractTests:922–930 LanguageModelsClientContractTests:60–68
58 SessionClientContractTests:814–822 ↔ SessionClientContractTests:973–981 LanguageModelsClientContractTests:60–68
59 SessionClientContractTests:814–822 ↔ SessionClientContractTests:1023–1031 LanguageModelsClientContractTests:60–68
59 SessionClientContractTests:814–822 ↔ SessionsClientContractTests:338–346 LanguageModelsClientContractTests:60–68
52 SessionClientContractTests:814–819 ↔ SessionsClientContractTests:402–407 LanguageModelsClientContractTests:60–68 (60–65)
55 SessionClientContractTests:814–822 ↔ ShellClientContractTests:114–122 LanguageModelsClientContractTests:60–68
50 SessionClientContractTests:1372–1378 ↔ SessionsClientContractTests:402–408 LanguageModelsClientContractTests:113–119
51 SessionsClientContractTests:326–334 ↔ SessionsClientContractTests:390–398 LanguageModelsClientContractTests:48–56
55 SessionsClientContractTests:402–407 ↔ ShellClientContractTests:113–119 LanguageModelsClientContractTests:60–68 (60–65)

These are the not-yet-converted door methods of P06 and P07, which remove them.

Review

  • Second-family review (Sol, requirements and diff only): no findings.
    • It compared each of the 14 deleted methods with its row: SDK call, arguments, canned status and body.
    • It resolved every row against spec/openapi.json, including the /anyOf/0 branch of project.update's 404.
    • All 8 door labels match.
    • All 46 retained methods are byte-identical.
  • Coordinator read: no findings. Every deleted call matches its door's lambda, including "prj_9" and "prj_1".

Local check (Windows, on master a323b4d; external/opencode synced to the gitlink 843a6c5)

  • slopwatch: 0 issues. dotnet build -c Release: 0 warnings, 0 errors. dotnet format whitespace and style: clean.
  • Sdk.Tests [(Category!=ServiceElection)&(Category!=NativeAot)]: net10.0 2933 / 2933, net472 2938 / 2938 passed.
  • Tools.Tests [Category!=NativeAot]: 2086 / 2086 passed.
  • verify-clones: passed at the 5% ceiling. Tests: 551 clones, 4.72%, 0 new.

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

@Blind-Striker
Blind-Striker added this pull request to the merge queue Oct 18, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 18, 2026
@Blind-Striker
Blind-Striker force-pushed the test/tst-e4a-p05b-door-rows branch from eef2a35 to e223af2 Compare October 18, 2026 08:57
@Blind-Striker
Blind-Striker added this pull request to the merge queue Oct 18, 2026
Merged via the queue into master with commit 1bba824 Oct 18, 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