Workflow automation in code
Add observability and tests
Metrics for unapproved_send_count == 0 and median_time_to_draft ≤ 45s must distinguish bad input from component failure for ops coordinator clearing a 200-message backlog without auto-sending refunds.
1Learn the idea
Read
Golden signals for this system
Instrument typed workflow that classifies inbound email → draft reply → human approve → send so ops coordinator clearing a 200-message backlog without auto-sending refunds can answer: demand, errors, latency/age, saturation. Emit fields needed by unapproved_send_count == 0 and median_time_to_draft ≤ 45s with bounded labels. Sample successful high-volume traces; keep errors and rollout transitions denser within policy.
Read
Alert path worth paging
Define at least one alert that would fire for WF-AUTOSEND-19, with a for/pending window that survives deploy blips. Missing scrape or missing revision labels must not look like health. Include a trace/log example id format you will actually search.
Read
Implementation artifact
log.info("workflow_transition", { runId, from, to, approval: Boolean(ctx.approvalToken) });
Read
Tests for telemetry
Add a unit/integration check that metrics increment on the happy path and on the model labels 'issue refund' and workflow auto-calls payment tool branch. Store machine-readable output in CI artifacts when practical.
Read
Stage depth
Cardinality discipline: tenant and revision are usually enough; raw question text is not a label. Exemplars or trace links beat screenshots alone when debugging WF-AUTOSEND-19. Define who owns alert fatigue review. If you export to a vendor, record retention and access. Synthetic probes should use non-sensitive fixtures and still exercise POST /v1/workflows/email-triage/runs. Practice the query you will type at 2am once, while calm.
Read
Field notes for `workflow-automation-code` / `observability`
Document the exact PromQL or log query in the runbook stub for this service. Verify histograms have buckets around your SLO target. Add a canary synthetic check that exercises the oracle path every few minutes in staging. Confirm that PII redaction happens before export. Track build/version as a label on the golden signals. Delete noisy debug logs before they become accidental product dependencies. In this chapter the product is typed workflow that classifies inbound email → draft reply → human approve → send, the human stakeholder is ops coordinator clearing a 200-message backlog without auto-sending refunds, and the incident id you design against is WF-AUTOSEND-19. Re-state the oracle in your notes — fixture thread reaches awaiting_approval with draft; send blocked until Approve(id) — and keep the invariant visible: send step requires approval token; classifier never triggers send directly. Track unapproved_send_count == 0 and median_time_to_draft ≤ 45s as the scoreboard. Surface under change control: POST /v1/workflows/email-triage/runs. If you only have forty minutes, finish the fixture for model labels 'issue refund' and workflow auto-calls payment tool before polishing UI. Promotion language stays ternary: promote, hold, or roll back based on evidence, not hope.
Go deeper
Before you start
Why this matters
Name the dashboard row or log line ops coordinator clearing a 200-message backlog without auto-sending refunds opens first during WF-AUTOSEND-19. It must include a correlation id and a bounded label from unapproved_send_count == 0 and median_time_to_draft ≤ 45s. If telemetry is missing, write whether you promote, hold, or roll back — and why hold is the default.
In the wild
See how this idea shows up as a product and a company — then come back to the lesson. Skills transfer across vendors.
Related lessons
Check your understanding
Page assessment
Answer from memory. Completion is saved from this evidence, not from opening the next page.
All responses are required.