Skip to content

fix: 12 test classes fail — WorkItemTemplate.tenancyId null on direct Panache persist() #261

@mdproctor

Description

@mdproctor

Problem

12 test classes in runtime/ fail with:

org.hibernate.PropertyValueException: not-null property references a null or transient value
for entity io.casehub.work.runtime.model.WorkItemTemplate.tenancyId

These tests create WorkItemTemplate entities via direct PanacheEntityBase.persist() without setting tenancyId. After #256 made tenancyId a non-null column, these bypass the store's put() stamping logic.

Failing tests

  • WorkItemInstancesResourceTest
  • LabelEndpointTest
  • WorkItemContextBuilderTest
  • MultiInstanceCreateTest
  • MultiInstanceCoordinatorTest
  • MultiInstanceClaimGuardTest
  • WorkItemGroupLifecycleEventTest
  • MultiInstanceInboxTest
  • WorkItemTemplateInstantiateTest
  • WorkItemTemplateServiceResolutionTest
  • RoutingCursorLastAccessedTest
  • RoutingCursorCleanupJobTest

Fix

Each test needs either:

  1. Set tenancyId on the template before persist(), or
  2. Use the store's put() method with a CurrentPrincipal that returns a tenancyId

This is the same static-Panache-bypass gotcha documented in GE-20260609-49bd08.

Context

Surfaced during work-end build verification for #256. Pre-existing — the code is identical pre/post squash (zero diff confirmed).

Refs #256

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions