发布

  • [OPIK-4938] [BE] Add X-Opik-Deprecation header for workspace-wide fallback lookups (#5760)

    frostbyte_neo 发布于 2026-03-20 15:51:52 +00:00

    • [OPIK-4938] [BE] Add project-scoped endpoint tests for prompts, datasets, experiments, and dashboards

    Add FindProjectPrompts, FindProjectDatasets, FindProjectExperiments, and
    FindProjectDashboards nested test classes that mirror their workspace-scoped
    counterparts, exercising the /v1/private/projects/{projectId}/{resource}
    endpoints with filtering, pagination, and sorting coverage.

    Also extract shared assertion helpers (assertPromptsPage, assertDashboardPage)
    to outer test classes for reuse, and add getProjectDashboards/getProjectPrompts
    client methods to the respective resource clients.

    • Revision 2: Fix missing @RequiredPermissions on ProjectPromptsResource and rename duplicate "By" in test method names

    • Revision 3: Remove @RequiredPermissions from ProjectPromptsResource that caused test compilation issue

    • Revision 4: Apply spotless formatting

    • [OPIK-4938] [BE] Add X-Opik-Deprecation header for workspace-wide fallback lookups

    When a dataset, prompt, or dashboard is found via workspace-wide search
    (i.e., the requested projectId did not match but a workspace-wide record
    exists), the response now includes X-Opik-Deprecation with a formatted
    message warning that explicit project scoping will be required in a
    future version.

    • Revision 2: Add tests for X-Opik-Deprecation workspace-fallback header

    Tests verify:

    • Header is returned with full formatted message when fallback to
      workspace-wide search is used (non-matching/non-existent project)
    • Header is absent when the entity is found directly in the requested project
    • Revision 3: Use WORKSPACE_FALLBACK_MESSAGE_TEMPLATE constant in tests

    • Revision 4: Fix fallback message when project name is provided but does not exist

    • Revision 5: Remove workspace fallback message from DashboardService (no expose endpoint)

    • Revision 6: Extract setWorkspaceFallbackFor helper to centralize fallback message setting

    • Revision 7: Fix OutOfScopeException in reactive stream by introducing resolveDatasetByName

    Split the blocking findByName(DatasetIdentifier) from the reactive stream
    path. Added resolveDatasetByName(DatasetIdentifier, Visibility) to the
    DatasetService interface that captures workspaceId on the request thread
    and returns a Mono, so the reactive chain in DatasetItemService
    no longer accesses the @RequestScoped RequestContext from a non-request
    thread.


    Co-authored-by: Andres Cruz andresc@comet.com

    下载附件