Skip to content

AliBadge 0.2.1

Latest

Choose a tag to compare

@navotvolkgroundup navotvolkgroundup released this 29 Jul 04:45

Patch release. One user-facing fix, plus the repository's first test suite and CI.

Fixed: the hourly rate cap had never fired

enqueue() pruned its timestamp window with

hourStamps.splice(0, hourStamps.findIndex((t) => now - t < 3600e3) + 1 || 0)

findIndex returns the index of the first live stamp, so + 1 deleted that one along with the stale ones. Under steady traffic the first live stamp is index 0 every call, so each call deleted the stamp it had just pushed: the array never passed length 1 and HOURLY_CAP = 120 was unreachable.

Replayed over 200 calls 4 seconds apart: array length 1, cap triggered 0 times. Now: 120 retained, 80 capped.

In practice 0.2.0 was throttled only by the 4-second gap between searches, so heavy browsing could issue roughly 900 searches an hour against an intended ceiling of 120 — which raises the odds of AliExpress rate-punishing you into silence. That is the whole user-visible difference in this release.

The reason it hid: two bookkeeping paths, a splice to prune and a filter to count, and only the filter was correct. There is now one, liveWithin() in lib.js, pure and unit-tested.

Reported by @ekrako in #1 while writing tests for code that had none.

Added: tests and CI

  • 183 unit tests across lib, worker, content and receipt, plus 6 Playwright tests covering extraction → decide() → badge in a real browser.
  • GitHub Actions running both suites on every push and PR, and a version-bump check on PRs touching extension code.
  • The hourly cap is now asserted through enqueue itself — a test that could not be written before the fix.

Install

Step-by-step instructions for non-developers — about two minutes, no terminal.

Download alibadge-0.2.1.zip below, unzip it somewhere permanent, then chrome://extensions → Developer mode → Load unpacked → pick the unzipped folder. An options page opens; nothing is uploaded until you enable it there.

Unchanged from 0.2.0, and worth repeating

It is silent on most pages by design. A number requires two independent things: a near-exact product-photo match, and importer fingerprints in the store itself. A photo match alone cannot say who copied whom.

Measured on a 40-product labelled set: 0 false positives across 32 legitimate-brand products, 2 of 8 dropship products detected. Raw runs are in labelset/.

Full changelog: v0.2.0...v0.2.1