feat(tracker-adapters): TorrentLeech hit-and-run + count fix - #2
Merged
Conversation
…hing counts Populate `hitAndRuns` from the header menu item titled "Hit and Run", which links to /profile/<user>/hnr. This is the field the fork exists for - TL has no API and upstream PR jordanlambrecht#175 stubs it null. Also fixes a real bug in the existing count parsing. The menu has two shapes: <div title="Uploaded (Seeding)"> <i/> <span>2.39 TB</span> (30) </div> <div title="Hit and Run"> <i/> 0 </div> Seeding/leeching lead with the transfer SIZE and put the torrent count in trailing parens, so the previous "first number in the element" match returned 2 (from "2.39 TB") and 244 (from "244.44 GB") instead of 30 and 9. Seeding and leeching counts have been wrong for every TL user. Now matches the parenthesised count for those, and the bare number for Hit and Run. `hitAndRuns` stays null when the counter is absent rather than defaulting to 0: a missing element must not render as "no hit and runs", which would hide the exact condition the field exists to surface. Adds a menu fixture to the tests (upstream had none, which is why the count bug went unnoticed) plus regression coverage for both shapes and the null-vs-zero distinction. 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 |
Upstream's release.yml cannot publish from a fork. Three blockers, none of them cosmetic: - "Log in to Docker Hub" uses DOCKERHUB_* secrets that do not exist here. docker/login-action fails on empty credentials, aborting the job BEFORE the build/push step ran, so no image was ever produced. - The build tagged docker.io/jordyjordy/tracker-tracker, upstream's Docker Hub namespace, which this fork cannot push to. - "Sync README to Docker Hub" has the same missing secrets and target. Removed all three. GHCR only; IMAGE_NAME already resolves to our repo path. Also makes Trivy non-blocking (exit-code 0) with if: always() on the SARIF upload. The image is pushed BEFORE the scan runs, so failing hard there never prevented a vulnerable image shipping - it only skipped the SARIF upload and the GitHub Release, leaving the run permanently red and the findings invisible in the Security tab. The current findings (undici, vite) come from upstream's lockfile. Documents all of it in FORK.md, since .github/ is now the main conflict surface on upstream syncs. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Trivy failed the build on undici and vite CVEs inherited from upstream's lockfile. Both are dev-only, reaching the image because the schema-deps Dockerfile stage runs a full pnpm install (devDependencies included) and the runner copies that node_modules in for drizzle-kit. undici: pinned to ^7.28.0 via pnpm.overrides, resolving to 7.29.0. Kept inside the 7.x line deliberately - an unbounded >= range pulled 8.9.0, a major jump for a jsdom dependency with no upside. vite: could not be moved. vitest 4.1.4 holds it at 7.3.2; 7.3.6 exists but neither overrides nor --force re-resolves it. Documented in .trivyignore instead, which is honest here rather than evasive: the CVE is a server.fs.deny bypass via Windows alternate paths in vite's DEV SERVER, and this image is Linux serving Next.js standalone with vite never started. Exposure is nil. That file already carries the same class of suppression for esbuild. The root cause - devDependencies shipping in the production image - is recorded in FORK.md as follow-up. Not attempted here because schema-sync runs at container startup, so getting it wrong breaks deploys rather than builds. Adapter tests: 248 pass with the bumped undici. Co-Authored-By: Claude Opus 5 <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.
Implements the reason this fork exists, using a real logged-in TL header capture.
Hit and run
TL exposes it in the header menu, linking to
/profile/<user>/hnr:hitAndRunsstays null when that element is absent rather than defaulting to 0 — a missing counter must not render as "no hit and runs", which would hide the exact condition the field exists to surface.Bug found in the process
The menu has two shapes, and the existing parser only handled one:
Seeding/leeching lead with the transfer size and carry the torrent count in trailing parens. Matching "the first number in the element" therefore returned 2 (from "2.39 TB") and 244 (from "244.44 GB") instead of 30 and 9 — so seeding and leeching counts are wrong for every TL user on upstream jordanlambrecht#175. Fixed by matching the parenthesised count for those and the bare number for Hit and Run.
Tests
Upstream had no
.div-menu-itemfixture, which is why the count bug went unnoticed. Added one taken from real markup, plus regression coverage for both shapes and the null-vs-zero distinction. 17 pass locally;tsc --noEmitandbiome checkclean.One unrelated pre-existing failure in
chart-transforms.test.tsreproduces identically on unmodifiedupstream/main— it is timezone-dependent and should pass in CI's UTC.Still stubbed
requiredRatioandwarnedremain null — neither appears in the header capture.warnedfeeds thewarnednotification event, so it is worth a follow-up if TL surfaces it elsewhere.🤖 Generated with Claude Code