SamuelChien821 commited on
Commit
f1fab2f
·
verified ·
1 Parent(s): fb87370

DevOpsBench-100 v3.0.0 realism release

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. README.md +4 -4
  2. data/tasks.jsonl +0 -0
  3. realism-standard.json +0 -65
  4. reports/build.json +47 -14
  5. reports/qualification.json +0 -0
  6. task_files/dob100-001-rca-analytics-egress-blocked/01-employee-request.md +1 -0
  7. task_files/dob100-001-rca-analytics-egress-blocked/01-work-ticket.md +0 -151
  8. task_files/dob100-001-rca-analytics-egress-blocked/02-jira-work-item.csv +2 -0
  9. task_files/dob100-001-rca-analytics-egress-blocked/02-service-catalog.csv +0 -14
  10. task_files/dob100-001-rca-analytics-egress-blocked/03-cross-tracker-links.json +7 -0
  11. task_files/dob100-001-rca-analytics-egress-blocked/03-observability.log +0 -12
  12. task_files/dob100-001-rca-analytics-egress-blocked/04-github-issue.json +8 -0
  13. task_files/dob100-001-rca-analytics-egress-blocked/04-incident-room.json +0 -202
  14. task_files/dob100-001-rca-analytics-egress-blocked/05-current-operating-control.pdf +38 -0
  15. task_files/dob100-001-rca-analytics-egress-blocked/05-deployment-state.json +0 -175
  16. task_files/dob100-001-rca-analytics-egress-blocked/06-repository-context.txt +0 -39
  17. task_files/dob100-001-rca-analytics-egress-blocked/06-retired-shortcut-note.pdf +38 -0
  18. task_files/dob100-001-rca-analytics-egress-blocked/07-case-room-thread.json +20 -0
  19. task_files/dob100-001-rca-analytics-egress-blocked/07-ci-and-tests.csv +0 -33
  20. task_files/dob100-001-rca-analytics-egress-blocked/08-data-change-controls.sql +0 -13
  21. task_files/dob100-001-rca-analytics-egress-blocked/08-pagerduty-change-events.csv +2 -0
  22. task_files/dob100-001-rca-analytics-egress-blocked/09-feature-and-security.yaml +0 -181
  23. task_files/dob100-001-rca-analytics-egress-blocked/09-service-owner-register.xlsx +0 -0
  24. task_files/dob100-001-rca-analytics-egress-blocked/10-release-calendar.xlsx +0 -0
  25. task_files/dob100-001-rca-analytics-egress-blocked/10-vendor-trackers.json +0 -194
  26. task_files/dob100-001-rca-analytics-egress-blocked/11-knowledge-base.md +0 -164
  27. task_files/dob100-001-rca-analytics-egress-blocked/11-source-inventory.csv +7 -0
  28. task_files/dob100-001-rca-analytics-egress-blocked/12-chat-and-status.json +0 -126
  29. task_files/dob100-001-rca-analytics-egress-blocked/12-request-email.eml +10 -0
  30. task_files/dob100-001-rca-analytics-egress-blocked/13-approval-and-ownership.md +0 -76
  31. task_files/dob100-001-rca-analytics-egress-blocked/13-former-owner-email.eml +10 -0
  32. task_files/dob100-001-rca-analytics-egress-blocked/14-service-catalog.csv +11 -0
  33. task_files/dob100-001-rca-analytics-egress-blocked/14-tool-contracts.json +0 -460
  34. task_files/dob100-001-rca-analytics-egress-blocked/15-slo-export.csv +2 -0
  35. task_files/dob100-001-rca-analytics-egress-blocked/16-metrics-export.csv +3 -0
  36. task_files/dob100-001-rca-analytics-egress-blocked/17-observability-log-slice.log +1 -0
  37. task_files/dob100-001-rca-analytics-egress-blocked/18-sentry-issues.json +49 -0
  38. task_files/dob100-001-rca-analytics-egress-blocked/19-kubernetes-pods.yaml +5 -0
  39. task_files/dob100-001-rca-analytics-egress-blocked/20-kubernetes-events.log +8 -0
  40. task_files/dob100-001-rca-analytics-egress-blocked/21-deployment-history.json +21 -0
  41. task_files/dob100-001-rca-analytics-egress-blocked/22-ci-runs.csv +3 -0
  42. task_files/dob100-001-rca-analytics-egress-blocked/23-pull-request-context.json +4 -0
  43. task_files/dob100-001-rca-analytics-egress-blocked/24-migration-state.sql +2 -0
  44. task_files/dob100-001-rca-analytics-egress-blocked/25-security-scanner-report.pdf +39 -0
  45. task_files/dob100-001-rca-analytics-egress-blocked/26-approval-policy.md +3 -0
  46. task_files/dob100-001-rca-analytics-egress-blocked/27-current-versus-stale-notes.txt +1 -0
  47. task_files/dob100-001-rca-analytics-egress-blocked/28-agent-visible-asset-manifest.json +142 -0
  48. task_files/dob100-002-rca-analytics-revoked-grant/01-employee-request.md +1 -0
  49. task_files/dob100-002-rca-analytics-revoked-grant/01-work-ticket.md +0 -151
  50. task_files/dob100-002-rca-analytics-revoked-grant/02-jira-work-item.csv +2 -0
README.md CHANGED
@@ -31,10 +31,10 @@ PagerDuty, Confluence, spreadsheets) and Kubernetes.
31
 
