Repository navigation
[TST-E4] test: thirteen more declared-error doors become table rows, each area's rows in its own slice - #460
Merged
Conversation
…'s rows in its own slice TST-E4a P04a. The Config, Credentials, Debug, FileWrite and Forms contract classes' declared-error door methods become rows of DeclaredErrorTests, each now proven on both the throwing and the NoThrow spine and traced to its declaration in the pinned spec. Each area's rows live in its slice (<Area>/<Area>DeclaredErrors.cs, a static Rows() of at most 80 lines), and EveryDoor() concatenates them; the pilot row moves to Worktrees/WorktreesDeclaredErrors.cs. The clone baseline drops the replaced methods' duplicates; jscpd regroups the remaining declared-error duplicates in untouched files under new fingerprints, and the totals fall.
This was referenced Oct 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
What does this PR do?
It is TST-E4a's first batch of declared-error door conversions. Thirteen methods move into the door table that #446 introduced: four in Config, four in Credentials, two in Debug, one in Experimental/FileWrite and two in Forms. Each of these methods proved only "door D answers declared status S with error type T", on one spine.
OpenCodeApiException, the exact status and the exact type. On the NoThrow spine it assertsIsError, the exact status and the exact type. Each row is also checked against its declaration in the pinnedspec/openapi.jsonby the one-way guard.Config/ConfigDeclaredErrors.cs,Credentials/…,Debug/…,Experimental/…andForms/…, each with a staticRows()of 17 to 61 lines.DeclaredErrorTests.EveryDoor()is only their concatenation, so both spines and the guard still read one row source. The pilot row moves verbatim toWorktrees/WorktreesDeclaredErrors.cs. This layout keeps the table inside analyzer MA0051's 80-line method limit and the slice layout, as the table grows to about 100 rows.Net line delta: +286 / −192 = +94 in test code. The conversions do not save lines; the six slice files add their own class scaffolding. The gains are fewer methods, coverage on both spines, and each row traced to the pin.
🔄 Type of Change
🎯 Protocol & API Surface
external/,spec/orsrc/was touched🧪 Testing
Test mapping (mechanical:
e4_test_map.pyovergit diff 7738dc33 d61b521f)tests/OpenCode.Sdk.Tests/Config/ConfigClientContractTests.csGetShellsAsync_Should_Throw_The_Declared_400_Errorconfig.shells:400:InvalidRequestErrortests/OpenCode.Sdk.Tests/Config/ConfigClientContractTests.csGetShellsAsync_Should_Return_The_401_Error_On_The_NoThrow_Spineconfig.shells:401:UnauthorizedErrortests/OpenCode.Sdk.Tests/Config/ConfigClientContractTests.csUpdateConfigAsync_Should_Throw_The_Declared_400_Errorexperimental.config.update:400:InvalidRequestErrortests/OpenCode.Sdk.Tests/Config/ConfigClientContractTests.csUpdateConfigAsync_Should_Return_The_401_Error_On_The_NoThrow_Spineexperimental.config.update:401:UnauthorizedErrortests/OpenCode.Sdk.Tests/Credentials/CredentialsClientContractTests.csCreateCredentialAsync_Should_Return_The_Declared_409_Error_On_The_NoThrow_Spinecredential.create:409:ConflictErrortests/OpenCode.Sdk.Tests/Credentials/CredentialsClientContractTests.csListCredentialsAsync_Should_Throw_The_Declared_401_Errorcredential.list:401:UnauthorizedErrortests/OpenCode.Sdk.Tests/Credentials/CredentialsClientContractTests.csActivateCredentialAsync_Should_Throw_The_Declared_400_Errorcredential.activate:400:InvalidRequestErrortests/OpenCode.Sdk.Tests/Credentials/CredentialsClientContractTests.csActivateCredentialAsync_Should_Return_The_401_Error_On_The_NoThrow_Spinecredential.activate:401:UnauthorizedErrortests/OpenCode.Sdk.Tests/Debug/DebugClientContractTests.csListLocationsAsync_Should_Throw_The_Declared_400_Errordebug.location.list:400:InvalidRequestErrortests/OpenCode.Sdk.Tests/Debug/DebugClientContractTests.csListLocationsAsync_Should_Return_The_401_Error_On_The_NoThrow_Spinedebug.location.list:401:UnauthorizedErrortests/OpenCode.Sdk.Tests/Experimental/FileWriteContractTests.csWriteFileAsync_Should_Throw_The_Declared_400_Errorexperimental.fs.write:400:InvalidRequestErrortests/OpenCode.Sdk.Tests/Forms/FormsClientContractTests.csListFormsAsync_Should_Throw_The_Declared_400_Errorform.list:400:InvalidRequestErrortests/OpenCode.Sdk.Tests/Forms/FormsClientContractTests.csListFormsAsync_Should_Return_The_401_Error_On_The_NoThrow_Spineform.list:401:UnauthorizedErrorUnmapped: 0
tests/OpenCode.Sdk.Tests/Common/Errors/DeclaredErrorTests.cstests/OpenCode.Sdk.Tests/Config/ConfigClientContractTests.cstests/OpenCode.Sdk.Tests/Config/ConfigDeclaredErrors.cstests/OpenCode.Sdk.Tests/Credentials/CredentialsClientContractTests.cstests/OpenCode.Sdk.Tests/Credentials/CredentialsDeclaredErrors.cstests/OpenCode.Sdk.Tests/Debug/DebugClientContractTests.cstests/OpenCode.Sdk.Tests/Debug/DebugDeclaredErrors.cstests/OpenCode.Sdk.Tests/Experimental/ExperimentalDeclaredErrors.cstests/OpenCode.Sdk.Tests/Experimental/FileWriteContractTests.cstests/OpenCode.Sdk.Tests/Forms/FormsClientContractTests.cstests/OpenCode.Sdk.Tests/Forms/FormsDeclaredErrors.cstests/OpenCode.Sdk.Tests/Worktrees/WorktreesDeclaredErrors.csThe negative deltas are the deleted methods' assertions. The rows assert the same status and exact type on both spines; DeclaredErrorTests' 12 assertion sites run for every row.
Equivalence mutants: one per source class (scratch only; restored byte-identically)
In each class's response adapter, the declared tags for one door's status were emptied.
src/OpenCode.Sdk/)Config/Internal/ConfigShellsResponseAdapter.cs:9GetShellsAsync_Should_Throw_The_Declared_400_Errorconfig.shells:400:InvalidRequestErrorCredentials/Internal/CredentialCreateResponseAdapter.cs:11CreateCredentialAsync_Should_Return_The_Declared_409_Error_On_The_NoThrow_Spinecredential.create:409:ConflictErrorDebug/Internal/DebugLocationListResponseAdapter.cs:9ListLocationsAsync_Should_Throw_The_Declared_400_Errordebug.location.list:400:InvalidRequestErrorExperimental/Internal/ExperimentalFsWriteResponseAdapter.cs:9WriteFileAsync_Should_Throw_The_Declared_400_Errorexperimental.fs.write:400:InvalidRequestErrorForms/Internal/FormListResponseAdapter.cs:9ListFormsAsync_Should_Throw_The_Declared_400_Errorform.list:400:InvalidRequestErrorBase: 5 failed. Finished table: 10 failed (5 rows × 2 spines). Every failure received
UnknownOpenCodeErrorat the exact-type assertion. Two row-oracle mutants are also killed: a wrong expected type turns both spines red, and a pointer into another operation turns the guard red.Clone baseline (regenerated, totals fall)
7738dc33The baseline loses 98 fingerprints and gains 64. None of the 62 duplicates jscpd reports as new involves a file this PR changes. Every one sits between files this PR does not touch, whose text is byte-identical to master. They are the not-yet-converted declared-error methods: once their Config, Credentials and other twins are deleted, jscpd reports their remaining duplicates under new pairings and new fingerprints. 22 of them map to a same-pair predecessor; the other 40 are the same unchanged fragments paired differently. They shrink as later door PRs convert those methods.
Review
spec/openapi.jsonand matched all 14nameoflabels to the call their lambda makes. It could not verify the baseline-regrouping claim from hashes alone; the jscpd analysis above is that evidence.✅ Completion Gate
Local check (
quality-gates.md) on headd61b521f, base7738dc33. Every step's own exit code was read:dotnet build --configuration Release: 0 warnings, 0 errorsdotnet format whitespace/dotnet format style --severity warn: no changesverify-clones: passed, 0 new (tests 5.12%)OpenCode.Sdk.Tools.Tests(all but NativeAot): 2081, 0 failedOpenCode.Sdk.Tests(all but ServiceElection/NativeAot): 8519, 0 failedThe 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
Need help on this PR? Tag
@codesmith-botwith what you need.