Skip to content

F: Add missing TypeSpec type definitions (errors, tracing, streaming, validation, wire)#350

Merged
sethjuarez merged 9 commits into
mainfrom
sethjuarez/add-missing-typespec-types
Apr 18, 2026
Merged

F: Add missing TypeSpec type definitions (errors, tracing, streaming, validation, wire)#350
sethjuarez merged 9 commits into
mainfrom
sethjuarez/add-missing-typespec-types

Conversation

@sethjuarez

Copy link
Copy Markdown
Member

Summary

Adds missing TypeSpec model definitions for types specified in spec/spec.md but not yet modeled in TypeSpec. All new types include @doc annotations and @sample examples matching the spec.

New Type Files

File Types Spec Section
schema/model/core/errors.tsp InvokerError, ValidationError, FileNotFoundError §12
schema/model/tracing/tracer.tsp TraceValue, TraceTime, TraceSpan, TraceFile §3
schema/model/streaming/stream.tsp StreamOptions §10
schema/model/core/validation.tsp ValidationResult §12
schema/model/wire/anthropic-types.tsp Anthropic Messages API content blocks, wire message, request/response, tool definitions, usage §7.5

Generated Output

All emitters ran successfully, generating code for:

  • Python, TypeScript, Go, Rust, C# runtimes
  • VS Code extension JSON schemas
  • Reference documentation

Notes

  • anthropic-types.tsp is separate from anthropic.tsp because TypeSpec's using/augment syntax (used in anthropic.tsp for @@knownAs mappings) conflicts with namespace model declarations
  • Some recursive types (TraceSpan.__frames, TraceValue collections) use unknown to work around a recursion limitation in the prompty-emitter
  • The cargo fmt step fails on generated Rust code due to a pre-existing emitter bug with the type keyword — not introduced by this PR

sethjuarez and others added 9 commits April 17, 2026 22:06
…lidation, wire)

Add new TypeSpec model files for types specified in spec.md but not yet modeled:

- F1: Error types (InvokerError, ValidationError, FileNotFoundError) in core/errors.tsp
- F2: Tracing types (TraceValue, TraceTime, TraceSpan, TraceFile) in tracing/tracer.tsp
- F3: Streaming types (StreamOptions) in streaming/stream.tsp
- F4: Validation types (ValidationResult) in core/validation.tsp
- F5: Anthropic wire format types (content blocks, messages, request/response) in wire/anthropic-types.tsp

All types include @doc annotations and @sample examples matching the spec.
Generated code emitted to all runtimes (Python, TypeScript, Go, Rust, C#).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… paths

- Add FileNotFoundError, InvokerError, ValidationError, ValidationResult to
  model/core/__init__.py and model/__init__.py (generated files missing exports)
- Fix 73 generated TS test files: ../../src/model/index -> ../../../src/model/index
  (wrong depth for tests in tests/model/<group>/ subdirectories, pre-existing from E1)
- Fix 5 hand-written TS tests: ../src/model/prompty.js / ../src/model/tool.js
  -> ../src/model/index.js (E1 moved files to subdirs, breaking direct imports)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Auto-fixed 21 import-block ordering errors (I001) flagged by ruff check:
- 17 test files: yaml import must follow stdlib imports with blank line separator
- _StreamOptions.py: removed unused 'field' import
- model/tracing/__init__.py, model/wire/__init__.py: alphabetized imports

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep consolidated index.js import (F branch has the correct fix).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Apply ruff format to new files (core, tracing, streaming, wire model files)
and corresponding test files. Resolves ruff format --check CI failures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…issing TS model group exports

- Rename hand-written exception class InvokerError -> InvokerNotFoundException in InvokerRegistry.cs
  to avoid collision with generated TypeSpec DTO InvokerError (partial class)
- Rename Key property to InvokerKey and update 4 throw sites
- Update PipelineTests.cs: Assert.Throws<InvokerNotFoundException> and ex.InvokerKey
- Add missing wire/streaming/tracing group exports to TypeScript model/index.ts
- Add missing core group members (FileNotFoundError, InvokerError, ValidationError,
  ValidationResult) to model/core/index.ts

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… fix docs and C# examples

- Add AnthropicWireMessage and all wire types to Python model/__init__.py
- Add StreamOptions to Python model/__init__.py
- Add TraceFile, TraceSpan, TraceTime to Python model/__init__.py
- Fix docs reference/index.md slug: 'reference/index' -> 'reference' to fix broken /reference/ links
- Fix C# docs examples: Pipeline.ParseAsync now requires context parameter (pass null)
- Fix C# docs examples: Message.Role is now Role enum, not string; use Role.System/Role.User

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
xUnit runs test classes in parallel by default. PromptyLoadsTests and
ChatTests both mutate OPENAI_API_KEY, causing ChatBasic_InvokeAsync_With
MockedExecutor to race and see a null env var. Adding [Collection]
serializes the two classes without changing logic.

Also commit the ruff isort fix for model/__init__.py (I001).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sethjuarez
sethjuarez merged commit f1c4c05 into main Apr 18, 2026
26 checks passed
@sethjuarez
sethjuarez deleted the sethjuarez/add-missing-typespec-types branch June 9, 2026 19:50
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