fix: SIE import voucher range bugs + remove describe transaction (#161)

* fix: fix SIE import voucher range bugs from multi-tenant migration and remove describe transaction feature

- Fix reserve_voucher_range RPC parameter mismatch (p_user_id → p_company_id) causing duplicate voucher errors
- Fix create-accounts onConflict from user_id to company_id
- Add reserve-then-adjust pattern: pre-reserve voucher range before batch insert, release unused range on partial failure
- Add release_voucher_range DB function for safe rollback
- Remove DescribeTransactionDialog, describe/batch-describe API routes, and related schemas (feature superseded)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address Greptile review — voucher range race condition and orphaned entries

- Add p_reserved_highest upper-bound guard to release_voucher_range to prevent
  rolling back past numbers claimed by concurrent operations
- Move highestInsertedVoucher tracking to after both headers AND lines succeed,
  preventing orphaned journal entries with no lines from being counted as "used"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-04-02 10:48:13 +02:00
committed by GitHub
co-authored by Claude Opus 4.6
parent 197beb1c58
commit 9dceb6285c
12 changed files with 103 additions and 1635 deletions
-10
View File
@@ -340,16 +340,6 @@ export const MatchSupplierInvoiceSchema = z.object({
supplier_invoice_id: uuid,
})
export const DescribeTransactionSchema = z.object({
description: z.string().min(3).max(500),
})
export const BatchDescribeSchema = z.object({
merchant_name: z.string().min(1),
template_id: z.string().min(1),
is_business: z.boolean(),
user_description: z.string().max(500).optional(),
})
// ============================================================
// Settings schemas