Skip to content

[TST-E4] test: twelve more declared-error doors become table rows, each door defined once per area - #463

Merged
Blind-Striker merged 1 commit into
masterfrom
test/tst-e4a-p04b-door-rows
Oct 17, 2026
Merged

Blind-Striker merged 1 commit into
masterfrom
test/tst-e4a-p04b-door-rows

Conversation

@Blind-Striker

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

Copy link
Copy Markdown
Collaborator

📝 Description

What does this PR do?
It is TST-E4a's second batch of declared-error door conversions, and the first using one shared door per area. Twelve more methods become rows of the door table: four in FileSystem, six in Integration and two in Integrations. Each of them 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.
  • The rows live in their slices: FileSystem/FileSystemDeclaredErrors.cs and Integrations/IntegrationsDeclaredErrors.cs, which also holds the Integration rows. Their Rows() are 35 and 67 lines.
  • Each door is defined once per area, as a static readonly DeclaredErrorDoor, and every case of that door references it. A door's nameof label and its call now live in exactly one place, which shrinks the accepted mislabel risk. DeclaredErrorTests.EveryDoor() appends the two new slices. The existing slices adopt shared doors in a separate small PR.
  • Four retained Integration tests drop member names that no longer exist (D7): GetIntegrationAsync → GetAsync, PostConnectKeyAsync → ConnectWithKeyAsync, PostOAuthConnectAsync → BeginOAuthConnectionAsync. Each new name is the member the test calls, and the old names exist nowhere under src. Only the names change; the bodies don't.
  • Every other method in the touched classes is byte-identical. No product, record or test-method change.

Net line delta: +174 / −162 = +12 in test code. P04a's was +94; shared doors account for most of the difference.

🔄 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 77bb1b51 336ac386)

File Base test method At head Target
tests/OpenCode.Sdk.Tests/FileSystem/FileSystemClientContractTests.cs ListEntriesAsync_Should_Throw_The_Declared_400_Error row fs.list:400:InvalidRequestError
tests/OpenCode.Sdk.Tests/FileSystem/FileSystemClientContractTests.cs ListEntriesAsync_Should_Return_The_401_Error_On_The_NoThrow_Spine row fs.list:401:UnauthorizedError
tests/OpenCode.Sdk.Tests/FileSystem/FileSystemClientContractTests.cs FindEntriesAsync_Should_Throw_The_Declared_400_Error row fs.find:400:InvalidRequestError
tests/OpenCode.Sdk.Tests/FileSystem/FileSystemClientContractTests.cs FindEntriesAsync_Should_Return_The_401_Error_On_The_NoThrow_Spine row fs.find:401:UnauthorizedError
tests/OpenCode.Sdk.Tests/Integrations/IntegrationClientContractTests.cs GetIntegrationAsync_Should_Return_The_Typed_Integration renamed GetAsync_Should_Return_The_Typed_Integration
tests/OpenCode.Sdk.Tests/Integrations/IntegrationClientContractTests.cs GetIntegrationAsync_Should_Throw_The_Declared_404_When_The_Integration_Is_Unknown renamed GetAsync_Should_Throw_The_Declared_404_When_The_Integration_Is_Unknown
tests/OpenCode.Sdk.Tests/Integrations/IntegrationClientContractTests.cs GetIntegrationAsync_Should_Throw_The_Declared_400_Error row integration.get:400:InvalidRequestError
tests/OpenCode.Sdk.Tests/Integrations/IntegrationClientContractTests.cs GetIntegrationAsync_Should_Return_The_401_Error_On_The_NoThrow_Spine row integration.get:401:UnauthorizedError
tests/OpenCode.Sdk.Tests/Integrations/IntegrationClientContractTests.cs PostConnectKeyAsync_Should_Send_The_Typed_Body_On_The_Handle_Route renamed ConnectWithKeyAsync_Should_Send_The_Typed_Body_On_The_Handle_Route
tests/OpenCode.Sdk.Tests/Integrations/IntegrationClientContractTests.cs PostConnectKeyAsync_Should_Throw_The_Declared_400_Error row integration.connect.key:400:InvalidRequestError
tests/OpenCode.Sdk.Tests/Integrations/IntegrationClientContractTests.cs PostConnectKeyAsync_Should_Return_The_401_Error_On_The_NoThrow_Spine row integration.connect.key:401:UnauthorizedError
tests/OpenCode.Sdk.Tests/Integrations/IntegrationClientContractTests.cs PostOAuthConnectAsync_Should_Return_The_Typed_Attempt renamed BeginOAuthConnectionAsync_Should_Return_The_Typed_Attempt
tests/OpenCode.Sdk.Tests/Integrations/IntegrationClientContractTests.cs PostOAuthConnectAsync_Should_Throw_The_Declared_400_Error row integration.oauth.connect:400:InvalidRequestError
tests/OpenCode.Sdk.Tests/Integrations/IntegrationClientContractTests.cs PostOAuthConnectAsync_Should_Return_The_401_Error_On_The_NoThrow_Spine row integration.oauth.connect:401:UnauthorizedError
tests/OpenCode.Sdk.Tests/Integrations/IntegrationsClientContractTests.cs ListIntegrationsAsync_Should_Throw_The_Declared_400_Error row integration.list:400:InvalidRequestError
tests/OpenCode.Sdk.Tests/Integrations/IntegrationsClientContractTests.cs ListIntegrationsAsync_Should_Return_The_401_Error_On_The_NoThrow_Spine row integration.list: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/FileSystem/FileSystemClientContractTests.cs 39 27 -12
tests/OpenCode.Sdk.Tests/FileSystem/FileSystemDeclaredErrors.cs 0 0 +0
tests/OpenCode.Sdk.Tests/Integrations/IntegrationClientContractTests.cs 41 23 -18
tests/OpenCode.Sdk.Tests/Integrations/IntegrationsClientContractTests.cs 12 6 -6
tests/OpenCode.Sdk.Tests/Integrations/IntegrationsDeclaredErrors.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 mutants: one per source class (scratch only; restored byte-identically)

