Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Show changed files | Details | Compare with Previous | Blame | RSS feed

Filtering Options

Rev Age Author Path Log message Diff
37428 45 d 3 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Oppo/Realme: record the captcha widget's own verdict alongside the lookup

r37426 made the lookup response the success signal, which is authoritative but
silent about WHY a drag was refused -- a timeout looks identical whether the aim
was wrong, the widget never rendered, or the page changed again.

The captcha widget answers that itself: it calls captcha-ind-sec.heytapmobile.com
and its replies carry a status and message. The hook now keeps the last such
response, and a failed attempt logs it, so 'Failed = 3' becomes 'Failed = 3
(captcha said: ...)'.

Note what the widget does NOT give us: its init call returns the puzzle's y
coordinate but not the x, which is the secret being protected. So the circle
detection still has to find the horizontal target -- there is no shortcut there,
and that remains the largest loss (60% of Oppo attempts never find the circles).
 
37425 45 d 4 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Oppo/Realme: capture the response from fetch as well as XHR

r37423 got Realme solving the captcha again -- 4 of 4 on the first tick after
deploy -- but every one logged 'Result shown but no active/check response
captured'. The capture hook only wrapped XMLHttpRequest, and realme's page issues
the lookup through fetch, so it recorded nothing and each imei was stored with a
null date.

The hook now wraps window.fetch too, cloning the response before reading it so
the page still consumes its own body. Applied to Oppo as well: its XHR path is
working today, but the same silent failure would follow any move to fetch, and
the cost is a few lines.
 
37424 45 d 4 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Oppo/Realme slider captcha: size the calibration nudge from the gap

r37422 replaced a 15px calibration nudge with a fixed 60px, which fixed the
under-measurement but introduced the opposite error. Production data over 764
calibrations shows 45% ended UNUSABLE (closed <= 0, i.e. the piece shot past the
hole and the measured gap grew instead of shrinking), and among gaps under 60px
it was 85%.

The nudge is now sized from the gap -- aim to close about half of it -- and
clamped to [10,60]. Replaying the real observed gap distribution: unusable and
overshoot fall from 21% to 2%.

The observed travel ratio in production is 1.13 circle px per slider px, against
1.68 measured locally; it varies with render scale, which is why the ratio is
still derived from the measurement. ASSUMED_RATIO only sizes the probe, and 1.7
errs toward a smaller nudge, which is the safe direction here.

Oppo is currently solving 43% (was 9% before r37422). Realme carries the same
widget and the same defect and has not been deployed yet.
 
37422 45 d 6 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Oppo slider captcha: calibrate over a longer nudge and correct before releasing

The captcha solves about 10 times in 115 attempts. The arithmetic was right; the
measurement feeding it was not.

To place the piece the code must first learn how far it travels per slider pixel,
which it did by nudging 15px and re-measuring. The piece moves ~1.7px per slider
px, so 15px closed the gap by only ~25px -- and Hough circle detection carries
about +/-2-3px per circle, so the ratio came from a measurement roughly 20%
wrong. That error was then multiplied across the whole remaining travel: on a
150px gap it landed ~30px out, against a hole ~30px wide.

Nudging 60px closes ~100px, so the same detection noise is ~5% rather than ~20%.
The code also released on its single computed offset, committing all of that
error to the final position; it now measures once more after the main move and
closes the remainder before releasing. Math.round replaces an (int) cast that
biased every move short by up to a pixel.

Monte Carlo over the measurement noise (20k trials, +/-8px tolerance): median
placement error 16.3px -> 2.1px, success 26% -> 98%. Holds across a 2x range of
travel ratios and degrades gracefully as detection worsens, because the ratio is
derived rather than assumed. Real-world will be lower -- the same model puts the
old code at 26% where production sees 9% -- so expect roughly 1 in 3, not 49 in
50, and read Success/Failed in the log to get the true figure.

The ratio is returned rather than held on a field: this is a singleton and the
Oppo secondary and tertiary jobs run through it concurrently.
 
37420 45 d 7 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Oppo warranty check: read the JSON response instead of scraping the date

Oppo has recorded no activation dates since 23-Aug. With logging restored
(r37410) the cause is visible: the captcha IS solved -- 10 successes per tick --
and it then fails on the very next line with

no such element: //*[contains(text(),'UTC+5.5') or contains(text(),'Non-Activate')]

Their result is now label/value pairs, and the value is rendered from TWO text
nodes: dayjs(regDate).format('DD/MM/YYYY') plus a '(UTC+x)' suffix computed from
the browser's own timezone. XPath contains(text(),...) tests only the first node
-- the date -- so it never matched. 'Non-Activate' is gone too: an inactive
device now reads 'The system will update the date within 7 days of device
activation.' Verified against a replica of their DOM: old locator 0 matches, and
the value element yields '23/08/2026 (UTC+5.5)'.

Rather than chase their markup again, take the value from the source: the page
calls /oppo-api/basic/v1/getDeviceInfo and the response carries regDate as epoch
millis -- no date format, no locale, no timezone suffix to parse. A small hook
records that response as the page receives it; nothing extra is requested and no
captcha behaviour changes.

Also switches the outcome to always record the imei. findElement THREW when the
element was missing, which skipped the fallback entirely, so nothing was written
to dateMap and the row was re-queued on every run indefinitely -- 'Could not
capture date' appears 0 times in the log because it was unreachable.
 
37410 45 d 10 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Oppo warranty check: log to the logger instead of stdout

Oppo has resolved nothing all day -- 83 ticks, the same 10 IMEIs recycled every
time, zero "Serial Number ... Date" results -- and the log shows only a single
line, 'Initiating webdriver...'. That is not silence: the class had 1 LOGGER call
against 28 System.out.println, and the cron JVM's stdout is a socket inherited
from the SSH session that launched it. Every diagnostic was going nowhere.

So the code has been reporting what is wrong 28 times per attempt (which element
was missing, the computed slider distance, success or failure per attempt, the
parsed date) and all of it was discarded. Same pattern as the Vivo bug found
today, where a five-word log line hid the real cause for weeks.

Converted to LOGGER at info, with warn on the failure paths and error on the
catch-all, which now includes the exception rather than a bare printStackTrace.
The slider-widget timeout says which element it was waiting for, since that is
the most likely failure point.

No behaviour change -- only where the output goes.
 
36583 146 d 7 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Fix hardcoded captcha element IDs to dynamic xpath in Oppo and Realme warranty scrapers  
36306 174 d 15 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/ Batch processing: BatchScheduledTasks, helpers for offer/sellin/partnerLimit, CronBatchService, OpenCV fix for Apple Silicon, CLI triggers  
36253 181 d 13 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Separate secondary/tertiary IMEI activation crons for Vivo/Oppo/Realme, perf fixes: shared saveActivation, Response leak fixes, /tmp cleanup, OpenCV static init, early break, remove class-level @Transactional from StandAlone  
34680 477 d 8 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Fixed  
34423 543 d 7 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ config  
34415 544 d 8 h amit.gupta /trunk/ Fixed oppo activation  
34413 545 d 5 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Fixed oppo tracking issues  
32148 1213 d 8 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Fixed imeis handling  
32146 1214 d 6 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Added warranty task fix  
30592 1586 d 5 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Added Einvoice Files  
30375 1622 d 2 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Added Einvoice Files  
30373 1622 d 4 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Added Einvoice Files  
30360 1625 d 6 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Fixed logic for oppo activation  
30359 1625 d 8 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Fixed missing date logic  

Show All