发布

  • [OPIK-5704] [BE][SDK] fix: dataset items not returned for datasets created without project_name (#6115)

    frostbyte_neo 发布于 2026-04-08 09:14:00 +00:00

    • [OPIK-5704] [BE][SDK] fix: dataset items not returned for datasets created without project_name

    Datasets created via UI or REST API without project_name have project_id=NULL
    in the DB. Two bugs caused get_items() to return empty for these datasets:

    1. BE: resolveDatasetByNameAsync called findByName() which called
      requestContext.get() on a Schedulers.boundedElastic() thread, throwing
      OutOfScopeException. Reactor silently dropped this error, returning
      Flux.empty(). Fixed by adding findByNameNoContext() that avoids
      requestContext.get() and using it in the async path.

    2. BE: findByName(DatasetIdentifier, Visibility) had @NonNull on visibility
      parameter, causing NPE since visibility is only set for public requests.
      Removed the @NonNull annotation — verifyVisibility() already handles null.

    3. SDK: Dataset.from_public() was using actual_project_name or project_name
      fallback, masking the null project_name returned by the backend. Fixed to
      use actual_project_name directly so datasets with no project preserve
      project_name=None, enabling the backend's workspace-wide fallback lookup.

    Implements OPIK-5704

    • fix(auth): set default visibility to PRIVATE for local auth path

    • revert(sdk): restore actual_project_name or project_name fallback in from_public

    The backend fix handles the workspace-wide fallback regardless of the
    project_name passed, so the SDK change was not necessary.

    • refactor(dataset): simplify resolveDatasetByName to delegate to findByName

    • fix(dataset): set workspace fallback header when project name provided but not found

    When a project_name is given in the request but does not exist in the
    workspace, projectId resolves to null and the private findByName skips
    its fallback branch entirely, so setWorkspaceFallbackFor was never called.
    Detect this case explicitly in findByName(DatasetIdentifier, Visibility)
    and set the header there.

    • fix test

    • chore: resolve merge conflicts in frontend files

    • chore: restore frontend files to match main

    • chore: remove unused Visibility import

    • test(datasets): add regression test for OPIK-5704 save side

    • test(datasets): remove ticket from test display name

    • test(datasets): use given/when/then structure

    • test(datasets): use given/when/then in display name

    下载附件