Revert "improvement(db): add session statement/lock timeouts; simplif…#4599
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview Reworks knowledge-base document creation ( Removes the per-transaction Reviewed by Cursor Bugbot for commit 32d5dc4. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR reverts the previous "improvement(db)" commit that added PostgreSQL-specific session-level
Confidence Score: 4/5Safe to merge once the missing The revert is clean and consistent across all four files. The only uncertainty is whether the apps/sim/lib/knowledge/documents/service.ts — verify Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant service.ts
participant DB as DB (transaction)
Note over service.ts, DB: createDocumentRecords / createSingleDocument (reverted)
Caller->>service.ts: createDocumentRecords(docs, kbId)
service.ts->>DB: BEGIN TRANSACTION
service.ts->>DB: "SELECT 1 FROM knowledge_base WHERE id=kbId FOR UPDATE"
service.ts->>DB: "SELECT id FROM knowledge_base WHERE id=kbId AND deleted_at IS NULL"
alt KB not found / soft-deleted
DB-->>service.ts: []
service.ts-->>Caller: throw Error("Knowledge base not found")
else KB alive
service.ts->>DB: INSERT INTO document VALUES (...)
service.ts->>DB: "UPDATE knowledge_base SET updated_at=now"
DB-->>service.ts: COMMIT
service.ts-->>Caller: DocumentData[]
end
Reviews (1): Last reviewed commit: "Revert "improvement(db): add session sta..." | Re-trigger Greptile |
| @@ -1430,21 +1307,31 @@ export async function createSingleDocument( | |||
| chunkCount: 0, | |||
| tokenCount: 0, | |||
| characterCount: 0, | |||
| processingStatus: 'pending', | |||
| enabled: true, | |||
| uploadedAt: now, | |||
| ...processedTags, | |||
| } | |||
There was a problem hiding this comment.
Missing
processingStatus in createSingleDocument
createDocumentRecords explicitly sets processingStatus: 'pending' as const, but createSingleDocument no longer does after this revert — ...processedTags only carries tag/number/date/boolean fields. If the document table column lacks a DEFAULT 'pending' at the DB level, every single-document insert will fail with a NOT NULL violation. Worth verifying the schema default exists, or restoring the explicit field here for symmetry.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 32d5dc4. Configure here.
| } | ||
|
|
||
| const newDocument: NewDocumentRow = { | ||
| const newDocument = { |
There was a problem hiding this comment.
Missing processingStatus in single document creation path
Low Severity
The createSingleDocument function no longer sets processingStatus: 'pending' in its newDocument object (lines 1300–1313), while the bulk createDocumentRecords path still explicitly includes processingStatus: 'pending' as const (line 816). The database column has a DEFAULT 'pending' so the insert succeeds, but the two code paths are now inconsistent — and the object returned to API callers from the single-document path will be missing the processingStatus property in the JSON response.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 32d5dc4. Configure here.
There was a problem hiding this comment.
Lets do a full revert ill follow up after.


Summary
Forgot pg lock didn't work with pscale. Reverting.
Type of Change
Testing
Checklist
Screenshots/Videos