feat(core): Require attributes on SerializedStreamedSpan#22052
Merged
Conversation
attributes on SerializedStreamedSpan
mydea
approved these changes
Jul 8, 2026
Lms24
marked this pull request as ready for review
July 8, 2026 09:13
Make attributes a required field on the final serialized span type so tests can rely on it always being present. Production code already guarantees this via serializeAttributes returning an empty object. Co-Authored-By: Cursor <cursoragent@cursor.com>
mydea
force-pushed
the
feat/required-streamed-span-attributes
branch
from
July 8, 2026 11:34
509ce9d to
9f80421
Compare
mydea
added a commit
that referenced
this pull request
Jul 8, 2026
The `suites/**` test files in `node-integration-tests` were never type-checked, so type errors only ever surfaced in the editor — never in CI. This adds a CI gate that type-checks the suites and fixes the ~2000 latent errors it surfaced. ## Root cause - `yarn type-check` runs a bare `tsc`, whose `tsconfig.json` only includes `utils/**` and `src/**` — not `suites/**`. - `yarn test` (vitest) transpiles with esbuild, which strips types without checking them. With nothing exercising the suite types, errors accumulated silently. ## Changes - Add `type-check:src` / `type-check:test` scripts (both `--noEmit`, so a bare run can't scatter `.js` next to sources) and run `yarn type-check` for the package in the **Lint** CI job. - Relax `noUncheckedIndexedAccess` for test code — indexing into span attributes/arrays that are known to exist at that point shouldn't require `!` everywhere — and exclude the Prisma CLI config, whose runtime shape intentionally differs from `@prisma/config`'s exported types. - Give `createTestServer` an explicit return type so chained `.get()` calls infer their `headers` callback parameter (previously only the first `.get()` was typed). - Add a `getStringAttributeValue` helper to narrow union-typed span attribute values in the AI tracing assertions (`includes` / `startsWith` / `match` / `length`). - Fix the vitest reporter config to the valid nested-tuple form. All changes are type-level / test-scoped and runtime-transparent. --- Stacked on top of #22052, which makes `attributes` required on `SerializedStreamedSpan` — merge that one first. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
49 tasks
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.
Make
attributesa required field onSerializedStreamedSpanso tests and downstream code can rely on it always being present, without optional chaining.Production code already guarantees this:
streamedSpanJsonToSerializedSpanalways sets attributes viaserializeAttributes(), which returns{}when the intermediateStreamedSpanJSONhas no attributes. Only test mocks needed updating to includeattributes: {}.We likely can adjust the
StreamedSpanJsontype in a similar way to gain some production code benefits as well. Gonna look at this in a follow-up