STATE-WP-0069 T04: meter workstream_id query-param aliases
Add legacy_compat helper and Deprecation headers when callers filter /tasks, /decisions, /token-events, or /execution/launch-requests with workstream_id. Preferred workplan_id filters are unchanged. Route removal remains gated on legacy-meter zero-usage windows.
This commit is contained in:
parent
b2b72b7327
commit
793a39a1a4
8 changed files with 181 additions and 15 deletions
|
|
@ -28,6 +28,7 @@ from api.services.execution_queue import (
|
|||
workplan_blockers,
|
||||
)
|
||||
from api.routers.workstreams import _legacy_key, _meter_legacy_route
|
||||
from api.services.legacy_compat import meter_legacy_query_param
|
||||
from api.workplan_status import CLOSED_WORKPLAN_STATUSES, normalize_workplan_status
|
||||
|
||||
router = APIRouter(prefix="/execution", tags=["execution"])
|
||||
|
|
@ -193,13 +194,26 @@ async def create_launch_request(
|
|||
|
||||
@router.get("/launch-requests", response_model=list[LaunchRequestRead])
|
||||
async def list_launch_requests(
|
||||
request: Request,
|
||||
response: Response,
|
||||
workplan_id: uuid.UUID | None = None,
|
||||
workstream_id: uuid.UUID | None = None,
|
||||
request_status: str | None = None,
|
||||
session: AsyncSession = Depends(get_session),
|
||||
) -> list[WorkplanLaunchRequest]:
|
||||
if workstream_id is not None and workplan_id is None:
|
||||
await meter_legacy_query_param(
|
||||
session=session,
|
||||
request=request,
|
||||
response=response,
|
||||
method="GET",
|
||||
route="/execution/launch-requests",
|
||||
replacement_ref="/execution/launch-requests?workplan_id=<workplan_id>",
|
||||
)
|
||||
q = select(WorkplanLaunchRequest).order_by(WorkplanLaunchRequest.created_at.desc())
|
||||
if workstream_id:
|
||||
q = q.where(WorkplanLaunchRequest.workplan_id == workstream_id)
|
||||
scope_id = workplan_id or workstream_id
|
||||
if scope_id:
|
||||
q = q.where(WorkplanLaunchRequest.workplan_id == scope_id)
|
||||
if request_status:
|
||||
q = q.where(WorkplanLaunchRequest.status == request_status)
|
||||
result = await session.execute(q)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue