Skip to content

Improve metadata matching and add comprehensive regression tests - #2

Merged
Nejaa merged 2 commits into
masterfrom
develop
Oct 11, 2026
Merged

Nejaa merged 2 commits into
masterfrom
develop

Conversation

@Nejaa

@Nejaa Nejaa commented Oct 11, 2026

Copy link
Copy Markdown
Owner

• Load cached catalog matches when selecting a book and improve series inference.
• Align CBZ metadata reading, writing, and validation with ComicInfo v2.0; handle EPUB 2 contributor roles and PDF publication dates correctly.
• Add regression tests for metadata formats, catalog matching, application workflows, persistence, settings, CLI options, desktop behavior, and OCR runtime handling.
• Run Go tests in CI and update user, build, maintainer, and architecture documentation.

Nejaa added 2 commits October 10, 2026 16:25
- Display cached matches automatically when selecting a book
- Prevent stale responses from overwriting the current selection
- Cache partial results even when another catalog fails
- Preserve provider warnings alongside cached matches
- Infer reviewable series and volume hints from structured filenames
- Retain catalog series labels without volume numbers
- Flag volume conflicts between catalog and filename clues
- Document automatic cache loading and partial-result caching
- Align CBZ metadata handling with ComicInfo v2.0
- Recognize EPUB 2 contributor roles and verify EPUB package metadata
- Add regression tests across metadata, app, catalog, persistence, and runtime
- Update CI and project documentation
@Nejaa
Nejaa merged commit bd9c688 into master Oct 11, 2026
1 check passed
@Nejaa
Nejaa requested a balanced review from Copilot October 11, 2026 06:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

CBZ ratings cannot be cleared, filename cleanup can produce malformed inferred titles, and the cached-search regression test does not exercise a cache hit.

4 open findings
What changed in this PR

Improves metadata matching and format handling while expanding regression coverage and documentation.

Changes:

  • Loads cached matches and improves series/title inference.
  • Aligns EPUB, CBZ, and PDF metadata behavior.
  • Adds broad Go test coverage and runs tests in CI.
File Description
README.md Updates usage and settings guidance.
MAINTAINER.md Documents build reproducibility limits.
BUILD.md Adds Go tests to verification steps.
Dockerfile Runs tests during build checks.
.github/​workflows/​ci.yml Reflects test execution in CI.
docs/​architecture.md Documents partial-result caching.
docs/​ux.md Updates draft and background-work behavior.
cmd/​shelfmark/​options_test.go Tests command-line parsing.
internal/​app/​proposal.go Encodes list fields safely for editing.
internal/​app/​search.go Adds cache-only match retrieval.
internal/​app/​server.go Registers the cached-search endpoint.
internal/​app/​server_test.go Tests API workflows and caching.
internal/​catalog/​catalog_test.go Adds catalog and reconciliation tests.
internal/​catalog/​proposal.go Improves series and volume inference.
internal/​desktop/​desktop_test.go Tests secure runtime extraction.
internal/​library/​book_label.go Infers separated filename volumes.
internal/​library/​library_test.go Tests matching and field parsing.
internal/​library/​presentation.go Adds CSV list-field round trips.
internal/​metadata/​comic.go Aligns CBZ handling with ComicInfo.
internal/​metadata/​comic_test.go Tests CBZ limits and round trips.
internal/​metadata/​epub_contributors.go Handles namespaced EPUB 2 roles.
internal/​metadata/​fields.go Adds format-specific validation.
internal/​metadata/​fields_test.go Tests metadata validation rules.
internal/​metadata/​formats_test.go Tests EPUB, FB2, and PDF behavior.
internal/​metadata/​pdf.go Stops treating creation date as publication date.
internal/​notices/​notices_test.go Tests bundled notice archives.
internal/​ocrruntime/​runtime_test.go Tests OCR extraction and installation.
internal/​settings/​settings_test.go Tests settings defaults and persistence.
internal/​store/​store_test.go Tests drafts, caching, and migrations.
internal/​webui/​js/​app.js Loads cached matches on selection.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +473 to +484
body := `{"id":` + mustJSON(t, id) + `,"query":"Cacheable title"}`
response = request(t, server.Handler(), http.MethodPost, "/api/search", body, "application/json")
if response.Code != http.StatusOK {
t.Fatalf("search failed: %d %s", response.Code, response.Body.String())
}
response = request(t, server.Handler(), http.MethodPost, "/api/search/cached", `{"id":`+mustJSON(t, id)+`}`, "application/json")
if response.Code != http.StatusOK {
t.Fatalf("cached search failed: %d %s", response.Code, response.Body.String())
}
if catalogue.callCount() != 1 {
t.Fatalf("cached selection triggered catalog request; calls = %d", catalogue.callCount())
}
parts := strings.Split(filename, " - ")
if len(parts) >= 3 && filenameVolume.MatchString(strings.TrimSpace(parts[1])) {
series := strings.TrimSpace(parts[0])
title := strings.TrimSpace(strings.Join(parts[2:], " - "))
Comment on lines +42 to +46
if key == "rating" {
rating := Text(value)
number, err := strconv.ParseFloat(rating, 64)
if err != nil || !comicRatingPattern.MatchString(rating) || number < 0 || number > 5 {
return fmt.Errorf("ComicInfo rating must be a decimal between 0 and 5 with at most two fractional digits")
Comment thread README.md
Comment on lines +187 to +188
catalogs, or **Ignore cache** to run a fresh search. Cache duration and size are
configurable. Catalog results can describe a different edition; Open Library
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants