Skip to content

Three Rust unit tests omit schema-required fields (connection, context) — 3 cargo test failures #452

Description

Summary

Three handwritten Rust unit tests build model payloads that omit fields the schema declares required. The generated loaders correctly reject them.

cargo test on wip/connection-open-discriminator against @typra/emitter@0.4.20:

test result: FAILED. 293 passed; 3 failed; 0 ignored

Same root pattern as #450, but in handwritten Rust test data rather than in vectors, so the fix locations are unrelated.

1 & 2. McpTool.connection — 2 failures

``
---- tool_dispatch::tests::test_dispatch_layer3_kind_handler stdout ----
panicked at prompty\src\model\tools\tool.rs:115:13:
connection: missing required field

---- tool_dispatch::tests::test_dispatch_layer3_wildcard_handler stdout ----
panicked at prompty\src\model\tools\tool.rs:115:13:
connection: missing required field
``

schema/model/tools/mcp.tsp:17connection: Connection;, required, no default.

runtime/rust/prompty/src/tool_dispatch.rs:

rust let agent = agent_with_tools(serde_json::json!([{ "name": "my_mcp_tool", "kind": "mcp", "serverName": "test-server" }]));

No connection. (It also omits approvalMode, which mcp.tsp:29 likewise declares required — that would fail next; see #450.)

3. ModelInvocationRequest.context — 1 failure

---- pipeline::live_turn::tests::streamed_responses_tool_round_preserves_delegated_continuation stdout ---- panicked at prompty\src\model\pipeline\model_invocation_request.rs:45:13: context: missing required field

schema/model/pipeline/invocation.tsp:119context: ModelInvocationContextSnapshot;, required, no default. The test payload in runtime/rust/prompty/src/pipeline/live_turn.rs omits it.

Both files are handwritten

Neither src/tool_dispatch.rs nor src/pipeline/live_turn.rs carries an auto-generated banner; the panic sites (src/model/tools/tool.rs, src/model/pipeline/model_invocation_request.rs) are generated, but they are being handed incomplete payloads by handwritten tests.

Suggested fix

Add the missing fields to the three test payloads — or, if these fields are genuinely meant to be optional, change the schema, in which case #450 should be resolved the same way and at the same time.

Not verified

I did not check whether the equivalent Go, TypeScript, Python or C# unit tests build the same payloads; those suites are green on these paths, so if they do construct them they are supplying the fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions