fix(api): non-empty stack_trace on recent-errors for legacy rows

When occurrence.stack_trace is null/blank, synthesize the same text as
ingest-api (BIT-796) at read time so CRM / Paperclip always get a stable
contract (BIT-1008, ERRPAYLOAD:5d26a50c83c0). Add unit tests and document
in HTTP_CONTRACTS + ERROR_MONITORING_PUBLIC_API.

Paperclip-Agent: 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376
Paperclip-Issue: BIT-1008
Paperclip-Run: 4c4da0dd-38ab-4f32-86d7-f2502c7cceca
Made-with: Cursor
This commit is contained in:
Peter Spark committed 2026-04-05 10:49:24 +00:00
1 parent eaa326e2bb
commit 6971b7669c
5 files changed
+71 -4

No files matched your search

+3 -1
View File
@@ -58,7 +58,7 @@ Alias: `GET /v1/paperclip/recent-errors` (same handler).
"status": "open",
"message": "Exception: …",
"error_message": "Exception: …",
"stack_trace": "",
"stack_trace": "#0 /app/src/foo.ts:42: Exception: …",
"file_path": "/app/src/foo.ts",
"line_number": "42",
"severity": "high",
@@ -70,6 +70,8 @@ Alias: `GET /v1/paperclip/recent-errors` (same handler).
}
```
**`stack_trace`:** The hub returns a **non-empty** string for every row. Ingest stores a synthesized stack when the reporter omits one; for legacy occurrences whose column is still null/blank, `recent-errors` applies the same synthesis at read time using `message` and `context_json` (BIT-1008).
```bash
API_KEY="$ERROR_RESOLVE_API_KEY"
BASE="${ER_API_BASE:-http://127.0.0.1:3200}"