D2: Order 360 timeline endpoint + stage-entry journal - #144
Merged
Conversation
GET /v1/entity/order/{order_id}/timeline composes the QueryEngine and
ControlPlaneStore ports (ADR 0011, no third path) into one read: order
state, stage history + pipeline trail from the pipeline_events journal,
the PII-free users_enriched customer block, and linked dead-letter
exceptions.
Makes the journal's entity_id axis real on the live write paths
(local_pipeline.py's three insert sites, clickhouse_sink.py's mirror —
previously only the demo seed populated it) and adds the orders.status
stage-entry writer alongside every order upsert on both backends. Seeds
stage trails for the 8 demo orders (ops-surfaces-spec.md §1.6): ORD-1004
is the sole SLA-breach candidate once D3 wires budgets, ORD-1001 carries
the full pending->confirmed->shipped->delivered story. error_rate re-pins
to 2/32 by arithmetic (B3 house rule). Excludes the new orders.status
topic from /v1/lineage's scan so the existing ingestion-trail endpoint
keeps reporting the platform-movement story, not warehouse stage moves.
sla_minutes/breached stay null until D3 lands the stages: contract block
(ops-surfaces-spec.md §1.5 is explicitly D3's, not D2's) — honest
degradation per the spec's own tolerant-of-absence design, not a gap.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
DORA Metrics
|
…nt-tools contract for D2 ruff format --check flagged the new ratchet test's one-line wrap; the export_openapi.py --check drift was expected — the new timeline endpoint adds to the OpenAPI schema and both generated tool-call contracts. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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/entity/order/{order_id}/timelinecomposes exactly theQueryEngine/ServingBackendandControlPlaneStoreports (ADR 0011): order state, stage history + pipeline trail from thepipeline_eventsjournal, the PII-freeusers_enrichedcustomer block, and linked dead-letter exceptions.entity_idaxis real on the live write paths (local_pipeline.py's 3 insert sites,clickhouse_sink.py's mirror) and adds theorders.statusstage-entry writer alongside every order upsert, both backends.ops-surfaces-spec.md§1.6): ORD-20260404-1004 is the sole SLA-breach candidate once D3 wires budgets; ORD-20260404-1001 carries the full stage history.error_ratere-pins to 2/32 by arithmetic (B3 house rule).orders.statustopic from/v1/lineage's scan so the pre-existing ingestion-trail endpoint keeps reporting platform movement, not warehouse stage transitions.sla_minutes/breachedstaynulluntil D3 lands thestages:contract block (spec §1.5 is explicitly D3's scope, not D2's) — honest degradation per the spec's own design, verified by test.Implements D2 per
docs/ops-surfaces-spec.md§1–2 andplan_endgame_02_07_26.md.Test plan
tests/unit/test_local_pipeline_entity_axis.py(entity_id derivation +orders.statusstage-row writer, DuckDB side)tests/unit/test_local_pipeline_clickhouse_mirror.pyfor the new mirror call sequencetests/integration/test_order_timeline.py(demo story pins I7, PII allow-list I3, fallback-clock honesty I12, stage-vocabulary tolerance I4, error_rate re-pin I9)tests/integration/test_tenant_isolation.pyfor cross-tenant timeline scoping (I8)tests/unit/test_control_plane_store.pywith the ADR 0011 no-third-path ratchet (I1)clickhouse_backend.py, reviewed, same static-seed pattern as its 7 existing sites)ruff check,mypy(strict) clean on touched files;pytest tests/unit tests/integration— 1817 passed, 52 skipped, 0 failed (4 pre-existingrequires_dockerKafka/Iceberg errors — no Docker on this Windows dev box per policy; 1 SSE streaming flake reproduced clean in isolation, confirmed unrelated to this diff)🤖 Generated with Claude Code