fix(docver): drop fields value limit + treat history 404 as empty in add-in
All checks were successful
Deploy eCourt Note Web to Server / Validate Database Schema (Drizzle) (push) Successful in 5s
Deploy eCourt Note Web to Server / Build Web Docker Image (push) Successful in 1m28s
Deploy eCourt Note Web to Server / Deploy eCourt Note Web to Server (push) Successful in 4s
Deploy eCourt Note Web to Server / Notify Deployment Status (push) Successful in 0s
All checks were successful
Deploy eCourt Note Web to Server / Validate Database Schema (Drizzle) (push) Successful in 5s
Deploy eCourt Note Web to Server / Build Web Docker Image (push) Successful in 1m28s
Deploy eCourt Note Web to Server / Deploy eCourt Note Web to Server (push) Successful in 4s
Deploy eCourt Note Web to Server / Notify Deployment Status (push) Successful in 0s
Two fixes from first real-Word testing of the unmocked versioning flow: - fields value length: remove the limit entirely (was 10,000, briefly 100,000) — real court documents run 100-200 pages with content controls several hundred thousand chars long; callers are Bearer-only and the column is Postgres jsonb (up to ~255MB), so no storage bottleneck. Structural guards stay: ≤1,000 keys (was 100), key ≤200 chars, value must be string. - getVersions in versioningService now maps the history 404 to an empty list: files stamped SavedByAddIn back in the mock era enter the tracking phase before any real upload exists, so the pane shows "ยังไม่มี version ในระบบ" and Save & Version creates v1 (implicit document creation) instead of surfacing a 404 error banner. Other errors still propagate. Tests: 288/288 (new cases — 1M-char value passes, key cap 1,000/1,001, history 404 -> []). E2E against MinIO: 50k and 1M-char Thai field values upload 200 and roundtrip byte-exact through jsonb. Docs synced: PLAN-DOCVER §1, CLAUDE.md. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
parent
37b18c58c2
commit
b8ff622999
6 changed files with 52 additions and 13 deletions
|
|
@ -124,8 +124,11 @@ export function parseFieldsJson(raw: string):
|
|||
}
|
||||
const record = parsed as Record<string, unknown>;
|
||||
const keys = Object.keys(record);
|
||||
if (keys.length > 100) {
|
||||
return { ok: false, error: 'field "fields" มี key เกิน 100 รายการ' };
|
||||
// เหลือ guard เชิงโครงสร้างเท่านั้น — ความยาวค่าไม่จำกัดแล้ว (2026-10-27 ตามคำขอผู้ใช้:
|
||||
// เอกสารจริง 100–200 หน้า มี CC ยาวหลายแสนตัวอักษร; ผู้เรียกผ่าน Bearer เท่านั้น + jsonb
|
||||
// ของ Postgres รับได้ถึงระดับ 255MB จึงไม่มีคอขวดฝั่งเก็บ)
|
||||
if (keys.length > 1_000) {
|
||||
return { ok: false, error: 'field "fields" มี key เกิน 1,000 รายการ' };
|
||||
}
|
||||
for (const key of keys) {
|
||||
if (key.length > 200) {
|
||||
|
|
@ -135,9 +138,6 @@ export function parseFieldsJson(raw: string):
|
|||
if (typeof value !== "string") {
|
||||
return { ok: false, error: 'ค่าของแต่ละรายการใน "fields" ต้องเป็น string' };
|
||||
}
|
||||
if (value.length > 10_000) {
|
||||
return { ok: false, error: 'ค่าของแต่ละรายการใน "fields" ยาวเกิน 10,000 ตัวอักษร' };
|
||||
}
|
||||
}
|
||||
return { ok: true, fields: keys.length === 0 ? null : (parsed as Record<string, string>) };
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue