feat(governance): link work items to event history
All checks were successful
Code Review / ai-code-review (push) Successful in 11s
CD Pipeline / tests (push) Successful in 3m35s
CD Pipeline / build-and-deploy (push) Successful in 3m50s
CD Pipeline / post-deploy-checks (push) Successful in 1m42s

This commit is contained in:
Your Name
2026-05-20 11:03:52 +08:00
parent 4a24d3e4fc
commit 739a8e0f78
9 changed files with 193 additions and 11 deletions

View File

@@ -195,6 +195,7 @@ async def _load_dispatch_ids_for_events(event_ids: list[str]) -> dict[str, list[
async def query_governance_events(
*,
event_ids: list[str] | None = None,
event_types: list[str] | None = None,
from_dt: datetime | None = None,
to_dt: datetime | None = None,
@@ -212,6 +213,14 @@ async def query_governance_events(
async with get_db_context() as db:
stmt = select(AiGovernanceEvent)
normalized_event_ids = [
event_id.strip()
for event_id in (event_ids or [])
if isinstance(event_id, str) and event_id.strip()
]
if normalized_event_ids:
stmt = stmt.where(AiGovernanceEvent.id.in_(normalized_event_ids))
if event_types:
stmt = stmt.where(AiGovernanceEvent.event_type.in_(event_types))