Skip to content

Add model card resolver to VFolderGQL #11475

@fregataa

Description

@fregataa

Background

ModelCardGQL.vfolder exposes the linked VFolder from a model card (api/gql/model_card/types.py:221-235), but the reverse direction is not exposed. There is no way to obtain the matching model card from a vfolder via either REST v2 or GraphQL.

Findings:

  • VFolderGQL (api/gql/vfolder_v2/types/node.py) has no model_card field.

  • VFolderNode REST v2 DTO (common/dto/manager/v2/vfolder/response.py:57) has no model_card field.

  • ModelCardFilter (common/dto/manager/v2/model_card/request.py) has no vfolder_id filter, so even an indirect lookup via model card search by vfolder ID is impossible.

  • Clients today must list all model cards in a project and match by vfolder_id field on the client side.

Goal

Add a model_card field to VFolderGQL that returns the linked ModelCardGQL | None, mirroring the existing ModelCardGQL.vfolder resolver.

Scope

  • Add a ModelCardLoader (or extend an existing data loader) keyed by vfolder_id to avoid N+1.

  • Add model_card field on VFolderGQL using strawberry.lazy() for the cross-entity reference.

  • Update VFolderNode REST v2 DTO if parity is desired (optional - GQL-first is acceptable).

  • Add tests covering: vfolder with no card, vfolder with card, RBAC visibility (caller can see vfolder but not the card).

Out of scope

  • Adding vfolder_id filter to ModelCardFilter (separate concern).

  • REST v2 inline expansion (can be added later if demand arises).

References

  • api/gql/CLAUDE.md — N+1 prevention rule, lazy import pattern.

  • api/gql/model_card/types.py:221-235 — existing forward-direction resolver as reference.

JIRA Issue: BA-5947

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Story.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions