Commit 26e73f4
migrations.py: the twin Z.AI base_url rewriters (_migrate_zai_legacy_base_url
and _migrate_zai_empty_base_url_to_coding) shared an identical load-JSON /
walk-zai-items / save-on-change body. Extracted _rewrite_zai_base_urls taking
a should_rewrite predicate + target URL; each public migration is now a thin
caller. Both run only when something changed (unchanged), and each keeps its
own provider_registry import + log message.
accounts.py: the Account(...) constructor block was duplicated verbatim in
get_accounts and get_live_usable_accounts. Extracted _account_from_row(row,
session_string); the two methods differ only in how they handle a decrypt
failure (raise vs skip), which stays in the caller. get_decrypted_session
reimplemented as a delegate to get_session_export so the SELECT + decrypt +
row-binding (#1145 consistency) is no longer forked.
messages.py: get_trending_emojis had two near-identical SQL bodies differing
only by a collected_at window fragment. Collapsed into one query with an
optional WHERE fragment + parameterized params list.
All three jscpd clones from the #1135 target list are removed.
migrations/accounts/messages unit + repository tests pass (400 + 481).
Part of #1135 (axis 5 of #1130).
Co-authored-by: axisrow <axisrow@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent d1796e4 commit 26e73f4
3 files changed
Lines changed: 79 additions & 112 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
710 | 710 | | |
711 | 711 | | |
712 | 712 | | |
713 | | - | |
714 | | - | |
715 | | - | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
716 | 721 | | |
717 | | - | |
718 | | - | |
719 | | - | |
720 | | - | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
721 | 728 | | |
722 | 729 | | |
723 | 730 | | |
| |||
740 | 747 | | |
741 | 748 | | |
742 | 749 | | |
743 | | - | |
744 | | - | |
| 750 | + | |
| 751 | + | |
745 | 752 | | |
746 | 753 | | |
747 | 754 | | |
| |||
752 | 759 | | |
753 | 760 | | |
754 | 761 | | |
755 | | - | |
| 762 | + | |
756 | 763 | | |
757 | 764 | | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
762 | | - | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
763 | 771 | | |
764 | | - | |
765 | | - | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
766 | 777 | | |
767 | | - | |
768 | | - | |
769 | | - | |
770 | | - | |
771 | | - | |
772 | | - | |
773 | | - | |
774 | | - | |
775 | | - | |
776 | 778 | | |
777 | | - | |
778 | | - | |
779 | | - | |
780 | | - | |
781 | | - | |
782 | | - | |
783 | | - | |
784 | | - | |
785 | | - | |
786 | | - | |
787 | | - | |
788 | | - | |
789 | 779 | | |
790 | | - | |
791 | | - | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
792 | 783 | | |
793 | | - | |
794 | | - | |
795 | | - | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
796 | 789 | | |
797 | | - | |
798 | 790 | | |
799 | 791 | | |
800 | 792 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
345 | 364 | | |
346 | 365 | | |
347 | 366 | | |
| |||
362 | 381 | | |
363 | 382 | | |
364 | 383 | | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
| 384 | + | |
378 | 385 | | |
379 | 386 | | |
380 | 387 | | |
| |||
389 | 396 | | |
390 | 397 | | |
391 | 398 | | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
| 399 | + | |
| 400 | + | |
404 | 401 | | |
405 | | - | |
406 | | - | |
| 402 | + | |
407 | 403 | | |
408 | 404 | | |
409 | 405 | | |
| |||
457 | 453 | | |
458 | 454 | | |
459 | 455 | | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
| 456 | + | |
472 | 457 | | |
473 | 458 | | |
474 | 459 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1362 | 1362 | | |
1363 | 1363 | | |
1364 | 1364 | | |
| 1365 | + | |
| 1366 | + | |
1365 | 1367 | | |
1366 | | - | |
1367 | | - | |
1368 | | - | |
1369 | | - | |
1370 | | - | |
1371 | | - | |
1372 | | - | |
1373 | | - | |
1374 | | - | |
1375 | | - | |
1376 | | - | |
1377 | | - | |
1378 | | - | |
1379 | | - | |
1380 | | - | |
1381 | | - | |
1382 | | - | |
1383 | | - | |
1384 | | - | |
1385 | | - | |
1386 | | - | |
1387 | | - | |
1388 | | - | |
1389 | | - | |
1390 | | - | |
1391 | | - | |
1392 | | - | |
1393 | | - | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
1394 | 1384 | | |
1395 | 1385 | | |
1396 | 1386 | | |
| |||
0 commit comments