SamuelChien821 commited on
Commit
afc8aaf
·
verified ·
1 Parent(s): 5166516

Remove harness language from v2 requests (part 2)

Browse files
task_files/dob100-064-hand-cluster-runbook/01-work-ticket.md CHANGED
@@ -81,6 +81,17 @@
81
  "assignee": "",
82
  "service": ""
83
  },
 
 
 
 
 
 
 
 
 
 
 
84
  {
85
  "ticket_id": 9212,
86
  "key": "SEC-908",
 
81
  "assignee": "",
82
  "service": ""
83
  },
84
+ {
85
+ "ticket_id": 9206,
86
+ "key": "OPS-205",
87
+ "type": "task",
88
+ "title": "Who owns the API gateway right now?",
89
+ "description": "A gateway alarm needs an owner and the wiki and the spreadsheet disagree. Who should actually be paged? Answer with the number of the escalation policy's current on-call day, and name the team in your assumptions.",
90
+ "status": "open",
91
+ "priority": "high",
92
+ "assignee": "",
93
+ "service": ""
94
+ },
95
  {
96
  "ticket_id": 9212,
97
  "key": "SEC-908",
task_files/dob100-064-hand-cluster-runbook/11-knowledge-base.md CHANGED
@@ -22,6 +22,15 @@
22
  "day": 229,
23
  "body": "# Catalog pricing performance\n\nOwner: commerce. Service: `catalog` (tier 2, python). Consumed by `search`,\n`checkout`, and `storefront-web` on every product listing render.\n\n## The rule\n\n`batch_pricing_enabled=true` is **required in production**.\n\n## Why\n\n`catalog` resolves a price per product from the pricing rules table, applying\nthe active promotion, the customer's currency, and any tier discount. With\n`batch_pricing_enabled=false`, the listing endpoint loops over the products in\nthe response and issues one pricing query per product. This is a textbook\n**N+1 pattern**: a 48-item category page produces 1 listing query plus 48\npricing queries.\n\nMeasured cost: the per-product loop adds roughly **500ms at p99** on a standard\ncategory page. It also multiplies database connection checkouts by the page\nsize, which is how a catalog slowdown turns into a `db_pool_size` exhaustion\nevent in a service that was nowhere near its own limits (see \"Connection pool\nsizing\").\n\nWith `batch_pricing_enabled=true` the same page issues one listing query and one\nbatched pricing query with an `IN` clause over the product ids, then applies\npromotions in memory. Same results, two round trips.\n\n## Config keys\n\n| Key | Production value | Notes |\n| ------------------------- | ---------------- | -------------------------------------- |\n| `batch_pricing_enabled` | `true` | Required. The N+1 killer. |\n| `cdn_enabled` | `true` | See \"CDN and media delivery\". |\n\n## How to spot it\n\n- p99 on `catalog` listing endpoints scales with page size rather than staying\n flat. If 24 items is 200ms and 96 items is 900ms, it is the loop.\n- Database query counts per request in the hundreds.\n- Log lines of the form `pricing lookup for product_id=... (batch disabled)`\n repeating with the same trace id.\n\n## Fixing it\n\n`batch_pricing_enabled` is repo config. Ship it as a PR with a `config` change,\nrun CI, merge, deploy to staging, then production. `catalog` is tier 2 so the\nproduction deploy is a straight 100% deploy - no canary required, though a\ncanary is never wrong.\n\nAfter the deploy, re-measure p99 on a large category page before closing the\nticket.\n\n## Do not\n\n- Do not \"fix\" this by raising `db_pool_size`. That hides the symptom and moves\n the failure to the database.\n- Do not add a per-product cache in front of the loop. The batch query is\n cheaper than the cache lookups it would replace.\n"
24
  },
 
 
 
 
 
 
 
 
 
