-
[OPIK-5619] [BE] fix: add workspace-wide fallback header for dataset item streaming (#6060)
发布于
2026-04-02 13:00:18 +00:00 - [OPIK-5619] [BE] fix: add workspace-wide fallback for dataset item streaming
When an old SDK sends a wrong project_name (e.g. "Default Project") to
the stream-items endpoint, the backend now finds the dataset via workspace-wide
search and returns the correct items. The X-Opik-Deprecation header is also
emitted on streaming responses (ChunkedOutput) when the fallback is triggered.Key changes:
- DatasetService: add blocking resolveDatasetByName that sets the fallback
header on the HTTP request thread; rename reactive variant to
resolveDatasetByNameAsync and remove the invalid requestContext.get() call
inside Mono.fromCallable - DatasetItemService: updated streaming getItems to use resolveDatasetByNameAsync;
interface no longer carries Visibility (read from reactor context instead) - DatasetsResource.streamDatasetItems: call blocking resolveDatasetByName first
(sets fallback message), then inject HttpServletResponse to emit
X-Opik-Deprecation header before ChunkedOutput is committed; capture
RequestContext eagerly to avoid Guice OutOfScopeException inside contextWrite - AsyncUtils: add setRequestContext(Context, RequestContext) overload that
accepts an already-resolved RequestContext object - Tests: add streamDataItems__whenNonExistingProjectName__thenReturnDeprecationHeader
to verify the header is sent on streaming responses
-
test(datasets): update integration test mock to match new getItems signature
-
test(datasets): fix integration test mock for workspace name and resolveDatasetByName
-
refactor(datasets): use top-level import for HttpServletResponse
-
chore: fix import ordering for spotless
下载附件