Skip to content

Fix: team tools fail output-schema validation on every call - #458

Merged
ready4god2513 merged 1 commit into
mainfrom
serialize-time
Aug 14, 2026
Merged

Fix: team tools fail output-schema validation on every call#458
ready4god2513 merged 1 commit into
mainfrom
serialize-time

Conversation

@ready4god2513

Copy link
Copy Markdown
Contributor

Description

twprojects-get_team and twprojects-list_teams returned structured content that no validating client would accept: the schema declared deletedDate as object|null while the value on the wire was a string. Clients that validate discarded every response; the rest never noticed.

twapi.OptionalDateTime is defined over time.Time, so jsonschema.For describes it by time.Time's unexported fields, while its MarshalJSON writes an RFC3339 string. Register the override in helpers.WithDateTypeSchema alongside twapi.Date rather than inline in teams.go: a response picks the type up transitively, and SearchResponse sideloads Team, so twprojects-search carried the same defect and is fixed by the same change.

twapi-go-sdk v1.21.4 makes the zero value marshal as null, which covers a live team on get_team. It does not cover a deleted one, and it does not touch list_teams at all — that tool streams the raw API body per the list_* contract, so MarshalJSON never runs and the API's literal deletedDate: "" reaches the client unchanged. The schema override is what fixes those.

Neither the server nor testutil.ExecuteToolRequest validates structured content against the output schema, so the new test pulls the tool's published schema and validates the result by hand — driving the tool alone passes against the broken code. The existing team tests reply {}, which leaves the field nil and encodes as null, so they could never have caught this.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Testing

  • Tests pass locally (go test -v ./...)
  • Added/updated tests for new functionality

Checklist

  • Code follows project style guidelines
  • Self-reviewed the code
  • Added necessary documentation
  • No new warnings or errors

`twprojects-get_team` and `twprojects-list_teams` returned structured content
that no validating client would accept: the schema declared `deletedDate` as
`object|null` while the value on the wire was a string. Clients that validate
discarded every response; the rest never noticed.

`twapi.OptionalDateTime` is defined over `time.Time`, so `jsonschema.For`
describes it by `time.Time`'s unexported fields, while its `MarshalJSON` writes
an RFC3339 string. Register the override in `helpers.WithDateTypeSchema`
alongside `twapi.Date` rather than inline in `teams.go`: a response picks the
type up transitively, and `SearchResponse` sideloads `Team`, so
`twprojects-search` carried the same defect and is fixed by the same change.

twapi-go-sdk v1.21.4 makes the zero value marshal as `null`, which covers a live
team on `get_team`. It does not cover a deleted one, and it does not touch
`list_teams` at all — that tool streams the raw API body per the `list_*`
contract, so `MarshalJSON` never runs and the API's literal `deletedDate: ""`
reaches the client unchanged. The schema override is what fixes those.

Neither the server nor `testutil.ExecuteToolRequest` validates structured
content against the output schema, so the new test pulls the tool's published
schema and validates the result by hand — driving the tool alone passes against
the broken code. The existing team tests reply `{}`, which leaves the field nil
and encodes as `null`, so they could never have caught this.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ready4god2513
ready4god2513 requested a review from a team as a code owner August 14, 2026 17:00
@ready4god2513
ready4god2513 merged commit 9175983 into main Aug 14, 2026
3 checks passed
@ready4god2513
ready4god2513 deleted the serialize-time branch August 14, 2026 17:03
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