发布

  • [OPIK-6810] [BE] add project_name to experiment_items_bulk to avoid Default Project fallback (#7021)

    frostbyte_neo 发布于 2026-06-12 09:45:30 +00:00

    • [OPIK-6810] [BE] add project_name to experiment_items_bulk to avoid Default Project fallback

    Bulk-ingested items that use evaluate_task_result (no trace) had their
    auto-created hidden traces hardcoded to the Default Project, while the
    experiment lived in its own project. The async aggregation job then derived
    the aggregate's project_id from those traces, and the find query served the
    experiment from the aggregate path filtered by that project — so the
    experiment disappeared from its own project view a few minutes after upload.

    • Add optional project_name to ExperimentItemBulkUpload; apply it to traces
      that don't carry their own project (auto-created or project-less explicit
      traces).
    • Keep the Default Project fallback when project_name is omitted, but return
      an X-Opik-Deprecation header only when a fallback actually occurred.
    • Reject a mismatch between request project_name and an item trace's
      project_name (422) via a bean-validation annotation.
    • Fix a pre-existing NPE in bulk validation when a trace is present with null
      spans.
    • Experiment items now carry the resolved project_id (was null on the
      no-trace path).

    Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

    • [OPIK-6810] [BE] use project_name when bulk creates the experiment and dataset

    The experiment built in the bulk path carried no project, so a bulk-created
    experiment (and its auto-created dataset) landed with no project. Set
    projectName on the experiment so ExperimentService.create resolves/creates the
    project and passes its id to getOrCreateDataset — experiment and dataset are
    now created in the requested project.

    Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

    • [OPIK-6810] [BE] make bulk spans inherit their trace's project

    Spans in experiment_items_bulk only kept source=EXPERIMENT and their own
    project_name, so a span could land in a different project than its trace
    (project_name isn't even part of ExperimentItemBulkWriteView, so it is never
    received on this path). Force each span into its trace's resolved project in
    splitBatches, and drop the now-redundant span projectName assignment in
    ExperimentItemBulkMapper (it still sets traceId for the trace-id match check).

    Also: validate project_name with @Pattern(NULL_OR_NOT_BLANK); drop unused
    workspaceId param from validateExperimentConsistency; log projectName.

    Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

    • [OPIK-6810] [BE] reject bulk upload when project_name conflicts with existing experiment's project

    Address PR review: when experimentId references an existing experiment,
    validateExperimentConsistency now rejects (409) a non-blank request project_name
    that doesn't match the experiment's project, preventing items from being split
    across projects. Also strengthen the dataset test to assert the dataset is
    created in the requested project (project_id), not just by name.

    Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

    • [OPIK-6810] [BE] dedupe bulk tests; document 409 as Conflict
    • Extract shared test helpers in the BulkUpload suite (createDatasetWithItem +
      BulkDataset record, newExperimentName, newProjectName) and apply them across
      the bulk tests, removing the repeated dataset/item setup and name generation.
    • experiment_items_bulk 409 ApiResponse description: "Experiment dataset
      mismatch" -> "Conflict" (now also covers project mismatch).

    Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

    • [OPIK-6810] [BE] move span/trace-id guard into hasMismatchingTraceId

    Address review: fold the empty-spans guard into the helper (renamed
    hasMatchingTraceId -> hasMismatchingTraceId since it returns true on a
    mismatch) so validate() reads cleanly and the helper is null-safe on its own.

    Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com


    Co-authored-by: Claude Opus 4.8 (1M context) noreply@anthropic.com

    下载附件