feat(hub): accept and expose paperclip_project_id on error records (BIT-25537)

- php-error bridge: accept paperclip_project_id / paperclipProjectId in
  CrmPhpPayload and promote into event context alongside project_slug/gitea_repo
- recent-errors: extract paperclip_project_id from context_json and emit as
  top-level field so error loop can route issues to the correct project board
  column without falling back to PAPERCLIP_ERROR_LOOP_PROJECT_ID_BY_SLUG
- Add tests for include/omit behaviour (mirrors gitea_repo coverage)
- Update ERROR_MONITORING_PUBLIC_API.md to document both optional fields

No DB migration required: field is stored in existing context_json column.

Co-Authored-By: Paperclip <[email protected]>
This commit is contained in:
David SantosandPaperclip committed 2026-06-18 02:15:49 +00:00
1 parent be735a16b6
commit 3c307ea32d
4 files changed
+78

No files matched your search

@@ -35,6 +35,9 @@ interface CrmPhpPayload {
project_slug?: unknown;
project_name?: unknown;
gitea_repo?: unknown;
// Paperclip project UUID — used by error loop to route issues to the correct project board column
paperclip_project_id?: unknown;
paperclipProjectId?: unknown;
}
function safeStr(v: unknown): string {
@@ -94,9 +97,11 @@ export async function POST(request: NextRequest) {
const gitea_repo = safeStr(body.gitea_repo);
const project_slug = safeStr(body.project_slug);
const project_name = safeStr(body.project_name);
const paperclip_project_id = safeStr(body.paperclip_project_id || body.paperclipProjectId);
if (gitea_repo) contextData.gitea_repo = gitea_repo;
if (project_slug) contextData.project_slug = project_slug;
if (project_name) contextData.project_name = project_name;
if (paperclip_project_id) contextData.paperclip_project_id = paperclip_project_id;
// Preserve other top-level diagnostic fields.
const file_path = safeStr(body.file_path);