发布

  • [OPIK-4931] [BE] Add project_name resolution for Dataset, Dashboard, and Prompt (#5683)

    frostbyte_neo 发布于 2026-03-16 19:20:58 +00:00

    • [OPIK-4931] [BE] Add project_id to datasets, prompts, and dashboards

    Add nullable project_id column with FK constraint to datasets, prompts,
    and dashboards tables. Wire project_id through all layers (DAO, Service,
    Resource) for create, findByName with fallback, and list/find filtering.
    Include integration tests for project-scoped CRUD and filtering.

    Resolves: OPIK-4931, OPIK-4934, OPIK-4935, OPIK-4936

    • Fix tests

    • Fix tests

    • Fix tests

    • [OPIK-4931] [BE] Centralize Dataset and Prompt test factory methods

    Extract buildDataset/buildDatasetList/buildPrompt into DatasetResourceClient
    and PromptResourceClient to eliminate duplicated manufacturePojo patterns
    across 19 test files.

    • Revision 2: Address PR review feedback
    • Merge duplicate DAO findByName methods using ST templates
    • Simplify service findByName with fallback logic
    • Remove FK constraints, add service-level project validation via ProjectService
    • Add composite indexes (workspace_id, project_id) on datasets, prompts, dashboards
    • Fix leftover 2-param findByName call in DatasetService.getOrCreate
    • Revision 3: Fix PODAM-generated projectId in assertion results tests

    Use buildDataset() helper which nulls out projectId to avoid
    409 Conflict from validateProjectIdExists on random UUIDs.

    • [OPIK-4931] [BE] Add project_name resolution for Dataset, Dashboard, and Prompt

    Allow users to provide project_name as an alternative to project_id when
    creating datasets, dashboards, and prompts. If project_name is provided
    but the project doesn't exist, it is automatically created via getOrCreate.

    • [OPIK-4931] [BE] Add @Schema descriptions to projectName fields

    Adds Swagger documentation to the projectName field on Dataset, Dashboard,
    and Prompt API models so users understand the project resolution behavior.

    • [OPIK-4931] [BE] Fix migration number collision (000056 -> 000057)

    000056 is already taken by drop_dashboard_name_uniqueness on main.

    • [OPIK-4931] [BE] Use DatasetResourceClient.buildDatasetList in all tests

    Ensures projectName is nulled out when building test datasets,
    preventing unintended project creation via project name resolution.

    • [OPIK-4931] [BE] Code quality nits: text blocks in DAO, move logic to impl

    • [OPIK-4931] [BE] Document projectId takes precedence over projectName in API schemas

    • [OPIK-4931] [BE] Use non-reactive getOrCreate, return 404 for missing project, consolidate test builders

    • [OPIK-4931] [BE] Validate projectName is not blank at API and service layers

    下载附件