diff --git a/backend/internal/bookfile/model.go b/backend/internal/bookfile/model.go index 8a8cbc47..3cbed21a 100644 --- a/backend/internal/bookfile/model.go +++ b/backend/internal/bookfile/model.go @@ -56,7 +56,7 @@ type Book struct { Description string // Notice are the book-level paragraphs a reader sees on OPENING the book — before the first chapter's // title, inside the first spine document (a separate title document would be read by ingest as a - // chapter of its own), and at the head of the text file. Empty for a book with nothing to declare. + // chapter of its own — before the reader learned to fold an uncovered leading document into chapter one), and at the head of the text file. Empty for a book with nothing to declare. Notice []string // Chapters in reading order; at least one (an EPUB with an empty spine is not an EPUB). Chapters []Chapter diff --git a/backend/internal/chunk/ingest_test.go b/backend/internal/chunk/ingest_test.go index 125b2970..50eebd31 100644 --- a/backend/internal/chunk/ingest_test.go +++ b/backend/internal/chunk/ingest_test.go @@ -574,7 +574,8 @@ func TestExtractXHTMLRejectsNonUTF8Charset(t *testing.T) { func TestIngestEPUBPercentEncodedHref(t *testing.T) { // Real epubs percent-encode non-ASCII (and spaced) filenames in the manifest while the zip - // entry carries the decoded name. Without resolveHref's url.PathUnescape the entry is missed + // entry carries the decoded name. Without the percent-decode in hrefTarget (which resolveHref wraps) + // the entry is missed // and ingest fails loud on a chapter that is actually present. chapters := []chunktest.Chapter{ {ID: "c1", Href: "%E7%AC%AC%E4%B8%80%E7%AB%A0.xhtml", EntryName: "第一章.xhtml", Body: `

第一章。

`}, diff --git a/backend/internal/chunk/ingestnotes_test.go b/backend/internal/chunk/ingestnotes_test.go index f4eb4896..7e2981ce 100644 --- a/backend/internal/chunk/ingestnotes_test.go +++ b/backend/internal/chunk/ingestnotes_test.go @@ -19,8 +19,9 @@ func TestEveryIngestCountReachesTheAlarm(t *testing.T) { f := rt.Field(i) d := &Document{Chapters: []string{"x"}} fv := reflect.ValueOf(d).Elem().Field(i) - // Every field that carries an alarm, whatever its type. Restricting this to ints is how the guard - // would quietly stop covering a count the day one grows into a list. + // The field types that carry an alarm TODAY: ints, and the one slice a count grew into. ⚠ This switch + // is the guard's OWN limit — a counter of any other type falls into `default` and is skipped silently, + // so a new alarm field must be added here as well as to IngestNotes. switch { case f.Type.Kind() == reflect.Int: fv.SetInt(1)