Fix function-value tag leak and add chapter helpers#7
Open
nacl-dev wants to merge 1 commit into
Open
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tableStrings()andluaCollectionValues()now skiplua.LTFunctionentries so Go helper methods (Reverse,Sort,Count,First,Last, etc.) registered on Lua collection tables no longer leak asfunction: 0x...strings into imported tag metadataFirst(),Last(),Clear()for bothpagesandchapterscollections, andFilterDuplicates()forchapters— the most common patterns found across real upstream HDoujin Lua modulesTODO_METADATA_AND_DOWNLOADS.mdwith completed items and new next-step itemsTest plan
go test ./backend/internal/downloader/...passes all 12 tests (3 existing + 9 new)TestHDoujinCollectionTagsIgnoreFunctionValuesconfirms no function-valued entries appear as tagsTestHDoujinChaptersFirstLastClearHelpersreturns correct chapter info fromFirst()/Last()TestHDoujinChaptersFilterDuplicatesdeduplicates 5 entries to 3 unique by URLTestHDoujinChaptersClearresets chapters and allows re-add🤖 Generated with Claude Code