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
37408 43 d 15 h amit /trunk/ Vivo IMEI activation: stop spending captchas on line items with no IMEI

76% of production captcha rejections were line items whose serial number is
null. Vivo answers those with {"msg":"参数为空"} -- "parameter is empty" --
and status 0, which this code recorded as a captcha failure. So a correctly
solved captcha looked wrong, no activated_imei row was written, the line item
stayed pending, and it came back every 5 minutes indefinitely. Those rows were
permanently consuming roughly 43% of the run quota, which is why every tick ran
full at 20/20 and the backlog never drained.

It also made the model look far worse than it is: measured accept rate 44%,
while the same solver scores 85-93% when the IMEI is present. True captcha
accuracy is around 77%.

Fixed at source: both named queries now exclude null and blank serial numbers,
so such line items never enter the pool (this also covers the Realme caller).
The loop additionally skips them before fetching a captcha, so no captcha,
solver call or Vivo request is spent discovering it.

Found via the diagnostics added in r37407 -- the previous log line recorded
five words and discarded the response that named the cause.
 
37407 43 d 15 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Vivo IMEI activation: log why a captcha was rejected

Production refuses ~56% of submissions, but reading the stored images by hand
showed 9 of 10 carried the CORRECT code. Replicating the request from the same
box gives 85-93%, and every external difference was measured and ruled out:
real vs dummy imei (7/8 both), user-agent (83% both), session reuse (74 vs 75%),
two concurrent jobs (80% both), source IP, and fetch-to-submit delay from 0 to
10s (90-91% throughout). Vivo's reply is byte-identical in every failure, so the
payload carries no discriminator.

That leaves something inside this process, and the old log line recorded five
words and discarded the evidence. It now captures the code submitted, the imei,
the real fetch-to-submit latency, the session cookies actually held at submit
time, and Vivo's full response.

The cookies matter most: if the SESSION cookie is being dropped or rotated
between fetching the captcha and submitting it, the captcha would be validated
against the wrong session and refused despite a correct code -- which fits every
measurement above and is invisible from outside the JVM.
 
37402 44 d 7 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Vivo IMEI activation: report Vivo's captcha verdict back to the solver

Only this cron ever learns whether Vivo accepted a captcha (status 0 means it
was wrong), so it is the only place that can label the solver's training data.
After each checkCode response it now posts the image, the code and the outcome
to the solver's /verdict endpoint, which files the sample as accepted (the
prediction was right - a free label) or rejected (needs a human to label it).

The solver has been running at a measured 22.3% accept rate and no training
data was ever collected, so the model could not be improved at all.

Strictly best-effort: 2s connect / 3s read timeouts and every exception
swallowed. Data collection must never slow down or break IMEI activation.

The shared secret is read from CAPTCHA_VERDICT_TOKEN in the environment,
falling back to a captcha.verdict.token property, so it need not be committed.
Without a token the call is skipped entirely.

Also drops /tmp/captcha.jpg: the captcha bytes are needed in memory for the
verdict report anyway, so the two concurrently-scheduled Vivo jobs no longer
share one file and overwrite each other's image.
 
37393 44 d 11 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Vivo IMEI activation: validate captcha solver response before submitting to Vivo

The captcha solver at 45.79.121.178 was down from 09-Jul-2026 to 25-Aug-2026
(uwsgi never restarted after a host reboot). nginx returned a 502 page for
every request. RestClient.executeJson returns the response body regardless of
HTTP status, so CaptchaService handed that HTML page to Vivo as the captcha
code and Vivo logged it as 'Found invalid captcha' - indistinguishable from an
ordinary wrong guess. The outage went unnoticed for 46 days.

CaptchaService now checks the response against the solver model's own 31-class
alphabet (^[1-9A-HK-NP-Z]{4}$) and returns null for anything else, logging the
offending payload. VivoImeiActivationService skips the IMEI when the code is
null instead of posting the garbage; it is retried on the next run.

Also drops a System.out.println of the full base64 captcha image.
 
36580 144 d 12 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Adjust IMEI activation deferral: secondary 4 days, tertiary 2 days for Vivo/Oppo/Realme  
36420 163 d 9 h amit /trunk/profitmandi-cron/ OkHttp→RestClient migration for IMEI activation services (Itel, Tecno, Vivo). Added test deps. Updated RunOnceTasks, ScheduledTasks, OrderTrackingService.  
36260 178 d 11 h amit /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Fix: add @Transactional(NOT_SUPPORTED) on Vivo methods to suspend ScheduledTasks outer transaction  
36253 179 d 17 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  
33453 845 d 12 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Do not run Vivo Activations on 1st of every month  
31128 1434 d 12 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Fixed Scheduling issues  
30937 1490 d 11 h amit.gupta /trunk/ Fixed activation logic  
30430 1604 d 17 h tejbeer /trunk/ change  
30376 1620 d 6 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Added Einvoice Files  
30371 1620 d 9 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Added Einvoice Files  
30369 1620 d 10 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Added Einvoice Files  
30343 1626 d 10 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Added Einvoice Files  
30337 1627 d 10 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/ Fixed ahead issue  
30335 1627 d 10 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/ Fixed vivo  
30329 1630 d 15 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/scheduled/  
30209 1657 d 10 h amit.gupta /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/ Added Oppo Activation  

Show All