32
  Tasks are outcome-only tickets (symptom + definition of done; company policy
33
  lives in the world's knowledge base, not the prompt). Reference trajectories
34
- run 4-35 tool calls (median 13), with
35
  100/100 distinct tool-name sequences. Every task publishes 14 task-scoped
36
  initial-state views, three operational alternatives, and
37
- 59-86 explicit
38
  vcode/evidence/containment criteria.
39
  Acceptance is fully deterministic: each task ships an executable vcode
40
  verifier that checks the final world state and the append-only audit log,
@@ -88,8 +88,8 @@ reward path.
88
  | Tasks | 100 | 100 |
89
  | High-level unique employee requests | 100 | 100 |
90
  | Unique reference tool sequences | 100 | 100 |
91
- | Inspectable assets per task | >=12 | 14 |
92
- | Public criteria per task | >=40 | 59-86 |
93
  | Oracle replays at reward 1.0 | 100/100 | see `reports/qualification.json` |
94
  | Deterministic verifier replays | 100/100 | see `reports/qualification.json` |
95
  | Negative-control false accepts | 0 | see `reports/qualification.json` |
 
31
 
32
  Tasks are outcome-only tickets (symptom + definition of done; company policy
33
  lives in the world's knowledge base, not the prompt). Reference trajectories
34
+ run 27-58 tool calls (median 37), with
35
  100/100 distinct tool-name sequences. Every task publishes 14 task-scoped
36
  initial-state views, three operational alternatives, and
37
+ 71-86 explicit
38
  vcode/evidence/containment criteria.
39
  Acceptance is fully deterministic: each task ships an executable vcode
40
  verifier that checks the final world state and the append-only audit log,
 
88
  | Tasks | 100 | 100 |
89
  | High-level unique employee requests | 100 | 100 |
90
  | Unique reference tool sequences | 100 | 100 |
91
+ | Inspectable assets per task | >=12 | 28 |
92
+ | Public criteria per task | >=40 | 71-86 |
93
  | Oracle replays at reward 1.0 | 100/100 | see `reports/qualification.json` |
94
  | Deterministic verifier replays | 100/100 | see `reports/qualification.json` |
95
  | Negative-control false accepts | 0 | see `reports/qualification.json` |
data/tasks.jsonl CHANGED
The diff for this file is too large to render. See raw diff
 
realism-standard.json DELETED
@@ -1,65 +0,0 @@
1
- {
2
- "schemaVersion": "blobfish.benchmark-realism-standard.v1",
3
- "name": "Blobfish Enterprise Benchmark Realism Standard",
4
- "effectiveDate": "2026-08-28",
5
- "scope": "Every Blobfish-authored first-party task and companion task layer published on /benchmarks.",
6
- "requirements": {
7
- "employeeRequest": {
8
- "minimumWords": 40,
9
- "maximumWords": 200,
10
- "exactDuplicatesAllowed": 0,
11
- "maximumPairwiseFiveShingleJaccard": 0.8,
12
- "proceduralRecipeAllowed": false,
13
- "harnessSyntaxAllowed": false,
14
- "gradingLanguageAllowed": false
15
- },
16
- "workflow": {
17
- "distinctReferenceToolSequences": true,
18
- "minimumEvidenceSystems": 3,
19
- "exactCallOrderGraded": false,
20
- "readBeforeWriteWhenApplicable": true
21
- },
22
- "assetRoom": {
23
- "minimumFilesPerTask": 12,
24
- "minimumFileKindsPerTask": 6,
25
- "fileKindDefinition": "A distinct released serialization format or independently identified source-record role.",
26
- "requiresStructuredData": true,
27
- "requiresSpreadsheet": true,
28
- "requiresDocument": true,
29
- "requiresCommunicationRecord": true
30
- },
31
- "rubric": {
32
- "minimumCriteriaPerTask": 40,
33
- "requiredCategories": [
34
- "investigation",
35
- "correlation",
36
- "decision",
37
- "state",
38
- "answer",
39
- "containment"
40
- ],
41
- "minimumDecisionOptions": 3,
42
- "deterministic": true,
43
- "llmJudgeCalls": 0
44
- },
45
- "sandbox": {
46
- "isolatedStartingState": true,
47
- "statefulMcp": true,
48
- "verifierHiddenFromAgent": true,
49
- "providerContractDisclosureRequired": true,
50
- "unsupportedOneToOneProviderClaimsAllowed": false
51
- },
52
- "qualification": {
53
- "oracleCoverage": "all released tasks",
54
- "deterministicReplayCoverage": "all released tasks",
55
- "negativeControlsRequired": true,
56
- "falseAcceptsAllowed": 0
57
- },
58
- "leaderboard": {
59
- "partialRunRankedAsReleaseResult": false,
60
- "staleReleaseRunRankedAsCurrent": false,
61
- "modelRowRequiresExactReleaseAndFullTaskCoverage": true,
62
- "referenceControlsRankedAsModels": false
63
- }
64
- }
65
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
reports/build.json CHANGED
@@ -1,8 +1,10 @@
1
  {
 
 
2
  "assets_per_task": {
3
- "max": 14,
4
- "median": 14,
5
- "min": 14
6
  },
7
  "benchmark": "DevOpsBench-100",
8
  "categories": {
@@ -29,8 +31,8 @@
29
  "category_count": 19,
30
  "criteria_per_task": {
31
  "max": 86,
32
- "median": 72,
33
- "min": 59
34
  },
35
  "decision_options_per_task": 3,
36
  "difficulties": {
@@ -39,32 +41,63 @@
39
  "hard": 31,
40
  "medium": 29
41
  },
 
 
 
 
 
42
  "exact_duplicate_prompts": 0,
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  "prompt_words": {
44
- "max": 180,
45
- "median": 76,
46
- "min": 45
47
  },
48
  "quality_gates": {
 
 
49
  "deep_task_assets": true,
50
  "high_level_prompt_length": true,
 
51
  "high_level_prompts_unique": true,
 
 
 
52
  "no_harness_or_grading_leakage_in_prompts": true,
53
  "one_hundred_tasks": true,
 
 
54
  "specific_public_criteria": true,
55
  "three_options_one_selected": true,
56
- "unique_reference_tool_sequences": true
 
57
  },
 
58
  "reference_tool_calls": {
59
- "max": 35,
60
- "median": 13,
61
- "min": 4,
62
- "total": 1346
63
  },
64
  "release_passed": true,
65
  "schema_version": "1.0",
 
66
  "task_count": 100,
 
67
  "unique_reference_tool_name_sequences": 100,
 
68
  "verifier": {
69
  "deterministic": true,
70
  "model_calls": 0,
@@ -72,7 +105,7 @@
72
  "random_calls": 0,
73
  "wall_clock_reads": 0
74
  },
75
- "version": "2.0.0",
76
  "world_commits": 417,
77
  "world_documents": 30,
78
  "world_seeded_rows": 1451,
 
1
  {
2
+ "agent_visible_asset_count": 2800,
3
+ "asset_leakage_hits": [],
4
  "assets_per_task": {
5
+ "max": 28,
6
+ "median": 28,
7
+ "min": 28
8
  },
9
  "benchmark": "DevOpsBench-100",
10
  "categories": {
 
31
  "category_count": 19,
32
  "criteria_per_task": {
33
  "max": 86,
34
+ "median": 78,
35
+ "min": 71
36
  },
37
  "decision_options_per_task": 3,
38
  "difficulties": {
 
41
  "hard": 31,
42
  "medium": 29
43
  },
44
+ "evidence_reads_per_task": {
45
+ "max": 25,
46
+ "median": 22,
47
+ "min": 20
48
+ },
49
  "exact_duplicate_prompts": 0,
50
+ "native_asset_formats": [
51
+ "csv",
52
+ "eml",
53
+ "json",
54
+ "log",
55
+ "md",
56
+ "pdf",
57
+ "sql",
58
+ "txt",
59
+ "xlsx",
60
+ "yaml"
61
+ ],
62
+ "prompt_max_pairwise_jaccard": 0.709924,
63
  "prompt_words": {
64
+ "max": 219,
65
+ "median": 129,
66
+ "min": 98
67
  },
68
  "quality_gates": {
69
+ "all_agent_visible_assets_unique": true,
70
+ "deep_causal_evidence_reads": true,
71
  "deep_task_assets": true,
72
  "high_level_prompt_length": true,
73
+ "high_level_prompt_similarity": true,
74
  "high_level_prompts_unique": true,
75
+ "long_horizon_reference": true,
76
+ "native_asset_formats": true,
77
+ "no_gold_or_recipe_leakage_in_assets": true,
78
  "no_harness_or_grading_leakage_in_prompts": true,
79
  "one_hundred_tasks": true,
80
+ "reference_tool_sequence_similarity": true,
81
+ "semantic_action_graph_similarity": true,
82
  "specific_public_criteria": true,
83
  "three_options_one_selected": true,
84
+ "unique_reference_tool_sequences": true,
85
+ "unique_semantic_action_graphs": true
86
  },
87
+ "reference_sequence_max_pairwise_similarity": 0.96,
88
  "reference_tool_calls": {
89
+ "max": 58,
90
+ "median": 37,
91
+ "min": 27,
92
+ "total": 3716
93
  },
94
  "release_passed": true,
95
  "schema_version": "1.0",
96
+ "semantic_graph_max_pairwise_jaccard": 0.1,
97
  "task_count": 100,
98
+ "unique_agent_visible_assets": 2800,
99
  "unique_reference_tool_name_sequences": 100,
100
+ "unique_semantic_action_graphs": 100,
101
  "verifier": {
102
  "deterministic": true,
103
  "model_calls": 0,
 
105
  "random_calls": 0,
106
  "wall_clock_reads": 0
107
  },
108
+ "version": "3.0.0",
109
  "world_commits": 417,
110
  "world_documents": 30,
111
  "world_seeded_rows": 1451,
reports/qualification.json CHANGED
The diff for this file is too large to render. See raw diff
 
task_files/dob100-001-rca-analytics-egress-blocked/01-employee-request.md ADDED
@@ -0,0 +1 @@
 
 
1
+ Customer support escalated a morning reliability review after two dashboards disagreed. Keep this to an investigation; production should remain unchanged. OPS-163 — Root cause: analytics connections are refused, not slow Get to the bottom of analytics-connection-refused: not just which service, but the mechanism and the exact setting responsible. The service's own code is not necessarily where this lives — confirm it against the state of the system rather than inferring it from the symptom alone. Leave an audit-ready diagnosis for 'analytics-connection-refused' that names the responsible service, the fault type, the offending key, and your evidence. The work item is DOB-001 for analytics-worker. Its business boundary is reporting freshness, warehouse replica access, scheduled rollups, and downstream decision data. The disputed mechanism is outbound connectivity, DNS reachability, firewall policy, and dependency access. Reconcile current authority with live state, make only supported changes, and leave a case-room handoff that you have reopened and verified.
task_files/dob100-001-rca-analytics-egress-blocked/01-work-ticket.md DELETED
@@ -1,151 +0,0 @@
1
- # 01 Work Ticket
2
-
3
- ## tickets (187 rows)
4
-
5
- ```json
6
- [
7
- {
8
- "ticket_id": 9103,
9
- "key": "ENG-2103",
10
- "type": "bug",
11
- "title": "Analytics worker restarting under queue load",
12
- "description": "analytics-worker error_rate_pct is 6.0% against a 2.0% SLO (alarm 9609) Investigate the root cause, ship the fix through the standard workflow, and follow the deployment policy.",
13
- "status": "open",
14
- "priority": "high",
15
- "assignee": "",
16
- "service": "analytics-worker"
17
- },
18
- {
19
- "ticket_id": 9108,
20
- "key": "ENG-2108",
21
- "type": "bug",
22
- "title": "Analytics rollups run in batches large enough to amplify memory pressure",
23
- "description": "large rollup batches amplify memory pressure on the consumer Investigate the root cause, ship the fix through the standard workflow, and follow the deployment policy.",
24
- "status": "open",
25
- "priority": "low",
26
- "assignee": "",
27
- "service": "analytics-worker"
28
- },
29
- {
30
- "ticket_id": 9143,
31
- "key": "ENG-2506",
32
- "type": "bug",
33
- "title": "Fix flaky test_rollup_window",
34
- "description": "test_rollup_window fails intermittently in CI: the rollup window boundary is computed from the current clock.",
35
- "status": "open",
36
- "priority": "medium",
37
- "assignee": "",
38
- "service": "analytics-worker"
39
- },
40
- {
41
- "ticket_id": 9158,
42
- "key": "OPS-113",
43
- "type": "incident",
44
- "title": "Localize alarm 9609 (analytics-worker errors)",
45
- "description": "Alarm 9609 is firing. Identify the responsible service and report the finding with submit_diagnosis. Read-only investigation.",
46
- "status": "open",
47
- "priority": "high",
48
- "assignee": "",
49
- "service": "analytics-worker"
50
- },
51
- {
52
- "ticket_id": 9170,
53
- "key": "OPS-160",
54
- "type": "incident",
55
- "title": "Root cause: analytics cannot read the replica since the rotation",
56
- "description": "Perform a root-cause analysis for analytics-cannot-read-replica and report service, fault type and the offending key with submit_diagnosis. Read-only investigation.",
57
- "status": "open",
58
- "priority": "critical",
59
- "assignee": "",
60
- "service": "analytics-worker"
61
- },
62
- {
63
- "ticket_id": 9173,
64
- "key": "OPS-163",
65
- "type": "incident",
66
- "title": "Root cause: analytics connections are refused, not slow",
67
- "description": "Perform a root-cause analysis for analytics-connection-refused and report service, fault type and the offending key with submit_diagnosis. Read-only investigation.",
68
- "status": "open",
69
- "priority": "critical",
70
- "assignee": "",
71
- "service": "analytics-worker"
72
- },
73
- {
74
- "ticket_id": 9175,
75
- "key": "OPS-151",
76
- "type": "incident",
77
- "title": "Root cause: the nightly reconciliation never runs",
78
- "description": "Perform a root-cause analysis for analytics-recon-never-runs and report service, fault type and the offending key with submit_diagnosis. Read-only investigation.",
79
- "status": "open",
80
- "priority": "high",
81
- "assignee": "",
82
- "service": "analytics-worker"
83
- },
84
- {
85
- "ticket_id": 9200,
86
- "key": "OPS-116",
87
- "type": "incident",
88
- "title": "Localize alarm 9609 \u2014 the error tracker shows nothing",
89
- "description": "Alarm 9609 is firing. Identify the responsible service and report the finding with submit_diagnosis. Read-only investigation.",
90
- "status": "open",
91
- "priority": "critical",
92
- "assignee": "",
93
- "service": "analytics-worker"
94
- },
95
- {
96
- "ticket_id": 9209,
97
- "key": "OPS-302",
98
- "type": "incident",
99
- "title": "Decide the remediation for the analytics crashloop",
100
- "description": "analytics-worker is being OOMKilled and is in CrashLoopBackOff. Four remediations have been proposed.",
101
- "status": "open",
102
- "priority": "high",
103
- "assignee": "",
104
- "service": ""
105
- },
106
- {
107
- "ticket_id": 9212,
108
- "key": "SEC-908",
109
- "type": "security",
110
- "title": "Rotate the exposed partner API credential",
111
- "description": "The partner API key was committed to the monorepo, so it must be treated as compromised and rotated in production. Rotation invalidates every existing partner session immediately and cannot be undone - a mistake locks partners out of production until a new key is issued.",
112
- "status": "open",
113
- "priority": "critical",
114
- "assignee": "",
115
- "service": "checkout"
116
- },
117
- {
118
- "ticket_id": 9213,
119
- "key": "SLO-7100",
120
- "type": "task",
121
- "title": "Is analytics-worker meeting its errors objective?",
122
- "description": "Is analytics-worker meeting its errors objective?",
123
- "status": "open",
124
- "priority": "medium",
125
- "assignee": "",
126
- "service": "analytics-worker"
127
- },
128
- {
129
- "ticket_id": 9225,
130
- "key": "QA-7200",
131
- "type": "task",
132
- "title": "Is test_rollup_window intermittent, or did it fail for a reason?",
133
- "description": "Is test_rollup_window intermittent, or did it fail for a reason?",
134
- "status": "open",
135
- "priority": "medium",
136
- "assignee": "",
137
- "service": "analytics-worker"
138
- },
139
- {
140
- "ticket_id": 9248,
141
- "key": "SUP-7500",
142
- "type": "task",
143
- "title": "Customer report: the numbers in this morning's report do not add up",
144
- "description": "Customer report: the numbers in this morning's report do not add up",
145
- "status": "open",
146
- "priority": "high",
147
- "assignee": "",
148
- "service": "analytics-worker"
149
- }
150
- ]
151
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
task_files/dob100-001-rca-analytics-egress-blocked/02-jira-work-item.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ assignee,component,created_day,issue_type,key,priority,project,resolution,status,summary,updated_day
2
+ on-call,analytics-worker,94,Task,DOB-001,High,DOB,,In Progress,"This is an investigation, not a change.",100
task_files/dob100-001-rca-analytics-egress-blocked/02-service-catalog.csv DELETED
@@ -1,14 +0,0 @@
1
- source_table,depends_on,description,environment,key,kind,language,name,repo_version,service,service_id,team,tier,value
2
- services,,Consumes the event queue and builds analytics rollups.,,,worker,python,analytics-worker,v2.1.7,,9010,platform,3,
3
- service_dependencies,pg-replica,,,,database,,,,search,,,,
4
- service_dependencies,rabbitmq,,,,queue,,,,analytics-worker,,,,
5
- env_state,,,staging,cdn_enabled,config,,,,catalog,,,,true
6
- env_state,,,production,cdn_enabled,config,,,,catalog,,,,true
7
- env_state,,,staging,prefetch_count,config,,,,analytics-worker,,,,0
8
- env_state,,,production,prefetch_count,config,,,,analytics-worker,,,,0
9
- env_state,,,staging,batch_size,config,,,,analytics-worker,,,,500
10
- env_state,,,production,batch_size,config,,,,analytics-worker,,,,500
11
- env_state,,,staging,rollup_daily,module,,,,analytics-worker,,,,present
12
- env_state,,,production,rollup_daily,module,,,,analytics-worker,,,,present
13
- env_state,,,staging,current,version,,,,analytics-worker,,,,v2.1.7
14
- env_state,,,production,current,version,,,,analytics-worker,,,,v2.1.7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
task_files/dob100-001-rca-analytics-egress-blocked/03-cross-tracker-links.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "kind": "relates",
4
+ "source": "DOB-001",
5
+ "target": "GH-9001"
6
+ }
7
+ ]
task_files/dob100-001-rca-analytics-egress-blocked/03-observability.log DELETED
@@ -1,12 +0,0 @@
1
- {"environment": "production", "metric": "error_rate_pct", "service": "analytics-worker", "source_table": "service_metrics", "value": 6.0}
2
- {"environment": "production", "metric": "latency_p99_ms", "service": "analytics-worker", "source_table": "service_metrics", "value": 300.0}
3
- {"environment": "production", "level": "ERROR", "log_id": 9021, "message": "consumer restarted after MemoryError; prefetch_count=0 means unlimited prefetch from rabbitmq", "service": "analytics-worker", "source_table": "logs"}
4
- {"culprit": "src/analytics/consumer.py in run", "event_id": 5, "events": 1180, "fingerprint": "ana-oom", "service": "analytics-worker", "source_table": "error_events", "status": "unresolved", "title": "MemoryError: consumer restarted after OOM"}
5
- {"counter_reset": 0, "day": 418, "label_env": "production", "label_service": "checkout_service", "metric": "http_requests_total:rate5m", "series_id": 1, "source_table": "prom_series", "value": 138.0}
6
- {"counter_reset": 0, "day": 419, "label_env": "production", "label_service": "checkout_service", "metric": "http_requests_total:rate5m", "series_id": 2, "source_table": "prom_series", "value": 141.0}
7
- {"counter_reset": 0, "day": 420, "label_env": "production", "label_service": "checkout_service", "metric": "http_requests_total:rate5m", "series_id": 3, "source_table": "prom_series", "value": 139.0}
8
- {"counter_reset": 0, "day": 418, "label_env": "production", "label_service": "checkout_service", "metric": "http_errors_total:rate5m", "series_id": 4, "source_table": "prom_series", "value": 7.6}
9
- {"events": 2317, "first_seen_day": 410, "issue_id": "CHECKOUT-1A", "last_seen_day": 420, "level": "error", "project_slug": "checkout-web", "source_table": "sentry_issues", "status": "unresolved", "title": "TypeError: NoneType has no attribute 'amount'", "users_affected": 890}
10
- {"events": 1904, "first_seen_day": 409, "issue_id": "CHECKOUT-2B", "last_seen_day": 420, "level": "error", "project_slug": "checkout-web", "source_table": "sentry_issues", "status": "unresolved", "title": "TimeoutError: payments call exceeded 8000ms", "users_affected": 1502}
11
- {"events": 18422, "first_seen_day": 405, "issue_id": "PAY-9C", "last_seen_day": 420, "level": "error", "project_slug": "payments-backend", "source_table": "sentry_issues", "status": "unresolved", "title": "ConnectionTimeout: notifications call exceeded 30000ms", "users_affected": 6210}
12
- {"events": 640, "first_seen_day": 414, "issue_id": "SRCH-3D", "last_seen_day": 419, "level": "warning", "project_slug": "search", "source_table": "sentry_issues", "status": "resolved", "title": "IndexRefreshTimeout", "users_affected": 210}
 
 
 
 
 
 
 
 
 
 
 
 
 
task_files/dob100-001-rca-analytics-egress-blocked/04-github-issue.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "created_day": 95,
3
+ "labels": "aiops_analysis,needs-correlation",
4
+ "number": 9001,
5
+ "repo": "novacart/analytics-worker",
6
+ "state": "open",
7
+ "title": "Operational evidence for DOB-001"
8
+ }
task_files/dob100-001-rca-analytics-egress-blocked/04-incident-room.json DELETED
@@ -1,202 +0,0 @@
1
- {
2
- "sources": [
3
- {
4
- "columns": [
5
- "incident_id",
6
- "severity",
7
- "title",
8
- "service",
9
- "status",
10
- "commander"
11
- ],
12
- "row_count": 3,
13
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
14
- "table": "incidents",
15
- "task_relevant_rows": [
16
- {
17
- "commander": "",
18
- "incident_id": 9701,
19
- "service": "api-gateway",
20
- "severity": "sev1",
21
- "status": "open",
22
- "title": "API gateway latency surge after v5.1.0 rollout"
23
- },
24
- {
25
- "commander": "",
26
- "incident_id": 9702,
27
- "service": "checkout",
28
- "severity": "sev2",
29
- "status": "open",
30
- "title": "Checkout error spike since instant_refunds ramp"
31
- },
32
- {
33
- "commander": "",
34
- "incident_id": 9703,
35
- "service": "inventory",
36
- "severity": "sev2",
37
- "status": "open",
38
- "title": "Inventory reservation failures during peak"
39
- }
40
- ]
41
- },
42
- {
43
- "columns": [
44
- "alert_id",
45
- "service",
46
- "metric",
47
- "severity",
48
- "status",
49
- "message"
50
- ],
51
- "row_count": 10,
52
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
53
- "table": "alerts",
54
- "task_relevant_rows": [
55
- {
56
- "alert_id": 9609,
57
- "message": "analytics-worker error_rate_pct 6.0 exceeds SLO 2.0",
58
- "metric": "error_rate_pct",
59
- "service": "analytics-worker",
60
- "severity": "medium",
61
- "status": "firing"
62
- }
63
- ]
64
- },
65
- {
66
- "columns": [
67
- "incident_number",
68
- "title",
69
- "pd_service_id",
70
- "urgency",
71
- "priority",
72
- "status",
73
- "created_day",
74
- "resolved_day"
75
- ],
76
- "row_count": 7,
77
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
78
- "table": "pd_incidents",
79
- "task_relevant_rows": [
80
- {
81
- "created_day": 411,
82
- "incident_number": 5101,
83
- "pd_service_id": "PSVC001",
84
- "priority": "P2",
85
- "resolved_day": 412,
86
- "status": "resolved",
87
- "title": "Elevated checkout latency",
88
- "urgency": "high"
89
- },
90
- {
91
- "created_day": 414,
92
- "incident_number": 5102,
93
- "pd_service_id": "PSVC002",
94
- "priority": "P1",
95
- "resolved_day": null,
96
- "status": "triggered",
97
- "title": "Payments error rate above SLO",
98
- "urgency": "high"
99
- },
100
- {
101
- "created_day": 416,
102
- "incident_number": 5103,
103
- "pd_service_id": "PSVC003",
104
- "priority": "P1",
105
- "resolved_day": null,
106
- "status": "acknowledged",
107
- "title": "Gateway latency surge after release",
108
- "urgency": "high"
109
- },
110
- {
111
- "created_day": 414,
112
- "incident_number": 5104,
113
- "pd_service_id": "PSVC004",
114
- "priority": "P4",
115
- "resolved_day": 415,
116
- "status": "resolved",
117
- "title": "Search index refresh lag",
118
- "urgency": "low"
119
- }
120
- ]
121
- },
122
- {
123
- "columns": [
124
- "pd_service_id",
125
- "name",
126
- "escalation_policy",
127
- "status"
128
- ],
129
- "row_count": 5,
130
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
131
- "table": "pd_services",
132
- "task_relevant_rows": [
133
- {
134
- "escalation_policy": "EP-Commerce",
135
- "name": "checkout-api",
136
- "pd_service_id": "PSVC001",
137
- "status": "active"
138
- },
139
- {
140
- "escalation_policy": "EP-Commerce",
141
- "name": "payments-api",
142
- "pd_service_id": "PSVC002",
143
- "status": "active"
144
- },
145
- {
146
- "escalation_policy": "EP-Platform",
147
- "name": "edge-gateway",
148
- "pd_service_id": "PSVC003",
149
- "status": "active"
150
- },
151
- {
152
- "escalation_policy": "EP-Growth",
153
- "name": "search-svc",
154
- "pd_service_id": "PSVC004",
155
- "status": "active"
156
- }
157
- ]
158
- },
159
- {
160
- "columns": [
161
- "schedule_id",
162
- "schedule_name",
163
- "escalation_policy",
164
- "user_name",
165
- "day"
166
- ],
167
- "row_count": 4,
168
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
169
- "table": "pd_oncall",
170
- "task_relevant_rows": [
171
- {
172
- "day": 418,
173
- "escalation_policy": "EP-Commerce",
174
- "schedule_id": "SCHED-COM",
175
- "schedule_name": "Commerce primary",
176
- "user_name": "Diego Ramos"
177
- },
178
- {
179
- "day": 419,
180
- "escalation_policy": "EP-Commerce",
181
- "schedule_id": "SCHED-COM",
182
- "schedule_name": "Commerce primary",
183
- "user_name": "Diego Ramos"
184
- },
185
- {
186
- "day": 419,
187
- "escalation_policy": "EP-Platform",
188
- "schedule_id": "SCHED-PLT",
189
- "schedule_name": "Platform primary",
190
- "user_name": "Priya Nair"
191
- },
192
- {
193
- "day": 419,
194
- "escalation_policy": "EP-Growth",
195
- "schedule_id": "SCHED-GRW",
196
- "schedule_name": "Growth primary",
197
- "user_name": "Mei Tanaka"
198
- }
199
- ]
200
- }
201
- ]
202
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
task_files/dob100-001-rca-analytics-egress-blocked/05-current-operating-control.pdf ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ %PDF-1.4
2
+ %����
3
+ 1 0 obj
4
+ << /Type /Catalog /Pages 2 0 R >>
5
+ endobj
6
+ 2 0 obj
7
+ << /Type /Pages /Kids [3 0 R] /Count 1 >>
8
+ endobj
9
+ 3 0 obj
10
+ << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Resources << /Font << /F1 5 0 R >> >> /Contents 4 0 R >>
11
+ endobj
12
+ 4 0 obj
13
+ << /Length 141 >>
14
+ stream
15
+ BT
16
+ /F1 9 Tf
17
+ 54 750 Td
18
+ 11 TL
19
+ (Control OPS-CONTROL-2026.03 is effective for DOB-001 and supersedes OPS-CONTROL-2025.11. Establish identi) Tj
20
+ ET
21
+ endstream
22
+ endobj
23
+ 5 0 obj
24
+ << /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>
25
+ endobj
26
+ xref
27
+ 0 6
28
+ 0000000000 65535 f
29
+ 0000000015 00000 n
30
+ 0000000064 00000 n
31
+ 0000000121 00000 n
32
+ 0000000247 00000 n
33
+ 0000000439 00000 n
34
+ trailer
35
+ << /Size 6 /Root 1 0 R >>
36
+ startxref
37
+ 509
38
+ %%EOF
task_files/dob100-001-rca-analytics-egress-blocked/05-deployment-state.json DELETED
@@ -1,175 +0,0 @@
1
- {
2
- "sources": [
3
- {
4
- "columns": [
5
- "deployment_id",
6
- "service",
7
- "environment",
8
- "version",
9
- "status",
10
- "canary_percent"
11
- ],
12
- "row_count": 22,
13
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
14
- "table": "deployments",
15
- "task_relevant_rows": [
16
- {
17
- "canary_percent": 100,
18
- "deployment_id": 9271,
19
- "environment": "staging",
20
- "service": "analytics-worker",
21
- "status": "succeeded",
22
- "version": "v2.1.7"
23
- },
24
- {
25
- "canary_percent": 100,
26
- "deployment_id": 9272,
27
- "environment": "production",
28
- "service": "analytics-worker",
29
- "status": "succeeded",
30
- "version": "v2.1.7"
31
- }
32
- ]
33
- },
34
- {
35
- "columns": [
36
- "route_id",
37
- "service",
38
- "route",
39
- "rps",
40
- "share_pct"
41
- ],
42
- "row_count": 13,
43
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
44
- "table": "traffic_profile",
45
- "task_relevant_rows": [
46
- {
47
- "route": "queue:events",
48
- "route_id": 9213,
49
- "rps": 900,
50
- "service": "analytics-worker",
51
- "share_pct": 100
52
- }
53
- ]
54
- },
55
- {
56
- "columns": [
57
- "service",
58
- "desired_replicas",
59
- "ready_replicas",
60
- "strategy",
61
- "storage_class"
62
- ],
63
- "row_count": 10,
64
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
65
- "table": "k8s_deployments",
66
- "task_relevant_rows": [
67
- {
68
- "desired_replicas": 2,
69
- "ready_replicas": 1,
70
- "service": "analytics-worker",
71
- "storage_class": "standard",
72
- "strategy": "RollingUpdate"
73
- }
74
- ]
75
- },
76
- {
77
- "columns": [
78
- "pod",
79
- "namespace",
80
- "service",
81
- "image_tag",
82
- "phase",
83
- "restarts",
84
- "memory_limit_mb",
85
- "memory_usage_mb",
86
- "node",
87
- "pending_reason"
88
- ],
89
- "row_count": 14,
90
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
91
- "table": "k8s_pods",
92
- "task_relevant_rows": [
93
- {
94
- "image_tag": "v2.1.7",
95
- "memory_limit_mb": 512,
96
- "memory_usage_mb": 511,
97
- "namespace": "production",
98
- "node": "node-a1",
99
- "pending_reason": "",
100
- "phase": "CrashLoopBackOff",
101
- "pod": "analytics-worker-7d9f-x2k1",
102
- "restarts": 47,
103
- "service": "analytics-worker"
104
- },
105
- {
106
- "image_tag": "v2.1.7",
107
- "memory_limit_mb": 512,
108
- "memory_usage_mb": 498,
109
- "namespace": "production",
110
- "node": "node-a1",
111
- "pending_reason": "",
112
- "phase": "Running",
113
- "pod": "analytics-worker-7d9f-m4p8",
114
- "restarts": 39,
115
- "service": "analytics-worker"
116
- },
117
- {
118
- "image_tag": "v2.1.7",
119
- "memory_limit_mb": 512,
120
- "memory_usage_mb": 0,
121
- "namespace": "production",
122
- "node": "",
123
- "pending_reason": "0/4 nodes are available: 1 node(s) had untolerated taint {workload: batch}, 3 node(s) didn't match Pod's node affinity/selector",
124
- "phase": "Pending",
125
- "pod": "analytics-recon-6a1b-jj10",
126
- "restarts": 0,
127
- "service": "analytics-worker"
128
- }
129
- ]
130
- },
131
- {
132
- "columns": [
133
- "event_id",
134
- "namespace",
135
- "pod",
136
- "reason",
137
- "message",
138
- "count",
139
- "day"
140
- ],
141
- "row_count": 8,
142
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
143
- "table": "k8s_events",
144
- "task_relevant_rows": [
145
- {
146
- "count": 47,
147
- "day": 419,
148
- "event_id": 9001,
149
- "message": "Container analytics exceeded its memory limit of 512Mi and was killed",
150
- "namespace": "production",
151
- "pod": "analytics-worker-7d9f-x2k1",
152
- "reason": "OOMKilled"
153
- },
154
- {
155
- "count": 47,
156
- "day": 419,
157
- "event_id": 9002,
158
- "message": "Back-off restarting failed container analytics",
159
- "namespace": "production",
160
- "pod": "analytics-worker-7d9f-x2k1",
161
- "reason": "CrashLoopBackOff"
162
- },
163
- {
164
- "count": 39,
165
- "day": 420,
166
- "event_id": 9003,
167
- "message": "Container analytics exceeded its memory limit of 512Mi and was killed",
168
- "namespace": "production",
169
- "pod": "analytics-worker-7d9f-m4p8",
170
- "reason": "OOMKilled"
171
- }
172
- ]
173
- }
174
- ]
175
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
task_files/dob100-001-rca-analytics-egress-blocked/06-repository-context.txt DELETED
@@ -1,39 +0,0 @@
1
- {"content": "\"\"\"Per-client rate limiting at the API gateway edge.\"\"\"\n\n\nclass TokenBucket:\n def __init__(self, capacity, refill_per_sec):\n raise NotImplementedError\n\n def allow(self, now_ms):\n \"\"\"True if a request may proceed, consuming one token.\"\"\"\n raise NotImplementedError\n", "file_id": 4, "language": "python", "loc": 10, "owner": "", "path": "src/gateway/token_bucket.py", "service": "api-gateway", "source_table": "repo_files"}
2
- {"content": "\"\"\"Client for the notifications service.\n\npayments calls notifications synchronously after a capture succeeds; a\npermanent failure here fails the payment (see ``payments.capture``).\n\"\"\"\nfrom __future__ import annotations\n\nimport logging\nimport time\nimport uuid\n\nimport requests\n\nfrom payments import settings\n\nlog = logging.getLogger(__name__)\n\nNOTIFICATIONS_BASE_URL = settings.get(\"notifications_base_url\")\nNOTIFICATIONS_TIMEOUT_MS = settings.get(\"notifications_timeout_ms\")\n\n# NOTE(dramos): the tenacity retry wrapper around _post() was removed to hit the\n# Q3 receipt-latency deadline -- backoff sleeps were showing up in payments p99.\n# The knob stayed in config. It is 0 today, so _post() gets exactly one attempt\n# and a single downstream timeout permanently fails the order.\nNOTIFICATIONS_RETRY_MAX_ATTEMPTS = settings.get(\"notifications_retry_max_attempts\")\n\n\nclass PaymentNotificationError(RuntimeError):\n \"\"\"The receipt notification could not be delivered.\"\"\"\n\n\ndef _post(path, payload, correlation_id):\n return requests.post(\n \"%s%s\" % (NOTIFICATIONS_BASE_URL, path),\n json=payload,\n timeout=NOTIFICATIONS_TIMEOUT_MS / 1000.0,\n headers={\"X-Correlation-Id\": correlation_id, \"X-Source\": \"payments\"},\n )\n\n\ndef send_receipt(order_id, customer_email, amount_cents, currency=\"USD\"):\n \"\"\"Deliver a receipt. Raises PaymentNotificationError if it cannot.\"\"\"\n correlation_id = str(uuid.uuid4())\n payload = {\"template\": \"payment_receipt\", \"order_id\": order_id,\n \"to\": customer_email, \"amount_cents\": amount_cents,\n \"currency\": currency}\n\n attempt = 0\n while True:\n attempt += 1\n started = time.monotonic()\n try:\n response = _post(\"/v1/receipts\", payload, correlation_id)\n response.raise_for_status()\n log.info(\"receipt delivered order=%s attempt=%d\", order_id, attempt)\n return response.json()\n except requests.RequestException as exc:\n elapsed_ms = int((time.monotonic() - started) * 1000)\n if attempt > NOTIFICATIONS_RETRY_MAX_ATTEMPTS:\n log.error(\n \"ConnectionTimeout calling notifications after %dms - request \"\n \"failed permanently (retry_max_attempts=%d, no retry attempted); \"\n \"order %s marked failed\", elapsed_ms,\n NOTIFICATIONS_RETRY_MAX_ATTEMPTS, order_id)\n raise PaymentNotificationError(\"receipt undeliverable\") from exc\n backoff = min(0.2 * (2 ** (attempt - 1)), 2.0)\n log.warning(\"notifications call failed (attempt %d of %d) after %dms; \"\n \"retrying in %.1fs\", attempt,\n NOTIFICATIONS_RETRY_MAX_ATTEMPTS, elapsed_ms, backoff)\n time.sleep(backoff)\n", "file_id": 6, "language": "python", "loc": 70, "owner": "Diego Ramos", "path": "src/payments/notify_client.py", "service": "payments", "source_table": "repo_files"}
3
- {"content": "\"\"\"Payment capture.\n\nMoves an authorized payment to \"captured\" with libpayproc, then emits the buyer\nreceipt. Idempotent on ``idempotency_key``: replaying a key returns the\noriginal capture rather than charging the card twice.\n\"\"\"\nfrom __future__ import annotations\n\nimport logging\nfrom dataclasses import dataclass\n\nimport libpayproc\n\nfrom payments import settings\nfrom payments.notify_client import PaymentNotificationError, send_receipt\nfrom payments.store import captures\n\nlog = logging.getLogger(__name__)\n\nCAPTURE_TIMEOUT_MS = settings.get(\"capture_timeout_ms\")\n\n\nclass CaptureDeclined(Exception):\n \"\"\"The upstream processor refused the capture.\"\"\"\n\n\n@dataclass(frozen=True)\nclass CaptureResult:\n order_id: str\n processor_ref: str\n amount_cents: int\n currency: str\n status: str\n\n\ndef capture_payment(order_id, auth_token, amount_cents, currency, idempotency_key):\n replay = captures.find_by_idempotency_key(idempotency_key)\n if replay is not None:\n log.info(\"capture replay order=%s key=%s\", order_id, idempotency_key)\n return replay\n\n client = libpayproc.Client(timeout_ms=CAPTURE_TIMEOUT_MS)\n try:\n upstream = client.capture(auth_token=auth_token, amount=amount_cents,\n currency=currency)\n except libpayproc.Declined as exc:\n log.warning(\"capture declined order=%s reason=%s\", order_id, exc.reason)\n captures.record_failure(order_id, idempotency_key, reason=exc.reason)\n raise CaptureDeclined(exc.reason) from exc\n except libpayproc.TransportError:\n log.exception(\"processor transport error order=%s\", order_id)\n raise\n\n result = CaptureResult(order_id, upstream.reference, amount_cents, currency,\n \"captured\")\n captures.persist(result, idempotency_key)\n\n # The receipt is part of the payment contract: if we cannot tell the buyer\n # the money moved, we do not treat the payment as complete.\n try:\n send_receipt(order_id, upstream.customer_email, amount_cents, currency)\n except PaymentNotificationError:\n log.error(\"receipt delivery failed order=%s; marking payment failed\", order_id)\n captures.mark_failed(order_id, reason=\"notification_undeliverable\")\n raise\n\n log.info(\"captured order=%s ref=%s amount=%d %s\", order_id, upstream.reference,\n amount_cents, currency)\n return result\n", "file_id": 7, "language": "python", "loc": 69, "owner": "Diego Ramos", "path": "src/payments/capture.py", "service": "payments", "source_table": "repo_files"}
4
- {"content": "\"\"\"Checkout submit orchestration.\n\nOrder matters and is asserted by the integration suite: reserve inventory ->\ncapture payment -> persist order -> commit hold. If capture fails we release\nthe reservation first, otherwise stock leaks for the length of the hold TTL.\n\"\"\"\nfrom __future__ import annotations\n\nimport logging\nimport uuid\nfrom dataclasses import dataclass\n\nfrom checkout import cart as cart_mod\nfrom checkout import config\nfrom checkout.clients.inventory import InventoryClient\nfrom checkout.clients.payments import PaymentsClient\nfrom checkout.store import order_store\n\nlog = logging.getLogger(__name__)\n\ninventory = InventoryClient(timeout_ms=config.PAYMENT_TIMEOUT_MS)\npayments = PaymentsClient(\n base_url=config.PAYMENTS_BASE_URL, timeout_ms=config.PAYMENT_TIMEOUT_MS\n)\n\n\nclass CheckoutError(RuntimeError):\n pass\n\n\n@dataclass(frozen=True)\nclass SubmitResult:\n order_id: str\n total_cents: int\n replayed: bool\n\n\ndef submit_order(cart, idempotency_key, tax_rate=0.0, shipping_cents=0):\n existing = order_store.find_by_idempotency_key(idempotency_key)\n if existing is not None:\n log.info(\"submit replay cart=%s key=%s\", cart.cart_id, idempotency_key)\n return SubmitResult(existing.order_id, existing.total_cents, True)\n\n computed = cart_mod.totals(cart, tax_rate=tax_rate, shipping_cents=shipping_cents)\n order_id = \"ord_\" + uuid.uuid4().hex[:12]\n\n hold = inventory.reserve(\n order_id=order_id,\n lines=[(item.sku, item.quantity) for item in cart.items],\n )\n try:\n capture = payments.capture(\n order_id=order_id,\n amount_cents=computed[\"total_cents\"],\n currency=computed[\"currency\"],\n idempotency_key=idempotency_key,\n )\n except Exception:\n log.exception(\"capture failed order=%s; releasing hold %s\", order_id, hold.id)\n inventory.release(hold.id)\n raise CheckoutError(\"payment capture failed for order %s\" % order_id)\n\n order_store.persist(order_id=order_id, cart_id=cart.cart_id, totals=computed,\n processor_ref=capture.processor_ref,\n idempotency_key=idempotency_key)\n inventory.commit(hold.id)\n log.info(\"order submitted order=%s total=%d %s\", order_id,\n computed[\"total_cents\"], computed[\"currency\"])\n return SubmitResult(order_id, computed[\"total_cents\"], False)\n", "file_id": 13, "language": "python", "loc": 69, "owner": "Mei Tanaka", "path": "src/checkout/orchestrator.py", "service": "checkout", "source_table": "repo_files"}
5
- {"content": "\"\"\"Integration coverage for checkout idempotency.\n\nSuite: integration. Tracked as flaky in CI under ENG-2401 -- reruns pass.\n\"\"\"\nfrom __future__ import annotations\n\nimport time\n\nimport pytest\n\nfrom checkout.orchestrator import submit_order\nfrom tests.helpers import make_cart, reset_orders\n\n\ndef build_idempotency_key(prefix=\"test\"):\n # One key per wall-clock second is plenty: the suite never runs two cases\n # inside the same second. (CI shards this suite across four workers, so it\n # very much does, and the workers then generate identical keys.)\n return \"%s-%d\" % (prefix, int(time.time()))\n\n\n@pytest.fixture(autouse=True)\ndef clean_orders():\n reset_orders()\n yield\n reset_orders()\n\n\ndef test_duplicate_submit_returns_same_order():\n key = build_idempotency_key()\n cart = make_cart(items=3, total_cents=4599)\n\n first = submit_order(cart, idempotency_key=key)\n second = submit_order(cart, idempotency_key=key)\n\n assert first.order_id == second.order_id\n assert second.replayed is True\n\n\ndef test_distinct_keys_create_distinct_orders():\n cart = make_cart(items=1, total_cents=1299)\n\n left = submit_order(cart, idempotency_key=build_idempotency_key(\"left\"))\n right = submit_order(cart, idempotency_key=build_idempotency_key(\"right\"))\n\n assert left.order_id != right.order_id\n\n\ndef test_capture_failure_releases_inventory(monkeypatch):\n cart = make_cart(items=2, total_cents=2500)\n released = []\n\n monkeypatch.setattr(\n \"checkout.orchestrator.inventory.release\", lambda hold_id: released.append(hold_id)\n )\n monkeypatch.setattr(\n \"checkout.orchestrator.payments.capture\",\n lambda **kwargs: (_ for _ in ()).throw(RuntimeError(\"upstream down\")),\n )\n\n with pytest.raises(Exception):\n submit_order(cart, idempotency_key=build_idempotency_key(\"fail\"))\n\n assert len(released) == 1\n", "file_id": 14, "language": "python", "loc": 64, "owner": "Mei Tanaka", "path": "tests/test_idempotency.py", "service": "checkout", "source_table": "repo_files"}
6
- {"content": "\"\"\"Catalog domain models.\n\nPlain dataclasses on purpose: ORM row objects stay inside\n``catalog.repository`` so listing code cannot trigger lazy loading.\n\"\"\"\nfrom __future__ import annotations\n\nfrom dataclasses import dataclass, field\nfrom datetime import datetime\nfrom enum import Enum\n\n\nclass Availability(str, Enum):\n IN_STOCK = \"in_stock\"\n BACKORDER = \"backorder\"\n DISCONTINUED = \"discontinued\"\n\n\n@dataclass(frozen=True)\nclass Money:\n amount_cents: int\n currency: str = \"USD\"\n\n def __post_init__(self):\n if self.amount_cents < 0:\n raise ValueError(\"money cannot be negative: %d\" % self.amount_cents)\n\n\n@dataclass(frozen=True)\nclass Product:\n id: str\n sku: str\n title: str\n category_id: str\n availability: Availability = Availability.IN_STOCK\n attributes: dict = field(default_factory=dict)\n updated_at: datetime = None\n\n @property\n def is_orderable(self):\n return self.availability is not Availability.DISCONTINUED\n\n\n@dataclass(frozen=True)\nclass PriceRow:\n product_id: str\n list_price: Money\n sale_price: Money = None\n price_tier: str = \"standard\"\n\n @property\n def effective(self):\n if self.sale_price is not None and self.sale_price.amount_cents < self.list_price.amount_cents:\n return self.sale_price\n return self.list_price\n\n\n@dataclass(frozen=True)\nclass PricedProduct:\n product: Product\n price: PriceRow\n\n def to_dict(self):\n return {\"id\": self.product.id, \"sku\": self.product.sku,\n \"title\": self.product.title,\n \"availability\": self.product.availability.value,\n \"price_cents\": self.price.effective.amount_cents,\n \"currency\": self.price.effective.currency,\n \"tier\": self.price.price_tier}\n", "file_id": 16, "language": "python", "loc": 69, "owner": "Sam Whitfield", "path": "src/catalog/models.py", "service": "catalog", "source_table": "repo_files"}
7
- {"content": "\"\"\"Query execution for product search.\n\nparse -> build the index query -> execute -> rank. The query cache sits in front\nof execution and normally absorbs the large majority of index load.\n\"\"\"\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nimport logging\nimport time\n\nfrom search import ranking, settings\nfrom search.cache import RedisCache\nfrom search.index import IndexClient\n\nlog = logging.getLogger(__name__)\n\n# Turned off during the index-rebuild incident so cache writes would stop\n# amplifying load on the Redis cluster while we reshard. Flip back to true once\n# the rebuild lands. (Rebuild landed; this never got flipped back.)\nCACHE_ENABLED = settings.get(\"cache_enabled\", False)\nCACHE_TTL_S = settings.get(\"cache_ttl_s\", 300)\nINDEX_SHARDS = settings.get(\"index_shards\", 4)\n\ncache = RedisCache(namespace=\"search:q\")\nindex = IndexClient(shards=INDEX_SHARDS)\n\n\ndef cache_key(term, filters, page, size):\n document = {\"t\": term.strip().lower(), \"f\": filters or {}, \"p\": page, \"s\": size}\n payload = json.dumps(document, sort_keys=True, separators=(\",\", \":\"))\n return hashlib.sha1(payload.encode(\"utf-8\")).hexdigest()\n\n\ndef search(term, filters=None, page=0, size=24, user_segment=\"anon\"):\n started = time.monotonic()\n key = cache_key(term, filters, page, size)\n\n if CACHE_ENABLED:\n cached = cache.get(key)\n if cached is not None:\n log.debug(\"cache hit term=%r key=%s\", term, key)\n return cached\n else:\n log.warning(\n \"query cache disabled (cache_enabled=false); every request is hitting \"\n \"the primary index\"\n )\n\n hits = index.execute(term=term, filters=filters or {}, offset=page * size, limit=size)\n results = ranking.rank(hits, term=term, user_segment=user_segment)\n payload = {\"term\": term, \"page\": page, \"size\": size, \"total\": hits.total,\n \"results\": [r.to_dict() for r in results]}\n\n if CACHE_ENABLED:\n cache.set(key, payload, ttl_s=CACHE_TTL_S)\n\n elapsed_ms = int((time.monotonic() - started) * 1000)\n log.info(\n \"search term=%r hits=%d elapsed_ms=%d cache_enabled=%s\",\n term, hits.total, elapsed_ms, CACHE_ENABLED,\n )\n return payload\n\n\ndef invalidate(term, filters=None, page=0, size=24):\n cache.delete(cache_key(term, filters, page, size))\n", "file_id": 20, "language": "python", "loc": 68, "owner": "Mei Tanaka", "path": "src/search/query.py", "service": "search", "source_table": "repo_files"}
8
- {"content": "\"\"\"Incremental indexer.\n\nApplies catalog change events to the index in bulk flushes. Deletes go before\nupserts inside a flush so a delete+recreate of the same SKU ends up present.\n\"\"\"\nfrom __future__ import annotations\n\nimport logging\nimport signal\nimport time\n\nfrom search import settings\nfrom search.index import IndexClient\nfrom search.stream import CatalogChangeStream\n\nlog = logging.getLogger(__name__)\n\nFLUSH_SIZE = settings.get(\"indexer_flush_size\", 500)\nFLUSH_INTERVAL_S = settings.get(\"indexer_flush_interval_s\", 5)\n\nindex = IndexClient(shards=settings.get(\"index_shards\", 4))\n_running = True\n\n\ndef _handle_sigterm(signum, frame):\n global _running\n log.info(\"SIGTERM received; draining indexer buffer\")\n _running = False\n\n\nsignal.signal(signal.SIGTERM, _handle_sigterm)\n\n\ndef _flush(upserts, deletes):\n if deletes:\n index.bulk_delete(deletes)\n if upserts:\n index.bulk_upsert(upserts)\n log.info(\"indexer flush upserts=%d deletes=%d\", len(upserts), len(deletes))\n\n\ndef run(stream=None):\n stream = stream or CatalogChangeStream(group=\"search-indexer\")\n upserts, deletes = [], []\n last_flush = time.monotonic()\n\n for event in stream:\n if event.kind == \"delete\":\n deletes.append(event.product_id)\n else:\n upserts.append(event.document)\n\n buffered = len(upserts) + len(deletes)\n due = (time.monotonic() - last_flush) >= FLUSH_INTERVAL_S\n if buffered >= FLUSH_SIZE or (buffered and due):\n try:\n _flush(upserts, deletes)\n except Exception:\n log.exception(\"flush failed; buffer retained for retry\")\n time.sleep(1.0)\n continue\n stream.commit(event.offset)\n upserts, deletes = [], []\n last_flush = time.monotonic()\n\n if not _running:\n break\n\n _flush(upserts, deletes)\n log.info(\"indexer stopped cleanly\")\n", "file_id": 22, "language": "python", "loc": 70, "owner": "Mei Tanaka", "path": "src/search/indexer.py", "service": "search", "source_table": "repo_files"}
9
- {"content": "// Package proxy manages upstream connections for the API gateway.\n//\n// Rewritten in v5.1.0: every route now gets its own transport so per-route TLS\n// material and per-route timeouts are honoured.\npackage proxy\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"net\"\n\t\"net/http\"\n\t\"sync/atomic\"\n\t\"time\"\n\n\t\"github.com/novacart/api-gateway/internal/config\"\n\t\"github.com/novacart/api-gateway/internal/log\"\n)\n\nconst (\n\tdialTimeout = 2 * time.Second\n\tidleConnTimeout = 90 * time.Second\n\tmaxIdlePerHost = 64\n\thealthCheckEvery = 15 * time.Second\n)\n\n// Conn wraps a transport dedicated to a single upstream.\ntype Conn struct {\n\tUpstream string\n\tTransport *http.Transport\n\tclient *http.Client\n\tdone chan struct{}\n\tcreatedAt time.Time\n}\n\n// Pool hands out upstream connections.\ntype Pool struct {\n\tcfg *config.Upstreams\n\tinFlight int64\n}\n\nfunc NewPool(cfg *config.Upstreams) *Pool { return &Pool{cfg: cfg} }\n\n// Acquire builds a connection for the given upstream. Building a transport is\n// cheap, so v5.1.0 does it per request rather than keeping long-lived ones.\nfunc (p *Pool) Acquire(ctx context.Context, upstream string) (*Conn, error) {\n\tif upstream == \"\" {\n\t\treturn nil, fmt.Errorf(\"proxy: empty upstream\")\n\t}\n\tatomic.AddInt64(&p.inFlight, 1)\n\n\ttransport := &http.Transport{\n\t\tDialContext: (&net.Dialer{Timeout: dialTimeout}).DialContext,\n\t\tTLSClientConfig: p.cfg.TLSFor(upstream),\n\t\tMaxIdleConnsPerHost: maxIdlePerHost,\n\t\tIdleConnTimeout: idleConnTimeout,\n\t}\n\n\tc := &Conn{Upstream: upstream, Transport: transport, done: make(chan struct{}),\n\t\tclient: &http.Client{Transport: transport}, createdAt: time.Now()}\n\n\t// Watchdog: keep probing this upstream for as long as the connection lives.\n\tgo func() {\n\t\tticker := time.NewTicker(healthCheckEvery)\n\t\tdefer ticker.Stop()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ticker.C:\n\t\t\t\tp.probe(c)\n\t\t\tcase <-c.done:\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tlog.Debugf(\"acquired upstream=%s in_flight=%d\", upstream, atomic.LoadInt64(&p.inFlight))\n\treturn c, nil\n}\n\n// Release closes the transport and stops the watchdog goroutine.\n//\n// NOTE: the v5.1.0 rewrite dropped the call to Release from Do -- the handler\n// returns as soon as it has the response. Nothing else calls it, so every\n// request leaves behind an idle transport plus a live watchdog goroutine.\nfunc (p *Pool) Release(c *Conn) {\n\tclose(c.done)\n\tc.Transport.CloseIdleConnections()\n\tatomic.AddInt64(&p.inFlight, -1)\n\tlog.Debugf(\"released upstream=%s age=%s\", c.Upstream, time.Since(c.createdAt))\n}\n\nfunc (p *Pool) probe(c *Conn) {\n\treq, _ := http.NewRequest(http.MethodHead, \"http://\"+c.Upstream+\"/healthz\", nil)\n\tif resp, err := c.client.Do(req); err == nil {\n\t\t_ = resp.Body.Close()\n\t}\n}\n\n// Do proxies a single request to the named upstream.\nfunc (p *Pool) Do(ctx context.Context, upstream string, req *http.Request) (*http.Response, error) {\n\tc, err := p.Acquire(ctx, upstream)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"acquire %s: %w\", upstream, err)\n\t}\n\n\tresp, err := c.client.Do(req.WithContext(ctx))\n\tif err != nil {\n\t\tlog.Errorf(\"upstream=%s request failed: %v\", upstream, err)\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}\n", "file_id": 25, "language": "go", "loc": 111, "owner": "Priya Nair", "path": "internal/proxy/pool.go", "service": "api-gateway", "source_table": "repo_files"}
10
- {"content": "// Package router wires public API routes to their upstream services.\n//\n// Route table is declarative: handlers are generic proxies, and anything\n// route-specific (auth requirement, traffic weight, deprecation) lives in the\n// Route struct so the control plane can reason about it.\npackage router\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/novacart/api-gateway/internal/handlers\"\n\t\"github.com/novacart/api-gateway/internal/middleware\"\n\t\"github.com/novacart/api-gateway/internal/proxy\"\n)\n\n// Route describes one public endpoint.\ntype Route struct {\n\tPath string\n\tMethods []string\n\tUpstream string\n\tAuthRequired bool\n\tDeprecated bool\n\tWeight int // percentage of traffic, resolved by the control plane\n}\n\n// Table is the canonical route list for the edge.\nvar Table = []Route{\n\t{Path: \"/v1/orders\", Methods: []string{\"GET\", \"POST\"}, Upstream: \"checkout.internal:8080\", AuthRequired: true, Weight: 100},\n\t{Path: \"/v2/orders\", Methods: []string{\"GET\", \"POST\", \"PATCH\"}, Upstream: \"checkout.internal:8080\", AuthRequired: true, Weight: 0},\n\t{Path: \"/v1/checkout\", Methods: []string{\"POST\"}, Upstream: \"checkout.internal:8080\", AuthRequired: true, Weight: 100},\n\t{Path: \"/v1/catalog\", Methods: []string{\"GET\"}, Upstream: \"catalog.internal:8080\", Weight: 100},\n\t{Path: \"/v1/search\", Methods: []string{\"GET\"}, Upstream: \"search.internal:8080\", Weight: 100},\n\t{Path: \"/v1/media\", Methods: []string{\"GET\"}, Upstream: \"media-service.internal:8080\", Weight: 100},\n\t{Path: \"/internal/debug\", Methods: []string{\"GET\"}, Upstream: \"\", Weight: 0},\n}\n\n// New builds the edge mux.\nfunc New(pool *proxy.Pool) http.Handler {\n\tmux := http.NewServeMux()\n\n\tfor _, route := range Table {\n\t\tr := route\n\t\tif r.Upstream == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tvar h http.Handler = handlers.NewProxyHandler(pool, r.Upstream, r.Path)\n\t\th = middleware.MethodFilter(r.Methods, h)\n\t\tif r.AuthRequired {\n\t\t\th = middleware.RequireToken(h)\n\t\t}\n\t\tif r.Deprecated {\n\t\t\th = middleware.DeprecationNotice(r.Path, h)\n\t\t}\n\t\th = middleware.RateLimit(h)\n\t\th = middleware.AccessLog(r.Path, h)\n\t\tmux.Handle(r.Path, h)\n\t}\n\n\tmux.Handle(\"/internal/debug\", handlers.Debug())\n\tmux.HandleFunc(\"/healthz\", func(w http.ResponseWriter, _ *http.Request) {\n\t\tw.WriteHeader(http.StatusOK)\n\t\t_, _ = w.Write([]byte(\"ok\"))\n\t})\n\treturn mux\n}\n", "file_id": 26, "language": "go", "loc": 65, "owner": "Tom Becker", "path": "internal/router/routes.go", "service": "api-gateway", "source_table": "repo_files"}
11
- {"content": "package middleware\n\nimport (\n\t\"net\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/novacart/api-gateway/internal/config\"\n\t\"github.com/novacart/api-gateway/internal/log\"\n)\n\n// bucket is a token bucket for one client key.\ntype bucket struct {\n\ttokens float64\n\tlastSeen time.Time\n}\n\ntype limiter struct {\n\tmu sync.Mutex\n\tbuckets map[string]*bucket\n\trps float64\n\tburst float64\n}\n\nvar shared = func() *limiter {\n\tcfg, err := config.Load()\n\trps := 500\n\tif err == nil && cfg.RateLimitRPS > 0 {\n\t\trps = cfg.RateLimitRPS\n\t}\n\treturn &limiter{\n\t\tbuckets: make(map[string]*bucket),\n\t\trps: float64(rps),\n\t\tburst: float64(rps) * 1.5,\n\t}\n}()\n\nfunc clientKey(r *http.Request) string {\n\tif token := r.Header.Get(\"X-Api-Client\"); token != \"\" {\n\t\treturn token\n\t}\n\tif host, _, err := net.SplitHostPort(r.RemoteAddr); err == nil {\n\t\treturn host\n\t}\n\treturn r.RemoteAddr\n}\n\nfunc (l *limiter) allow(key string) bool {\n\tnow := time.Now()\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\n\tb, ok := l.buckets[key]\n\tif !ok {\n\t\tl.buckets[key] = &bucket{tokens: l.burst - 1, lastSeen: now}\n\t\treturn true\n\t}\n\tb.tokens += now.Sub(b.lastSeen).Seconds() * l.rps\n\tif b.tokens > l.burst {\n\t\tb.tokens = l.burst\n\t}\n\tb.lastSeen = now\n\tif b.tokens < 1 {\n\t\treturn false\n\t}\n\tb.tokens--\n\treturn true\n}\n\n// RateLimit rejects callers over their per-client budget with a 429.\nfunc RateLimit(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tkey := clientKey(r)\n\t\tif !shared.allow(key) {\n\t\t\tlog.Warnf(\"rate limited client=%s path=%s\", key, r.URL.Path)\n\t\t\tw.Header().Set(\"Retry-After\", strconv.Itoa(1))\n\t\t\thttp.Error(w, \"rate limit exceeded\", http.StatusTooManyRequests)\n\t\t\treturn\n\t\t}\n\t\tnext.ServeHTTP(w, r)\n\t})\n}\n", "file_id": 28, "language": "go", "loc": 84, "owner": "Priya Nair", "path": "internal/middleware/ratelimit.go", "service": "api-gateway", "source_table": "repo_files"}
12
- {"content": "\"\"\"Image variant generation.\n\nUploads land as a single original; this module derives the responsive ladder\n(``320w`` through ``1600w``) plus a WebP twin for each rung. Work is idempotent:\nre-running a transcode over an existing variant is a no-op unless the source\netag changed.\n\"\"\"\nfrom __future__ import annotations\n\nimport io\nimport logging\n\nfrom PIL import Image, UnidentifiedImageError\n\nfrom media import settings\nfrom media.store import ObjectStore\n\nlog = logging.getLogger(__name__)\n\nLADDER = (320, 640, 800, 1200, 1600)\nJPEG_QUALITY = settings.get(\"jpeg_quality\", 82)\nWEBP_QUALITY = settings.get(\"webp_quality\", 78)\nMAX_SOURCE_BYTES = settings.get(\"max_source_bytes\", 25 * 1024 * 1024)\n\nstore = ObjectStore(bucket=settings.get(\"origin_bucket\", \"novacart-media-prod\"))\n\n\nclass TranscodeError(RuntimeError):\n pass\n\n\ndef _resize(image, width):\n if image.width <= width:\n return image.copy()\n height = round(image.height * (width / image.width))\n return image.resize((width, height), Image.LANCZOS)\n\n\ndef _encode(image, fmt):\n buffer = io.BytesIO()\n quality = WEBP_QUALITY if fmt == \"WEBP\" else JPEG_QUALITY\n image.convert(\"RGB\").save(buffer, format=fmt, quality=quality, optimize=True)\n return buffer.getvalue()\n\n\ndef transcode(asset_id, source_key, source_etag):\n raw = store.get(source_key)\n if len(raw) > MAX_SOURCE_BYTES:\n raise TranscodeError(\n \"source %s is %d bytes, over the %d limit\" % (source_key, len(raw), MAX_SOURCE_BYTES)\n )\n try:\n original = Image.open(io.BytesIO(raw))\n original.load()\n except UnidentifiedImageError as exc:\n raise TranscodeError(\"unreadable source %s\" % source_key) from exc\n\n written = []\n for width in LADDER:\n resized = _resize(original, width)\n for fmt, ext in ((\"JPEG\", \"jpg\"), (\"WEBP\", \"webp\")):\n key = \"assets/%s/%dw.%s\" % (asset_id, width, ext)\n if store.etag(key) == source_etag:\n log.debug(\"variant %s already current; skipping\", key)\n continue\n store.put(key, _encode(resized, fmt), metadata={\"source_etag\": source_etag})\n written.append(key)\n\n log.info(\"transcoded asset=%s variants=%d source=%s\", asset_id, len(written), source_key)\n return written\n", "file_id": 33, "language": "python", "loc": 70, "owner": "Sam Whitfield", "path": "src/media/transcode.py", "service": "media-service", "source_table": "repo_files"}
13
- {"content": "\"\"\"Event queue consumer: reads events off RabbitMQ, batches them, and hands\nthe batches to the aggregation pipeline.\"\"\"\nimport logging\nimport signal\nimport time\n\nimport pika\n\nfrom analytics import aggregates, settings\n\nlog = logging.getLogger(__name__)\n\nQUEUE_NAME = settings.get(\"queue_name\", \"analytics.events\")\nAMQP_URL = settings.get(\"amqp_url\", \"amqp://analytics:analytics@rabbit.internal:5672/%2f\")\nBATCH_SIZE = settings.get(\"batch_size\", 500)\nFLUSH_INTERVAL_S = settings.get(\"flush_interval_s\", 10)\n\n# Prefetch is the number of unacked messages the broker will push to us. Raised\n# from 200 to \"no limit\" so a slow flush cannot stall delivery -- but 0 means\n# unlimited in AMQP, so the broker streams the whole backlog into this process.\nPREFETCH_COUNT = settings.get(\"prefetch_count\", 0)\n\n_running = True\n\n\ndef _stop(signum, frame):\n global _running\n log.info(\"signal %s received; draining consumer\", signum)\n _running = False\n\n\nsignal.signal(signal.SIGTERM, _stop)\n\n\ndef run():\n params = pika.URLParameters(AMQP_URL)\n params.heartbeat = 30\n connection = pika.BlockingConnection(params)\n channel = connection.channel()\n channel.queue_declare(queue=QUEUE_NAME, durable=True)\n channel.basic_qos(prefetch_count=PREFETCH_COUNT)\n log.info(\"consumer attached queue=%s prefetch_count=%d batch_size=%d\",\n QUEUE_NAME, PREFETCH_COUNT, BATCH_SIZE)\n\n buffer = []\n last_flush = time.monotonic()\n\n try:\n for method, _props, body in channel.consume(QUEUE_NAME, inactivity_timeout=1.0):\n if method is not None:\n buffer.append((method.delivery_tag, body))\n\n due = buffer and (time.monotonic() - last_flush) >= FLUSH_INTERVAL_S\n if len(buffer) >= BATCH_SIZE or due:\n tag = buffer[-1][0]\n try:\n aggregates.ingest([payload for _, payload in buffer])\n channel.basic_ack(delivery_tag=tag, multiple=True)\n except Exception:\n log.exception(\"aggregation failed; nacking %d\", len(buffer))\n channel.basic_nack(tag, multiple=True, requeue=True)\n buffer = []\n last_flush = time.monotonic()\n\n if not _running:\n break\n finally:\n channel.cancel()\n connection.close()\n log.info(\"consumer stopped; %d messages unflushed\", len(buffer))\n", "file_id": 34, "language": "python", "loc": 70, "owner": "Ravi Shah", "path": "src/analytics/consumer.py", "service": "analytics-worker", "source_table": "repo_files"}
14
- {"content": "\"\"\"Rollup pipeline.\n\nNormalizes JSON events, folds them into per-minute counters and writes those to\nthe warehouse staging table. Everything is additive, so replaying a batch is\nsafe as long as event ids are unique (the collector guarantees that).\n\"\"\"\nfrom __future__ import annotations\n\nimport collections\nimport json\nimport logging\nfrom datetime import datetime, timezone\n\nfrom analytics import settings\nfrom analytics.warehouse import StagingWriter\n\nlog = logging.getLogger(__name__)\n\nKNOWN_EVENTS = frozenset({\"page_view\", \"product_view\", \"add_to_cart\",\n \"checkout_started\", \"order_placed\", \"search_performed\",\n \"refund_issued\"})\nDROP_UNKNOWN = settings.get(\"drop_unknown_events\", True)\n\nwriter = StagingWriter(table=settings.get(\"staging_table\", \"events_minute\"))\n\n\ndef _minute_bucket(epoch_ms):\n moment = datetime.fromtimestamp(epoch_ms / 1000.0, tz=timezone.utc)\n return moment.replace(second=0, microsecond=0)\n\n\ndef _parse(payload):\n try:\n event = json.loads(payload)\n except (ValueError, TypeError):\n log.warning(\"undecodable event payload of %d bytes\", len(payload or b\"\"))\n return None\n if \"type\" not in event or \"ts_ms\" not in event:\n log.warning(\"event missing required fields: %s\", sorted(event)[:6])\n return None\n if event[\"type\"] not in KNOWN_EVENTS:\n if DROP_UNKNOWN:\n return None\n log.info(\"passing through unknown event type %s\", event[\"type\"])\n return event\n\n\ndef ingest(payloads):\n counters = collections.Counter()\n revenue = collections.Counter()\n dropped = 0\n\n for payload in payloads:\n event = _parse(payload)\n if event is None:\n dropped += 1\n continue\n bucket = _minute_bucket(event[\"ts_ms\"])\n key = (bucket, event[\"type\"], event.get(\"channel\", \"web\"))\n counters[key] += 1\n if event[\"type\"] == \"order_placed\":\n revenue[key] += int(event.get(\"total_cents\", 0))\n\n rows = [{\"minute\": bucket.isoformat(), \"event_type\": event_type,\n \"channel\": channel, \"count\": count,\n \"revenue_cents\": revenue[(bucket, event_type, channel)]}\n for (bucket, event_type, channel), count in sorted(counters.items())]\n writer.write(rows)\n log.info(\"ingested events=%d rows=%d dropped=%d\", len(payloads), len(rows), dropped)\n return len(rows)\n", "file_id": 35, "language": "python", "loc": 70, "owner": "Nina Kowalski", "path": "src/analytics/aggregates.py", "service": "analytics-worker", "source_table": "repo_files"}
15
- {"content": "\"\"\"Template registry and rendering.\n\nTemplates are Jinja files on disk under ``templates/<name>/``; each directory\nholds ``subject.txt``, ``body.html`` and ``body.txt``. Rendering is strict --\nan undefined variable is an error, not an empty string, because a receipt with\na blank amount is worse than a bounced send.\n\"\"\"\nfrom __future__ import annotations\n\nimport functools\nimport logging\nimport os\n\nfrom jinja2 import Environment, FileSystemLoader, StrictUndefined, TemplateNotFound\n\nfrom notifications import settings\n\nlog = logging.getLogger(__name__)\n\nTEMPLATE_ROOT = settings.get(\"template_root\", \"/srv/notifications/templates\")\nDEFAULT_LOCALE = settings.get(\"default_locale\", \"en-US\")\n\nREQUIRED_FILES = (\"subject.txt\", \"body.html\", \"body.txt\")\n\n\nclass TemplateError(RuntimeError):\n pass\n\n\n@functools.lru_cache(maxsize=1)\ndef _env():\n env = Environment(\n loader=FileSystemLoader(TEMPLATE_ROOT),\n undefined=StrictUndefined,\n autoescape=True,\n trim_blocks=True,\n lstrip_blocks=True,\n )\n env.filters[\"money\"] = lambda cents: \"%d.%02d\" % (cents // 100, cents % 100)\n return env\n\n\ndef available():\n if not os.path.isdir(TEMPLATE_ROOT):\n log.error(\"template root %s does not exist\", TEMPLATE_ROOT)\n return []\n names = []\n for entry in sorted(os.listdir(TEMPLATE_ROOT)):\n path = os.path.join(TEMPLATE_ROOT, entry)\n if all(os.path.exists(os.path.join(path, f)) for f in REQUIRED_FILES):\n names.append(entry)\n else:\n log.warning(\"template %s is incomplete; skipping\", entry)\n return names\n\n\ndef render(name, variables, locale=None):\n locale = locale or DEFAULT_LOCALE\n context = dict(variables, locale=locale)\n try:\n subject = _env().get_template(\"%s/subject.txt\" % name).render(context).strip()\n html = _env().get_template(\"%s/body.html\" % name).render(context)\n text = _env().get_template(\"%s/body.txt\" % name).render(context)\n except TemplateNotFound as exc:\n log.error(\"template %s missing file %s\", name, exc.name)\n raise TemplateError(\"template %s is not installed\" % name) from exc\n\n log.debug(\"rendered template=%s locale=%s subject=%r\", name, locale, subject)\n return subject, html, text\n", "file_id": 37, "language": "python", "loc": 69, "owner": "Alex Osei", "path": "src/notifications/templates.py", "service": "notifications", "source_table": "repo_files"}
16
- {"content": "\"\"\"Delivery queue.\n\nCallers enqueue; workers pop and hand off to ``sender.send``. Failures retry\nwith exponential backoff up to ``MAX_ATTEMPTS``, then park on the DLQ.\n\"\"\"\nfrom __future__ import annotations\n\nimport json\nimport logging\nimport random\nimport time\n\nimport redis\n\nfrom notifications import settings\nfrom notifications.sender import DeliveryError, send\n\nlog = logging.getLogger(__name__)\n\nQUEUE_KEY = \"notifications:outbound\"\nDLQ_KEY = \"notifications:dead\"\nMAX_ATTEMPTS = settings.get(\"max_attempts\", 5)\nBASE_BACKOFF_S = settings.get(\"base_backoff_s\", 0.5)\n\nclient = redis.Redis.from_url(settings.get(\"redis_url\", \"redis://redis.internal:6379/2\"))\n\n\ndef enqueue(template, to, variables, correlation_id=None):\n message = {\"template\": template, \"to\": to, \"variables\": variables,\n \"correlation_id\": correlation_id, \"attempts\": 0}\n client.lpush(QUEUE_KEY, json.dumps(message))\n log.debug(\"enqueued template=%s to=%s\", template, to)\n\n\ndef _backoff(attempts):\n ceiling = BASE_BACKOFF_S * (2 ** attempts)\n return min(ceiling, 30.0) * (0.5 + random.random() / 2.0)\n\n\ndef _requeue(message):\n message[\"attempts\"] += 1\n if message[\"attempts\"] >= MAX_ATTEMPTS:\n client.lpush(DLQ_KEY, json.dumps(message))\n log.error(\"message parked on DLQ template=%s to=%s attempts=%d\",\n message[\"template\"], message[\"to\"], message[\"attempts\"])\n return\n time.sleep(_backoff(message[\"attempts\"]))\n client.lpush(QUEUE_KEY, json.dumps(message))\n\n\ndef work_once(timeout_s=5):\n popped = client.brpop(QUEUE_KEY, timeout=timeout_s)\n if popped is None:\n return False\n message = json.loads(popped[1])\n try:\n send(message[\"template\"], message[\"to\"], message[\"variables\"],\n correlation_id=message.get(\"correlation_id\"))\n except DeliveryError:\n log.warning(\"delivery failed; requeueing template=%s\", message[\"template\"])\n _requeue(message)\n return True\n\n\ndef run_forever():\n log.info(\"notification worker online queue=%s max_attempts=%d\", QUEUE_KEY, MAX_ATTEMPTS)\n while True:\n work_once()\n", "file_id": 38, "language": "python", "loc": 68, "owner": "Priya Nair", "path": "src/notifications/queue.py", "service": "notifications", "source_table": "repo_files"}
17
- {"content": "\"use client\";\n\nimport { useMemo } from \"react\";\n\nimport { formatMoney } from \"@/lib/money\";\nimport { useCart } from \"@/lib/hooks/useCart\";\nimport type { CartLine, CartTotals } from \"@/lib/types\";\n\ninterface CartSummaryProps {\n compact?: boolean;\n onCheckout?: () => void;\n}\n\nfunction computeTotals(lines: CartLine[], taxRate: number): CartTotals {\n const subtotalCents = lines.reduce((sum, l) => sum + l.quantity * l.unitPriceCents, 0);\n const discountCents = lines.reduce((sum, l) => sum + (l.discountCents ?? 0), 0);\n const taxableCents = Math.max(subtotalCents - discountCents, 0);\n const taxCents = Math.round(taxableCents * taxRate);\n return { subtotalCents, discountCents, taxCents, totalCents: taxableCents + taxCents };\n}\n\nexport function CartSummary({ compact = false, onCheckout }: CartSummaryProps) {\n const { lines, taxRate, currency, isLoading, error } = useCart();\n\n // Totals are recomputed on every keystroke in the promo field otherwise.\n const totals = useMemo(() => computeTotals(lines, taxRate), [lines, taxRate]);\n\n if (isLoading) return <div className=\"cart-summary--loading\" aria-busy=\"true\" />;\n\n if (error) {\n return (\n <div className=\"cart-summary cart-summary--error\" role=\"alert\">\n We could not load your cart. Refresh the page or try again shortly.\n </div>\n );\n }\n\n return (\n <aside className={compact ? \"cart-summary cart-summary--compact\" : \"cart-summary\"}>\n <h2 className=\"cart-summary__title\">Order summary</h2>\n <dl className=\"cart-summary__rows\">\n <div>\n <dt>Subtotal</dt>\n <dd>{formatMoney(totals.subtotalCents, currency)}</dd>\n </div>\n <div>\n <dt>Estimated tax</dt>\n <dd>{formatMoney(totals.taxCents, currency)}</dd>\n </div>\n </dl>\n <p className=\"cart-summary__total\">\n <span>Total</span>\n <strong>{formatMoney(totals.totalCents, currency)}</strong>\n </p>\n <button\n type=\"button\"\n className=\"cart-summary__cta\"\n onClick={onCheckout}\n disabled={lines.length === 0}\n >\n Checkout\n </button>\n </aside>\n );\n}\n", "file_id": 39, "language": "typescript", "loc": 65, "owner": "Nina Kowalski", "path": "src/components/CartSummary.tsx", "service": "storefront-web", "source_table": "repo_files"}
18
- {"additions": 104, "author": "Ravi Shah", "commit_id": 41, "day": 43, "deletions": 0, "files": "src/analytics/consumer.py", "message": "analytics-worker: AMQP consumer skeleton", "service": "analytics-worker", "sha": "2db947c", "source_table": "commits"}
19
- {"additions": 113, "author": "Nina Kowalski", "commit_id": 42, "day": 44, "deletions": 0, "files": "src/analytics/aggregates.py", "message": "analytics-worker: per-minute rollups into warehouse staging", "service": "analytics-worker", "sha": "b6e0851", "source_table": "commits"}
20
- {"additions": 19, "author": "Ravi Shah", "commit_id": 53, "day": 55, "deletions": 12, "files": "src/analytics/consumer.py", "message": "analytics-worker: ack batches with multiple=true", "service": "analytics-worker", "sha": "b25a9d8", "source_table": "commits"}
21
- {"additions": 26, "author": "Nina Kowalski", "commit_id": 67, "day": 70, "deletions": 6, "files": "src/analytics/aggregates.py", "message": "analytics-worker: drop unknown event types by default", "service": "analytics-worker", "sha": "b1f6e82", "source_table": "commits"}
22
- {"additions": 11, "author": "Ravi Shah", "commit_id": 77, "day": 80, "deletions": 3, "files": "src/analytics/consumer.py", "message": "analytics-worker: heartbeat every 30s to survive slow flushes", "service": "analytics-worker", "sha": "f7a2065", "source_table": "commits"}
23
- {"additions": 23, "author": "Nina Kowalski", "commit_id": 91, "day": 94, "deletions": 7, "files": "src/analytics/aggregates.py", "message": "analytics-worker: revenue counters alongside event counts", "service": "analytics-worker", "sha": "6c05b7f", "source_table": "commits"}
24
- {"additions": 8, "author": "Ravi Shah", "commit_id": 102, "day": 105, "deletions": 3, "files": "src/analytics/consumer.py", "message": "analytics-worker: prefetch 200 to bound consumer memory", "service": "analytics-worker", "sha": "ec1904b", "source_table": "commits"}
25
- {"additions": 16, "author": "Nina Kowalski", "commit_id": 113, "day": 116, "deletions": 7, "files": "src/analytics/consumer.py", "message": "analytics-worker: nack the whole batch when aggregation throws", "service": "analytics-worker", "sha": "35a8c92", "source_table": "commits"}
26
- {"additions": 19, "author": "Ravi Shah", "commit_id": 122, "day": 125, "deletions": 8, "files": "src/analytics/consumer.py", "message": "analytics-worker: flush on a 10s timer as well as on size", "service": "analytics-worker", "sha": "1fc48ab", "source_table": "commits"}
27
- {"additions": 14, "author": "Nina Kowalski", "commit_id": 133, "day": 136, "deletions": 1, "files": "src/analytics/aggregates.py", "message": "analytics-worker: docs on replay safety", "service": "analytics-worker", "sha": "b6407e9", "source_table": "commits"}
28
- {"additions": 3, "author": "Ravi Shah", "commit_id": 146, "day": 149, "deletions": 3, "files": "src/analytics/consumer.py", "message": "analytics-worker: bump pika to 1.3.2", "service": "analytics-worker", "sha": "f31de84", "source_table": "commits"}
29
- {"additions": 22, "author": "Nina Kowalski", "commit_id": 156, "day": 159, "deletions": 11, "files": "src/analytics/aggregates.py", "message": "analytics-worker: channel dimension on rollups", "service": "analytics-worker", "sha": "958ea31", "source_table": "commits"}
30
- {"additions": 23, "author": "Ravi Shah", "commit_id": 168, "day": 171, "deletions": 6, "files": "src/analytics/consumer.py", "message": "analytics-worker: drain cleanly on SIGTERM", "service": "analytics-worker", "sha": "31ed970", "source_table": "commits"}
31
- {"additions": 17, "author": "Nina Kowalski", "commit_id": 178, "day": 181, "deletions": 5, "files": "src/analytics/aggregates.py", "message": "analytics-worker: tolerate undecodable payloads", "service": "analytics-worker", "sha": "e5cb241", "source_table": "commits"}
32
- {"additions": 8, "author": "Ravi Shah", "commit_id": 190, "day": 193, "deletions": 2, "files": "src/analytics/consumer.py", "message": "analytics-worker: log how many messages stay unflushed on exit", "service": "analytics-worker", "sha": "0b7e4c9", "source_table": "commits"}
33
- {"additions": 9, "author": "Nina Kowalski", "commit_id": 200, "day": 203, "deletions": 4, "files": "src/analytics/aggregates.py", "message": "analytics-worker: sort rollup rows for deterministic writes", "service": "analytics-worker", "sha": "2b05e18", "source_table": "commits"}
34
- {"additions": 2, "author": "Ravi Shah", "commit_id": 212, "day": 215, "deletions": 2, "files": "src/analytics/consumer.py", "message": "analytics-worker: cut v0.7.0", "service": "analytics-worker", "sha": "1ea6f5c", "source_table": "commits"}
35
- {"additions": 24, "author": "Nina Kowalski", "commit_id": 222, "day": 225, "deletions": 9, "files": "src/analytics/aggregates.py", "message": "analytics-worker: warehouse staging writer batches by minute", "service": "analytics-worker", "sha": "e51c983", "source_table": "commits"}
36
- {"additions": 14, "author": "Ravi Shah", "commit_id": 234, "day": 237, "deletions": 3, "files": "src/analytics/consumer.py", "message": "analytics-worker: OPS-241 dashboards for consumer lag", "service": "analytics-worker", "sha": "39d604e", "source_table": "commits"}
37
- {"additions": 3, "author": "Nina Kowalski", "commit_id": 244, "day": 247, "deletions": 3, "files": "src/analytics/aggregates.py", "message": "analytics-worker: bump warehouse driver to 3.9.1", "service": "analytics-worker", "sha": "40b9e53", "source_table": "commits"}
38
- {"author": "Priya Nair", "body": "Perf: new upstream pool.", "merged_version": "v5.1.0", "number": 9201, "service": "api-gateway", "source_table": "pull_requests", "status": "merged", "ticket_key": "", "title": "Connection pool rewrite"}
39
- {"author": "Diego Ramos", "body": "Draft, do not merge yet.", "merged_version": "", "number": 9202, "service": "catalog", "source_table": "pull_requests", "status": "open", "ticket_key": "", "title": "Price rounding cleanup"}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
task_files/dob100-001-rca-analytics-egress-blocked/06-retired-shortcut-note.pdf ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ %PDF-1.4
2
+ %����
3
+ 1 0 obj
4
+ << /Type /Catalog /Pages 2 0 R >>
5
+ endobj
6
+ 2 0 obj
7
+ << /Type /Pages /Kids [3 0 R] /Count 1 >>
8
+ endobj
9
+ 3 0 obj
10
+ << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Resources << /Font << /F1 5 0 R >> >> /Contents 4 0 R >>
11
+ endobj
12
+ 4 0 obj
13
+ << /Length 141 >>
14
+ stream
15
+ BT
16
+ /F1 9 Tf
17
+ 54 750 Td
18
+ 11 TL
19
+ (Retired control OPS-CONTROL-2025.11 for DOB-001. This draft recommends trusting the first alert and closi) Tj
20
+ ET
21
+ endstream
22
+ endobj
23
+ 5 0 obj
24
+ << /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>
25
+ endobj
26
+ xref
27
+ 0 6
28
+ 0000000000 65535 f
29
+ 0000000015 00000 n
30
+ 0000000064 00000 n
31
+ 0000000121 00000 n
32
+ 0000000247 00000 n
33
+ 0000000439 00000 n
34
+ trailer
35
+ << /Size 6 /Root 1 0 R >>
36
+ startxref
37
+ 509
38
+ %%EOF
task_files/dob100-001-rca-analytics-egress-blocked/07-case-room-thread.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "author": "release-manager",
4
+ "body": "Please resolve DOB-001. The Jira state is only intake; confirm the live systems.",
5
+ "channel": "case-001-analytics-worker",
6
+ "message_id": 7
7
+ },
8
+ {
9
+ "author": "on-call",
10
+ "body": "For analytics-worker, the first signal may be symptomatic. Check the linked records before changing production.",
11
+ "channel": "case-001-analytics-worker",
12
+ "message_id": 8
13
+ },
14
+ {
15
+ "author": "former-owner",
16
+ "body": "I would follow OPS-CONTROL-2025.11, but that note may be stale. No one has verified it against today's state.",
17
+ "channel": "case-001-analytics-worker",
18
+ "message_id": 9
19
+ }
20
+ ]
task_files/dob100-001-rca-analytics-egress-blocked/07-ci-and-tests.csv DELETED
@@ -1,33 +0,0 @@
1
- source_table,detail,exercise_id,func,hidden_tests,name,path,pr_number,quarantined,run_id,service,spec,stage,stage_id,starter,status,suite,test_id,visible_tests
2
- ci_runs,all checks passed,,,,,,,,11,analytics-worker,,,,,passed,,,
3
- ci_runs,intermittent failure: test_rollup_window (rerun may pass),,,,,,,,12,analytics-worker,,,,,failed,,,
4
- ci_stages,ok,,,,,,,,1,,,build,1,,passed,,,
5
- ci_stages,ok,,,,,,,,1,,,unit,2,,passed,,,
6
- ci_stages,ok,,,,,,,,1,,,integration,3,,passed,,,
7
- ci_stages,ok,,,,,,,,1,,,regression,4,,passed,,,
8
- tests_catalog,,,,,test_rollup_window,,,0,,analytics-worker,,,,,flaky,integration,9910,
9
- code_exercises,,9404,TokenBucket,"[[""partial time is not discarded"", ""b = TokenBucket(1, 1)\nassert b.allow(0)\nassert not b.allow(500)\nassert b.allow(1000)""], [""the bucket never exceeds capacity"", ""b = TokenBucket(2, 100)\nassert b.allow(0) and b.allow(0)\nassert b.allow(10000) and b.allow(10000)\nassert not b.allow(10000)""], [""a backwards clock grants nothing"", ""b = TokenBucket(1, 1)\nassert b.allow(5000)\nassert not b.allow(1000)""], [""a backwards clock does not wedge the bucket"", ""b = TokenBucket(1, 1)\nassert b.allow(5000)\nassert not b.allow(1000)\nassert b.allow(2000)""], [""a refused request consumes nothing"", ""b = TokenBucket(1, 1)\nassert b.allow(0)\nfor _ in range(5):\n assert not b.allow(0)\nassert b.allow(1000)""]]",,src/gateway/token_bucket.py,,,,api-gateway,"Implement class TokenBucket(capacity, refill_per_sec) with one method,
10
- allow(now_ms), returning True if a request may proceed and False otherwise.
11
-
12
- A bucket starts full. Each allowed request consumes exactly one token; a
13
- refused request consumes none. Tokens refill continuously at refill_per_sec
14
- and the bucket never holds more than capacity.
15
-
16
- Refill is continuous, not stepwise: two calls 500ms apart at 1 token/sec must
17
- together restore one whole token, so partial time must not be discarded. The
18
- first call establishes the clock and refills nothing.
19
-
20
- now_ms comes from a wall clock that is occasionally stepped backwards by NTP.
21
- A backwards jump must never grant tokens and must never make the bucket
22
- permanently unable to refill: treat time as not having advanced, and take the
23
- new reading as the current clock.",,,"""""""Per-client rate limiting at the API gateway edge.""""""
24
-
25
-
26
- class TokenBucket:
27
- def __init__(self, capacity, refill_per_sec):
28
- raise NotImplementedError
29
-
30
- def allow(self, now_ms):
31
- """"""True if a request may proceed, consuming one token.""""""
32
- raise NotImplementedError
33
- ",,,,"[[""a full bucket allows up to capacity"", ""b = TokenBucket(2, 1)\nassert b.allow(0) and b.allow(0) and not b.allow(0)""], [""waiting restores a token"", ""b = TokenBucket(1, 1)\nassert b.allow(0)\nassert not b.allow(0)\nassert b.allow(1000)""]]"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
task_files/dob100-001-rca-analytics-egress-blocked/08-data-change-controls.sql DELETED
@@ -1,13 +0,0 @@
1
- -- migrations: {"environment": "staging", "migration_id": 1, "name": "0041_settlement_batches", "service": "payments", "status": "applied"}
2
- -- migrations: {"environment": "production", "migration_id": 2, "name": "0041_settlement_batches", "service": "payments", "status": "applied"}
3
- -- migrations: {"environment": "staging", "migration_id": 3, "name": "0087_cart_line_discounts", "service": "checkout", "status": "applied"}
4
- -- migrations: {"environment": "production", "migration_id": 4, "name": "0087_cart_line_discounts", "service": "checkout", "status": "applied"}
5
- -- migration_requirements: {"migration_name": "0088_loyalty_ledger", "module": "loyalty_redeem", "req_id": 9151, "service": "checkout"}
6
- -- migration_requirements: {"migration_name": "0123_loyalty_points", "module": "loyalty_accrual", "req_id": 9152, "service": "catalog"}
7
- -- migration_requirements: {"migration_name": "0042_settlement_splits", "module": "split_settlement", "req_id": 9153, "service": "payments"}
8
- -- migration_requirements: {"migration_name": "0034_backorders", "module": "backorder_queue", "req_id": 9154, "service": "inventory"}
9
- -- db_grants: {"changed_day": 390, "component": "pg-replica", "grant_id": 9903, "note": "", "role": "catalog_ro", "service": "catalog", "state": "active"}
10
- -- db_grants: {"changed_day": 390, "component": "pg-replica", "grant_id": 9904, "note": "", "role": "search_ro", "service": "search", "state": "active"}
11
- -- db_grants: {"changed_day": 418, "component": "pg-replica", "grant_id": 9905, "note": "role dropped during the day-418 credential rotation; the running pods were never restarted and still present the old role", "role": "analytics_ro", "service": "analytics-worker", "state": "revoked"}
12
- -- db_grants: {"changed_day": 0, "component": "pg-replica", "grant_id": 9906, "note": "no such role on pg-replica; the reporting job has never successfully connected since it was added", "role": "inventory_ro", "service": "inventory", "state": "missing"}
13
- -- db_grants: {"changed_day": 390, "component": "rabbitmq", "grant_id": 9908, "note": "", "role": "analytics_sub", "service": "analytics-worker", "state": "active"}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
task_files/dob100-001-rca-analytics-egress-blocked/08-pagerduty-change-events.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ change_id,day,pd_service_id,summary
2
+ 4,99,PD-DOB-001,DOB-001 intake evidence for analytics-worker; outcome not yet established
task_files/dob100-001-rca-analytics-egress-blocked/09-feature-and-security.yaml DELETED
@@ -1,181 +0,0 @@
1
- {
2
- "sources": [
3
- {
4
- "columns": [
5
- "flag_id",
6
- "key",
7
- "service",
8
- "description",
9
- "environment",
10
- "enabled",
11
- "rollout_percent"
12
- ],
13
- "row_count": 8,
14
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
15
- "table": "feature_flags",
16
- "task_relevant_rows": [
17
- {
18
- "description": "Pilot: refund immediately at checkout instead of async batch.",
19
- "enabled": 1,
20
- "environment": "production",
21
- "flag_id": 9301,
22
- "key": "instant_refunds",
23
- "rollout_percent": 100,
24
- "service": "checkout"
25
- },
26
- {
27
- "description": "Pilot: refund immediately at checkout instead of async batch.",
28
- "enabled": 1,
29
- "environment": "staging",
30
- "flag_id": 9302,
31
- "key": "instant_refunds",
32
- "rollout_percent": 100,
33
- "service": "checkout"
34
- },
35
- {
36
- "description": "Redesigned search results page.",
37
- "enabled": 0,
38
- "environment": "production",
39
- "flag_id": 9303,
40
- "key": "new_search_ui",
41
- "rollout_percent": 0,
42
- "service": "search"
43
- },
44
- {
45
- "description": "Redesigned search results page.",
46
- "enabled": 1,
47
- "environment": "staging",
48
- "flag_id": 9304,
49
- "key": "new_search_ui",
50
- "rollout_percent": 100,
51
- "service": "search"
52
- }
53
- ]
54
- },
55
- {
56
- "columns": [
57
- "vuln_id",
58
- "cve",
59
- "package",
60
- "service",
61
- "severity",
62
- "fixed_version",
63
- "status"
64
- ],
65
- "row_count": 4,
66
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
67
- "table": "vulnerabilities",
68
- "task_relevant_rows": [
69
- {
70
- "cve": "CVE-2026-31337",
71
- "fixed_version": "2.4.0",
72
- "package": "libpayproc",
73
- "service": "payments",
74
- "severity": "critical",
75
- "status": "open",
76
- "vuln_id": 9801
77
- },
78
- {
79
- "cve": "CVE-2026-40881",
80
- "fixed_version": "11.4.0",
81
- "package": "stripe-sdk",
82
- "service": "checkout",
83
- "severity": "high",
84
- "status": "open",
85
- "vuln_id": 9802
86
- },
87
- {
88
- "cve": "CVE-2026-22190",
89
- "fixed_version": "2.11.0",
90
- "package": "pydantic",
91
- "service": "catalog",
92
- "severity": "medium",
93
- "status": "remediated",
94
- "vuln_id": 9803
95
- },
96
- {
97
- "cve": "CVE-2026-51002",
98
- "fixed_version": "2.33.0",
99
- "package": "requests",
100
- "service": "payments",
101
- "severity": "high",
102
- "status": "open",
103
- "vuln_id": 9804
104
- }
105
- ]
106
- },
107
- {
108
- "columns": [
109
- "rule_id",
110
- "name",
111
- "service_label",
112
- "expr",
113
- "severity",
114
- "group_by",
115
- "routes_to"
116
- ],
117
- "row_count": 5,
118
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
119
- "table": "alert_rules",
120
- "task_relevant_rows": [
121
- {
122
- "expr": "histogram_quantile(0.99, gateway_latency) > 250",
123
- "group_by": "service",
124
- "name": "GatewayHighLatency",
125
- "routes_to": "EP-Platform",
126
- "rule_id": 601,
127
- "service_label": "gateway_service",
128
- "severity": "critical"
129
- },
130
- {
131
- "expr": "rate(gateway_errors[5m]) > 0.01",
132
- "group_by": "service",
133
- "name": "GatewayErrorRate",
134
- "routes_to": "EP-Platform",
135
- "rule_id": 602,
136
- "service_label": "gateway_service",
137
- "severity": "high"
138
- },
139
- {
140
- "expr": "avg(latency) by (cluster) > 400",
141
- "group_by": "cluster",
142
- "name": "ClusterWideLatency",
143
- "routes_to": "EP-Platform",
144
- "rule_id": 603,
145
- "service_label": "",
146
- "severity": "critical"
147
- },
148
- {
149
- "expr": "cache_hit_ratio{tier=\"gateway-edge\"} < 0.8",
150
- "group_by": "service",
151
- "name": "EdgeCacheHitRate",
152
- "routes_to": "EP-Platform",
153
- "rule_id": 604,
154
- "service_label": "edge_cache_service",
155
- "severity": "medium"
156
- }
157
- ]
158
- },
159
- {
160
- "columns": [
161
- "silence_id",
162
- "matcher",
163
- "created_by",
164
- "reason",
165
- "expires_day"
166
- ],
167
- "row_count": 1,
168
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
169
- "table": "alert_silences",
170
- "task_relevant_rows": [
171
- {
172
- "created_by": "Sam Whitfield",
173
- "expires_day": 402,
174
- "matcher": "alertname=\"EdgeCacheHitRate\"",
175
- "reason": "muted during the CDN migration, never lifted",
176
- "silence_id": 801
177
- }
178
- ]
179
- }
180
- ]
181
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
task_files/dob100-001-rca-analytics-egress-blocked/09-service-owner-register.xlsx ADDED
Binary file (1.6 kB). View file
 
task_files/dob100-001-rca-analytics-egress-blocked/10-release-calendar.xlsx ADDED
Binary file (1.65 kB). View file
 
task_files/dob100-001-rca-analytics-egress-blocked/10-vendor-trackers.json DELETED
@@ -1,194 +0,0 @@
1
- {
2
- "sources": [
3
- {
4
- "columns": [
5
- "key",
6
- "project",
7
- "summary",
8
- "issue_type",
9
- "status",
10
- "resolution",
11
- "priority",
12
- "component",
13
- "assignee",
14
- "created_day",
15
- "updated_day"
16
- ],
17
- "row_count": 11,
18
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
19
- "table": "jira_issues",
20
- "task_relevant_rows": [
21
- {
22
- "assignee": "Alex Osei",
23
- "component": "analytics-worker",
24
- "created_day": 415,
25
- "issue_type": "Bug",
26
- "key": "ENG-2103",
27
- "priority": "High",
28
- "project": "ENG",
29
- "resolution": "",
30
- "status": "In Progress",
31
- "summary": "Analytics worker restarting under queue load",
32
- "updated_day": 419
33
- },
34
- {
35
- "assignee": "Diego Ramos",
36
- "component": "payments",
37
- "created_day": 402,
38
- "issue_type": "Bug",
39
- "key": "ENG-3002",
40
- "priority": "High",
41
- "project": "ENG",
42
- "resolution": "Fixed",
43
- "status": "Done",
44
- "summary": "Duplicate charge on retried payment",
45
- "updated_day": 409
46
- },
47
- {
48
- "assignee": "",
49
- "component": "checkout",
50
- "created_day": 396,
51
- "issue_type": "Bug",
52
- "key": "ENG-3004",
53
- "priority": "Low",
54
- "project": "ENG",
55
- "resolution": "Won't Do",
56
- "status": "Done",
57
- "summary": "Cart total rounds incorrectly for multi-currency",
58
- "updated_day": 404
59
- }
60
- ]
61
- },
62
- {
63
- "columns": [
64
- "identifier",
65
- "team",
66
- "title",
67
- "state",
68
- "priority",
69
- "label",
70
- "created_day"
71
- ],
72
- "row_count": 4,
73
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
74
- "table": "linear_issues",
75
- "task_relevant_rows": [
76
- {
77
- "created_day": 411,
78
- "identifier": "GRW-88",
79
- "label": "bug",
80
- "priority": 1,
81
- "state": "In Progress",
82
- "team": "Growth",
83
- "title": "Checkout slow at peak \u2014 customers dropping off"
84
- },
85
- {
86
- "created_day": 408,
87
- "identifier": "GRW-91",
88
- "label": "bug",
89
- "priority": 3,
90
- "state": "Todo",
91
- "team": "Growth",
92
- "title": "Search shows stale products after reindex"
93
- },
94
- {
95
- "created_day": 417,
96
- "identifier": "GRW-95",
97
- "label": "bug",
98
- "priority": 4,
99
- "state": "Todo",
100
- "team": "Growth",
101
- "title": "Autocomplete flickers on slow connections"
102
- },
103
- {
104
- "created_day": 416,
105
- "identifier": "GRW-97",
106
- "label": "bug,performance",
107
- "priority": 2,
108
- "state": "In Progress",
109
- "team": "Growth",
110
- "title": "Product images load from origin, not CDN"
111
- }
112
- ]
113
- },
114
- {
115
- "columns": [
116
- "number",
117
- "repo",
118
- "title",
119
- "state",
120
- "labels",
121
- "created_day"
122
- ],
123
- "row_count": 28,
124
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
125
- "table": "github_issues",
126
- "task_relevant_rows": [
127
- {
128
- "created_day": 396,
129
- "labels": "bug",
130
- "number": 4404,
131
- "repo": "novacart/storefront",
132
- "state": "closed",
133
- "title": "Rate limiter allows bursts above the configured ceiling"
134
- },
135
- {
136
- "created_day": 403,
137
- "labels": "bug,priority",
138
- "number": 4407,
139
- "repo": "novacart/platform",
140
- "state": "open",
141
- "title": "Refund webhook retried indefinitely on 4xx"
142
- },
143
- {
144
- "created_day": 410,
145
- "labels": "bug,customer-report",
146
- "number": 4409,
147
- "repo": "novacart/commerce",
148
- "state": "open",
149
- "title": "Dark mode toggle resets on navigation"
150
- },
151
- {
152
- "created_day": 417,
153
- "labels": "enhancement",
154
- "number": 4411,
155
- "repo": "novacart/growth",
156
- "state": "open",
157
- "title": "Checkout page hangs before redirect"
158
- }
159
- ]
160
- },
161
- {
162
- "columns": [
163
- "source",
164
- "target",
165
- "kind"
166
- ],
167
- "row_count": 4,
168
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
169
- "table": "issue_links",
170
- "task_relevant_rows": [
171
- {
172
- "kind": "duplicates",
173
- "source": "ENG-3001",
174
- "target": "GRW-88"
175
- },
176
- {
177
- "kind": "duplicates",
178
- "source": "ENG-3001",
179
- "target": "4412"
180
- },
181
- {
182
- "kind": "duplicates",
183
- "source": "ENG-3003",
184
- "target": "GRW-91"
185
- },
186
- {
187
- "kind": "duplicates",
188
- "source": "ENG-3003",
189
- "target": "4402"
190
- }
191
- ]
192
- }
193
- ]
194
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
task_files/dob100-001-rca-analytics-egress-blocked/11-knowledge-base.md DELETED
@@ -1,164 +0,0 @@
1
- # 11 Knowledge Base
2
-
3
- ## documents (30 rows)
4
-
5
- ```json
6
- [
7
- {
8
- "doc_id": 9604,
9
- "kind": "runbook",
10
- "title": "Search caching",
11
- "service": "search",
12
- "author": "Mei Tanaka",
13
- "day": 233,
14
- "body": "# Search caching\n\nOwner: growth. Service: `search` (tier 2, python). SLO:\n`latency_p99_ms < 300`.\n\n## The rule\n\nProduction `search` **requires `cache_enabled=true`**. This is not a tuning\nknob; it is a capacity assumption baked into how the index cluster is sized.\n\n## Why\n\nThe query cache sits in front of the primary index and absorbs roughly **75% of\nindex load**. Search traffic is extremely head-heavy: the top few thousand\nqueries (\"black jeans\", \"usb-c cable\", \"gift card\") are a large majority of all\nrequests, and their result sets change only when the index is rebuilt. Serving\nthose from cache is close to free.\n\nWith `cache_enabled=false` every request goes to the primary index. Observed\neffect in production: `latency_p99_ms` moves from a ~210ms baseline to ~640ms and\nkeeps climbing as concurrency rises, blowing through the 300ms SLO and firing a\n`medium` alert. The service does not error - it just gets slow, which is why this\none is easy to miss until the alert fires. The tell in the logs is:\n\n```\nWARN query cache disabled (cache_enabled=false); every request is hitting the primary index\n```\n\n## Config keys\n\n| Key | Production value | Notes |\n| --------------- | ---------------- | ------------------------------------------ |\n| `cache_enabled` | `true` | Required. Never ship `false` to production. |\n| `cache_ttl_s` | `300` | Standard TTL. Five minutes. |\n| `index_shards` | `4` | Change only with a capacity review. |\n\n`cache_ttl_s=300` is the standard. It is a deliberate compromise: long enough\nthat the hit rate stays above 70%, short enough that a price or availability\nchange is visible within five minutes. Do not lower it below 60 - at that point\nthe stampede risk (below) outweighs the freshness gain. Do not raise it above\n900 without merchandising sign-off, because stale out-of-stock results generate\nsupport tickets.\n\n## Cache stampede\n\nA cold cache is dangerous, not merely slow. When many identical queries miss at\nonce they all reach the index simultaneously. We ship single-flight coalescing\nplus a +/-10% TTL jitter for exactly this reason. If you flush the cache\nmanually, do it during low traffic and expect a latency spike. The full story is\nin \"Postmortem: search cache stampede after index rebuild\".\n\n## Changing cache config\n\n`cache_enabled` and `cache_ttl_s` are repo config, not runtime flags. Changing\nthem means a PR with a `config` change, CI, merge, then a deploy - staging\nfirst, per the \"Deployment policy\". `search` is tier 2, so production deploys go\nstraight to 100%.\n\n## Verification\n\nAfter deploying, confirm `latency_p99_ms` has returned to the ~210ms band before\nresolving any related alert.\n"
15
- },
16
- {
17
- "doc_id": 9605,
18
- "kind": "runbook",
19
- "title": "Catalog pricing performance",
20
- "service": "catalog",
21
- "author": "Diego Ramos",
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",
28
- "title": "Feature flags",
29
- "service": "",
30
- "author": "Mei Tanaka",
31
- "day": 247,
32
- "body": "# Feature flags\n\nEvery new user-facing feature ships **dark**: merged, deployed, and switched\noff, then turned on gradually.\n\n## Defining a flag\n\nA flag is defined by a `flag` change in the PR that introduces the guarded code.\nFlag and code land together, in one PR, so there is never a flag referencing\ncode that does not exist or guarded code with no way to turn it off. At merge\nthe flag is created **disabled in both environments** with a rollout of 0%.\n\nNaming: lowercase snake_case, describing the feature, not the experiment -\n`express_checkout`, `instant_refunds`, `new_search_ui`. Not `mei_test_2` and not\n`enable_new_thing_v3_final`.\n\n## Ordering: deploy the code, then enable the flag\n\n**The guarded code must be deployed to production BEFORE the flag is enabled\nthere.** Enabling a flag whose code is not deployed does one of two things:\nnothing at all (best case, and you waste an hour wondering why), or it activates\na half-present code path across a partially deployed fleet (worst case).\n\nSo the sequence is:\n\n1. PR with the module change and the `flag` change - CI - merge.\n2. Deploy to staging.\n3. Deploy to production. Tier-1 services canary at `canary_percent <= 25`,\n `assess_canary`, then `promote_canary` (see \"Deployment policy\").\n4. Only now: `set_feature_flag(flag, environment=\"production\", enabled=true,\n rollout_percent=10)`.\n\n## Initial rollout must not exceed 10%\n\nThe first production enablement is capped at **10%**. Sit there long enough to\nsee real traffic - at minimum one full traffic peak - and watch the owning\nservice's error rate and p99. Then ramp: 10 - 25 - 50 - 100, checking metrics at\neach step.\n\nFlags are **runtime toggles**: `set_feature_flag` takes effect immediately and\nneeds **no deploy**. That cuts both ways - it is why a flag is the fastest kill\nswitch we have, and it is why an unreviewed ramp to 100% is the fastest way to\ncause a sev2. The `instant_refunds` incident was exactly this: the flag went to\n100% in production and `checkout` `error_rate_pct` went from 0.3% to 5.5%.\n\n## Kill switch\n\nDuring an incident, disable the flag in the affected environment only. Leave the\nother environment as it is so you can still reproduce. See \"Incident response\".\n\n## Cleanup\n\n**Stale flags must be cleaned up after full rollout.** Once a flag has been at\n100% in production for two weeks and there is no plan to turn it off, remove the\nconditional from the code and delete the flag in a follow-up PR. Every flag left\nbehind is a branch of untested code and a future outage. The owning team reviews\nits flag list at each sprint boundary.\n"
33
- },
34
- {
35
- "doc_id": 9609,
36
- "kind": "runbook",
37
- "title": "Security response",
38
- "service": "",
39
- "author": "Alex Osei",
40
- "day": 263,
41
- "body": "# Security response\n\nCovers dependency vulnerabilities reported by the scanner and secrets found in\nsource. Security tickets carry the `security` type and are prioritized above\nfeature work.\n\n## Vulnerable dependency\n\nOrdered steps:\n\n1. **Patch the vulnerable dependency.** Bump to the fixed version named in the\n finding via a PR with a `dependency` change. Do not jump several major\n versions to \"get ahead\" - patch to the fixed version, then plan the upgrade\n separately.\n2. **Deploy staging, then production.** Staging-first per the \"Deployment\n policy\". Tier-1 services canary at `canary_percent <= 25`, `assess_canary`,\n then `promote_canary`.\n3. **Verify the scanner shows the finding remediated.** Re-run the scan against\n the deployed service and confirm the vulnerability status is no longer\n `open`. A merged PR is not remediation; a deployed and re-scanned service is.\n4. **Post an audit summary to `#security` referencing the CVE id.** State the\n CVE, the service, the old and new versions, and when production was patched.\n Auditors read this channel; the CVE id must appear literally.\n5. **Close the security ticket.**\n\nTimelines by severity, measured from the finding appearing:\n\n| Severity | Production patched within |\n| -------- | ------------------------- |\n| critical | 48 hours |\n| high | 7 days |\n| medium | 30 days |\n| low | next maintenance window |\n\n## Secrets in code\n\nIf a credential, API key, or token is found in source, config, or CI logs:\n\n1. **Move it to the secret manager.** Set config key\n `use_secret_manager=true` for the service and reference the secret by name;\n the value never appears in the repo again.\n2. **Rotate the credential.** Assume it is compromised the moment it was\n committed - git history is forever and the repo is mirrored to CI. Rotation\n is not optional even if the repo is private.\n3. Deploy staging then production, verify the service still authenticates, and\n post the summary to `#security`.\n\nDo not \"delete the line and force-push\". The old blob is still reachable and the\ncredential is still live.\n\n## Escalation\n\nAnything involving customer data exposure, an actively exploited vulnerability,\nor credential misuse in production is a sev1 - open an incident and follow\n\"Incident response\" in parallel with this runbook.\n\n## Related\n\n- \"ADR-027: Move partner credentials to the secret manager\".\n"
42
- },
43
- {
44
- "doc_id": 9612,
45
- "kind": "runbook",
46
- "title": "Queue consumer tuning",
47
- "service": "notifications",
48
- "author": "Priya Nair",
49
- "day": 226,
50
- "body": "# Queue consumer tuning\n\nOwner: platform. Primary consumer service: `notifications` (tier 2), which\ndrains the email, SMS, and push delivery queues. The same rules apply to any\nservice that consumes from the message broker.\n\n## The rule\n\n`prefetch_count` must be a **bounded** value. **Recommended: 50.**\n\n`prefetch_count=0` means **unlimited prefetch** and is the single worst setting\nin this runbook.\n\n## What prefetch does\n\nPrefetch is the number of unacknowledged messages the broker will push to a\nsingle consumer. With `prefetch_count=50`, a consumer holds at most 50\nin-flight messages; the broker will not send a 51st until one is acknowledged.\nThis is the backpressure mechanism - it is what lets a slow consumer tell the\nbroker to slow down.\n\nWith `prefetch_count=0` there is no backpressure. The broker pushes the entire\nbacklog to whichever consumer connects first. Consequences, all of which we have\nseen in `notifications`:\n\n- **Memory pressure.** A 400k-message backlog lands in one process's heap. RSS\n climbs until the container hits its memory limit.\n- **Consumer restarts.** The container is OOM-killed, the unacknowledged\n messages are redelivered, the restarted consumer grabs them all again, and it\n is killed again. A restart loop that looks like a broker problem and is not.\n- **Terrible load distribution.** One consumer holds everything while its\n siblings sit idle, so scaling out does nothing.\n- **Head-of-line latency.** A high-priority message sits behind 400k others.\n\n## Sizing\n\n| Message profile | prefetch_count |\n| ------------------------------ | -------------- |\n| Fast, uniform (a few ms each) | 100-200 |\n| Standard delivery work | **50** |\n| Slow or variable (seconds) | 5-10 |\n| Long-running jobs (minutes) | 1 |\n\nRule of thumb: `prefetch_count` should be roughly the number of messages a\nconsumer can process in one to two seconds. Start at 50 and adjust with\nevidence.\n\n## Related settings\n\n- `smtp_pool` on `notifications` bounds concurrent SMTP connections. Prefetch\n above the SMTP concurrency just buys queueing inside the process.\n- Ack **after** the work is done, never on receipt. Acking on receipt turns a\n crash into silent message loss.\n- Dead-letter after 5 delivery attempts so a poison message cannot loop forever.\n\n## Changing it\n\nRepo config: PR with a `config` change, CI, merge, staging, production.\n`notifications` is tier 2 - straight 100% deploy after staging. Watch consumer\nmemory and queue depth for one full peak after the change.\n"
51
- },
52
- {
53
- "doc_id": 9613,
54
- "kind": "runbook",
55
- "title": "CDN and media delivery",
56
- "service": "media-service",
57
- "author": "Mei Tanaka",
58
- "day": 221,
59
- "body": "# CDN and media delivery\n\nCovers media-service, the product-image and asset delivery path owned by\ncommerce and shipped as part of the `catalog` service. Product photography,\ngenerated thumbnails, size charts, and marketing video posters all flow through\nit.\n\n## The rule\n\n`cdn_enabled=true` is **required in production** for media-service. Origin-only\nserving is not an acceptable production configuration.\n\n## Why\n\nWith the CDN enabled, edge nodes serve cached objects close to the user and the\norigin sees only cache misses and revalidations - typically under 5% of\nrequests. With `cdn_enabled=false`, every image request travels to the origin\nand out of the object store.\n\nMeasured impact of origin-only serving:\n\n- **~600ms added at p99** on image-heavy pages. Category and product-detail\n pages are the worst affected because they fan out to dozens of assets, and\n browsers cap parallel connections per origin, so the latency serializes.\n- **Object-store cost rises sharply.** Egress and per-request charges are billed\n on every single request instead of on misses. In the one week we ran\n origin-only during a migration, media egress was roughly 20x the normal line\n item.\n- Origin bandwidth saturates first during traffic spikes, and image failures\n make the storefront look broken even when checkout is perfectly healthy.\n\n## Config\n\n| Key | Production value | Notes |\n| --------------- | ---------------- | --------------------------------------- |\n| `cdn_enabled` | `true` | Required. |\n\nCache-control defaults: immutable, content-hashed asset URLs get a one-year\nmax-age; mutable paths get 300s with revalidation. Because asset URLs are\ncontent-hashed, a new image is a new URL - you should almost never need to purge.\n\n## Purging\n\nPurge only for a legal or trademark takedown, or for an asset published in\nerror. A full-prefix purge is effectively a cold cache: expect an origin load\nspike and a temporary p99 regression. Purge narrowly, by exact URL, during low\ntraffic.\n\n## Troubleshooting\n\n- Images slow but HTML fast: check `cdn_enabled` first, before anything else.\n- Cache hit ratio below 90%: usually a query string added to asset URLs, which\n fragments the cache key. Strip non-semantic query parameters at the edge.\n- 403s from the edge: signed-URL clock skew on the origin.\n\n## Changing it\n\nRepo config: PR with a `config` change, CI, merge, staging, then production per\nthe \"Deployment policy\". Verify p99 on a product-detail page and the edge hit\nratio before closing the ticket.\n"
60
- },
61
- {
62
- "doc_id": 9614,
63
- "kind": "design_doc",
64
- "title": "Checkout architecture",
65
- "service": "checkout",
66
- "author": "Diego Ramos",
67
- "day": 198,
68
- "body": "# Checkout architecture\n\nService: `checkout` (tier 1, python, commerce). Owns the cart and the checkout\norchestration state machine. SLOs: `error_rate_pct < 1.0`,\n`latency_p99_ms < 400`.\n\n## Responsibilities\n\n`checkout` owns the transition from \"a cart exists\" to \"an order exists and is\npaid\". It does not own money movement (that is `payments`), product data (that\nis `catalog`), or customer notification (that is `notifications`). It owns the\nsequencing and the guarantee that the sequence happens exactly once.\n\nModules: `cart`, `checkout_flow`, and - once the loyalty program ships -\n`loyalty_redeem`.\n\n## The state machine\n\nEvery checkout session is a row with an explicit state:\n\n```\ncart_open -> pricing_locked -> payment_pending -> paid -> order_created\n | |\n +-> abandoned +-> payment_failed\n```\n\nTransitions are append-only and each is stamped with the idempotency key of the\nrequest that caused it. Replaying a request that has already produced a\ntransition returns the existing result rather than performing it again. This is\nwhat makes the checkout endpoint safe to retry, which matters because clients\nretry aggressively on mobile networks.\n\n## Dependencies\n\n| Downstream | Call | Timeout budget |\n| --------------- | ------------------------ | ------------------------- |\n| `catalog` | price and availability | `<= 2000ms`, 3 attempts |\n| `payments` | authorize and capture | `payment_timeout_ms` |\n| `notifications` | order confirmation | async, fire-and-forget |\n\nAll synchronous calls follow the \"Retry and timeout standard\": three attempts,\ntimeout at or below 2000ms. The `notifications` call is deliberately\nasynchronous - a confirmation email must never be able to fail an order.\n\n## Pricing lock\n\nAt `pricing_locked` we snapshot the price, the promotion, and the tax\ncomputation into the session row. From that point the customer pays the price\nthey were shown even if `catalog` changes underneath. The lock expires after 20\nminutes, after which the session re-prices.\n\n## Failure handling\n\n- `payments` timeout: the session stays `payment_pending` and a reconciliation\n job asks `payments` for the authoritative status. We never assume a timeout\n means \"did not happen\".\n- `catalog` unavailable: fail closed. We do not sell at a guessed price.\n- Partial capture: not supported; a capture is all-or-nothing per order.\n\n## Feature flags\n\nCheckout-adjacent behavior ships behind flags - `instant_refunds`,\n`express_checkout`. Per the \"Feature flags\" runbook, the code deploys first and\nthe flag is enabled afterwards at no more than 10%. `instant_refunds` is the\ncautionary tale: ramped to 100% in production, it took `error_rate_pct` from\n0.3% to 5.5% via a nil-pointer panic in the refund worker.\n\n## Open questions\n\n- Should the pricing lock move into `catalog` so `search` can honor it too?\n- Cart merge on login is still last-write-wins; it should be a real merge.\n"
69
- },
70
- {
71
- "doc_id": 9617,
72
- "kind": "design_doc",
73
- "title": "Loyalty points program",
74
- "service": "",
75
- "author": "Diego Ramos",
76
- "day": 288,
77
- "body": "# Loyalty points program\n\nCross-service feature spanning `catalog`, `checkout`, and `storefront-web`.\nCustomers earn points on purchases and redeem them for order discounts.\n\n## Modules and ownership\n\n| Module | Service | Responsibility |\n| ----------------- | ----------------- | ------------------------------------- |\n| `loyalty_accrual` | `catalog` | Points-earning rules per product |\n| `loyalty_redeem` | `checkout` | Applying points as an order discount |\n| `loyalty_widget` | `storefront-web` | Balance display and redeem affordance |\n\nEach module ships in **its own PR against its own service**. There is no shared\nlibrary; the contract between them is the points-rate field on the product\npayload and the redeem call on the checkout API.\n\n## Why this split\n\nAccrual rules are product data - they vary per product and per category, they\nchange with merchandising campaigns, and they belong next to pricing. Redemption\nis an order-level money decision and belongs in the checkout state machine.\nDisplay is display. Putting accrual in `checkout` would have meant `checkout`\nreading the product rules table, which is exactly the coupling we spent last\nyear removing.\n\n## Rollout order\n\nDeployment order matters and is not negotiable:\n\n**`catalog` - then `checkout` - then `storefront-web`.**\n\nThe reasoning is a strict data dependency chain:\n\n1. `catalog` must be emitting a points rate on the product payload before\n `checkout` can compute a balance to redeem against. If `checkout` ships\n first, every redeem attempt reads a missing field and either errors or\n silently computes zero.\n2. `checkout` must expose the redeem endpoint and be live before\n `storefront-web` renders a redeem button. If the widget ships first,\n customers see a button that 404s - a visible, embarrassing failure on the\n busiest page we have.\n\n`catalog` is tier 2 (straight production deploy after staging). `checkout` and\n`storefront-web` are tier 1, so each is staging-first, then a production canary\nat `canary_percent <= 25`, `assess_canary`, then `promote_canary` - see\n\"Deployment policy\". Do not begin the next service's production deploy until the\nprevious one is fully promoted.\n\n## Points model\n\nBalances live in an append-only ledger, mirroring the approach in \"Payments\nsettlement pipeline\": `earn`, `redeem`, `expire`, `adjust`. Balance is the sum,\nnever a stored counter. Redemption is authorized at `pricing_locked` and\ncommitted at `paid`; an abandoned cart releases the hold after 20 minutes.\n\nDefault rate is 1 point per whole currency unit, 100 points equals one currency\nunit of discount, points expire 12 months after earning. Maximum redemption is\n50% of order subtotal.\n\n## Risks\n\n- Double-redeem across concurrent sessions. Mitigated by the hold and by the\n idempotency key on the checkout transition.\n- Accrual rule changes retroactively altering historical balances. The ledger\n stamps the rate version at earn time.\n"
78
- },
79
- {
80
- "doc_id": 9620,
81
- "kind": "adr",
82
- "title": "ADR-027: Move partner credentials to the secret manager",
83
- "service": "payments",
84
- "author": "Alex Osei",
85
- "day": 191,
86
- "body": "# ADR-027: Move partner credentials to the secret manager\n\n**Status:** Accepted\n**Date:** day 191\n**Deciders:** security, platform, commerce\n\n## Context\n\nPartner credentials - the payment processor API key, the shipping carrier\ntokens, the SMTP credentials used by `notifications`, and the analytics\nwrite key - were stored as plain config values in each service's repo config\nand injected as environment variables at deploy time.\n\nThree problems made this untenable:\n\n1. **Git history is permanent.** Every credential ever committed remains in\n history, in every clone, and in every CI cache. Removing the line does not\n remove the secret.\n2. **Rotation was a deploy.** Rotating the processor key meant a PR, CI, staging,\n canary, promote - per service. So rotation happened roughly never, and the\n processor key in production had been unchanged for over a year.\n3. **No access audit.** We could not answer \"who read this value, and when\",\n which is a direct finding in the annual audit.\n\nThe trigger was a scanner hit: a carrier token visible in a config file in a\nrepo that four teams could read.\n\n## Decision\n\nAll partner credentials move to the managed **secret manager**. Each service\nopts in with the config key **`use_secret_manager=true`** and references secrets\nby name rather than value. The application resolves secrets at startup and on a\nrefresh interval; the plaintext never appears in the repo, in a PR diff, or in a\ndeploy artifact.\n\nEvery credential moved is **rotated as part of the move**, on the assumption\nthat anything previously in the repo is compromised.\n\nRollout order: `payments` first (highest value), then `notifications`, then the\nremaining services.\n\n## Alternatives considered\n\n**Encrypted secrets committed to the repo (sealed values).** Rejected: it solves\nplaintext exposure but not rotation-as-a-deploy, and the decryption key becomes\nthe new committed secret.\n\n**Environment variables set manually on hosts.** Rejected: unauditable,\ndrift-prone, and impossible to reproduce.\n\n**Do nothing, tighten repo permissions.** Rejected: it does not address history,\nrotation, or audit.\n\n## Consequences\n\nPositive: rotation is an operation, not a release; access is logged per read;\nsecret scanning in CI becomes a hard gate rather than advisory.\n\nNegative: a new startup-time dependency. If the secret manager is unreachable a\nservice cannot start, so we cache the last successful resolution on disk,\nencrypted, with a short TTL, to survive a brief outage.\n\nOperational procedure for a leaked credential is in the \"Security response\"\nrunbook: move to the secret manager, **rotate**, deploy, verify, post to\n`#security`.\n"
87
- },
88
- {
89
- "doc_id": 9622,
90
- "kind": "postmortem",
91
- "title": "Postmortem: search cache stampede after index rebuild",
92
- "service": "search",
93
- "author": "Mei Tanaka",
94
- "day": 183,
95
- "body": "# Postmortem: search cache stampede after index rebuild\n\n**Severity:** sev2\n**Service:** `search`\n**Duration:** 34 minutes of degraded search\n**Author:** Mei Tanaka\n**Status:** action items complete\n\n## Summary\n\nA planned index rebuild swapped the search index alias at a moderate traffic\nhour. The alias swap invalidated the entire query cache. Every in-flight query\nmissed simultaneously and hit the primary index, driving `latency_p99_ms` from\n~210ms to a peak of 2100ms and firing the `search latency_p99_ms` alert against\nits 300ms SLO. Search was slow, not down; conversion on search-originated\nsessions dropped an estimated 18% for the duration.\n\n## Timeline (UTC)\n\n- **14:02** Engineer starts a full index rebuild for an analyzer change. Routine;\n done a dozen times before.\n- **14:41** Rebuild completes. Alias swaps to the new index. Query cache keys are\n namespaced by index generation, so the swap invalidates 100% of the cache.\n- **14:42** `latency_p99_ms` crosses 300ms. Alert fires, `medium`.\n- **14:44** On-call acknowledges. Initial hypothesis: the new analyzer is slow.\n- **14:51** Index CPU is pegged; per-query cost is unchanged from before the\n rebuild. Hypothesis discarded - it is volume, not per-query cost.\n- **14:58** Cache hit ratio confirmed at 3%, against a normal 76%. Root cause\n identified.\n- **15:06** Traffic to search temporarily shed at the gateway by 30% to let the\n cache refill.\n- **15:16** Hit ratio back above 60%; p99 at 340ms and falling.\n- **15:22** Shedding removed. p99 at 215ms.\n- **15:26** Alert resolved, incident resolved, update posted in `#incidents`.\n\n## Root cause\n\nThe query cache is namespaced by index generation. An alias swap therefore\nperforms a **complete, instantaneous cache flush** with no warm-up. Because the\ncache normally absorbs about **75% of index load**, the index was asked to serve\nroughly 4x its steady-state query volume within one second. Requests queued,\nlatency rose, clients retried, and the retries added load - a classic stampede\nwith a positive feedback loop.\n\n## Contributing factors\n\n- No warm-up step in the rebuild procedure. The runbook ended at \"swap alias\".\n- Rebuild was run at 14:00 local, in the daily traffic ramp, because the job\n takes 40 minutes and nobody wanted to babysit it at night.\n- Single-flight coalescing existed for identical concurrent queries but the\n stampede was across *thousands of distinct* queries, so coalescing did nothing.\n- No alert on cache hit ratio, so the actual signal was invisible for 14 minutes.\n\n## What went well\n\n- Alerting fired within a minute of the SLO breach.\n- Load shedding at the gateway was the correct blunt instrument and worked.\n\n## Action items\n\n1. Add a **warm-up phase** to the rebuild: replay the top 5000 queries against\n the new index before swapping the alias. **Done.**\n2. Add **+/-10% TTL jitter** to `cache_ttl_s=300` so natural expiry never\n synchronizes. **Done.**\n3. Alert on **cache hit ratio below 50%** for 5 minutes. **Done.**\n4. Move scheduled rebuilds to 03:00-05:00 UTC. **Done.**\n5. Document the stampede risk in the \"Search caching\" runbook. **Done.**\n"
96
- },
97
- {
98
- "doc_id": 9623,
99
- "kind": "postmortem",
100
- "title": "Postmortem: catalog migration 0043 forced a rollback",
101
- "service": "catalog",
102
- "author": "Diego Ramos",
103
- "day": 202,
104
- "body": "# Postmortem: catalog migration 0043 forced a rollback\n\n**Severity:** sev1\n**Service:** `catalog` (with knock-on impact to `checkout` and `storefront-web`)\n**Duration:** 22 minutes of failed product-detail pages\n**Author:** Diego Ramos\n**Status:** action items complete\n\n## Summary\n\nMigration `0043_rename_price_column` renamed `catalog_products.price_cents` to\n`price_minor_units` in a single step, and the matching code version `v1.8.0` was\ndeployed immediately after. The migration was applied to production before the\ndeploy, as policy requires - but the migration was **not backwards compatible**\nwith the code version already running. Between the migration completing and the\nnew version being fully rolled out, the running `v1.7.6` instances queried a\ncolumn that no longer existed. Product-detail and category pages returned 500s;\n`checkout` fell back to failing closed on pricing, per its design.\n\n## Timeline (UTC)\n\n- **09:12** `apply_migration(catalog, production, 0043)` starts.\n- **09:13** Migration completes. Column renamed.\n- **09:13** `v1.7.6` instances begin throwing\n `UndefinedColumn: price_cents` on every pricing query.\n- **09:14** `catalog` error rate goes vertical. `checkout` starts failing closed.\n Two alerts fire.\n- **09:15** Deploy of `v1.8.0` starts, as planned, but rolls instance by instance.\n- **09:17** On-call acknowledges, declares sev1.\n- **09:19** Commander recognizes the pattern: schema ahead of code, partial fleet.\n- **09:21** Decision: do **not** attempt to reverse the migration. Accelerate the\n `v1.8.0` rollout instead.\n- **09:31** Rollout complete on all instances. Errors stop.\n- **09:34** Metrics confirmed recovered; alerts resolved; incident resolved.\n- **09:40** Update posted in `#incidents`; status page updated and cleared.\n- Later that day: `v1.8.0` was rolled back for an unrelated defect found in\n review, which is when the second lesson landed - the rolled-back `v1.7.6` code\n could not read the renamed column either, and a hotfix `v1.8.1` had to be cut\n because **migrations are forward-only** and there was no going back.\n\n## Root cause\n\nA **destructive, non-backwards-compatible schema change shipped in one step**. A\ncolumn rename is two incompatible states with no overlap: code that knows the old\nname and code that knows the new name cannot both work against the same schema.\nAny window in which both code versions run - and a rolling deploy guarantees such\na window - is an outage.\n\n## Contributing factors\n\n- The \"migration before code\" rule was followed correctly, and following it\n correctly was *insufficient*. The rule says nothing about compatibility with\n the code already running.\n- The migration had one reviewer, from the authoring team.\n- Rolling deploys were assumed to be fast enough not to matter. They are not.\n- `catalog` is tier 2, so there was no canary to catch it at 25%.\n\n## What went well\n\n- Nobody tried to hand-write a reverse migration under pressure. Rolling forward\n was the right call and it was made in six minutes.\n- `checkout` failing closed on pricing prevented selling at a wrong price.\n\n## Action items\n\n1. Write the **N-1 rule** into the \"Database migration policy\": every migration\n must leave the schema usable by the currently deployed code. **Done.**\n2. Mandate the **expand/contract** pattern for renames: add column, dual-write,\n backfill, switch reads, drop in a later migration. **Done.**\n3. Require a **second reviewer from platform** for migrations on tables above ten\n million rows. **Done.**\n4. Add a CI check that flags `DROP COLUMN`, `RENAME COLUMN`, and new `NOT NULL`\n constraints for explicit sign-off. **Done.**\n"
105
- },
106
- {
107
- "doc_id": 9624,
108
- "kind": "api_spec",
109
- "title": "Public Orders API",
110
- "service": "api-gateway",
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
- "doc_id": 9630,
117
- "kind": "onboarding",
118
- "title": "Service catalog and service tiers",
119
- "service": "",
120
- "author": "Mei Tanaka",
121
- "day": 285,
122
- "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"
123
- }
124
- ]
125
- ```
126
-
127
- ## confluence_pages (4 rows)
128
-
129
- ```json
130
- [
131
- {
132
- "page_id": 8001,
133
- "space": "ENG",
134
- "title": "Checkout Platform \u2014 architecture",
135
- "body": "Checkout Platform is owned by the Commerce Platform team. It calls payments and inventory synchronously. Escalate via #commerce.",
136
- "last_updated_day": 372,
137
- "stale": 0
138
- },
139
- {
140
- "page_id": 8002,
141
- "space": "ENG",
142
- "title": "Gateway runbook (legacy)",
143
- "body": "The Edge Team owns the gateway. Page the Edge Team rota for any 5xx spike. Restart procedure targets host gw-prod-03.",
144
- "last_updated_day": 181,
145
- "stale": 1
146
- },
147
- {
148
- "page_id": 8003,
149
- "space": "ENG",
150
- "title": "Weekly reporting conventions",
151
- "body": "Engineering weekly reports run Monday to Sunday, ISO-8601 week numbering, in UTC. Note that the service-owner spreadsheet uses a Sunday start and will disagree by one day at the boundary.",
152
- "last_updated_day": 401,
153
- "stale": 0
154
- },
155
- {
156
- "page_id": 8004,
157
- "space": "ENG",
158
- "title": "Incident severity ladder",
159
- "body": "P1 = customer-facing outage, P2 = degraded customer experience, P3 = internal only, P4 = cosmetic. Customer-facing status is recorded on the public status page, not on the incident.",
160
- "last_updated_day": 395,
161
- "stale": 0
162
- }
163
- ]
164
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
task_files/dob100-001-rca-analytics-egress-blocked/11-source-inventory.csv ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ case_id,source,status
2
+ DOB-001,Jira,inspect
3
+ DOB-001,GitHub,inspect
4
+ DOB-001,Confluence,inspect
5
+ DOB-001,Slack,inspect
6
+ DOB-001,PagerDuty,inspect
7
+ DOB-001,live service,inspect
task_files/dob100-001-rca-analytics-egress-blocked/12-chat-and-status.json DELETED
@@ -1,126 +0,0 @@
1
- {
2
- "sources": [
3
- {
4
- "columns": [
5
- "message_id",
6
- "channel",
7
- "author",
8
- "body"
9
- ],
10
- "row_count": 6,
11
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
12
- "table": "messages",
13
- "task_relevant_rows": [
14
- {
15
- "author": "Priya Nair",
16
- "body": "Declared incident 9701 (sev1): api-gateway p99 through the roof since the v5.1.0 promote.",
17
- "channel": "#incidents",
18
- "message_id": 1
19
- },
20
- {
21
- "author": "Diego Ramos",
22
- "body": "Incident 9702 (sev2): checkout error rate tracks the instant_refunds ramp exactly.",
23
- "channel": "#incidents",
24
- "message_id": 2
25
- },
26
- {
27
- "author": "Alex Osei",
28
- "body": "Incident 9703 (sev2): inventory reservations timing out at peak; pool looks undersized.",
29
- "channel": "#incidents",
30
- "message_id": 3
31
- },
32
- {
33
- "author": "Mei Tanaka",
34
- "body": "Reminder: deployment policy = staging first; tier-1 canary at 25% then promote.",
35
- "channel": "#eng",
36
- "message_id": 4
37
- }
38
- ]
39
- },
40
- {
41
- "columns": [
42
- "channel",
43
- "purpose"
44
- ],
45
- "row_count": 4,
46
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
47
- "table": "channels",
48
- "task_relevant_rows": [
49
- {
50
- "channel": "#incidents",
51
- "purpose": "Incident coordination and status updates."
52
- },
53
- {
54
- "channel": "#security",
55
- "purpose": "Security advisories and audit notes."
56
- },
57
- {
58
- "channel": "#eng",
59
- "purpose": "General engineering."
60
- },
61
- {
62
- "channel": "#deploys",
63
- "purpose": "Deployment announcements."
64
- }
65
- ]
66
- },
67
- {
68
- "columns": [
69
- "post_id",
70
- "state",
71
- "title",
72
- "body"
73
- ],
74
- "row_count": 1,
75
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
76
- "table": "status_page",
77
- "task_relevant_rows": [
78
- {
79
- "body": "Catalog read replica maintenance completed with no customer impact.",
80
- "post_id": 1,
81
- "state": "resolved",
82
- "title": "Scheduled maintenance completed"
83
- }
84
- ]
85
- },
86
- {
87
- "columns": [
88
- "post_id",
89
- "title",
90
- "impact",
91
- "state",
92
- "published_day",
93
- "linked_incident"
94
- ],
95
- "row_count": 3,
96
- "selection_note": "Rows matching task identifiers are shown; a small source sample is shown when no identifier matches.",
97
- "table": "status_page_posts",
98
- "task_relevant_rows": [
99
- {
100
- "impact": "major",
101
- "linked_incident": 5101,
102
- "post_id": 7001,
103
- "published_day": 412,
104
- "state": "resolved",
105
- "title": "Degraded checkout performance"
106
- },
107
- {
108
- "impact": "minor",
109
- "linked_incident": 5102,
110
- "post_id": 7002,
111
- "published_day": 415,
112
- "state": "monitoring",
113
- "title": "Elevated error rates on payments"
114
- },
115
- {
116
- "impact": "major",
117
- "linked_incident": 5103,
118
- "post_id": 7003,
119
- "published_day": 417,
120
- "state": "resolved",
121
- "title": "API latency affecting some customers"
122
- }
123
- ]
124
- }
125
- ]
126
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
task_files/dob100-001-rca-analytics-egress-blocked/12-request-email.eml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ From: release-manager@novacart.example
2
+ To: on-call@novacart.example
3
+ Date: Tue, 03 Mar 2026 09:00:00 +0000
4
+ Subject: Please resolve DOB-001
5
+ Message-ID: <dob-001-dob-001@novacart.example>
6
+ X-Work-Item: DOB-001
7
+ MIME-Version: 1.0
8
+ Content-Type: text/plain; charset=utf-8
9
+
10
+ The tracker captures intake only. Reconcile the live systems and leave an auditable handoff; do not follow a copied runbook blindly.
task_files/dob100-001-rca-analytics-egress-blocked/13-approval-and-ownership.md DELETED
@@ -1,76 +0,0 @@
1
- # 13 Approval And Ownership
2
-
3
- ## approval_policy (5 rows)
4
-
5
- ```json
6
- [
7
- {
8
- "policy_id": 502,
9
- "action": "retire_endpoint_with_live_traffic",
10
- "approver_role": "service-owner",
11
- "rationale": "drops in-flight customer requests; cannot be undone once clients fail"
12
- }
13
- ]
14
- ```
15
-
16
- ## owner_spreadsheet (5 rows)
17
-
18
- ```json
19
- [
20
- {
21
- "row_id": 1,
22
- "service_label": "Checkout (commerce)",
23
- "owning_team": "Commerce Platform",
24
- "slack_channel": "#commerce",
25
- "last_reviewed_day": 340,
26
- "week_start": "sunday"
27
- },
28
- {
29
- "row_id": 2,
30
- "service_label": "Payments (commerce)",
31
- "owning_team": "Commerce Platform",
32
- "slack_channel": "#commerce",
33
- "last_reviewed_day": 340,
34
- "week_start": "sunday"
35
- },
36
- {
37
- "row_id": 3,
38
- "service_label": "Search (growth)",
39
- "owning_team": "Discovery Squad",
40
- "slack_channel": "#growth",
41
- "last_reviewed_day": 210,
42
- "week_start": "sunday"
43
- },
44
- {
45
- "row_id": 4,
46
- "service_label": "Gateway (platform)",
47
- "owning_team": "Edge Team",
48
- "slack_channel": "#edge",
49
- "last_reviewed_day": 180,
50
- "week_start": "sunday"
51
- }
52
- ]
53
- ```
54
-
55
- ## oncall (4 rows)
56
-
57
- ```json
58
- [
59
- {
60
- "team": "platform",
61
- "engineer": "Priya Nair"
62
- },
63
- {
64
- "team": "commerce",
65
- "engineer": "Diego Ramos"
66
- },
67
- {
68
- "team": "growth",
69
- "engineer": "Mei Tanaka"
70
- },
71
- {
72
- "team": "sre",
73
- "engineer": "Alex Osei"
74
- }
75
- ]
76
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
task_files/dob100-001-rca-analytics-egress-blocked/13-former-owner-email.eml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ From: release-manager@novacart.example
2
+ To: on-call@novacart.example
3
+ Date: Tue, 03 Mar 2026 09:00:00 +0000
4
+ Subject: Old suggestion for DOB-001
5
+ Message-ID: <dob-101-dob-001@novacart.example>
6
+ X-Work-Item: DOB-001
7
+ MIME-Version: 1.0
8
+ Content-Type: text/plain; charset=utf-8
9
+
10
+ I previously used OPS-CONTROL-2025.11. That may no longer be valid, and I did not verify today's production state.
task_files/dob100-001-rca-analytics-egress-blocked/14-service-catalog.csv ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ case_id,description,kind,language,name,repo_version,service_id,team,tier
2
+ DOB-001,"Customer-facing storefront (Next.js): browse, cart, checkout UI.",frontend,typescript,storefront-web,v3.2.4,9001,growth,1
3
+ DOB-001,"Public API edge: routing, auth, rate limiting, traffic weighting.",backend,go,api-gateway,v5.1.0,9002,platform,1
4
+ DOB-001,"Product catalog, pricing, and merchandising.",backend,python,catalog,v1.9.2,9003,commerce,2
5
+ DOB-001,Cart and checkout orchestration.,backend,python,checkout,v2.6.3,9004,commerce,1
6
+ DOB-001,"Payment capture, refunds, and settlement.",backend,python,payments,v2.7.0,9005,commerce,1
7
+ DOB-001,Email/SMS/push notification delivery.,worker,python,notifications,v1.4.8,9006,platform,2
8
+ DOB-001,Product search and ranking.,backend,python,search,v3.0.5,9007,growth,2
9
+ DOB-001,"Stock levels, reservations, and warehouse sync.",backend,java,inventory,v4.3.1,9008,commerce,2
10
+ DOB-001,Product imagery and video delivery from the object store.,backend,python,media-service,v0.9.4,9009,growth,3
11
+ DOB-001,Consumes the event queue and builds analytics rollups.,worker,python,analytics-worker,v2.1.7,9010,platform,3
task_files/dob100-001-rca-analytics-egress-blocked/14-tool-contracts.json DELETED
@@ -1,460 +0,0 @@
1
- {
2
- "note": "These are the exact sandbox schemas used by this task; first-party NovaCart tools and vendor-shaped adapters are labeled as such in their descriptions.",
3
- "tools": [
4
- {
5
- "description": "Whether a service can reach a target at the transport layer: open, refused or timing out. The distinction matters - a timeout looks like load and a refusal does not, so a refused path is a policy or firewall change rather than a capacity problem.",
6
- "json_schema": {
7
- "description": "Whether a service can reach a target at the transport layer: open, refused or timing out. The distinction matters - a timeout looks like load and a refusal does not, so a refused path is a policy or firewall change rather than a capacity problem.",
8
- "name": "check_network_path",
9
- "parameters": {
10
- "properties": {
11
- "blocked_only": {
12
- "description": "blocked_only",
13
- "type": "boolean"
14
- },
15
- "from_service": {
16
- "description": "from_service",
17
- "type": "string"
18
- }
19
- },
20
- "required": [],
21
- "type": "object"
22
- }
23
- },
24
- "name": "check_network_path",
25
- "parameters": [
26
- {
27
- "default": "None",
28
- "description": "from_service",
29
- "name": "from_service",
30
- "required": false,
31
- "type": "str"
32
- },
33
- {
34
- "default": "False",
35
- "description": "blocked_only",
36
- "name": "blocked_only",
37
- "required": false,
38
- "type": "bool"
39
- }
40
- ],
41
- "read_tables": [
42
- "network_paths"
43
- ],
44
- "return_type": "list[dict]",
45
- "source_code": "def check_network_path(db_path=None, from_service=None, blocked_only=False):\n \"\"\"Whether a service can reach a target at the transport layer: open, refused or timing out. The distinction matters - a timeout looks like load and a refusal does not, so a refused path is a policy or firewall change rather than a capacity problem.\"\"\"\n import sqlite3 as _sq\n import json as _json\n if db_path:\n conn = _sq.connect(db_path)\n else:\n conn = get_db()\n conn.row_factory = _sq.Row\n try:\n try:\n conn.execute('INSERT INTO tool_calls(tool) VALUES (?)', ('check_network_path',)); conn.commit()\n except Exception:\n pass\n sql = 'SELECT * FROM network_paths'\n conds, args = [], []\n if from_service:\n conds.append('from_service=?'); args.append(from_service)\n if str(blocked_only).lower() in ('1', 'true', 'yes', 'on'):\n conds.append(\"state != 'open'\")\n if conds:\n sql += ' WHERE ' + ' AND '.join(conds)\n return [dict(r) for r in conn.execute(sql + ' ORDER BY from_service, to_target', args).fetchall()]\n finally:\n conn.close()\n",
46
- "tool_id": "tool_check_network_path",
47
- "write_tables": []
48
- },
49
- {
50
- "description": "Full detail for one service: metadata, deployed config, modules, endpoints, dependencies, current metrics.",
51
- "json_schema": {
52
- "description": "Full detail for one service: metadata, deployed config, modules, endpoints, dependencies, current metrics.",
53
- "name": "get_service",
54
- "parameters": {
55
- "properties": {
56
- "service": {
57
- "description": "service",
58
- "type": "string"
59
- }
60
- },
61
- "required": [
62
- "service"
63
- ],
64
- "type": "object"
65
- }
66
- },
67
- "name": "get_service",
68
- "parameters": [
69
- {
70
- "default": null,
71
- "description": "service",
72
- "name": "service",
73
- "required": true,
74
- "type": "str"
75
- }
76
- ],
77
- "read_tables": [
78
- "env_state",
79
- "oncall",
80
- "service_dependencies",
81
- "service_metrics",
82
- "services"
83
- ],
84
- "return_type": "dict",
85
- "source_code": "def get_service(db_path=None, service=None):\n \"\"\"Full detail for one service: metadata, deployed config, modules, endpoints, dependencies, current metrics.\"\"\"\n import sqlite3 as _sq\n import json as _json\n if db_path:\n conn = _sq.connect(db_path)\n else:\n conn = get_db()\n conn.row_factory = _sq.Row\n try:\n try:\n conn.execute('INSERT INTO tool_calls(tool) VALUES (?)', ('get_service',)); conn.commit()\n except Exception:\n pass\n if service is None:\n return {'ok': False, 'error': 'missing required parameter: service'}\n row = conn.execute('SELECT * FROM services WHERE name=?', (service,)).fetchone()\n if row is None:\n return {'ok': False, 'error': 'unknown service: ' + str(service)}\n d = dict(row)\n d['production'] = {}\n for r in conn.execute(\"SELECT kind, key, value FROM env_state WHERE service=? AND environment='production' ORDER BY kind, key\", (service,)).fetchall():\n d['production'].setdefault(r['kind'], {})[r['key']] = r['value']\n d['depends_on'] = [dict(r) for r in conn.execute('SELECT depends_on, kind FROM service_dependencies WHERE service=? ORDER BY depends_on', (service,)).fetchall()]\n d['metrics'] = {r['metric']: r['value'] for r in conn.execute(\"SELECT metric, value FROM service_metrics WHERE service=? AND environment='production'\", (service,)).fetchall()}\n oc = conn.execute('SELECT engineer FROM oncall WHERE team=?', (row['team'],)).fetchone()\n d['oncall_engineer'] = oc[0] if oc else ''\n return d\n finally:\n conn.close()\n",
86
- "tool_id": "tool_get_service",
87
- "write_tables": []
88
- },
89
- {
90
- "description": "Fetch one ticket by key (e.g. ENG-2101).",
91
- "json_schema": {
92
- "description": "Fetch one ticket by key (e.g. ENG-2101).",
93
- "name": "get_ticket",
94
- "parameters": {
95
- "properties": {
96
- "key": {
97
- "description": "key",
98
- "type": "string"
99
- }
100
- },
101
- "required": [
102
- "key"
103
- ],
104
- "type": "object"
105
- }
106
- },
107
- "name": "get_ticket",
108
- "parameters": [
109
- {
110
- "default": null,
111
- "description": "key",
112
- "name": "key",
113
- "required": true,
114
- "type": "str"
115
- }
116
- ],
117
- "read_tables": [
118
- "tickets"
119
- ],
120
- "return_type": "dict",
121
- "source_code": "def get_ticket(db_path=None, key=None):\n \"\"\"Fetch one ticket by key (e.g. ENG-2101).\"\"\"\n import sqlite3 as _sq\n import json as _json\n if db_path:\n conn = _sq.connect(db_path)\n else:\n conn = get_db()\n conn.row_factory = _sq.Row\n try:\n try:\n conn.execute('INSERT INTO tool_calls(tool) VALUES (?)', ('get_ticket',)); conn.commit()\n except Exception:\n pass\n if key is None:\n return {'ok': False, 'error': 'missing required parameter: key'}\n row = conn.execute('SELECT * FROM tickets WHERE key=?', (key,)).fetchone()\n if row is None:\n return {'ok': False, 'error': 'no such ticket: ' + str(key)}\n return dict(row)\n finally:\n conn.close()\n",
122
- "tool_id": "tool_get_ticket",
123
- "write_tables": []
124
- },
125
- {
126
- "description": "Error-tracking issues (Sentry-style): grouped exceptions with culprit and event counts.",
127
- "json_schema": {
128
- "description": "Error-tracking issues (Sentry-style): grouped exceptions with culprit and event counts.",
129
- "name": "list_error_events",
130
- "parameters": {
131
- "properties": {
132
- "service": {
133
- "description": "service",
134
- "type": "string"
135
- },
136
- "status": {
137
- "description": "unresolved|resolved",
138
- "type": "string"
139
- }
140
- },
141
- "required": [],
142
- "type": "object"
143
- }
144
- },
145
- "name": "list_error_events",
146
- "parameters": [
147
- {
148
- "default": "None",
149
- "description": "service",
150
- "name": "service",
151
- "required": false,
152
- "type": "str"
153
- },
154
- {
155
- "default": "None",
156
- "description": "unresolved|resolved",
157
- "name": "status",
158
- "required": false,
159
- "type": "str"
160
- }
161
- ],
162
- "read_tables": [
163
- "error_events"
164
- ],
165
- "return_type": "list[dict]",
166
- "source_code": "def list_error_events(db_path=None, service=None, status=None):\n \"\"\"Error-tracking issues (Sentry-style): grouped exceptions with culprit and event counts.\"\"\"\n import sqlite3 as _sq\n import json as _json\n if db_path:\n conn = _sq.connect(db_path)\n else:\n conn = get_db()\n conn.row_factory = _sq.Row\n try:\n try:\n conn.execute('INSERT INTO tool_calls(tool) VALUES (?)', ('list_error_events',)); conn.commit()\n except Exception:\n pass\n sql = 'SELECT * FROM error_events'\n conds, args = [], []\n if service:\n conds.append('service=?'); args.append(service)\n if status:\n conds.append('status=?'); args.append(status)\n if conds:\n sql += ' WHERE ' + ' AND '.join(conds)\n return [dict(r) for r in conn.execute(sql + ' ORDER BY events DESC', args).fetchall()]\n finally:\n conn.close()\n",
167
- "tool_id": "tool_list_error_events",
168
- "write_tables": []
169
- },
170
- {
171
- "description": "Read current production service metrics (recomputed continuously from live traffic).",
172
- "json_schema": {
173
- "description": "Read current production service metrics (recomputed continuously from live traffic).",
174
- "name": "query_metrics",
175
- "parameters": {
176
- "properties": {
177
- "metric": {
178
- "description": "metric",
179
- "type": "string"
180
- },
181
- "service": {
182
- "description": "service",
183
- "type": "string"
184
- }
185
- },
186
- "required": [],
187
- "type": "object"
188
- }
189
- },
190
- "name": "query_metrics",
191
- "parameters": [
192
- {
193
- "default": "None",
194
- "description": "service",
195
- "name": "service",
196
- "required": false,
197
- "type": "str"
198
- },
199
- {
200
- "default": "None",
201
- "description": "metric",
202
- "name": "metric",
203
- "required": false,
204
- "type": "str"
205
- }
206
- ],
207
- "read_tables": [
208
- "service_metrics"
209
- ],
210
- "return_type": "list[dict]",
211
- "source_code": "def query_metrics(db_path=None, service=None, metric=None):\n \"\"\"Read current production service metrics (recomputed continuously from live traffic).\"\"\"\n import sqlite3 as _sq\n import json as _json\n if db_path:\n conn = _sq.connect(db_path)\n else:\n conn = get_db()\n conn.row_factory = _sq.Row\n try:\n try:\n conn.execute('INSERT INTO tool_calls(tool) VALUES (?)', ('query_metrics',)); conn.commit()\n except Exception:\n pass\n sql = \"SELECT * FROM service_metrics WHERE environment='production'\"\n args = []\n if service:\n sql += ' AND service=?'; args.append(service)\n if metric:\n sql += ' AND metric=?'; args.append(metric)\n return [dict(r) for r in conn.execute(sql + ' ORDER BY service, metric', args).fetchall()]\n finally:\n conn.close()\n",
212
- "tool_id": "tool_query_metrics",
213
- "write_tables": []
214
- },
215
- {
216
- "description": "Search application logs by substring, service, or level.",
217
- "json_schema": {
218
- "description": "Search application logs by substring, service, or level.",
219
- "name": "search_logs",
220
- "parameters": {
221
- "properties": {
222
- "level": {
223
- "description": "level",
224
- "type": "string"
225
- },
226
- "limit": {
227
- "description": "limit",
228
- "type": "integer"
229
- },
230
- "query": {
231
- "description": "query",
232
- "type": "string"
233
- },
234
- "service": {
235
- "description": "service",
236
- "type": "string"
237
- }
238
- },
239
- "required": [],
240
- "type": "object"
241
- }
242
- },
243
- "name": "search_logs",
244
- "parameters": [
245
- {
246
- "default": "None",
247
- "description": "service",
248
- "name": "service",
249
- "required": false,
250
- "type": "str"
251
- },
252
- {
253
- "default": "",
254
- "description": "query",
255
- "name": "query",
256
- "required": false,
257
- "type": "str"
258
- },
259
- {
260
- "default": "None",
261
- "description": "level",
262
- "name": "level",
263
- "required": false,
264
- "type": "str"
265
- },
266
- {
267
- "default": "20",
268
- "description": "limit",
269
- "name": "limit",
270
- "required": false,
271
- "type": "int"
272
- }
273
- ],
274
- "read_tables": [
275
- "logs"
276
- ],
277
- "return_type": "list[dict]",
278
- "source_code": "def search_logs(db_path=None, service=None, query='', level=None, limit=20):\n \"\"\"Search application logs by substring, service, or level.\"\"\"\n import sqlite3 as _sq\n import json as _json\n if db_path:\n conn = _sq.connect(db_path)\n else:\n conn = get_db()\n conn.row_factory = _sq.Row\n try:\n try:\n conn.execute('INSERT INTO tool_calls(tool) VALUES (?)', ('search_logs',)); conn.commit()\n except Exception:\n pass\n sql = 'SELECT * FROM logs'\n conds, args = [], []\n if service:\n conds.append('service=?'); args.append(service)\n if level:\n conds.append('level=?'); args.append(level)\n if query:\n conds.append('message LIKE ?'); args.append('%' + str(query) + '%')\n if conds:\n sql += ' WHERE ' + ' AND '.join(conds)\n return [dict(r) for r in conn.execute(sql + ' ORDER BY log_id LIMIT ?', args + [int(limit)]).fetchall()]\n finally:\n conn.close()\n",
279
- "tool_id": "tool_search_logs",
280
- "write_tables": []
281
- },
282
- {
283
- "description": "Submit a diagnostic finding for an investigation. `scope` is what you were asked to investigate (a service name or alarm id). Set fault_detected=false with fault_type='none' when the scope is healthy. fault_type is one of: misconfig, missing_retry, missing_timeout, resource_exhaustion, unbounded_prefetch, cache_disabled, n_plus_one_query, cdn_bypass, bad_release, feature_flag_regression, node_unhealthy, unclassified, none. Use node_unhealthy when the cause is the node a service runs on rather than the service's own code or config. Use unclassified when you have established that a fault is present but were not asked for, and have not determined, the mechanism - reporting a breach you can evidence is better than reporting health you cannot. offending_key is the specific config key, flag key, node name or version responsible.",
284
- "json_schema": {
285
- "description": "Submit a diagnostic finding for an investigation. `scope` is what you were asked to investigate (a service name or alarm id). Set fault_detected=false with fault_type='none' when the scope is healthy. fault_type is one of: misconfig, missing_retry, missing_timeout, resource_exhaustion, unbounded_prefetch, cache_disabled, n_plus_one_query, cdn_bypass, bad_release, feature_flag_regression, node_unhealthy, unclassified, none. Use node_unhealthy when the cause is the node a service runs on rather than the service's own code or config. Use unclassified when you have established that a fault is present but were not asked for, and have not determined, the mechanism - reporting a breach you can evidence is better than reporting health you cannot. offending_key is the specific config key, flag key, node name or version responsible.",
286
- "name": "submit_diagnosis",
287
- "parameters": {
288
- "properties": {
289
- "evidence": {
290
- "description": "what you observed that supports this finding",
291
- "type": "string"
292
- },
293
- "fault_detected": {
294
- "description": "true if the scope is faulting, false if it is healthy",
295
- "type": "boolean"
296
- },
297
- "fault_type": {
298
- "description": "the mechanism, or 'unclassified' when a fault is evidenced but its mechanism was not asked for, or 'none' when healthy",
299
- "enum": [
300
- "misconfig",
301
- "missing_retry",
302
- "missing_timeout",
303
- "resource_exhaustion",
304
- "unbounded_prefetch",
305
- "cache_disabled",
306
- "n_plus_one_query",
307
- "cdn_bypass",
308
- "bad_release",
309
- "feature_flag_regression",
310
- "node_unhealthy",
311
- "unclassified",
312
- "none"
313
- ],
314
- "type": "string"
315
- },
316
- "offending_key": {
317
- "description": "config key, flag key or version at fault",
318
- "type": "string"
319
- },
320
- "scope": {
321
- "description": "the service or alarm id you were asked to investigate",
322
- "type": "string"
323
- },
324
- "service": {
325
- "description": "the service responsible (localization)",
326
- "type": "string"
327
- }
328
- },
329
- "required": [
330
- "scope",
331
- "fault_detected"
332
- ],
333
- "type": "object"
334
- }
335
- },
336
- "name": "submit_diagnosis",
337
- "parameters": [
338
- {
339
- "default": null,
340
- "description": "the service or alarm id you were asked to investigate",
341
- "name": "scope",
342
- "required": true,
343
- "type": "str"
344
- },
345
- {
346
- "default": null,
347
- "description": "true if the scope is faulting, false if it is healthy",
348
- "name": "fault_detected",
349
- "required": true,
350
- "type": "bool"
351
- },
352
- {
353
- "default": "",
354
- "description": "the service responsible (localization)",
355
- "name": "service",
356
- "required": false,
357
- "type": "str"
358
- },
359
- {
360
- "default": "none",
361
- "description": "the mechanism, or 'unclassified' when a fault is evidenced but its mechanism was not asked for, or 'none' when healthy",
362
- "name": "fault_type",
363
- "required": false,
364
- "type": "str"
365
- },
366
- {
367
- "default": "",
368
- "description": "config key, flag key or version at fault",
369
- "name": "offending_key",
370
- "required": false,
371
- "type": "str"
372
- },
373
- {
374
- "default": "",
375
- "description": "what you observed that supports this finding",
376
- "name": "evidence",
377
- "required": false,
378
- "type": "str"
379
- }
380
- ],
381
- "read_tables": [
382
- "services"
383
- ],
384
- "return_type": "dict",
385
- "source_code": "def submit_diagnosis(db_path=None, scope=None, fault_detected=None, service='', fault_type='none', offending_key='', evidence=''):\n \"\"\"Submit a diagnostic finding for an investigation. `scope` is what you were asked to investigate (a service name or alarm id). Set fault_detected=false with fault_type='none' when the scope is healthy. fault_type is one of: misconfig, missing_retry, missing_timeout, resource_exhaustion, unbounded_prefetch, cache_disabled, n_plus_one_query, cdn_bypass, bad_release, feature_flag_regression, node_unhealthy, unclassified, none. Use node_unhealthy when the cause is the node a service runs on rather than the service's own code or config. Use unclassified when you have established that a fault is present but were not asked for, and have not determined, the mechanism - reporting a breach you can evidence is better than reporting health you cannot. offending_key is the specific config key, flag key, node name or version responsible.\"\"\"\n import sqlite3 as _sq\n import json as _json\n if db_path:\n conn = _sq.connect(db_path)\n else:\n conn = get_db()\n conn.row_factory = _sq.Row\n try:\n try:\n conn.execute('INSERT INTO tool_calls(tool) VALUES (?)', ('submit_diagnosis',)); conn.commit()\n except Exception:\n pass\n if scope is None:\n return {'ok': False, 'error': 'missing required parameter: scope'}\n if fault_detected is None:\n return {'ok': False, 'error': 'missing required parameter: fault_detected'}\n def _audit(conn, _tool, _svc, _detail):\n conn.execute('INSERT INTO audit_events(tool, service, detail) VALUES (?,?,?)', (_tool, _svc, _json.dumps(_detail)))\n kinds = ('misconfig', 'missing_retry', 'missing_timeout', 'resource_exhaustion', 'unbounded_prefetch', 'cache_disabled', 'n_plus_one_query', 'cdn_bypass', 'bad_release', 'feature_flag_regression', 'node_unhealthy', 'unclassified', 'none')\n if fault_type not in kinds:\n return {'ok': False, 'error': 'fault_type must be one of: ' + ', '.join(kinds)}\n _t, _f = ('1', 'true', 'yes', 'on'), ('0', 'false', 'no', 'off')\n _v = str(fault_detected).lower()\n if _v not in _t + _f:\n return {'ok': False, 'error': 'fault_detected must be true or false, not ' + repr(fault_detected)}\n det = 1 if _v in _t else 0\n if service and conn.execute('SELECT 1 FROM services WHERE name=?', (service,)).fetchone() is None:\n return {'ok': False, 'error': 'unknown service: ' + str(service)}\n if det and fault_type == 'none':\n return {'ok': False, 'error': \"fault_detected=true requires a specific fault_type\"}\n if not det and fault_type != 'none':\n return {'ok': False, 'error': \"fault_detected=false requires fault_type='none'\"}\n cur = conn.execute('INSERT INTO diagnoses(scope, fault_detected, service, fault_type, offending_key, evidence) VALUES (?,?,?,?,?,?)',\n (str(scope), det, service or '', fault_type, offending_key or '', evidence or ''))\n _audit(conn, 'submit_diagnosis', service or '', {'scope': str(scope), 'fault_detected': det,\n 'fault_type': fault_type,\n 'offending_key': offending_key or ''})\n conn.commit()\n return {'ok': True, 'diagnosis_id': cur.lastrowid, 'scope': str(scope),\n 'fault_detected': bool(det), 'service': service or '', 'fault_type': fault_type,\n 'offending_key': offending_key or ''}\n finally:\n conn.close()\n",
386
- "tool_id": "tool_submit_diagnosis",
387
- "write_tables": [
388
- "audit_events",
389
- "diagnoses"
390
- ]
391
- },
392
- {
393
- "description": "Update a ticket's status and/or assignee.",
394
- "json_schema": {
395
- "description": "Update a ticket's status and/or assignee.",
396
- "name": "update_ticket",
397
- "parameters": {
398
- "properties": {
399
- "assignee": {
400
- "description": "assignee",
401
- "type": "string"
402
- },
403
- "key": {
404
- "description": "key",
405
- "type": "string"
406
- },
407
- "status": {
408
- "description": "open|in_progress|in_review|done",
409
- "enum": [
410
- "open",
411
- "in_progress",
412
- "in_review",
413
- "done"
414
- ],
415
- "type": "string"
416
- }
417
- },
418
- "required": [
419
- "key"
420
- ],
421
- "type": "object"
422
- }
423
- },
424
- "name": "update_ticket",
425
- "parameters": [
426
- {
427
- "default": null,
428
- "description": "key",
429
- "name": "key",
430
- "required": true,
431
- "type": "str"
432
- },
433
- {
434
- "default": "None",
435
- "description": "open|in_progress|in_review|done",
436
- "name": "status",
437
- "required": false,
438
- "type": "str"
439
- },
440
- {
441
- "default": "None",
442
- "description": "assignee",
443
- "name": "assignee",
444
- "required": false,
445
- "type": "str"
446
- }
447
- ],
448
- "read_tables": [
449
- "tickets"
450
- ],
451
- "return_type": "dict",
452
- "source_code": "def update_ticket(db_path=None, key=None, status=None, assignee=None):\n \"\"\"Update a ticket's status and/or assignee.\"\"\"\n import sqlite3 as _sq\n import json as _json\n if db_path:\n conn = _sq.connect(db_path)\n else:\n conn = get_db()\n conn.row_factory = _sq.Row\n try:\n try:\n conn.execute('INSERT INTO tool_calls(tool) VALUES (?)', ('update_ticket',)); conn.commit()\n except Exception:\n pass\n if key is None:\n return {'ok': False, 'error': 'missing required parameter: key'}\n def _audit(conn, _tool, _svc, _detail):\n conn.execute('INSERT INTO audit_events(tool, service, detail) VALUES (?,?,?)', (_tool, _svc, _json.dumps(_detail)))\n row = conn.execute('SELECT * FROM tickets WHERE key=?', (key,)).fetchone()\n if row is None:\n return {'ok': False, 'error': 'no such ticket: ' + str(key)}\n if status is None and assignee is None:\n return {'ok': False, 'error': 'provide status and/or assignee'}\n if status is not None and status not in ('open', 'in_progress', 'in_review', 'done'):\n return {'ok': False, 'error': 'invalid status: ' + str(status)}\n ns = row['status'] if status is None else status\n na = row['assignee'] if assignee is None else assignee\n conn.execute('UPDATE tickets SET status=?, assignee=? WHERE key=?', (ns, na, key))\n _audit(conn, 'update_ticket', row['service'], {'key': key, 'status': ns})\n conn.commit()\n return {'ok': True, 'key': key, 'status': ns, 'assignee': na}\n finally:\n conn.close()\n",
453
- "tool_id": "tool_update_ticket",
454
- "write_tables": [
455
- "audit_events",
456
- "tickets"
457
- ]
458
- }
459
- ]
460
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
task_files/dob100-001-rca-analytics-egress-blocked/15-slo-export.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ case_id,description,metric,service,slo_id,threshold
2
+ DOB-001,Event processing succeeds 98% of the time.,error_rate_pct,analytics-worker,9511,2.0
task_files/dob100-001-rca-analytics-egress-blocked/16-metrics-export.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ case_id,environment,metric,service,value
2
+ DOB-001,production,error_rate_pct,analytics-worker,6.0
3
+ DOB-001,production,latency_p99_ms,analytics-worker,300.0
task_files/dob100-001-rca-analytics-egress-blocked/17-observability-log-slice.log ADDED
@@ -0,0 +1 @@
 
 
1
+ {"case_id": "DOB-001", "environment": "production", "level": "ERROR", "log_id": 9021, "message": "consumer restarted after MemoryError; prefetch_count=0 means unlimited prefetch from rabbitmq", "service": "analytics-worker"}
task_files/dob100-001-rca-analytics-egress-blocked/18-sentry-issues.json ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "DOB-001",
3
+ "issues": [
4
+ {
5
+ "events": 2317,
6
+ "first_seen_day": 410,
7
+ "issue_id": "CHECKOUT-1A",
8
+ "last_seen_day": 420,
9
+ "level": "error",
10
+ "project_slug": "checkout-web",
11
+ "status": "unresolved",
12
+ "title": "TypeError: NoneType has no attribute 'amount'",
13
+ "users_affected": 890
14
+ },
15
+ {
16
+ "events": 1904,
17
+ "first_seen_day": 409,
18
+ "issue_id": "CHECKOUT-2B",
19
+ "last_seen_day": 420,
20
+ "level": "error",
21
+ "project_slug": "checkout-web",
22
+ "status": "unresolved",
23
+ "title": "TimeoutError: payments call exceeded 8000ms",
24
+ "users_affected": 1502
25
+ },
26
+ {
27
+ "events": 18422,
28
+ "first_seen_day": 405,
29
+ "issue_id": "PAY-9C",
30
+ "last_seen_day": 420,
31
+ "level": "error",
32
+ "project_slug": "payments-backend",
33
+ "status": "unresolved",
34
+ "title": "ConnectionTimeout: notifications call exceeded 30000ms",
35
+ "users_affected": 6210
36
+ },
37
+ {
38
+ "events": 640,
39
+ "first_seen_day": 414,
40
+ "issue_id": "SRCH-3D",
41
+ "last_seen_day": 419,
42
+ "level": "warning",
43
+ "project_slug": "search",
44
+ "status": "resolved",
45
+ "title": "IndexRefreshTimeout",
46
+ "users_affected": 210
47
+ }
48
+ ]
49
+ }
task_files/dob100-001-rca-analytics-egress-blocked/19-kubernetes-pods.yaml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ case_id: DOB-001
2
+ items:
3
+ - {"image_tag": "v2.1.7", "memory_limit_mb": 512, "memory_usage_mb": 511, "namespace": "production", "node": "node-a1", "pending_reason": "", "phase": "CrashLoopBackOff", "pod": "analytics-worker-7d9f-x2k1", "restarts": 47, "service": "analytics-worker"}
4
+ - {"image_tag": "v2.1.7", "memory_limit_mb": 512, "memory_usage_mb": 498, "namespace": "production", "node": "node-a1", "pending_reason": "", "phase": "Running", "pod": "analytics-worker-7d9f-m4p8", "restarts": 39, "service": "analytics-worker"}
5
+ - {"image_tag": "v2.1.7", "memory_limit_mb": 512, "memory_usage_mb": 0, "namespace": "production", "node": "", "pending_reason": "0/4 nodes are available: 1 node(s) had untolerated taint {workload: batch}, 3 node(s) didn't match Pod's node affinity/selector", "phase": "Pending", "pod": "analytics-recon-6a1b-jj10", "restarts": 0, "service": "analytics-worker"}
task_files/dob100-001-rca-analytics-egress-blocked/20-kubernetes-events.log ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {"case_id": "DOB-001", "count": 47, "day": 419, "event_id": 9001, "message": "Container analytics exceeded its memory limit of 512Mi and was killed", "namespace": "production", "pod": "analytics-worker-7d9f-x2k1", "reason": "OOMKilled"}
2
+ {"case_id": "DOB-001", "count": 47, "day": 419, "event_id": 9002, "message": "Back-off restarting failed container analytics", "namespace": "production", "pod": "analytics-worker-7d9f-x2k1", "reason": "CrashLoopBackOff"}
3
+ {"case_id": "DOB-001", "count": 39, "day": 420, "event_id": 9003, "message": "Container analytics exceeded its memory limit of 512Mi and was killed", "namespace": "production", "pod": "analytics-worker-7d9f-m4p8", "reason": "OOMKilled"}
4
+ {"case_id": "DOB-001", "count": 1, "day": 417, "event_id": 9004, "message": "Stopping container gateway for rollout", "namespace": "production", "pod": "api-gateway-9f2e-cc33", "reason": "Killing"}
5
+ {"case_id": "DOB-001", "count": 3, "day": 420, "event_id": 9005, "message": "The node was low on resource: ephemeral-storage. Container media was using 4Gi", "namespace": "production", "pod": "media-service-2e4f-ee55", "reason": "Evicted"}
6
+ {"case_id": "DOB-001", "count": 214, "day": 419, "event_id": 9006, "message": "0/4 nodes are available: 4 node(s) didn't match Pod's node affinity/selector", "namespace": "production", "pod": "search-reindex-8c2a-gg77", "reason": "FailedScheduling"}
7
+ {"case_id": "DOB-001", "count": 1, "day": 420, "event_id": 9007, "message": "Node node-c1 status is now: NodeNotReady", "namespace": "production", "pod": "notifications-1b7d-hh88", "reason": "NodeNotReady"}
8
+ {"case_id": "DOB-001", "count": 96, "day": 418, "event_id": 9008, "message": "Error: container has runAsNonRoot and image will run as root", "namespace": "production", "pod": "inventory-migrator-4d9e-ii99", "reason": "Failed"}
task_files/dob100-001-rca-analytics-egress-blocked/21-deployment-history.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case_id": "DOB-001",
3
+ "deployments": [
4
+ {
5
+ "canary_percent": 100,
6
+ "deployment_id": 9271,
7
+ "environment": "staging",
8
+ "service": "analytics-worker",
9
+ "status": "succeeded",
10
+ "version": "v2.1.7"
11
+ },
12
+ {
13
+ "canary_percent": 100,
14
+ "deployment_id": 9272,
15
+ "environment": "production",
16
+ "service": "analytics-worker",
17
+ "status": "succeeded",
18
+ "version": "v2.1.7"
19
+ }
20
+ ]
21
+ }
task_files/dob100-001-rca-analytics-egress-blocked/22-ci-runs.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ case_id,detail,pr_number,run_id,service,status
2
+ DOB-001,all checks passed,,11,analytics-worker,passed
3
+ DOB-001,intermittent failure: test_rollup_window (rerun may pass),,12,analytics-worker,failed
task_files/dob100-001-rca-analytics-egress-blocked/23-pull-request-context.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "case_id": "DOB-001",
3
+ "pull_requests": []
4
+ }
task_files/dob100-001-rca-analytics-egress-blocked/24-migration-state.sql ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ -- case_id: DOB-001
2
+
task_files/dob100-001-rca-analytics-egress-blocked/25-security-scanner-report.pdf ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ %PDF-1.4
2
+ %����
3
+ 1 0 obj
4
+ << /Type /Catalog /Pages 2 0 R >>
5
+ endobj
6
+ 2 0 obj
7
+ << /Type /Pages /Kids [3 0 R] /Count 1 >>
8
+ endobj
9
+ 3 0 obj
10
+ << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Resources << /Font << /F1 5 0 R >> >> /Contents 4 0 R >>
11
+ endobj
12
+ 4 0 obj
13
+ << /Length 118 >>
14
+ stream
15
+ BT
16
+ /F1 9 Tf
17
+ 54 750 Td
18
+ 11 TL
19
+ (Case DOB-001 security observations) Tj
20
+ T* (No task conclusion is precomputed here.) Tj
21
+ ET
22
+ endstream
23
+ endobj
24
+ 5 0 obj
25
+ << /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>
26
+ endobj
27
+ xref
28
+ 0 6
29
+ 0000000000 65535 f
30
+ 0000000015 00000 n
31
+ 0000000064 00000 n
32
+ 0000000121 00000 n
33
+ 0000000247 00000 n
34
+ 0000000416 00000 n
35
+ trailer
36
+ << /Size 6 /Root 1 0 R >>
37
+ startxref
38
+ 486
39
+ %%EOF
task_files/dob100-001-rca-analytics-egress-blocked/26-approval-policy.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Approval context for DOB-001
2
+
3
+ OPS-CONTROL-2026.03 is operative. Irreversible actions require the approval recorded in the live policy system. Difficulty is not a reason to seek approval, and approval is not evidence that a proposed outcome is correct.
task_files/dob100-001-rca-analytics-egress-blocked/27-current-versus-stale-notes.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ DOB-001 has a current control (OPS-CONTROL-2026.03) and a retained retired note (OPS-CONTROL-2025.11). Resolve effective status and corroborate the underlying facts; filenames and display names are not authority.
task_files/dob100-001-rca-analytics-egress-blocked/28-agent-visible-asset-manifest.json ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "assets": [
3
+ {
4
+ "evidence_role": "request",
5
+ "filename": "01-employee-request.md",
6
+ "source": "employee request"
7
+ },
8
+ {
9
+ "evidence_role": "identity",
10
+ "filename": "02-jira-work-item.csv",
11
+ "source": "Atlassian Jira"
12
+ },
13
+ {
14
+ "evidence_role": "identity",
15
+ "filename": "03-cross-tracker-links.json",
16
+ "source": "tracker link registry"
17
+ },
18
+ {
19
+ "evidence_role": "engineering-signal",
20
+ "filename": "04-github-issue.json",
21
+ "source": "GitHub"
22
+ },
23
+ {
24
+ "evidence_role": "authority",
25
+ "filename": "05-current-operating-control.pdf",
26
+ "source": "Confluence current export"
27
+ },
28
+ {
29
+ "evidence_role": "stale-authority",
30
+ "filename": "06-retired-shortcut-note.pdf",
31
+ "source": "Confluence history export"
32
+ },
33
+ {
34
+ "evidence_role": "conversation",
35
+ "filename": "07-case-room-thread.json",
36
+ "source": "Slack"
37
+ },
38
+ {
39
+ "evidence_role": "change-history",
40
+ "filename": "08-pagerduty-change-events.csv",
41
+ "source": "PagerDuty"
42
+ },
43
+ {
44
+ "evidence_role": "ownership",
45
+ "filename": "09-service-owner-register.xlsx",
46
+ "source": "Microsoft Graph workbook"
47
+ },
48
+ {
49
+ "evidence_role": "schedule",
50
+ "filename": "10-release-calendar.xlsx",
51
+ "source": "Microsoft Graph workbook"
52
+ },
53
+ {
54
+ "evidence_role": "inventory",
55
+ "filename": "11-source-inventory.csv",
56
+ "source": "case intake"
57
+ },
58
+ {
59
+ "evidence_role": "request",
60
+ "filename": "12-request-email.eml",
61
+ "source": "Gmail export"
62
+ },
63
+ {
64
+ "evidence_role": "conflict",
65
+ "filename": "13-former-owner-email.eml",
66
+ "source": "Gmail export"
67
+ },
68
+ {
69
+ "evidence_role": "service-state",
70
+ "filename": "14-service-catalog.csv",
71
+ "source": "service catalog"
72
+ },
73
+ {
74
+ "evidence_role": "live-signal",
75
+ "filename": "15-slo-export.csv",
76
+ "source": "SLO platform"
77
+ },
78
+ {
79
+ "evidence_role": "live-signal",
80
+ "filename": "16-metrics-export.csv",
81
+ "source": "Prometheus"
82
+ },
83
+ {
84
+ "evidence_role": "live-signal",
85
+ "filename": "17-observability-log-slice.log",
86
+ "source": "log platform"
87
+ },
88
+ {
89
+ "evidence_role": "live-signal",
90
+ "filename": "18-sentry-issues.json",
91
+ "source": "Sentry"
92
+ },
93
+ {
94
+ "evidence_role": "runtime-state",
95
+ "filename": "19-kubernetes-pods.yaml",
96
+ "source": "Kubernetes"
97
+ },
98
+ {
99
+ "evidence_role": "runtime-state",
100
+ "filename": "20-kubernetes-events.log",
101
+ "source": "Kubernetes"
102
+ },
103
+ {
104
+ "evidence_role": "deployment-state",
105
+ "filename": "21-deployment-history.json",
106
+ "source": "deployment platform"
107
+ },
108
+ {
109
+ "evidence_role": "build-state",
110
+ "filename": "22-ci-runs.csv",
111
+ "source": "CI platform"
112
+ },
113
+ {
114
+ "evidence_role": "change-state",
115
+ "filename": "23-pull-request-context.json",
116
+ "source": "GitHub"
117
+ },
118
+ {
119
+ "evidence_role": "change-control",
120
+ "filename": "24-migration-state.sql",
121
+ "source": "database change control"
122
+ },
123
+ {
124
+ "evidence_role": "security",
125
+ "filename": "25-security-scanner-report.pdf",
126
+ "source": "security scanner"
127
+ },
128
+ {
129
+ "evidence_role": "governance",
130
+ "filename": "26-approval-policy.md",
131
+ "source": "change governance"
132
+ },
133
+ {
134
+ "evidence_role": "lineage",
135
+ "filename": "27-current-versus-stale-notes.txt",
136
+ "source": "evidence custodian"
137
+ }
138
+ ],
139
+ "case_id": "DOB-001",
140
+ "gold_included": false,
141
+ "oracle_sequence_included": false
142
+ }
task_files/dob100-002-rca-analytics-revoked-grant/01-employee-request.md ADDED
@@ -0,0 +1 @@
 
 
1
+ The overnight on-call handover left an unresolved production judgement for the incoming engineer. Keep this to an investigation; production should remain unchanged. OPS-160 — Root cause: analytics cannot read the replica since the rotation Get to the bottom of analytics-cannot-read-replica: not just which service, but the mechanism and the exact setting responsible. The service's own code is not necessarily where this lives — confirm it against the state of the system rather than inferring it from the symptom alone. Leave an audit-ready diagnosis for 'analytics-cannot-read-replica' that names the responsible service, the fault type, the offending key, and your evidence. The work item is DOB-002 for analytics-worker. Its business boundary is reporting freshness, warehouse replica access, scheduled rollups, and downstream decision data. The disputed mechanism is database authorization, revoked roles, credential scope, and least-privilege access. Reconcile current authority with live state, make only supported changes, and leave a case-room handoff that you have reopened and verified.
task_files/dob100-002-rca-analytics-revoked-grant/01-work-ticket.md DELETED
@@ -1,151 +0,0 @@
1
- # 01 Work Ticket
2
-
3
- ## tickets (187 rows)
4
-
5
- ```json
6
- [
7
- {
8
- "ticket_id": 9103,
9
- "key": "ENG-2103",
10
- "type": "bug",
11
- "title": "Analytics worker restarting under queue load",
12
- "description": "analytics-worker error_rate_pct is 6.0% against a 2.0% SLO (alarm 9609) Investigate the root cause, ship the fix through the standard workflow, and follow the deployment policy.",
13
- "status": "open",
14
- "priority": "high",
15
- "assignee": "",
16
- "service": "analytics-worker"
17
- },
18
- {
19
- "ticket_id": 9108,
20
- "key": "ENG-2108",
21
- "type": "bug",
22
- "title": "Analytics rollups run in batches large enough to amplify memory pressure",
23
- "description": "large rollup batches amplify memory pressure on the consumer Investigate the root cause, ship the fix through the standard workflow, and follow the deployment policy.",
24
- "status": "open",
25
- "priority": "low",
26
- "assignee": "",
27
- "service": "analytics-worker"
28
- },
29
- {
30
- "ticket_id": 9143,
31
- "key": "ENG-2506",
32
- "type": "bug",
33
- "title": "Fix flaky test_rollup_window",
34
- "description": "test_rollup_window fails intermittently in CI: the rollup window boundary is computed from the current clock.",
35
- "status": "open",
36
- "priority": "medium",
37
- "assignee": "",
38
- "service": "analytics-worker"
39
- },
40
- {
41
- "ticket_id": 9158,
42
- "key": "OPS-113",
43
- "type": "incident",
44
- "title": "Localize alarm 9609 (analytics-worker errors)",
45
- "description": "Alarm 9609 is firing. Identify the responsible service and report the finding with submit_diagnosis. Read-only investigation.",
46
- "status": "open",
47
- "priority": "high",
48
- "assignee": "",
49
- "service": "analytics-worker"
50
- },
51
- {
52
- "ticket_id": 9170,
53
- "key": "OPS-160",
54
- "type": "incident",
55
- "title": "Root cause: analytics cannot read the replica since the rotation",
56
- "description": "Perform a root-cause analysis for analytics-cannot-read-replica and report service, fault type and the offending key with submit_diagnosis. Read-only investigation.",
57
- "status": "open",
58
- "priority": "critical",
59
- "assignee": "",
60
- "service": "analytics-worker"
61
- },
62
- {
63
- "ticket_id": 9173,
64
- "key": "OPS-163",
65
- "type": "incident",
66
- "title": "Root cause: analytics connections are refused, not slow",
67
- "description": "Perform a root-cause analysis for analytics-connection-refused and report service, fault type and the offending key with submit_diagnosis. Read-only investigation.",
68
- "status": "open",
69
- "priority": "critical",
70
- "assignee": "",
71
- "service": "analytics-worker"
72
- },
73
- {
74
- "ticket_id": 9175,
75
- "key": "OPS-151",
76
- "type": "incident",
77
- "title": "Root cause: the nightly reconciliation never runs",
78
- "description": "Perform a root-cause analysis for analytics-recon-never-runs and report service, fault type and the offending key with submit_diagnosis. Read-only investigation.",
79
- "status": "open",
80
- "priority": "high",
81
- "assignee": "",
82
- "service": "analytics-worker"
83
- },
84
- {
85
- "ticket_id": 9200,
86
- "key": "OPS-116",
87
- "type": "incident",
88
- "title": "Localize alarm 9609 \u2014 the error tracker shows nothing",
89
- "description": "Alarm 9609 is firing. Identify the responsible service and report the finding with submit_diagnosis. Read-only investigation.",
90
- "status": "open",
91
- "priority": "critical",
92
- "assignee": "",
93
- "service": "analytics-worker"
94
- },
95
- {
96
- "ticket_id": 9209,
97
- "key": "OPS-302",
98
- "type": "incident",
99
- "title": "Decide the remediation for the analytics crashloop",
100
- "description": "analytics-worker is being OOMKilled and is in CrashLoopBackOff. Four remediations have been proposed.",
101
- "status": "open",
102
- "priority": "high",
103
- "assignee": "",
104
- "service": ""
105
- },
106
- {
107
- "ticket_id": 9212,
108
- "key": "SEC-908",
109
- "type": "security",
110
- "title": "Rotate the exposed partner API credential",
111
- "description": "The partner API key was committed to the monorepo, so it must be treated as compromised and rotated in production. Rotation invalidates every existing partner session immediately and cannot be undone - a mistake locks partners out of production until a new key is issued.",
112
- "status": "open",
113
- "priority": "critical",
114
- "assignee": "",
115
- "service": "checkout"
116
- },
117
- {
118
- "ticket_id": 9213,
119
- "key": "SLO-7100",
120
- "type": "task",
121
- "title": "Is analytics-worker meeting its errors objective?",
122
- "description": "Is analytics-worker meeting its errors objective?",
123
- "status": "open",
124
- "priority": "medium",
125
- "assignee": "",
126
- "service": "analytics-worker"
127
- },
128
- {
129
- "ticket_id": 9225,
130
- "key": "QA-7200",
131
- "type": "task",
132
- "title": "Is test_rollup_window intermittent, or did it fail for a reason?",
133
- "description": "Is test_rollup_window intermittent, or did it fail for a reason?",
134
- "status": "open",
135
- "priority": "medium",
136
- "assignee": "",
137
- "service": "analytics-worker"
138
- },
139
- {
140
- "ticket_id": 9248,
141
- "key": "SUP-7500",
142
- "type": "task",
143
- "title": "Customer report: the numbers in this morning's report do not add up",
144
- "description": "Customer report: the numbers in this morning's report do not add up",
145
- "status": "open",
146
- "priority": "high",
147
- "assignee": "",
148
- "service": "analytics-worker"
149
- }
150
- ]
151
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
task_files/dob100-002-rca-analytics-revoked-grant/02-jira-work-item.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ assignee,component,created_day,issue_type,key,priority,project,resolution,status,summary,updated_day
2
+ on-call,analytics-worker,94,Task,DOB-002,High,DOB,,In Progress,"This is an investigation, not a change.",100