发布

  • [OPIK-4381] [BE] Add experiment_items.project_id with fallback logic (#5185)

    frostbyte_neo 发布于 2026-02-16 11:42:27 +00:00

    • [OPIK-4381] [BE] Make experiment_items.project_id nullable with fallback logic
    • Made project_id column nullable in experiment_items table
    • Added fallback logic to populate project_id from traces when not provided
    • Updated ExperimentItemService to retrieve project_id from traces
    • Added database migration script (000057)
    • Fixed test data generation with ExperimentItemTypeManufacturer
    • Updated tests to handle nullable project_id correctly

    All 239 ExperimentsResourceTest tests passing.

    • Revision 2: Fix ExperimentItem tests for projectId/projectName API changes
    • Fixed ApiKey deleteExperimentItems test to handle projectName resolution
    • Added createAndGetWithoutProjectName test to verify null project behavior
    • Updated test pattern to use assertExperimentItems helper method
    • All tests now properly handle projectId (READ_ONLY) and projectName (WRITE_ONLY)
    • Revision 3: Address PR review comments
    • Add FINAL to TraceDAO query for latest merged rows from ReplacingMergeTree
    • Fix byte[] to String casting in getProjectIdsByTraceIds
    • Use groupUniqArray instead of groupArray to avoid duplicates
    • Remove unnecessary GROUP BY workspace_id (already filtered)
    • Add migration rollback clause for reversibility
    • Add @Nullable annotation to projectId field for explicit nullability
    • Revision 4: Consolidate duplicate tests into parameterized test
    • Merged createAndGet and createAndGetWithoutProjectName into single parameterized test
    • Follows testing guidelines: similar test cases varying only by inputs should use @ParameterizedTest
    • Tests both scenarios: with project (projectName/projectId) and without (both null)
    • Uses MethodSource for test cases (includeProject = true/false)
    • All 2 test cases passing (with and without project)
    • Fix tests

    • Fix tests

    • [OPIK-4381] [SDK] Fix experiment items serialization to allow unknown fields

    Configure NDJSON stream parser to strip unrecognized object keys instead
    of failing validation. This fixes the integration test failure where
    experiment items were being silently dropped due to the backend sending
    a new project_id field that wasn't in the TypeScript SDK's schema.

    The fix makes the SDK more resilient to backend schema additions by
    passing { unrecognizedObjectKeys: 'strip' } to the Fern serializer's
    parse method.

    下载附件