In each class's response adapter, Status400Tags was emptied for one door.

Adapter (src/OpenCode.Sdk/) Old method, red on base New row, red on both spines
FileSystem/Internal/FsListResponseAdapter.cs:9 ListEntriesAsync_Should_Throw_The_Declared_400_Error fs.list:400:InvalidRequestError
Integrations/Internal/IntegrationResponseAdapter.cs:9 GetIntegrationAsync_Should_Throw_The_Declared_400_Error integration.get:400:InvalidRequestError
Integrations/Internal/IntegrationListResponseAdapter.cs:9 ListIntegrationsAsync_Should_Throw_The_Declared_400_Error integration.list:400:InvalidRequestError

Base: 3 failed. Finished table: 6 failed (3 rows × 2 spines). 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)

Master 77bb1b51 This PR
Test clones 603 586
Tests duplication 5.12% 4.99%

The baseline loses 59 fingerprints and gains 42. None of the 42 duplicates that jscpd reports as new involves a file this PR changes. All of them sit between untouched files whose text is byte-identical to master: once their FileSystem and Integration twins are deleted, jscpd pairs the still-unconverted declared-error methods differently.

Review

  • Coordinator: read the diff and the shared-door layout.
  • Sol (given only the requirements and the diff) found no defects and no out-of-scope changes. It confirmed that every row agrees with spec/openapi.json, that all 12 nameof labels match the call their lambda makes, that each door is defined once per area, and the renames. It could not verify the baseline regrouping from hashes alone; the jscpd analysis above is that evidence.

✅ Completion Gate

Local check (quality-gates.md) on head 336ac386, base 77bb1b51. 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 4.99%)
  • OpenCode.Sdk.Tools.Tests (all but NativeAot): 2086, 0 failed
  • OpenCode.Sdk.Tests (all but ServiceElection/NativeAot): 8591, 0 failed

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 or weakened; every removed method is mapped to its row above, and every renamed method to its new name

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

…efined once per area

TST-E4a P04b. The FileSystem, Integration and Integrations contract classes' declared-error door methods become rows of DeclaredErrorTests, proven on both spines and traced to the pinned spec, in FileSystem/FileSystemDeclaredErrors.cs and Integrations/IntegrationsDeclaredErrors.cs. Each door is defined once per area and its cases reference it, so a door's label and call live in one place. Four retained Integration tests drop member names that no longer exist (GetIntegrationAsync -> GetAsync, PostConnectKeyAsync -> ConnectWithKeyAsync, PostOAuthConnectAsync -> BeginOAuthConnectionAsync).
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