fix(tracker-adapters): correct TL downloaded bytes and user class parsing - #3
Merged
Conversation
…sing Two parsing bugs surfaced by a real logged-in TorrentLeech profile page. Both produced confidently wrong data rather than errors, so neither was visible without comparing against the live page. downloaded read as 0 bytes. TL's markup is inconsistent: the uploaded and ratio spans carry both `profile-info-details` and a specific `profile-*-details` class, but the downloaded span only carries the generic one: uploaded: <span class="profile-info-details profile-uploaded-details"> downloaded: <span class="profile-info-details"> So `.profile-downloaded-details` matched nothing. This also corrupted bufferBytes, computed as uploaded minus downloaded, which reported the full uploaded figure as buffer. Now falls back to scoping by the wrapper div. User class read as "ic TL". The previous body-text regex scans the whole document and hits the "Classic TL" link in the nav menu long before the real field - "Class" matches inside "Classic", capturing "ic TL". Replaced with the `.label-user-class` badge, falling back to the profile table's Class row. Correctly reads "Super User". Tests use the real markup shapes, including the nav menu that caused the class collision, so both are covered by regression guards. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Knip Code AnalysisFound 8 total issues
View details
Use |
|
🚫 Security audit failed Critical Failures
Warnings
Passed (36/38)
Summary: 36/38 checks passed See |
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.
Two parsing bugs found by comparing a real logged-in TL profile page against what the adapter actually wrote to the DB. Both produced confidently wrong data rather than errors, so neither surfaced without that comparison.
downloadedread as 0 bytesTL's markup is inconsistent — uploaded and ratio carry a specific class, downloaded does not:
.profile-downloaded-detailstherefore matched nothing. This also corruptedbufferBytes(uploaded − downloaded), which reported the entire uploaded figure as buffer. Now falls back to scoping by the wrapper div.User class read as
"ic TL"The body-text regex scans the whole document and reaches the nav menu's "Classic TL" link long before the real field — "Class" matches inside "Classic", capturing
"ic TL". Replaced with the.label-user-classbadge, falling back to the profile table's Class row. Now reads"Super User".Verification
Observed live before this fix:
downloaded=0 bytes,group_name="ic TL". Both now covered by regression tests built from the real markup, including the nav menu that caused the collision. 20 tests pass;tscandbiomeclean.Version bumped to
2.8.9-homelab.2so the release publishes.🤖 Generated with Claude Code