debug: add raw value snippet to debug-sequences for regex diagnostics

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-11 22:04:25 +02:00
parent 39d64b033e
commit 4b61d07ffd
@@ -22,17 +22,18 @@ export async function GET() {
Array<{ company: string; year: number; type: string; lastSeq: number }>
>`SELECT company, year, type, "lastSeq" FROM "RegistrySequence" ORDER BY company, year, type`;
// Sample: show actual number values from entries (for debugging regex issues)
// Sample: show raw value snippet + extracted number (for debugging regex issues)
const samples = await prisma.$queryRawUnsafe<
Array<{ key: string; num: string }>
Array<{ key: string; num: string | null; snippet: string }>
>(`
SELECT key,
SUBSTRING(value::text FROM '"number":"([^"]+)"') AS num
SUBSTRING(value::text FROM '"number":"([^"]+)"') AS num,
SUBSTRING(value::text FROM 1 FOR 200) AS snippet
FROM "KeyValueStore"
WHERE namespace = 'registratura'
AND key LIKE 'entry:%'
ORDER BY key
LIMIT 20
LIMIT 5
`);
// Get actual max sequences from entries — current format: B-2026-00001