Skip to content

Fix function-value tag leak and add chapter helpers#7

Open
nacl-dev wants to merge 1 commit into
mainfrom
fix/hdoujin-collection-tags-and-chapter-helpers
Open

Fix function-value tag leak and add chapter helpers#7
nacl-dev wants to merge 1 commit into
mainfrom
fix/hdoujin-collection-tags-and-chapter-helpers

Conversation

@nacl-dev
Copy link
Copy Markdown
Owner

Summary

  • Bug fix: tableStrings() and luaCollectionValues() now skip lua.LTFunction entries so Go helper methods (Reverse, Sort, Count, First, Last, etc.) registered on Lua collection tables no longer leak as function: 0x... strings into imported tag metadata
  • New chapter/page helpers: Added First(), Last(), Clear() for both pages and chapters collections, and FilterDuplicates() for chapters — the most common patterns found across real upstream HDoujin Lua modules
  • 9 new test fixtures covering the bug fix, all new helpers, chapter-series parsing from mock HTML, metadata extraction with sidecar verification, and edge cases (empty chapter lists, single-chapter works, reversed ordering)
  • Updated TODO_METADATA_AND_DOWNLOADS.md with completed items and new next-step items

Test plan

  • Verify go test ./backend/internal/downloader/... passes all 12 tests (3 existing + 9 new)
  • Verify TestHDoujinCollectionTagsIgnoreFunctionValues confirms no function-valued entries appear as tags
  • Verify TestHDoujinChaptersFirstLastClearHelpers returns correct chapter info from First()/Last()
  • Verify TestHDoujinChaptersFilterDuplicates deduplicates 5 entries to 3 unique by URL
  • Verify TestHDoujinChaptersClear resets chapters and allows re-add
  • Verify chapter-series fixture tests (parsing, metadata, empty, single, reversed) all pass

🤖 Generated with Claude Code

…lpers

Collection-backed tag lists (from dom.SelectValues, etc.) could leak
helper method references as "function: 0x..." strings into imported
metadata. Filter LTFunction entries in tableStrings() and
luaCollectionValues() so only real data values propagate into tags.

Also adds First(), Last(), Clear() for both pages and chapters
collections, and FilterDuplicates() for chapters — the most common
patterns found across real upstream Lua modules for duplicate
filtering, conditional chapter rebuilding, and chapter introspection.

Includes 9 new test fixtures covering the bug fix, helper methods,
chapter-series parsing, metadata extraction, and edge cases (empty
chapters, single-chapter works, reversed ordering).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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