fix(release): prepare aligned 0.1.45 composition and guarded candidate sequencing
This commit is contained in:
@@ -25,6 +25,11 @@ from govoplan_core.core.institutional import (
|
||||
TemporalRevision,
|
||||
service_launch_capability,
|
||||
)
|
||||
from govoplan_core.core.temporal import (
|
||||
TemporalDataContext,
|
||||
bind_temporal_data_context,
|
||||
reset_temporal_data_context,
|
||||
)
|
||||
from govoplan_cases.backend.party_context import CasePartyContext
|
||||
from govoplan_cases.backend.db.models import (
|
||||
CaseAccessGrant,
|
||||
@@ -134,6 +139,13 @@ class _Registry:
|
||||
|
||||
|
||||
class InstitutionalGovernanceJourneyTests(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
# Portal's effective_at does not replace the SQL provider's request-local
|
||||
# read clock. Keep both on the journey date, without bypassing validity
|
||||
# filtering or extending the fixture's finite publication interval.
|
||||
token = bind_temporal_data_context(TemporalDataContext(evaluated_at=NOW))
|
||||
self.addCleanup(reset_temporal_data_context, token)
|
||||
|
||||
def test_service_to_formal_outcome_retains_governed_context(self) -> None:
|
||||
engine = create_engine("sqlite+pysqlite:///:memory:")
|
||||
for table in (
|
||||
@@ -220,13 +232,44 @@ class InstitutionalGovernanceJourneyTests(unittest.TestCase):
|
||||
service_launch_capability("case"): object(),
|
||||
}
|
||||
)
|
||||
entry = PortalServiceDirectory(service_registry).list_entries(
|
||||
directory = PortalServiceDirectory(service_registry)
|
||||
for outside_interval in (
|
||||
service.temporal.valid_from - timedelta(microseconds=1),
|
||||
service.temporal.valid_to,
|
||||
):
|
||||
with self.subTest(outside_interval=outside_interval):
|
||||
token = bind_temporal_data_context(
|
||||
TemporalDataContext(evaluated_at=outside_interval)
|
||||
)
|
||||
try:
|
||||
# Keep Portal inside the valid interval: the real SQL
|
||||
# provider must still exclude a service outside its own
|
||||
# temporal read context, before Portal can project it.
|
||||
self.assertEqual(
|
||||
(),
|
||||
directory.list_entries(
|
||||
session,
|
||||
principal,
|
||||
tenant_id="tenant-1",
|
||||
effective_at=NOW,
|
||||
audiences=("resident",),
|
||||
),
|
||||
)
|
||||
finally:
|
||||
reset_temporal_data_context(token)
|
||||
|
||||
entries = directory.list_entries(
|
||||
session,
|
||||
principal,
|
||||
tenant_id="tenant-1",
|
||||
effective_at=NOW,
|
||||
audiences=("resident",),
|
||||
)[0]
|
||||
)
|
||||
self.assertEqual(
|
||||
(service.reference,),
|
||||
tuple(entry.definition.reference for entry in entries),
|
||||
)
|
||||
entry = entries[0]
|
||||
self.assertTrue(entry.available)
|
||||
intake = CaseServiceIntake().plan(
|
||||
entry.definition,
|
||||
|
||||
Reference in New Issue
Block a user