Skip to content

Conversation

@RogerHYang
Copy link
Contributor

@RogerHYang RogerHYang commented Oct 24, 2025

Note

Refactors GraphQL types and mutations/queries to use TableFieldsDataLoader-backed field resolvers and consistent Node(id, db_record) construction, while expanding annotation schema and related fields.

  • GraphQL Schema/Types:
    • Expand Annotation interface and concrete types to include annotatorKind, metadata, source, identifier, user, and timing fields; align DocumentAnnotation, SpanAnnotation, TraceAnnotation, ExperimentRunAnnotation, and ProjectSessionAnnotation accordingly (e.g., traceId: ID).
    • Migrate many types (Project, Trace, Span, Dataset*, Prompt*, User*, etc.) to lazy, dataloader-backed field resolvers; standardize construction to Node(id, db_record).
  • DataLoaders/Context:
    • Add numerous TableFieldsDataLoader entries (e.g., for datasets, splits, versions, prompts, labels, users, api keys, annotations, experiments, traces, sessions) and expose them through Context.DataLoaders.
  • Mutations/Queries:
    • Update mutations (prompts, prompt labels/tags, datasets/splits/labels, span/trace/session annotations, users, API keys) to return nodes via id and optional db_record instead of bespoke converters.
    • Refactor prompt creation: move prompt version normalization into ChatPromptVersionInput.to_orm_prompt_version and simplify prompt mutations.
    • Adjust queries and node resolver to construct nodes with id and rely on dataloaders for fields; remove legacy to_gql helpers.
  • Runtime/Subscriptions:
    • Update chat completion (mutation/subscription) payloads to use Span(id, db_record) and enqueue events as before.

Written by Cursor Bugbot for commit 59da6ad. This will update automatically on new commits. Configure here.

@RogerHYang RogerHYang requested review from a team as code owners October 24, 2025 22:45
@github-project-automation github-project-automation bot moved this to 📘 Todo in phoenix Oct 24, 2025
@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Oct 24, 2025
Copy link
Contributor

@axiomofjoy axiomofjoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth making the interface classes into abstract base classes with abstract methods to ensure the sub-classes implement the required fields.

Comment on lines +62 to +74
@strawberry.field
async def color(
self,
info: Info[Context, None],
) -> str:
if self.db_record:
val = self.db_record.color or "#ffffff"
else:
val = await info.context.data_loaders.dataset_split_fields.load(
(self.id, models.DatasetSplit.color),
)
val = val or "#ffffff"
return val
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@strawberry.field
async def color(
self,
info: Info[Context, None],
) -> str:
if self.db_record:
val = self.db_record.color or "#ffffff"
else:
val = await info.context.data_loaders.dataset_split_fields.load(
(self.id, models.DatasetSplit.color),
)
val = val or "#ffffff"
return val
@strawberry.field
async def color(
self,
info: Info[Context, None],
) -> str:
if self.db_record:
val = self.db_record.color
else:
val = await info.context.data_loaders.dataset_split_fields.load(
(self.id, models.DatasetSplit.color),
)
return val

Required type

@strawberry.field
async def user(self, info: Info[Context, None]) -> Optional[User]:
async def user(
self, info: Info[Context, None]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self, info: Info[Context, None]
self

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Annotation interface has more in it than it used to. Is that on purpose?

@github-project-automation github-project-automation bot moved this from 📘 Todo to 👍 Approved in phoenix Oct 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

Status: 👍 Approved

Development

Successfully merging this pull request may close these issues.

2 participants