D3: stuck-orders worklist + SLA-stage contract block - #145
Merged
Conversation
New GET /v1/ops/stuck-orders (ops-surfaces-spec.md §3): the catalog gains an optional `stages:` ladder on order.yaml (§1.5), a new QueryEngine bulk read (fetch_orders_by_status) fetches open orders in one query, and the stage clock/breach arithmetic that D2 inlined in the timeline handler is factored into a shared src/serving/semantic_layer/stage_clock.py used by both surfaces (I2). Widens the I1 structural ratchet to cover routers/ops.py and bumps the reviewed B608 nosec count for the new bulk-read site. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
DORA Metrics
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GET /v1/ops/stuck-orders(docs/ops-surfaces-spec.md§3): open orders (catalog ladder) left-joined to their latestorders.statusjournal row, breach arithmetic from the contractstages:block,stage/include_within_sla/pagination params,open_by_stage/breached_by_stagesummary.contracts/entities/order.yamlgains thestages:SLA ladder (§1.5):pending30m /confirmed24h /shipped5d,delivered/cancelledterminal.EntityDefinition/entity_type_registry.pyparse it, tolerant of absence.QueryEngine.fetch_orders_by_status(one query, no per-order round-trips) and atopicfilter onfetch_pipeline_events.agent_query.pyinto sharedsrc/serving/semantic_layer/stage_clock.py(coerce_dt/stage_budget/ladder_stage_names/resolve_breach), now used by both the Order 360 timeline and the new worklist — no budget-literal duplication (I2).test_control_plane_store.py) to also scanrouters/ops.py; bumped the reviewed B608 nosec count for the new bulk-read site inentity_queries.py.docs/openapi.json+ agent-tools JSON for the new route.Demo story (I7) verified by arithmetic against the D2 seed: default view returns exactly
ORD-20260404-1004(45min pending vs 30min budget, overshoot 1.5×);open_by_stage/breached_by_stagematch the spec's worked example exactly.Test plan
pytest tests/unit— 1606 passedpytest tests/integration -m "not requires_docker and not live"— 224 passed, 50 skipped, 5 deselectedruff check/ruff format --check/mypy --stricton touched files — cleantests/integration/test_stuck_orders.py(I2/I4/I7/I12),test_tenant_isolation.pycross-tenant case (I8),test_entity_type_registry.pystages-parsing cases, widened I1 ratchet🤖 Generated with Claude Code