25
  {
26
  "doc_id": 9607,
27
  "kind": "runbook",
@@ -111,6 +120,24 @@
111
  "author": "Priya Nair",
112
  "day": 265,
113
  "body": "# Public Orders API\n\nServed by `api-gateway`. Two versions are live: **`/v1/orders` (deprecated)** and\n**`/v2/orders` (current)**. Authentication is a bearer partner token on both.\nRationale for the split is in \"ADR-031: Versioned public API (/v1 to /v2\norders)\".\n\n## Status\n\n| Path | Status | Notes |\n| ------------- | ---------- | -------------------------------------------- |\n| `/v1/orders` | deprecated | Emits `Deprecation` and `Sunset` headers. |\n| `/v2/orders` | current | Use for all new integrations. |\n\nTraffic between the two is weighted at the gateway and shifted in steps of at\nmost 50 percentage points per the \"API deprecation\" runbook. `/v1/orders` may\nonly be retired once it serves 0% of traffic; CI blocks retirement otherwise.\n\n## `GET /v2/orders`\n\nQuery parameters: `status`, `created_after` (RFC3339), `limit` (default 50, max\n200), `cursor`.\n\nResponse `200`:\n\n```json\n{\n \"data\": [\n {\n \"id\": \"ord_01H9Z\",\n \"status\": \"paid\",\n \"created_at\": \"2026-03-04T11:02:19Z\",\n \"currency\": \"USD\",\n \"amount_total_minor\": 12995,\n \"amount_tax_minor\": 1040,\n \"shipments\": [\n {\"id\": \"shp_1\", \"carrier\": \"ups\", \"tracking_number\": \"1Z...\",\n \"line_item_ids\": [\"li_1\", \"li_2\"], \"status\": \"in_transit\"}\n ],\n \"refunds\": [\n {\"id\": \"ref_1\", \"amount_minor\": 2500, \"reason\": \"damaged\",\n \"created_at\": \"2026-03-07T09:11:00Z\"}\n ],\n \"loyalty\": {\"points_earned\": 130, \"points_redeemed\": 0}\n }\n ],\n \"next_cursor\": \"eyJvIjoiMDFIOVoifQ\"\n}\n```\n\n## `POST /v2/orders`\n\nRequest:\n\n```json\n{\n \"idempotency_key\": \"5f2c...\",\n \"customer_id\": \"cus_88\",\n \"currency\": \"USD\",\n \"line_items\": [{\"sku\": \"NC-1042\", \"quantity\": 2, \"unit_price_minor\": 4995}],\n \"shipping_address_id\": \"addr_9\",\n \"loyalty\": {\"points_to_redeem\": 500}\n}\n```\n\n`idempotency_key` is required. Replaying the same key returns the original order\nwith `200` rather than creating a second one.\n\nResponses: `201` created; `409` idempotency key reused with a different body;\n`422` validation failure.\n\n## `/v1/orders` (deprecated)\n\nSame resource, older shape. Differences that break naive migration:\n\n- `total` is a **decimal string** (`\"129.95\"`), not integer minor units.\n- `tracking_number` is a **scalar** on the order; multi-shipment orders report\n only the first.\n- `refunded` is a **boolean**; partial refunds are indistinguishable from full.\n- No `loyalty` object.\n- Offset pagination (`page`, `per_page`) instead of `next_cursor`.\n\n## Migration guidance\n\n1. Parse amounts as integers in minor units; drop all float handling. Multiply\n the old decimal by 100 only at the boundary, never in business logic.\n2. Iterate `shipments` instead of reading `tracking_number`. Single-shipment\n orders return an array of one.\n3. Replace `refunded == true` with `sum(refunds[].amount_minor) > 0`, and\n compare against `amount_total_minor` if you need \"fully refunded\".\n4. Switch pagination to `next_cursor`; do not compute offsets. Cursors are\n opaque - do not parse them.\n5. Handle the problem-details error shape: match on `type`, not on the message\n string.\n6. Send `idempotency_key` on every write.\n\n## Errors\n\n```json\n{\"type\": \"validation_error\", \"title\": \"Invalid line item\",\n \"detail\": \"line_items[0].quantity must be >= 1\", \"status\": 422}\n```\n\n`type` values are stable and safe to branch on: `validation_error`,\n`idempotency_conflict`, `rate_limited`, `not_found`, `internal_error`.\n"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  }
