fix(ingest): non-empty stack_trace for hub occurrences (BIT-796)

Accept stack_trace as an alias for stacktrace. When both are absent, store a
synthesized stack line derived from context so recent-errors always exposes
dedupe-friendly text. Fingerprints still ignore synthesized stacks so grouping
matches legacy omit-stack payloads.

PHP ingest client: fatal shutdown handler now sends a minimal stack line.

Paperclip-Agent: David Santos (id 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376)
Paperclip-Issue: BIT-796
Paperclip-Run: 7f4a8c69-7b5b-47f2-9fc9-c99e6d57f2d2
Made-with: Cursor
This commit is contained in:
David Santos committed 2026-04-04 18:26:15 +00:00
1 parent b41f17886a
commit bd6e3805ec
5 files changed
+105 -5

No files matched your search

+10 -2
View File
@@ -12,6 +12,10 @@ import {
parseOccurredAt,
} from "../lib/normalize.js";
import { evaluateNoise, NOISE_RULESET_VERSION } from "../lib/noisePolicy.js";
import {
clientProvidedStack,
synthesizeStackTraceForOccurrence,
} from "../lib/ingestStacktrace.js";
export type IngestEventInput = {
schema_version: number;
@@ -20,6 +24,8 @@ export type IngestEventInput = {
message: string;
fingerprint?: string;
stacktrace?: string;
/** CRM / snake_case alias for `stacktrace` (same fingerprint rules as stacktrace). */
stack_trace?: string;
context?: Record<string, unknown>;
};
@@ -178,14 +184,16 @@ async function _ingestOneEvent(
fingerprint_policy_version: FINGERPRINT_POLICY_VERSION,
};
}
const _clientStack = clientProvidedStack(_ev);
const _fingerprint = computeFingerprint({
clientFingerprint: _ev.fingerprint,
message: _message,
stacktrace: _ev.stacktrace,
...(_clientStack !== null ? { stacktrace: _clientStack } : {}),
context: _context,
});
const _title = incidentTitleFromMessage(_message);
const _stack = typeof _ev.stacktrace === "string" ? _ev.stacktrace : null;
const _stack =
_clientStack !== null ? _clientStack : synthesizeStackTraceForOccurrence(_message, _context);
await client.execute(
`INSERT INTO er_incidents (