Align Go parser backends and PDF pipeline with Python (#16676)

Ports remaining Go parser wiring and PDF backends, adds tenant-aware VLM
dispatch, aligns post-processing with Python, and adds end-to-end
pipeline coverage with a generated six-page PDF.
This commit is contained in:
Zhichang Yu
2026-07-06 19:50:54 +08:00
committed by GitHub
parent 3044283442
commit 55af1d70f3
36 changed files with 4918 additions and 28 deletions

View File

@@ -450,3 +450,30 @@ func TestParserComponent_Invoke_PageSizeHint(t *testing.T) {
}
}
}
// TestParseBatch_IsFormatAgnostic pins the batching contract:
// parseBatch does not resolve parsers or inspect file families. It
// only wraps already-prepared page bytes into schema.Page items.
func TestParseBatch_IsFormatAgnostic(t *testing.T) {
got, err := parseBatch(context.Background(), [][]byte{
[]byte("first page from dispatch"),
[]byte("<table>second page from html dispatch</table>"),
})
if err != nil {
t.Fatalf("parseBatch: %v", err)
}
if len(got) != 2 {
t.Fatalf("len(got) = %d, want 2", len(got))
}
if got[0]["text"] != "first page from dispatch" {
t.Fatalf("got[0][text] = %v, want first page from dispatch", got[0]["text"])
}
if got[1]["text"] != "<table>second page from html dispatch</table>" {
t.Fatalf("got[1][text] = %v, want HTML payload preserved verbatim", got[1]["text"])
}
for i := range got {
if got[i]["doc_type_kwd"] != "text" {
t.Fatalf("got[%d][doc_type_kwd] = %v, want text", i, got[i]["doc_type_kwd"])
}
}
}