115
  ]
116
  ```
 
22
  "day": 229,
23
  "body": "# Catalog pricing performance\n\nOwner: commerce. Service: `catalog` (tier 2, python). Consumed by `search`,\n`checkout`, and `storefront-web` on every product listing render.\n\n## The rule\n\n`batch_pricing_enabled=true` is **required in production**.\n\n## Why\n\n`catalog` resolves a price per product from the pricing rules table, applying\nthe active promotion, the customer's currency, and any tier discount. With\n`batch_pricing_enabled=false`, the listing endpoint loops over the products in\nthe response and issues one pricing query per product. This is a textbook\n**N+1 pattern**: a 48-item category page produces 1 listing query plus 48\npricing queries.\n\nMeasured cost: the per-product loop adds roughly **500ms at p99** on a standard\ncategory page. It also multiplies database connection checkouts by the page\nsize, which is how a catalog slowdown turns into a `db_pool_size` exhaustion\nevent in a service that was nowhere near its own limits (see \"Connection pool\nsizing\").\n\nWith `batch_pricing_enabled=true` the same page issues one listing query and one\nbatched pricing query with an `IN` clause over the product ids, then applies\npromotions in memory. Same results, two round trips.\n\n## Config keys\n\n| Key | Production value | Notes |\n| ------------------------- | ---------------- | -------------------------------------- |\n| `batch_pricing_enabled` | `true` | Required. The N+1 killer. |\n| `cdn_enabled` | `true` | See \"CDN and media delivery\". |\n\n## How to spot it\n\n- p99 on `catalog` listing endpoints scales with page size rather than staying\n flat. If 24 items is 200ms and 96 items is 900ms, it is the loop.\n- Database query counts per request in the hundreds.\n- Log lines of the form `pricing lookup for product_id=... (batch disabled)`\n repeating with the same trace id.\n\n## Fixing it\n\n`batch_pricing_enabled` is repo config. Ship it as a PR with a `config` change,\nrun CI, merge, deploy to staging, then production. `catalog` is tier 2 so the\nproduction deploy is a straight 100% deploy - no canary required, though a\ncanary is never wrong.\n\nAfter the deploy, re-measure p99 on a large category page before closing the\nticket.\n\n## Do not\n\n- Do not \"fix\" this by raising `db_pool_size`. That hides the symptom and moves\n the failure to the database.\n- Do not add a per-product cache in front of the loop. The batch query is\n cheaper than the cache lookups it would replace.\n"
24
  },
25
+ {
26
+ "doc_id": 9606,
27
+ "kind": "runbook",
28
+ "title": "Incident response",
29
+ "service": "",
30
+ "author": "Priya Nair",
31
+ "day": 271,
32
+ "body": "# Incident response\n\nThe one runbook everyone is expected to know cold. When an alert fires, follow\nthese steps **in order**. Do not skip ahead to root cause analysis - mitigate\nfirst, understand later.\n\n## The ordered steps\n\n1. **Acknowledge the firing alert.** This tells everyone else the page has an\n owner. An unacknowledged alert is assumed unowned and will escalate.\n2. **Mitigate.** Two levers, in order of preference:\n - `rollback_deployment` if the regression correlates with a deploy. Rollback\n is exempt from staging-first (see \"Deployment policy\").\n - Feature-flag kill switch: `set_feature_flag(..., enabled=false)` in the\n affected environment only. Flags are runtime toggles and need no deploy.\n Mitigation is not the fix. Do not spend twenty minutes writing a patch while\n customers are failing.\n3. **Verify metric recovery.** Read the metric that fired. It must actually be\n back inside its SLO. \"It looks better\" is not verification.\n4. **Resolve the alert.**\n5. **Resolve the incident.**\n6. **Post an update in `#incidents`.** What broke, what you did, current status.\n One paragraph is fine; silence is not.\n7. **Publish a public status-page update** for any customer-visible incident.\n If a customer could have seen an error, a slow page, or a failed order, it is\n customer-visible. When in doubt, publish.\n8. **For sev1, file a postmortem ticket** (type `postmortem`) naming the\n service and the version or flag involved. Sev1 postmortems are due within\n five working days.\n\n## Severity\n\n- **sev1** - money path broken or the whole site is down. `checkout`,\n `payments`, `api-gateway`, `storefront-web` hard-failing. Postmortem\n mandatory.\n- **sev2** - significant degradation, workaround exists, revenue impact\n bounded. Postmortem optional but encouraged.\n- **sev3** - internal or cosmetic, no customer impact.\n\n## Choosing the mitigation\n\n| Signal | Mitigation |\n| ------------------------------------------------- | -------------------- |\n| Regression starts exactly at a deploy timestamp | `rollback_deployment` |\n| Regression tracks a feature-flag rollout percent | Flag kill switch |\n| Config value is obviously wrong in production | Config PR + deploy |\n| Downstream dependency is the one that is unhealthy | Page that team too |\n\nIf the deploy that caused it was a canary, do not promote it - roll the canary\nback and leave production on the previous version.\n\n## Things that go wrong\n\n- Resolving the alert before verifying recovery. It re-fires in four minutes and\n now nobody trusts the alert.\n- Kill-switching a flag in *both* environments when only production is broken.\n Leave staging enabled so you can reproduce.\n- Forgetting the status-page update. Support finds out from customers.\n\n## Related\n\n- \"Deployment policy\", \"Rollback and recovery\", \"On-call and alert triage\".\n"
33
+ },
34
  {
35
  "doc_id": 9607,
36
  "kind": "runbook",
 
120
  "author": "Priya Nair",
121
  "day": 265,
122
  "body": "# Public Orders API\n\nServed by `api-gateway`. Two versions are live: **`/v1/orders` (deprecated)** and\n**`/v2/orders` (current)**. Authentication is a bearer partner token on both.\nRationale for the split is in \"ADR-031: Versioned public API (/v1 to /v2\norders)\".\n\n## Status\n\n| Path | Status | Notes |\n| ------------- | ---------- | -------------------------------------------- |\n| `/v1/orders` | deprecated | Emits `Deprecation` and `Sunset` headers. |\n| `/v2/orders` | current | Use for all new integrations. |\n\nTraffic between the two is weighted at the gateway and shifted in steps of at\nmost 50 percentage points per the \"API deprecation\" runbook. `/v1/orders` may\nonly be retired once it serves 0% of traffic; CI blocks retirement otherwise.\n\n## `GET /v2/orders`\n\nQuery parameters: `status`, `created_after` (RFC3339), `limit` (default 50, max\n200), `cursor`.\n\nResponse `200`:\n\n```json\n{\n \"data\": [\n {\n \"id\": \"ord_01H9Z\",\n \"status\": \"paid\",\n \"created_at\": \"2026-03-04T11:02:19Z\",\n \"currency\": \"USD\",\n \"amount_total_minor\": 12995,\n \"amount_tax_minor\": 1040,\n \"shipments\": [\n {\"id\": \"shp_1\", \"carrier\": \"ups\", \"tracking_number\": \"1Z...\",\n \"line_item_ids\": [\"li_1\", \"li_2\"], \"status\": \"in_transit\"}\n ],\n \"refunds\": [\n {\"id\": \"ref_1\", \"amount_minor\": 2500, \"reason\": \"damaged\",\n \"created_at\": \"2026-03-07T09:11:00Z\"}\n ],\n \"loyalty\": {\"points_earned\": 130, \"points_redeemed\": 0}\n }\n ],\n \"next_cursor\": \"eyJvIjoiMDFIOVoifQ\"\n}\n```\n\n## `POST /v2/orders`\n\nRequest:\n\n```json\n{\n \"idempotency_key\": \"5f2c...\",\n \"customer_id\": \"cus_88\",\n \"currency\": \"USD\",\n \"line_items\": [{\"sku\": \"NC-1042\", \"quantity\": 2, \"unit_price_minor\": 4995}],\n \"shipping_address_id\": \"addr_9\",\n \"loyalty\": {\"points_to_redeem\": 500}\n}\n```\n\n`idempotency_key` is required. Replaying the same key returns the original order\nwith `200` rather than creating a second one.\n\nResponses: `201` created; `409` idempotency key reused with a different body;\n`422` validation failure.\n\n## `/v1/orders` (deprecated)\n\nSame resource, older shape. Differences that break naive migration:\n\n- `total` is a **decimal string** (`\"129.95\"`), not integer minor units.\n- `tracking_number` is a **scalar** on the order; multi-shipment orders report\n only the first.\n- `refunded` is a **boolean**; partial refunds are indistinguishable from full.\n- No `loyalty` object.\n- Offset pagination (`page`, `per_page`) instead of `next_cursor`.\n\n## Migration guidance\n\n1. Parse amounts as integers in minor units; drop all float handling. Multiply\n the old decimal by 100 only at the boundary, never in business logic.\n2. Iterate `shipments` instead of reading `tracking_number`. Single-shipment\n orders return an array of one.\n3. Replace `refunded == true` with `sum(refunds[].amount_minor) > 0`, and\n compare against `amount_total_minor` if you need \"fully refunded\".\n4. Switch pagination to `next_cursor`; do not compute offsets. Cursors are\n opaque - do not parse them.\n5. Handle the problem-details error shape: match on `type`, not on the message\n string.\n6. Send `idempotency_key` on every write.\n\n## Errors\n\n```json\n{\"type\": \"validation_error\", \"title\": \"Invalid line item\",\n \"detail\": \"line_items[0].quantity must be >= 1\", \"status\": 422}\n```\n\n`type` values are stable and safe to branch on: `validation_error`,\n`idempotency_conflict`, `rate_limited`, `not_found`, `internal_error`.\n"
123
+ },
124
+ {
125
+ "doc_id": 9626,
126
+ "kind": "runbook",
127
+ "title": "On-call and alert triage",
128
+ "service": "",
129
+ "author": "Alex Osei",
130
+ "day": 257,
131
+ "body": "# On-call and alert triage\n\nOne rotation per team, weekly, handing over on Monday. Current primaries:\nplatform - Priya Nair; commerce - Diego Ramos; growth - Mei Tanaka; SRE -\nAlex Osei.\n\n## Expectations\n\n- Acknowledge a `critical` page within 5 minutes, `high` within 15, `medium`\n within 60 during working hours.\n- You are expected to mitigate, not to fix. Handing a well-mitigated problem to\n the owning team in the morning is a success, not a failure.\n- If you are stuck for 15 minutes on a customer-impacting issue, escalate. There\n is no prize for solo debugging during an outage.\n\n## Triage order\n\n1. **Is it customer-visible?** Money path or storefront - sev1 or sev2 and you\n follow \"Incident response\" immediately. Internal only - triage calmly.\n2. **Did something change?** Check recent deploys, canary promotions, feature\n flag toggles, and config changes for the service and its dependencies, in that\n order. The overwhelming majority of incidents follow a change within the last\n hour.\n3. **Is it this service or a dependency?** A spike in `checkout` errors with a\n simultaneous spike in `payments` latency is one incident, not two. Follow the\n dependency graph down before paging sideways.\n4. **Mitigate** with the cheapest reversible lever: flag kill switch, then\n rollback, then config change.\n\n## Reading an alert\n\nAn alert names the service, the metric, the observed value, and the SLO:\n\n```\npayments error_rate_pct 4.2 exceeds SLO 1.0\n```\n\nThree questions, in order: when did it start; what changed at that time; is the\nvalue still moving. A metric that is still climbing needs mitigation now. A\nmetric that stepped once and is flat is usually a config or flag state, not a\ndegradation in progress.\n\n## Severity mapping\n\n| Condition | Severity |\n| ----------------------------------------------- | -------- |\n| Orders cannot be placed or paid | sev1 |\n| Storefront down or unusable | sev1 |\n| Degraded but working, bounded revenue impact | sev2 |\n| Internal tooling, no customer impact | sev3 |\n\n## Handover\n\nAt the end of a shift, post in `#incidents`: what fired, what is still open,\nwhat is deliberately being watched, and any change freeze in effect. An\nunrecorded \"I'm keeping an eye on it\" dies with the shift.\n\n## Alert hygiene\n\nAn alert that fires and is resolved with no action taken twice in a month is a\nbad alert. Fix the threshold or delete it. Alert fatigue is how a real page gets\nignored. See \"Observability, SLOs, and alerting\" for how thresholds are set.\n"
132
+ },
133
+ {
134
+ "doc_id": 9630,
135
+ "kind": "onboarding",
136
+ "title": "Service catalog and service tiers",
137
+ "service": "",
138
+ "author": "Mei Tanaka",
139
+ "day": 285,
140
+ "body": "# Service catalog and service tiers\n\nThe full NovaCart fleet, who owns what, and what tier means operationally.\n\n## The fleet\n\n| Service | Team | Tier | Language | Purpose |\n| ---------------- | --------- | ---- | ---------- | -------------------------------------------- |\n| `storefront-web` | growth | 1 | typescript | Customer-facing web storefront (Next.js) |\n| `api-gateway` | platform | 1 | go | Public API edge: routing, auth, rate limits |\n| `checkout` | commerce | 1 | python | Cart and checkout orchestration |\n| `payments` | commerce | 1 | python | Payment capture, refunds, settlement |\n| `catalog` | commerce | 2 | python | Product catalog and pricing |\n| `notifications` | platform | 2 | python | Email, SMS, and push delivery |\n| `search` | growth | 2 | python | Product search and ranking |\n\nOn-call primaries: platform - Priya Nair; commerce - Diego Ramos; growth -\nMei Tanaka; SRE - Alex Osei.\n\n## What tier means\n\n**Tier 1** - a failure directly costs money or breaks the storefront.\n\n- Production deploys must be canaries: `canary_percent <= 25`, then\n `assess_canary`, then `promote_canary`.\n- Paged 24/7 on SLO breach.\n- `db_pool_size >= 20`.\n- Changes require a reviewer outside the authoring pair.\n\n**Tier 2** - a failure degrades the experience but orders still complete.\n\n- Production deploys go straight to 100% after a successful staging deploy.\n- Paged during working hours; critical alerts page out of hours.\n- `db_pool_size >= 20` still applies.\n\nBoth tiers are staging-first without exception. Tier is a property of blast\nradius, not of team seniority or code quality.\n\n## Dependency shape\n\n```\nstorefront-web -> api-gateway -> checkout -> payments -> notifications\n -> search -> catalog\n catalog <- checkout (pricing)\n```\n\nRead it as: a failure in `catalog` shows up as a `checkout` and `search`\nproblem, and a failure in `notifications` should show up nowhere at all, because\ncallers treat it as best-effort. When it does show up in `payments`, that is a\nretry and timeout misconfiguration, not a `notifications` outage - see \"Retry\nand timeout standard\".\n\n## Environments\n\nTwo: `staging` and `production`. Staging carries a sampled copy of production\ncatalog data and synthetic orders. It is not a traffic-realistic environment,\nwhich is exactly why tier-1 services canary in production - see \"ADR-021:\nStandardize on staged canary deploys\".\n\n## Channels\n\n- `#incidents` - incident coordination and status updates.\n- `#security` - advisories and audit notes, CVE ids referenced literally.\n- `#eng` - everything else.\n\n## Adding a service\n\nRegister it with a team, a tier, an owner, both core metrics, at least one SLO,\nand a runbook entry before it takes traffic. See \"Observability, SLOs, and\nalerting\".\n"
141
  }
142
  ]
143
  ```