mirror of
https://github.com/hanzoai/ai.git
synced 2026-11-20 14:13:23 +00:00
go test ./... in this repo failed in five packages, so nobody ran it, so
nothing in it was read. Underneath were four genuine defects:
1. CREATE DATABASE against SQLite. object/adapter.go switched on driverName
with a postgres case and a DEFAULT that emits MySQL DDL, so sqlite got
`CREATE DATABASE IF NOT EXISTS … charset utf8mb4` and every caller took
`near "DATABASE": syntax error`. SQLite has no CREATE DATABASE at all — the
database IS the file. A default that assumes one dialect is wrong for every
dialect it has not met.
2. Markdown chunks came out in RANDOM ORDER. SplitText ranged a map, and Go
randomises map iteration, so the same document produced the same chunks in a
different sequence every run. Chunks are reassembled into context
downstream; document order is the only order that means anything. Now sorted
by position in the source (not alphabetically — "Section 10" must not sort
before "Section 9").
3. Tables lost their last row. Every row pattern ends in \\n, so a table running
to end-of-input dropped its final row into the remainder, where it came back
out glued to the neighbouring prose — a table silently split across two
chunks. Sections are sliced per heading, so ending without a newline is the
COMMON case.
4. GetVideoCoverUrl("") panicked. VodClient is package-level and nil until
SetVodClient runs, so on any deployment without the Aliyun VOD provider all
four entry points called through nil, inside request handlers. An
unconfigured OPTIONAL provider took the process down. Plus resp.Body.Video
was three unguarded dereferences on a response we do not control.
Also: ExtractMarkdownTree emitted result["root"] = "" for documents opening
with a heading — a key for content that does not exist — and the flush logic
was written twice.
Why they were invisible: 14 files are operator SCRIPTS wearing func Test —
69 panics, ZERO assertions, needing a populated database, live credentials or
fixtures not in this repo. A panicking test aborts the whole binary, so one
missing mp3 took every real test in its package with it. They are now behind
`-tags ai_scripts`; several WRITE to whatever database they find, which
`go test ./...` must never do. TestListGeminiModels had `apiKey := ""`
hardcoded and could only ever panic; it and the txt fixture test now skip,
matching TestGenerateImageDOAI_Live which already did this correctly.
The split tests also said only "did not get the expected result" and "Expected
6 headings, got 7". They now name which section and which heading.
Whole suite green.
Co-authored-by: Hanzo Dev <[email protected]>