feat(platform): Fix pg-boss queue conflict and add safety standards

Summary:
- Fix pg-boss queue conflict (duplicate key violation on queue_pkey)
- Add global error listener to prevent process crash
- Reduce connection pool from 10 to 4
- Add graceful shutdown handling (SIGTERM/SIGINT)
- Fix researchWorker recursive call bug in catch block
- Make screeningWorker idempotent using upsert

Security Standards (v1.1):
- Prohibit recursive retry in Worker catch blocks
- Prohibit payload bloat (only store fileKey/ID in job.data)
- Require Worker idempotency (upsert + unique constraint)
- Recommend task-specific expireInSeconds settings
- Document graceful shutdown pattern

New Features:
- PKB signed URL endpoint for document preview/download
- pg_bigm installation guide for Docker
- Dockerfile.postgres-with-extensions for pgvector + pg_bigm

Documentation:
- Update Postgres-Only async task processing guide (v1.1)
- Add troubleshooting SQL queries
- Update safety checklist

Tested: Local verification passed
This commit is contained in:
2026-01-23 22:07:26 +08:00
parent 9c96f75c52
commit 61cdc97eeb
297 changed files with 1147 additions and 21 deletions

View File

@@ -264,5 +264,6 @@ checkDCTables();

View File

@@ -19,3 +19,4 @@ CREATE SCHEMA IF NOT EXISTS capability_schema;

View File

@@ -216,5 +216,6 @@ createAiHistoryTable()

View File

@@ -203,5 +203,6 @@ createToolCTable()

View File

@@ -200,5 +200,6 @@ createToolCTable()

View File

@@ -322,3 +322,4 @@ main()

View File

@@ -129,3 +129,4 @@ main()

View File

@@ -347,5 +347,6 @@ runTests().catch(error => {

View File

@@ -95,3 +95,4 @@ testAPI().catch(console.error);

View File

@@ -125,3 +125,4 @@ testDeepSearch().catch(console.error);

View File

@@ -312,5 +312,6 @@ verifySchemas()