JewelSteps · all clients · LOCAL tracker

JewelSteps — SQL Report Optimisation

All clients: JewelSteps (same code path for every client DB: HYT, ISHA, SOPHIE, PREMIER, JMSCRM, FAZGOLD, META). Compare main vs each saved version vs branch HEAD. Worktree AngularJMS-combined · branch test/apicrm-widecols-combined. Page auto-refreshes every 15s; public URL updates when the publish watcher runs.

Updated 2026-12-06 17:30 All clients · 7 local *_TH DBs HEAD ready 5 · pending 5 Steps 14/27 done
Done
14
of 27 steps
Running
2
in progress now
To do
9
queued
Skip / owner
2
parked
HEAD gates
5
5 still pending
Fail steps
0
from steps TSV
Comparison basis: OLD = code on main, NEW = latest on test/apicrm-widecols-combined. Gates run on all 7 local client DBs. Sections 2–3 read ~/.ai/apicrm-migration/mainvs/*.tsv (workspace folder name only).

1. Current steps

Done Running To do Owner / speed warn FAIL
StepStatusDetail
JMSCRM_TH migration ID fixDoneFresh migration 20261206100700, applied to 7 local DBs
Wide columns (140 + 1693 = 1833 cols)DoneWideColumnResizeSql single source; EF sizes in one loop; migration regenerated (1617 AlterColumn, nothing extra)
Remove LedgerNameKeyDone28 ledger SPs + GetObjectsByMultipleColumnsWithIn; index now on LedgerName; 0 objects use LedgerNameKey
Apply to local DBs (7 *_TH)Done0 errors, 35 SP/fn deploy
Main worktree WIP -> combined, slowapi worktree removeDonebackups ~/.ai/apicrm-migration/main-wip-backup-2026-12-06, slowapi-backup-2026-12-06
Final output parity (6 objects x 7 DBs)DoneOVERALL PASS: 6 objects x 7 DBs, 0 FAIL (SKIP = no data)
Goldsilver parity (3 SPs x 7 DBs)Done21/21 OVERALL PASS, 0 FAIL; zz_*_old dropped from 7 DBs
zz_*_old drop + commit + push (parity files)Donezz dropped on 7 DBs; commit 526ee8be205 pushed to origin
Goldsilver separate commit + push (+ tools/perf/sp-compare)Donecommit 18ccfed4b4a pushed to origin
Review + noise run, CRUD gateTo doAfter commits
LTS decisions (section 4 order, A1)DoneOwner 2026-12-06: order OK (A1-A4 -> D1+E1-E4 -> C1+C4, C2, C3 -> B1-B4 -> A5-A6); A1 keep; D2 (DevMiniz off prod) SKIP
LTS step 1: A1-A4 code + rule fixTo doA1 goes in the parity commit; A2-A4 after that, local only
LTS step 2: D1 settings + E1-E4 alertsTo doNothing on live without separate approval
LTS step 3: C1 + C4, phir C2, C3To dosp_GetAccountLedgerBalanceByMetals + grant cap
LTS step 4: B1-B4 startup deployTo do
LTS step 5: A5-A6 publish guard + self-healTo do
LTS D2: DevMiniz off prodSKIP (owner)Owner 2026-12-06: SKIP
Extra perf #1 DSR grant trim (v5)DoneFull gate OVERALL PASS 7/7 DBs (v4 vs v5 output identical, truncation clean); grant PREMIER 215->73 MB, SOPHIE 208->70 MB, JMSCRM 233->76 MB; commit eb9306d1d44 pushed
Extra perf #2 Appraisal SOPHIE grant trim (v2)SKIP (owner)No gain: biggest grant is in fn_AccountLedgerBalance (#Bal), v2 does not change it; output PASS but no repo change
Extra perf #3 Goldsilver speed gateRunninggs_fix new2 OVERALL PASS 7 DBs x 3 SPs (output+speed vs old); mv_gs (main vs v1/v2/HEAD) running; repo edit only if v2 beats main
DSR CPU profile (main vs HEAD, FAZGOLD+HYT)Done17:20: ~90% of CPU is compile in both; HEAD (v5) CPU = main within noise; FAZGOLD elapsed main 17-22 s vs HEAD ~2 s; +13-18% CPU was v2 only
DSR v6 (filter temps back to main inline shape, keep v5 footer)To doOnly if mv_dsr HEAD rows show CPU FAIL vs main
Review mv_* HEAD rows (must be output PASS vs main on 7 DBs)To doNext after lanes finish; then decide alb + gs repo changes
Import test of 26 commented sample xlsx + commitTo doCursor --test import each file; then commit + push
Import sample limits mapDoneimp_hdr DONE 17:30: 381 Max N characters header comments in 26 files, verify PASS 30/30; 4 high-risk files skipped. Uncommitted
Re-run all comparisons: OLD = main branch, NEW = each saved version + branch HEADRunningRunning now (7 DBs): mv_dsr 11 rows (DSR+OnlyDiamond, output 11/11 PASS, v2 CPU +13-18%, HEAD rows pending); mv_io 22 rows (HEAD iw/oos/cons PASS on FAZGOLD; old v2 oos had Ambiguous LocationId error, HEAD fixed); mv_alb 61 rows (output all PASS; older versions speed FAIL: reads, v3e grant 2x on FAZGOLD; HEAD rows pending); mv_gs 20 rows (0 output FAIL, HEAD pending)
Progress page fully English + redesignDoneSection 5 history translated (status md); sections 2-3 rebuilt as one table per object (main -> vN -> HEAD); earlier gates collapsed in section 4

2. Final verdict: main → branch HEAD

Output PASS = rows equal and EXCEPT both ways empty. Speed PASS = CPU ≤ main×1.10+20 ms, reads ≤ main×1.10, grant ≤ main×1.10+1 MB (blue = some speed cases slower).

ObjectOutput (cases PASS)Speed (cases PASS)CPU ms total main → verReads total main → verMax grant main → ver
sp_GetDiamondAndStoneReport_OptimizedRunning main → HEAD gate pending / running
sp_GetOnlyDiamondReport_OptimizedRunning main → HEAD gate pending / running
sp_GetImitationWatchesReport_Optimized6/66/64059 → 2649 (-35%)1104 → 624 (-43%)237.8 MB → 115.1 MB (-52%)
sp_GetOtherOrServicesReport_Optimized4/42/43829 → 3374 (-12%)1060 → 602 (-43%)236.8 MB → 110.5 MB (-53%)
sp_GetAllConsignmentOutReportByCustomerId4/44/42344 → 2384 (+2%)6673 → 6673 (+0%)1.3 MB → 1.3 MB (+0%)
fn_AccountLedgerBalance14/142/14744 → 739 (-1%)29032 → 104160 (+259%)68.0 MB → 134.8 MB (+98%)
sp_GetAppraisalLedgerListRunning main → HEAD gate pending / running
sp_GetGoldSilverCurrentStockReport14/143/143849 → 4678 (+22%)65931 → 62058 (-6%)8.9 MB → 8.9 MB (+0%)
sp_GetGoldSilverCurrentStockReport_NSRunning main → HEAD gate pending / running
sp_GetGoldSilverCurrentStockReport_NS_VariantWiseRunning main → HEAD gate pending / running

3. Each object: main → every saved version → HEAD

One card per object. Expand “Per DB / case detail” for every DB × case row.

sp_GetDiamondAndStoneReport_Optimized

ComparisonOutput (cases PASS)Speed (cases PASS)CPU ms total main → verReads total main → verMax grant main → ver
main → v214/141/1449239 → 53965 (+10%)1224673 → 1687653 (+38%)236.8 MB → 237.4 MB (+0%)
main → v35/50/56553 → 7304 (+11%)58556 → 82056 (+40%)237.7 MB → 215.0 MB (-10%)
Per DB / case detail
DBCaseOutputRows main/verCPU main/verReads main/verGrant KB main/verSpeedNote
main → v2
FAZGOLDa_defaultPASS1/11417/1604 +13%193/211 +9%241552/201248 -17%FAILcpu VER=1604 > MAIN=1417*1.10+20=1578.7
FAZGOLDc_getallPASS1/11357/1573 +16%193/211 +9%242160/201248 -17%FAILcpu VER=1573 > MAIN=1357*1.10+20=1512.7
HYTa_defaultPASS1/11250/1472 +18%126/137 +9%241352/203424 -16%FAILcpu VER=1472 > MAIN=1250*1.10+20=1395.0
HYTc_getallPASS1/11251/1487 +19%126/137 +9%241848/203424 -16%FAILcpu VER=1487 > MAIN=1251*1.10+20=1396.1
ISHAa_defaultPASS134/1341655/1855 +12%58081/81579 +40%242360/220136 -9%FAILcpu VER=1855 > MAIN=1655*1.10+20=1840.5;reads VER=81579 > MAIN=58081*1.10=63889.1
ISHAc_getallPASS4689/46896859/6811 -1%129777/137148 +6%242016/241728 -0%PASS
JMSCRMa_defaultPASS146/1461960/2067 +5%187999/273668 +46%241048/233096 -3%FAILreads VER=273668 > MAIN=187999*1.10=206798.9
JMSCRMc_getallPASS10306/1030612156/12998 +7%267669/316328 +18%241680/242744 +0%FAILreads VER=316328 > MAIN=267669*1.10=294435.9
METAa_defaultPASS146/1462183/2444 +12%187718/273690 +46%241832/233096 -4%FAILcpu VER=2444 > MAIN=2183*1.10+20=2421.3;reads VER=273690 > MAIN=187718*1.10=206489.8
METAc_getallPASS10306/1030612040/13366 +11%267799/316391 +18%241968/242472 +0%FAILcpu VER=13366 > MAIN=12040*1.10+20=13264.0;reads VER=316391 > MAIN=267799*1.10=294578.9
PREMIERa_defaultPASS83/831526/1666 +9%32658/107029 +228%241752/215248 -11%FAILreads VER=107029 > MAIN=32658*1.10=35923.8
PREMIERc_getallPASS801/8012210/2565 +16%59952/132970 +122%241072/243128 +1%FAILcpu VER=2565 > MAIN=2210*1.10+20=2451.0;reads VER=132970 > MAIN=59952*1.10=65947.2
SOPHIEa_defaultPASS26/261494/1902 +27%10647/18480 +74%242432/207952 -14%FAILcpu VER=1902 > MAIN=1494*1.10+20=1663.4;reads VER=18480 > MAIN=10647*1.10=11711.7
SOPHIEc_getallPASS190/1901881/2155 +15%21735/29674 +37%241168/207952 -14%FAILcpu VER=2155 > MAIN=1881*1.10+20=2089.1;reads VER=29674 > MAIN=21735*1.10=23908.5
main → v3
FAZGOLDa_defaultPASS1/11678/1891 +13%193/220 +14%243416/201248 -17%FAILcpu VER=1891 > MAIN=1678*1.10+20=1865.8;reads VER=220 > MAIN=193*1.10=212.3
FAZGOLDc_getallPASS1/11753/1944 +11%193/220 +14%241424/201248 -17%FAILreads VER=220 > MAIN=193*1.10=212.3
HYTa_defaultPASS1/123/44 +91%79/97 +23%243264/203424 -16%FAILreads VER=97 > MAIN=79*1.10=86.9
HYTc_getallPASS1/11437/1552 +8%126/146 +16%241160/203424 -16%FAILreads VER=146 > MAIN=126*1.10=138.6
ISHAa_defaultPASS134/1341662/1873 +13%57965/81373 +40%242368/220136 -9%FAILcpu VER=1873 > MAIN=1662*1.10+20=1848.2;reads VER=81373 > MAIN=57965*1.10=63761.5

sp_GetOnlyDiamondReport_Optimized

ComparisonOutput (cases PASS)Speed (cases PASS)CPU ms total main → verReads total main → verMax grant main → ver
Running pending / running

sp_GetImitationWatchesReport_Optimized

ComparisonOutput (cases PASS)Speed (cases PASS)CPU ms total main → verReads total main → verMax grant main → ver
main → v26/66/64548 → 3946 (-13%)1104 → 1104 (+0%)238.3 MB → 239.1 MB (+0%)
main → v36/66/63919 → 2691 (-31%)1104 → 624 (-43%)238.7 MB → 115.1 MB (-52%)
main → HEAD (final)6/66/64059 → 2649 (-35%)1104 → 624 (-43%)237.8 MB → 115.1 MB (-52%)
Per DB / case detail
DBCaseOutputRows main/verCPU main/verReads main/verGrant KB main/verSpeedNote
main → v2
FAZGOLDa_defaultPASS1/1433/496 +15%508/508 +0%241336/244800 +1%PASS
FAZGOLDc_getallPASS1/11318/672 -49%508/508 +0%242976/241072 -1%PASS
HYTa_defaultPASS1/1691/675 -2%22/22 +0%241096/241968 +0%PASS
HYTc_getallPASS1/1681/709 +4%22/22 +0%244064/241720 -1%PASS
ISHAa_defaultPASS1/1684/682 -0%22/22 +0%243064/242872 -0%PASS
ISHAc_getallPASS1/1741/712 -4%22/22 +0%243232/242584 -0%PASS
main → v3
FAZGOLDa_defaultPASS1/1505/390 -23%508/266 -48%244008/117880 -52%PASS
FAZGOLDc_getallPASS1/1525/419 -20%508/266 -48%244440/117880 -52%PASS
HYTa_defaultPASS1/1724/447 -38%22/23 +5%242528/71968 -70%PASS
HYTc_getallPASS1/1707/456 -36%22/23 +5%241504/71968 -70%PASS
ISHAa_defaultPASS1/1795/538 -32%22/23 +5%242640/71968 -70%PASS
ISHAc_getallPASS1/1663/441 -33%22/23 +5%242256/71968 -70%PASS
main → HEAD
FAZGOLDa_defaultPASS1/1565/422 -25%508/266 -48%241016/117880 -51%PASS
FAZGOLDc_getallPASS1/1609/409 -33%508/266 -48%241984/117880 -51%PASS
HYTa_defaultPASS1/1744/449 -40%22/23 +5%240840/71968 -70%PASS
HYTc_getallPASS1/1723/459 -37%22/23 +5%241728/71968 -70%PASS
ISHAa_defaultPASS1/1752/478 -36%22/23 +5%242392/71968 -70%PASS
ISHAc_getallPASS1/1666/432 -35%22/23 +5%243512/71968 -70%PASS

sp_GetOtherOrServicesReport_Optimized

ComparisonOutput (cases PASS)Speed (cases PASS)CPU ms total main → verReads total main → verMax grant main → ver
main → v20/60/60 → 0 (-)0 → 0 (-)- → - (-)
main → v34/42/42617 → 2376 (-9%)1060 → 602 (-43%)237.5 MB → 110.5 MB (-53%)
main → HEAD (final)4/42/43829 → 3374 (-12%)1060 → 602 (-43%)236.8 MB → 110.5 MB (-53%)
Per DB / case detail
DBCaseOutputRows main/verCPU main/verReads main/verGrant KB main/verSpeedNote
main → v2
FAZGOLDa_defaultFAIL// -/ -/ -FAILERR_VER|209|Ambiguous column name 'LocationId'.
FAZGOLDc_getallFAIL// -/ -/ -FAILERR_VER|209|Ambiguous column name 'LocationId'.
HYTa_defaultFAIL// -/ -/ -FAILERR_VER|209|Ambiguous column name 'LocationId'.
HYTc_getallFAIL// -/ -/ -FAILERR_VER|209|Ambiguous column name 'LocationId'.
ISHAa_defaultFAIL// -/ -/ -FAILERR_VER|209|Ambiguous column name 'LocationId'.
ISHAc_getallFAIL// -/ -/ -FAILERR_VER|209|Ambiguous column name 'LocationId'.
main → v3
FAZGOLDa_defaultPASS1/1564/475 -16%508/272 -46%241896/113200 -53%PASS
FAZGOLDc_getallPASS1/1564/488 -13%508/272 -46%243168/113200 -53%PASS
HYTa_defaultPASS1/1712/686 -4%22/29 +32%243184/71968 -70%FAILreads VER=29 > MAIN=22*1.10=24.2
HYTc_getallPASS1/1777/727 -6%22/29 +32%242912/71968 -70%FAILreads VER=29 > MAIN=22*1.10=24.2
main → HEAD
FAZGOLDa_defaultPASS1/1547/422 -23%508/272 -46%242472/113200 -53%PASS
FAZGOLDc_getallPASS1/1587/519 -12%508/272 -46%241328/113200 -53%PASS
HYTa_defaultPASS1/11958/1674 -15%22/29 +32%241056/71968 -70%FAILreads VER=29 > MAIN=22*1.10=24.2
HYTc_getallPASS1/1737/759 +3%22/29 +32%241328/71968 -70%FAILreads VER=29 > MAIN=22*1.10=24.2

sp_GetAllConsignmentOutReportByCustomerId

ComparisonOutput (cases PASS)Speed (cases PASS)CPU ms total main → verReads total main → verMax grant main → ver
main → v24/44/44269 → 2695 (-37%)6833 → 5843 (-14%)1.3 MB → 1.0 MB (-22%)
main → v34/42/43234 → 3177 (-2%)6833 → 9476 (+39%)1.3 MB → 2.3 MB (+79%)
main → HEAD (final)4/44/42344 → 2384 (+2%)6673 → 6673 (+0%)1.3 MB → 1.3 MB (+0%)
Per DB / case detail
DBCaseOutputRows main/verCPU main/verReads main/verGrant KB main/verSpeedNote
main → v2
FAZGOLDa_defaultPASS0/01142/573 -50%18/18 +0%1024/1024 +0%PASS
FAZGOLDc_getallPASS0/0751/548 -27%18/18 +0%1320/1024 -22%PASS
HYTa_defaultPASS13/131326/808 -39%4005/2904 -27%1024/1024 +0%PASS
HYTc_getallPASS13/131050/766 -27%2792/2903 +4%1024/1024 +0%PASS
main → v3
FAZGOLDa_defaultPASS0/01041/856 -18%18/18 +0%1024/1024 +0%PASS
FAZGOLDc_getallPASS0/0769/827 +8%18/18 +0%1320/1024 -22%PASS
HYTa_defaultPASS13/131393/1170 -16%4165/4801 +15%1024/2360 +130%FAILreads VER=4801 > MAIN=4165*1.10=4581.5;grant VER=2360KB > MAIN=1024*1.10+1024=2150.4KB
HYTc_getallPASS13/1331/324 +945%2632/4639 +76%1024/2360 +130%FAILcpu VER=324 > MAIN=31*1.10+20=54.1;reads VER=4639 > MAIN=2632*1.10=2895.2;grant VER=2360KB > MAIN=1024*1.10+1024=2150.4KB
main → HEAD
FAZGOLDa_defaultPASS0/01058/1130 +7%18/18 +0%1024/1024 +0%PASS
FAZGOLDc_getallPASS0/0883/832 -6%18/18 +0%1320/1320 +0%PASS
HYTa_defaultPASS13/13373/392 +5%4005/4005 +0%1024/1024 +0%PASS
HYTc_getallPASS13/1330/30 +0%2632/2632 +0%1024/1024 +0%PASS

fn_AccountLedgerBalance

ComparisonOutput (cases PASS)Speed (cases PASS)CPU ms total main → verReads total main → verMax grant main → ver
main → v214/140/14573 → 1311 (+129%)29032 → 206232 (+610%)68.0 MB → 71.1 MB (+5%)
main → v314/142/14593 → 705 (+19%)29032 → 104160 (+259%)68.0 MB → 134.8 MB (+98%)
main → v3b14/146/14591 → 527 (-11%)29032 → 107620 (+271%)68.0 MB → 134.7 MB (+98%)
main → v3c14/140/14598 → 684 (+14%)29032 → 221158 (+662%)68.0 MB → 67.5 MB (-1%)
main → v3e14/142/14595 → 535 (-10%)29032 → 104160 (+259%)68.0 MB → 134.8 MB (+98%)
main → HEAD (final)14/142/14744 → 739 (-1%)29032 → 104160 (+259%)68.0 MB → 134.8 MB (+98%)
Per DB / case detail
DBCaseOutputRows main/verCPU main/verReads main/verGrant KB main/verSpeedNote
main → v2
FAZGOLDa_defaultPASS1642/164299/172 +74%256/510 +99%69664/72856 +5%FAILcpu ver=172 > main=99*1.10+20=128.9;reads ver=510 > main=256*1.10=281.6
FAZGOLDc_getallPASS1642/164296/165 +72%256/510 +99%69664/72856 +5%FAILcpu ver=165 > main=96*1.10+20=125.6;reads ver=510 > main=256*1.10=281.6
HYTa_defaultPASS1/12/3 +50%48/98 +104%68848/70960 +3%FAILreads ver=98 > main=48*1.10=52.8
HYTc_getallPASS1/12/4 +100%48/98 +104%68848/70960 +3%FAILreads ver=98 > main=48*1.10=52.8
ISHAa_defaultPASS4/47/13 +86%1094/2183 +100%68848/72048 +5%FAILreads ver=2183 > main=1094*1.10=1203.4
ISHAc_getallPASS4/48/12 +50%1094/2183 +100%68848/72048 +5%FAILreads ver=2183 > main=1094*1.10=1203.4
JMSCRMa_defaultPASS109/10930/56 +87%6154/12193 +98%68912/72032 +5%FAILcpu ver=56 > main=30*1.10+20=53.0;reads ver=12193 > main=6154*1.10=6769.4
JMSCRMc_getallPASS109/10930/55 +83%6154/12193 +98%68912/72032 +5%FAILcpu ver=55 > main=30*1.10+20=53.0;reads ver=12193 > main=6154*1.10=6769.4
METAa_defaultPASS109/10929/56 +93%6154/12193 +98%68912/72032 +5%FAILcpu ver=56 > main=29*1.10+20=51.9;reads ver=12193 > main=6154*1.10=6769.4
METAc_getallPASS109/10929/54 +86%6154/12193 +98%68912/72032 +5%FAILcpu ver=54 > main=29*1.10+20=51.9;reads ver=12193 > main=6154*1.10=6769.4
PREMIERa_defaultPASS391/39190/269 +199%716/59895 +8265%69056/72240 +5%FAILcpu ver=269 > main=90*1.10+20=119.0;reads ver=59895 > main=716*1.10=787.6
PREMIERc_getallPASS391/39191/304 +234%716/59895 +8265%69056/72240 +5%FAILcpu ver=304 > main=91*1.10+20=120.1;reads ver=59895 > main=716*1.10=787.6
SOPHIEa_defaultPASS191/19130/74 +147%94/16044 +16968%69000/72224 +5%FAILcpu ver=74 > main=30*1.10+20=53.0;reads ver=16044 > main=94*1.10=103.4
SOPHIEc_getallPASS191/19130/74 +147%94/16044 +16968%69000/72224 +5%FAILcpu ver=74 > main=30*1.10+20=53.0;reads ver=16044 > main=94*1.10=103.4
main → v3
FAZGOLDa_defaultPASS1642/164299/101 +2%256/269 +5%69664/137200 +97%FAILgrant ver=137200KB > main=69664*1.10+1024=77654.4KB
FAZGOLDc_getallPASS1642/164298/100 +2%256/269 +5%69664/137200 +97%FAILgrant ver=137200KB > main=69664*1.10+1024=77654.4KB
HYTa_defaultPASS1/14/3 -25%48/89 +85%68848/66720 -3%FAILreads ver=89 > main=48*1.10=52.8
HYTc_getallPASS1/14/4 +0%48/89 +85%68848/66720 -3%FAILreads ver=89 > main=48*1.10=52.8
ISHAa_defaultPASS4/49/7 -22%1094/1115 +2%68848/70904 +3%PASS
ISHAc_getallPASS4/48/9 +12%1094/1115 +2%68848/70904 +3%PASS
JMSCRMa_defaultPASS109/10930/30 +0%6154/6158 +0%68912/137752 +100%FAILgrant ver=137752KB > main=68912*1.10+1024=76827.2KB
JMSCRMc_getallPASS109/10930/30 +0%6154/6158 +0%68912/137752 +100%FAILgrant ver=137752KB > main=68912*1.10+1024=76827.2KB
METAa_defaultPASS109/10931/31 +0%6154/6158 +0%68912/137752 +100%FAILgrant ver=137752KB > main=68912*1.10+1024=76827.2KB
METAc_getallPASS109/10932/32 +0%6154/6158 +0%68912/137752 +100%FAILgrant ver=137752KB > main=68912*1.10+1024=76827.2KB
PREMIERa_defaultPASS391/39195/138 +45%716/30160 +4112%69056/138008 +100%FAILcpu ver=138 > main=95*1.10+20=124.5;reads ver=30160 > main=716*1.10=787.6;grant ver=138008KB > main=69056*1.10+1024=76985.6KB
PREMIERc_getallPASS391/39191/138 +52%716/30160 +4112%69056/138008 +100%FAILcpu ver=138 > main=91*1.10+20=120.1;reads ver=30160 > main=716*1.10=787.6;grant ver=138008KB > main=69056*1.10+1024=76985.6KB
SOPHIEa_defaultPASS191/19131/40 +29%94/8131 +8550%69000/137928 +100%FAILreads ver=8131 > main=94*1.10=103.4;grant ver=137928KB > main=69000*1.10+1024=76924.0KB
SOPHIEc_getallPASS191/19131/42 +35%94/8131 +8550%69000/137928 +100%FAILreads ver=8131 > main=94*1.10=103.4;grant ver=137928KB > main=69000*1.10+1024=76924.0KB
main → v3b
FAZGOLDa_defaultPASS1642/164299/89 -10%256/1999 +681%69664/137024 +97%FAILreads ver=1999 > main=256*1.10=281.6;grant ver=137024KB > main=69664*1.10+1024=77654.4KB
FAZGOLDc_getallPASS1642/164299/88 -11%256/1999 +681%69664/137024 +97%FAILreads ver=1999 > main=256*1.10=281.6;grant ver=137024KB > main=69664*1.10+1024=77654.4KB
HYTa_defaultPASS1/13/2 -33%48/89 +85%68848/66720 -3%FAILreads ver=89 > main=48*1.10=52.8
HYTc_getallPASS1/13/3 +0%48/89 +85%68848/66720 -3%FAILreads ver=89 > main=48*1.10=52.8
ISHAa_defaultPASS4/410/6 -40%1094/1115 +2%68848/70904 +3%PASS
ISHAc_getallPASS4/49/6 -33%1094/1115 +2%68848/70904 +3%PASS
JMSCRMa_defaultPASS109/10932/21 -34%6154/6158 +0%68912/74144 +8%PASS
JMSCRMc_getallPASS109/10931/20 -35%6154/6158 +0%68912/74144 +8%PASS
METAa_defaultPASS109/10931/20 -35%6154/6158 +0%68912/74144 +8%PASS
METAc_getallPASS109/10930/21 -30%6154/6158 +0%68912/74144 +8%PASS
PREMIERa_defaultPASS391/39193/100 +8%716/30160 +4112%69056/137960 +100%FAILreads ver=30160 > main=716*1.10=787.6;grant ver=137960KB > main=69056*1.10+1024=76985.6KB
PREMIERc_getallPASS391/39191/92 +1%716/30160 +4112%69056/137960 +100%FAILreads ver=30160 > main=716*1.10=787.6;grant ver=137960KB > main=69056*1.10+1024=76985.6KB
SOPHIEa_defaultPASS191/19131/30 -3%94/8131 +8550%69000/137912 +100%FAILreads ver=8131 > main=94*1.10=103.4;grant ver=137912KB > main=69000*1.10+1024=76924.0KB
SOPHIEc_getallPASS191/19129/29 +0%94/8131 +8550%69000/137912 +100%FAILreads ver=8131 > main=94*1.10=103.4;grant ver=137912KB > main=69000*1.10+1024=76924.0KB
main → v3c
FAZGOLDa_defaultPASS1642/1642102/122 +20%256/35703 +13846%69664/67824 -3%FAILreads ver=35703 > main=256*1.10=281.6
FAZGOLDc_getallPASS1642/164299/116 +17%256/32906 +12754%69664/67824 -3%FAILreads ver=32906 > main=256*1.10=281.6
HYTa_defaultPASS1/13/4 +33%48/437 +810%68848/68880 +0%FAILreads ver=437 > main=48*1.10=52.8
HYTc_getallPASS1/13/4 +33%48/437 +810%68848/68880 +0%FAILreads ver=437 > main=48*1.10=52.8
ISHAa_defaultPASS4/49/26 +189%1094/8815 +706%68848/68944 +0%FAILreads ver=8815 > main=1094*1.10=1203.4
ISHAc_getallPASS4/48/19 +138%1094/8815 +706%68848/68944 +0%FAILreads ver=8815 > main=1094*1.10=1203.4
JMSCRMa_defaultPASS109/10933/26 -21%6154/7543 +23%68912/68912 +0%FAILreads ver=7543 > main=6154*1.10=6769.4
JMSCRMc_getallPASS109/10932/24 -25%6154/7530 +22%68912/68912 +0%FAILreads ver=7530 > main=6154*1.10=6769.4
METAa_defaultPASS109/10933/25 -24%6154/7543 +23%68912/68912 +0%FAILreads ver=7543 > main=6154*1.10=6769.4
METAc_getallPASS109/10931/24 -23%6154/7530 +22%68912/68912 +0%FAILreads ver=7530 > main=6154*1.10=6769.4
PREMIERa_defaultPASS391/39190/112 +24%716/43209 +5935%69056/69072 +0%FAILreads ver=43209 > main=716*1.10=787.6
PREMIERc_getallPASS391/39192/113 +23%716/40051 +5494%69056/69072 +0%FAILreads ver=40051 > main=716*1.10=787.6
SOPHIEa_defaultPASS191/19130/36 +20%94/10343 +10903%69000/69152 +0%FAILreads ver=10343 > main=94*1.10=103.4
SOPHIEc_getallPASS191/19133/33 +0%94/10296 +10853%69000/69152 +0%FAILreads ver=10296 > main=94*1.10=103.4
main → v3e
FAZGOLDa_defaultPASS1642/1642110/99 -10%256/269 +5%69664/137200 +97%FAILgrant ver=137200KB > main=69664*1.10+1024=77654.4KB
FAZGOLDc_getallPASS1642/164298/84 -14%256/269 +5%69664/137200 +97%FAILgrant ver=137200KB > main=69664*1.10+1024=77654.4KB
HYTa_defaultPASS1/13/2 -33%48/89 +85%68848/66720 -3%FAILreads ver=89 > main=48*1.10=52.8
HYTc_getallPASS1/13/2 -33%48/89 +85%68848/66720 -3%FAILreads ver=89 > main=48*1.10=52.8
ISHAa_defaultPASS4/48/5 -38%1094/1115 +2%68848/70904 +3%PASS
ISHAc_getallPASS4/48/6 -25%1094/1115 +2%68848/70904 +3%PASS
JMSCRMa_defaultPASS109/10932/23 -28%6154/6158 +0%68912/137752 +100%FAILgrant ver=137752KB > main=68912*1.10+1024=76827.2KB
JMSCRMc_getallPASS109/10930/24 -20%6154/6158 +0%68912/137752 +100%FAILgrant ver=137752KB > main=68912*1.10+1024=76827.2KB
METAa_defaultPASS109/10933/22 -33%6154/6158 +0%68912/137752 +100%FAILgrant ver=137752KB > main=68912*1.10+1024=76827.2KB
METAc_getallPASS109/10930/21 -30%6154/6158 +0%68912/137752 +100%FAILgrant ver=137752KB > main=68912*1.10+1024=76827.2KB
PREMIERa_defaultPASS391/39188/93 +6%716/30160 +4112%69056/138008 +100%FAILreads ver=30160 > main=716*1.10=787.6;grant ver=138008KB > main=69056*1.10+1024=76985.6KB
PREMIERc_getallPASS391/39191/94 +3%716/30160 +4112%69056/138008 +100%FAILreads ver=30160 > main=716*1.10=787.6;grant ver=138008KB > main=69056*1.10+1024=76985.6KB
SOPHIEa_defaultPASS191/19129/29 +0%94/8131 +8550%69000/137928 +100%FAILreads ver=8131 > main=94*1.10=103.4;grant ver=137928KB > main=69000*1.10+1024=76924.0KB
SOPHIEc_getallPASS191/19132/31 -3%94/8131 +8550%69000/137928 +100%FAILreads ver=8131 > main=94*1.10=103.4;grant ver=137928KB > main=69000*1.10+1024=76924.0KB
main → HEAD
FAZGOLDa_defaultPASS1642/164296/84 -12%256/269 +5%69664/137200 +97%FAILgrant ver=137200KB > main=69664*1.10+1024=77654.4KB
FAZGOLDc_getallPASS1642/1642197/242 +23%256/269 +5%69664/137200 +97%FAILcpu ver=242 > main=197*1.10+20=236.7;grant ver=137200KB > main=69664*1.10+1024=77654.4KB
HYTa_defaultPASS1/14/3 -25%48/89 +85%68848/66720 -3%FAILreads ver=89 > main=48*1.10=52.8
HYTc_getallPASS1/13/2 -33%48/89 +85%68848/66720 -3%FAILreads ver=89 > main=48*1.10=52.8
ISHAa_defaultPASS4/49/6 -33%1094/1115 +2%68848/70904 +3%PASS
ISHAc_getallPASS4/49/6 -33%1094/1115 +2%68848/70904 +3%PASS
JMSCRMa_defaultPASS109/10933/23 -30%6154/6158 +0%68912/137752 +100%FAILgrant ver=137752KB > main=68912*1.10+1024=76827.2KB
JMSCRMc_getallPASS109/10930/25 -17%6154/6158 +0%68912/137752 +100%FAILgrant ver=137752KB > main=68912*1.10+1024=76827.2KB
METAa_defaultPASS109/10935/23 -34%6154/6158 +0%68912/137752 +100%FAILgrant ver=137752KB > main=68912*1.10+1024=76827.2KB
METAc_getallPASS109/10937/22 -41%6154/6158 +0%68912/137752 +100%FAILgrant ver=137752KB > main=68912*1.10+1024=76827.2KB
PREMIERa_defaultPASS391/391123/107 -13%716/30160 +4112%69056/138008 +100%FAILreads ver=30160 > main=716*1.10=787.6;grant ver=138008KB > main=69056*1.10+1024=76985.6KB
PREMIERc_getallPASS391/391105/127 +21%716/30160 +4112%69056/138008 +100%FAILreads ver=30160 > main=716*1.10=787.6;grant ver=138008KB > main=69056*1.10+1024=76985.6KB
SOPHIEa_defaultPASS191/19132/37 +16%94/8131 +8550%69000/137928 +100%FAILreads ver=8131 > main=94*1.10=103.4;grant ver=137928KB > main=69000*1.10+1024=76924.0KB
SOPHIEc_getallPASS191/19131/32 +3%94/8131 +8550%69000/137928 +100%FAILreads ver=8131 > main=94*1.10=103.4;grant ver=137928KB > main=69000*1.10+1024=76924.0KB

sp_GetAppraisalLedgerList

ComparisonOutput (cases PASS)Speed (cases PASS)CPU ms total main → verReads total main → verMax grant main → ver
main → v11/11/123164 → 1323 (-94%)232050 → 116398 (-50%)237.9 MB → 68.9 MB (-71%)
Per DB / case detail
DBCaseOutputRows main/verCPU main/verReads main/verGrant KB main/verSpeedNote
main → v1
FAZGOLDa_defaultPASS27/2723164/1323 -94%232050/116398 -50%243568/70584 -71%PASS

sp_GetGoldSilverCurrentStockReport

ComparisonOutput (cases PASS)Speed (cases PASS)CPU ms total main → verReads total main → verMax grant main → ver
main → v114/147/143046 → 3600 (+18%)65771 → 61680 (-6%)8.9 MB → 8.9 MB (+0%)
main → v214/1413/143941 → 4098 (+4%)65848 → 65932 (+0%)8.9 MB → 8.9 MB (+0%)
main → HEAD (final)14/143/143849 → 4678 (+22%)65931 → 62058 (-6%)8.9 MB → 8.9 MB (+0%)
Per DB / case detail
DBCaseOutputRows main/verCPU main/verReads main/verGrant KB main/verSpeedNote
main → v1
FAZGOLDa_defaultPASS26/26102/120 +18%5836/12618 +116%8816/8816 +0%FAILreads VER=12618 > MAIN=5836*1.10=6419.6
FAZGOLDc_getallPASS115/115288/382 +33%6157/13112 +113%8816/8816 +0%FAILcpu VER=382 > MAIN=288*1.10+20=336.8;reads VER=13112 > MAIN=6157*1.10=6772.7
HYTa_defaultPASS1/1248/276 +11%360/323 -10%1056/2112 +100%PASS
HYTc_getallPASS1/1223/281 +26%360/323 -10%1056/2112 +100%FAILcpu VER=281 > MAIN=223*1.10+20=265.3
ISHAa_defaultPASS2/2246/264 +7%1861/1738 -7%1056/2112 +100%PASS
ISHAc_getallPASS2/2244/301 +23%1861/1738 -7%1056/2112 +100%FAILcpu VER=301 > MAIN=244*1.10+20=288.4
JMSCRMa_defaultPASS2/2257/269 +5%2391/843 -65%1056/2112 +100%PASS
JMSCRMc_getallPASS2/2246/284 +15%2391/843 -65%1056/2112 +100%PASS
METAa_defaultPASS2/254/59 +9%2311/757 -67%1056/2112 +100%PASS
METAc_getallPASS2/240/42 +5%2311/757 -67%1056/2112 +100%PASS
PREMIERa_defaultPASS11/11234/315 +35%15967/5204 -67%4064/4064 +0%FAILcpu VER=315 > MAIN=234*1.10+20=277.4
PREMIERc_getallPASS11/11265/296 +12%15967/5204 -67%2424/2424 +0%PASS
SOPHIEa_defaultPASS25/25286/346 +21%4003/9114 +128%9160/9160 +0%FAILcpu VER=346 > MAIN=286*1.10+20=334.6;reads VER=9114 > MAIN=4003*1.10=4403.3
SOPHIEc_getallPASS25/25313/365 +17%3995/9106 +128%9160/9160 +0%FAILcpu VER=365 > MAIN=313*1.10+20=364.3;reads VER=9106 > MAIN=3995*1.10=4394.5
main → v2
FAZGOLDa_defaultPASS26/26288/296 +3%5836/5836 +0%8816/8816 +0%PASS
FAZGOLDc_getallPASS115/115297/302 +2%6157/6157 +0%8816/8816 +0%PASS
HYTa_defaultPASS1/1206/165 -20%360/360 +0%1056/1056 +0%PASS
HYTc_getallPASS1/1214/214 +0%360/360 +0%1056/1056 +0%PASS
ISHAa_defaultPASS2/2246/258 +5%1861/1861 +0%1056/1056 +0%PASS
ISHAc_getallPASS2/2250/235 -6%1861/1861 +0%1056/1056 +0%PASS
JMSCRMa_defaultPASS2/2263/260 -1%2391/2391 +0%1056/1056 +0%PASS
JMSCRMc_getallPASS2/2242/301 +24%2391/2391 +0%1056/1056 +0%FAILcpu VER=301 > MAIN=242*1.10+20=286.2
METAa_defaultPASS2/2235/260 +11%2307/2391 +4%1056/1056 +0%PASS
METAc_getallPASS2/2230/234 +2%2391/2391 +0%1056/1056 +0%PASS
PREMIERa_defaultPASS11/11237/240 +1%15967/15967 +0%4064/4064 +0%PASS
PREMIERc_getallPASS11/11253/283 +12%15967/15967 +0%2424/2424 +0%PASS
SOPHIEa_defaultPASS25/25775/861 +11%4003/4003 +0%9160/9160 +0%PASS
SOPHIEc_getallPASS25/25205/189 -8%3996/3996 +0%9160/9160 +0%PASS
main → HEAD
FAZGOLDa_defaultPASS26/26382/405 +6%5836/12808 +119%8816/8816 +0%FAILreads VER=12808 > MAIN=5836*1.10=6419.6
FAZGOLDc_getallPASS115/115310/379 +22%6157/13128 +113%8816/8816 +0%FAILcpu VER=379 > MAIN=310*1.10+20=361.0;reads VER=13128 > MAIN=6157*1.10=6772.7
HYTa_defaultPASS1/1188/264 +40%360/323 -10%1056/2112 +100%FAILcpu VER=264 > MAIN=188*1.10+20=226.8
HYTc_getallPASS1/1191/246 +29%360/323 -10%1056/2112 +100%FAILcpu VER=246 > MAIN=191*1.10+20=230.1
ISHAa_defaultPASS2/2229/284 +24%1861/1738 -7%1056/2112 +100%FAILcpu VER=284 > MAIN=229*1.10+20=271.9
ISHAc_getallPASS2/2292/352 +21%1861/1738 -7%1056/2112 +100%FAILcpu VER=352 > MAIN=292*1.10+20=341.2
JMSCRMa_defaultPASS2/2246/324 +32%2391/843 -65%1056/2112 +100%FAILcpu VER=324 > MAIN=246*1.10+20=290.6
JMSCRMc_getallPASS2/2261/287 +10%2391/843 -65%1056/2112 +100%PASS
METAa_defaultPASS2/2328/317 -3%2391/843 -65%1056/2112 +100%PASS
METAc_getallPASS2/2283/296 +5%2391/843 -65%1056/2112 +100%PASS
PREMIERa_defaultPASS11/11250/399 +60%15967/5204 -67%4064/4064 +0%FAILcpu VER=399 > MAIN=250*1.10+20=295.0
PREMIERc_getallPASS11/11239/295 +23%15967/5204 -67%2424/2424 +0%FAILcpu VER=295 > MAIN=239*1.10+20=282.9
SOPHIEa_defaultPASS25/25389/482 +24%4003/9114 +128%9160/9160 +0%FAILcpu VER=482 > MAIN=389*1.10+20=447.9;reads VER=9114 > MAIN=4003*1.10=4403.3
SOPHIEc_getallPASS25/25261/348 +33%3995/9106 +128%9160/9160 +0%FAILcpu VER=348 > MAIN=261*1.10+20=307.1;reads VER=9106 > MAIN=3995*1.10=4394.5

sp_GetGoldSilverCurrentStockReport_NS

ComparisonOutput (cases PASS)Speed (cases PASS)CPU ms total main → verReads total main → verMax grant main → ver
main → v13/31/3619 → 671 (+8%)25317 → 43736 (+73%)15.4 MB → 16.0 MB (+4%)
Per DB / case detail
DBCaseOutputRows main/verCPU main/verReads main/verGrant KB main/verSpeedNote
main → v1
FAZGOLDa_defaultPASS26/26130/188 +45%12307/21685 +76%15816/16384 +4%FAILcpu VER=188 > MAIN=130*1.10+20=163.0;reads VER=21685 > MAIN=12307*1.10=13537.7
FAZGOLDc_getallPASS115/115153/133 -13%12646/22024 +74%15816/16384 +4%FAILreads VER=22024 > MAIN=12646*1.10=13910.6
HYTa_defaultPASS1/1336/350 +4%364/27 -93%2112/2112 +0%PASS

sp_GetGoldSilverCurrentStockReport_NS_VariantWise

ComparisonOutput (cases PASS)Speed (cases PASS)CPU ms total main → verReads total main → verMax grant main → ver
Running pending / running

4. Earlier gates

(superseded: OLD was the previous commit, not main)

Final output parity — overall: PASS

ObjectHYTISHASOPHIEPREMIERJMSCRMFAZGOLDMETA
sp_GetDiamondAndStoneReport_OptimizedTo doTo doTo doTo doTo doTo doTo do
sp_GetOtherOrServicesReport_OptimizedTo doTo doTo doTo doTo doTo doTo do
sp_GetImitationWatchesReport_OptimizedTo doTo doTo doTo doTo doTo doTo do
sp_GetOnlyDiamondReport_OptimizedTo doTo doTo doTo doTo doTo doTo do
sp_GetAppraisalLedgerListTo doTo doTo doTo doTo doTo doTo do
fn_AccountLedgerBalanceTo doTo doTo doTo doTo doTo doTo do

Goldsilver parity — overall: PASS

ObjectHYTISHASOPHIEPREMIERJMSCRMFAZGOLDMETA
sp_GetGoldSilverCurrentStockReportTo doTo doTo doTo doTo doTo doTo do
sp_GetGoldSilverCurrentStockReport_NSTo doTo doTo doTo doTo doTo doTo do
sp_GetGoldSilverCurrentStockReport_NS_VariantWiseTo doTo doTo doTo doTo doTo doTo do

Speed / memory

ObjectMeasuredOLDNEWNote
sp_GetDiamondAndStoneReport_OptimizedMemory grantPREMIER 241 MB, SOPHIE 241 MBPREMIER 215 MB, SOPHIE 208 MBOutput same 6 DBs; GetAll time <= +5% (ns_dsr4, 2026-12-06)
sp_GetOnlyDiamondReport_OptimizedMemory grant (paged)PREMIER 190 MB, SOPHIE 40 MBPREMIER 72 MB, SOPHIE 5 MBOutput same 6 DBs; GetAll time <= +5% (ns_onlydiamond5)
sp_GetImitationWatchesReport_OptimizedMemory grantPREMIER/SOPHIE 241 MB72-74 MBOutput same (g3)
sp_GetOtherOrServicesReport_OptimizedMemory grant241-244 MB (all DBs)71-74 MBOutput same (g3)
sp_GetAppraisalLedgerList + fn_AccountLedgerBalanceCPU timeFAZGOLD 154 s, PREMIER 44 s, SOPHIE 11.6 s, JMSCRM/META 4 s, ISHA 0.9 sFAZGOLD 1.9 s, PREMIER 0.4 s, SOPHIE 0.3 s, JMSCRM/META 0.25 s, ISHA 0.16 sReads 10-60x kam; output same (ns_appr)
Goldsilver 3 SPs---Speed gate pending; output parity first

Output per case (final parity)

No cases yet.

Output per case (goldsilver)

No cases yet.

5. Full history

(oldest first)
#What happened
1DONE 2026-12-05: apicrm UP; heavy-query inventory (~/.ai/apicrm-migration/heavy-queries-2026-12-05.csv); local disk cleanup (41 GB free); BarcodeNoColumnResizeSql per-table fix coded (uncommitted).
2DONE 2026-12-05: ISHA, FAZGOLD, SOPHIE, PREMIER, JMSCRM restored locally (ONLINE, 459-469 tables).
3NEXT: per-query plan+fix with zero output change via Cursor; test barcode fix on JMSCRM_TH.
42026-12-05 fn_AccountLedgerBalance (top heavy query, all clients): root cause = ROW_NUMBER sort carries LedgerName NVARCHAR(MAX) -> desired grant ~670 MB (uses ~2 MB). Fix: Bal CTE + SrNo over narrow keys (K) -> ~79 MB. New text: scratchpad alb/new_fn.sql; test copy dbo.zz_fn_AccountLedgerBalance_v2 in 5 local DBs (drop after). Cursor test alb-test running (log ~/.claude/cursor-runs/apicrm-migration-alb-test*). NEXT: if PASS -> write to repo fn file, drop zz_*, next query (LIVEMINIZ adhoc needs LIVEMINIZ restore; ISHA OPENJSON @FoundIndex 931k execs).
52026-12-05 owner: test under server-like load + zero output change + all heavy objects. Plan docs/ai/apicrm-perf-plan-2026-12-05.html; agent ~/.claude/agents/sql-perf-lead.md. NEXT: (1) review Cursor alb-test result; (2) read server SQL container limits read-only, set local identical (no extra resources; increases = readiness item for both sides, restore LIVEMINIZ/META) + replay harness via Cursor; (3) per-object loop.
62026-12-05 20:10 alb-test partial: rows identical so far (ISHA order differs = no ORDER BY, check SrNo); NEW CPU higher on FAZGOLD (278 vs 151 ms) -> must compare grants before accepting. NEXT: read alb-test .json result, decide.
72026-12-05 20:30 alb-test DONE: output gate PASS (5 DBs x 6 cases, EXCEPT both ways 0, SrNo same). BUT on local Developer edition NEW is slower (PREMIER 192->289 ms, FAZGOLD 197->317) and desired grant higher (3.3->6.7 MB): local plan != server plan (server Express asked ~670 MB). Fix NOT landed; re-judge only on the Express-like env. zz_fn_AccountLedgerBalance_v2 still in 5 local DBs.
82026-12-05 server SQL read (read-only): Express 17.0.5065.9, image mcr.microsoft.com/mssql/server@sha256:05644dad1266ca3d445d1e8f6d2ebb9a6a03df9a39376e0f7b48917356dca9d9, MSSQL_PID=Express, MSSQL_MEMORY_LIMIT_MB=4096, no docker mem/cpu limit, 4 schedulers, max server memory 2560, target 1315 MB, MAXDOP 0, CTFP 5, adhoc 0, tempdb 6 files, 19 user DBs, DB-scoped MAXDOP 0. Live: 277% CPU, 3.68 GiB.
9Local `sqlserver`: Developer 17.0.5005.3, MSSQL_MEMORY_LIMIT_MB=2048, docker mem 2.5 GB, tempdb 4 files, 6 DBs = ~9.7 GB data + 2.8 GB log. Mac disk 22 GB free.
10NEXT (owner choice pending): A) new local container `sqlperf` (same digest, MSSQL_PID=Express, MSSQL_MEMORY_LIMIT_MB=4096, --memory 4g, --cpus 4, max server memory 2560, tempdb 6 files) + restore copies of the 6 DBs (~12.5 GB disk, ~4 GB RAM); or B) switch existing `sqlserver` to the same settings (no extra disk; restarts the shared local SQL used by other chats). Then Cursor builds T-SQL replay harness (sessions = sqlcmd loops in container, weighted mix from heavy-queries CSV, timings logged to harness table, DMV deltas: grants, RESOURCE_SEMAPHORE, CPU, reads).
11Owner 2026-12-05: all chat replies of this task (apicrm-migration) in Hinglish (only this task).
122026-12-05 owner chose same-as-server: building local container sqlperf (port 14330, Express, digest as server) via scratchpad sqlperf/build.sh; log ~/.claude/cursor-runs/apicrm-migration-sqlperf-build.log. NEXT: verify BUILD_DONE, then Cursor replay harness.
13Owner 2026-12-05: all changes local only; server strictly read-only incl. no temp files (rule 10 in agent).
142026-12-05 20:45 DONE: local container sqlperf (port 14330) = server copy: Express 17.0.5065.9 same digest, MSSQL_MEMORY_LIMIT_MB 4096, max server mem 2560, 4 CPU, MAXDOP 0, CTFP 5, tempdb 6 files; 6 DBs ONLINE (copies). Runs amd64 emulated on Mac -> ms higher than server, grants/reads/plans comparable. Open: local target_mb 3238 vs server 1315 (server host pressure) - harness to cap grant with load. sqlq.sh: SQLC=sqlperf. Docker cleanup done (mzt-sql container + 7 test images; volumes kept). Mac disk 8.6 GB free. NEXT: Cursor builds T-SQL replay harness on sqlperf (zz_PerfHarness DB, sqlcmd session loops, weighted mix from heavy-queries CSV, p50/p95 + grant/RESOURCE_SEMAPHORE/CPU/reads deltas), then re-judge alb fix (zz_fn_AccountLedgerBalance_v2 must be created in sqlperf DBs).
152026-12-05 21:00 harness handoff ~/.ai/apicrm-migration/harness/HANDOFF.md; Cursor lanes harnessA (setup/report.sql) + harnessB (build_workload.py, run_load.sh) running. NEXT: review, run setup+build on sqlperf, OLD vs NEW_ALB load runs.
162026-12-05 21:15 harness files reviewed OK; setup.sql applied on sqlperf (zz_PerfHarness); sqlperf max server memory set 1312 (server effective target ~1315); build_workload.sql running (needs sqlcmd -I; wrapper harness/hsql.sh). NEXT: check Workload resolved counts, then run_load.sh OLD 30 sess 300 s vs NEW_ALB, compare report.
172026-12-05 21:30 DONE: Workload built, 110/110 heavy queries resolved (5 DBs; HYT none in CSV). Weights = CEILING(SQRT(execs)) when >100 (raw execs = 97% ISHA OPENJSON); ALB share 256/3480. LOAD RUNNING (background, ~7 min): OLD_s20 (20 sess, 180 s) then NEW_ALB_s20; logs ~/.claude/cursor-runs/apicrm-migration-load-OLD.log / -NEW.log (LOAD_DONE marker at end). NEXT: compare via harness report.sql RunA=<OLD id> RunB=<NEW id> (./hsql.sh -d zz_PerfHarness -i /tmp/harness_report.sql -v RunA=.. RunB=..); accept alb fix only if ALB p95/grant/RESOURCE_SEMAPHORE better and no other query worse; then write fix to repo fn file, drop zz_* in local DBs; then per-object loop over remaining heavy objects.
182026-12-05 earlier load failed (run_load.sh not executable; LOAD_DONE marker was false). Re-run with 'bash run_load.sh' in background: OLD_s20 then NEW_ALB_s20 (logs same paths). NEXT: RunIds from first line of each log -> report.sql compare -> decide alb.
19Owner 2026-12-05: CRUD must have zero impact + CRUD paths also to be optimised. Added rules 11-12 to sql-perf-lead agent. NEXT after alb load compare: Cursor adds write-path workload to harness (top write procs from Query Store in local DBs, run in TRAN+ROLLBACK, lock/block/deadlock deltas) and CRUD regression check for alb fix (fn_AccountLedgerBalance is read-only fn: confirm no writer calls it).
202026-12-05 load runs 1 (OLD) / 2 (NEW_ALB) INVALID: 55% stmts error both runs (#temp fragments, TVF via EXEC, stale 4-arg ALB texts), all params NULL (plan XML namespace), CpuMs/Reads 0 (dm_exec_sessions), report dup rows. Cursor lanes harnessfixA (setup/report: dm_exec_requests, usp_ValidateWorkload, TRAN+ROLLBACK replay, per-WorkloadId report) + harnessfixB (build_workload.py: namespace, latest text, TVF call) running; outs ~/.claude/cursor-runs/apicrm-migration-harnessfix{A,B}.out. NEXT: review diffs, re-run setup + build + validate, OLD vs OLD noise run, then OLD vs NEW_ALB.
212026-12-05 harnessfixA+B DONE (rc 0; setup.sql/report.sql/build_workload.py edited, NOT yet reviewed; build_workload.sql not regenerated; B uses DEFAULT keyword for missing param with default). NEXT: review the 3 diffs, apply setup.sql, python3 build_workload.py -> run build_workload.sql (hsql.sh), EXEC usp_ValidateWorkload, run OLD vs OLD (noise) then OLD vs NEW_ALB (bash run_load.sh ...), report.sql per-WorkloadId + set 6 (ALB). CRUD gate per agent rules 11-12.
222026-12-05 harnessfixA+B reviewed OK. Claude fixed build_workload.py (XML GROUP BY bug; sqrt weights now inside build). Workload rebuilt 110/110 resolved, ALB = 9 adhoc batches (weight 256/3480). Gap: many params NULL (procs + some ALB) -> Cursor lanes harnessfixC (param fallback: object plans -> DB pool -> DEFAULT) + harnessfixD (report set 6 filter by Batch text) running. NEXT: review C/D, rebuild, usp_ValidateWorkload, OLD vs OLD noise run, OLD vs NEW_ALB (needs zz_fn_AccountLedgerBalance_v2 in sqlperf DBs - check).
232026-12-05 harnessfixC (param fallback objparam/poolparam/DEFAULT) + harnessfixD (report set 6 by Batch text) DONE; Claude fixed C's XML-method GROUP BY (derived table). Rebuild + usp_ValidateWorkload was started (backgrounded; output /private/tmp/claude-501/-Users-dhirajbhalme-Documents-GitHub-AngularJMS/cca854b0-c875-4fa2-b1e8-6093979883d0/tasks/bhr8c39fb.output, may be gone). NEXT: check zz_PerfHarness.dbo.Workload (resolved/valid counts per DB, Note nullparam/poolparam, ALB batches PREMIER/FAZGOLD non-NULL params); if build not done rerun: cd harness; python3 build_workload.py; docker cp build_workload.sql sqlperf:/tmp/h_build.sql; ./hsql.sh -d zz_PerfHarness -i /tmp/h_build.sql -b; ./hsql.sh -d zz_PerfHarness -Q "EXEC dbo.usp_ValidateWorkload". Then: docker cp report.sql sqlperf:/tmp/harness_report.sql; bash run_load.sh OLD_a 20 180; bash run_load.sh OLD_b 20 180 (noise); bash run_load.sh NEW_ALB 20 180 NEW_ALB; compare report.sql RunA/RunB, decide alb fix (CRUD gate rules 11-12).
242026-12-05 late: DB-wide param pool was too slow (20000 plan XML shred, 6+ min CPU on ISHA alone) -> killed; Claude rewrote pool (TOP 1000 plans with ParameterCompiledValue text, <1 MB, execs aggregated once; backup build_workload.py.bak). Rebuild+validate running in background, log ~/.claude/cursor-runs/apicrm-migration-rebuild.log (BUILD_RC / VALIDATE_DONE markers). NEXT: read log, check Workload counts + ALB params, then noise run + OLD vs NEW_ALB.
252026-12-05 owner: noise run after rebuild. Chained background job: gate (valid>=80, ALB>=1, PREMIER/FAZGOLD ALB no NULL LedgerId) -> run_load OLD_a + OLD_b (20 sess, 180 s) -> report ~/.claude/cursor-runs/apicrm-migration-noise-report.txt; markers in apicrm-migration-noise.log (GATE_PASS/GATE_FAIL, RUNS, NOISE_DONE). NEXT: read noise report (OLD_a vs OLD_b deltas = noise band), then NEW_ALB run vs OLD_a.
262026-12-05 21:00 rebuild OK (6 min, pool fixed) but VALIDATE only 34/110 valid -> GATE_FAIL, noise run NOT started (correct). Causes: ~70 'adhoc' hashes are statements INSIDE procs (#temp / @tablevar missing); 8 CREATE INDEX (DDL); 4 TOP/FETCH NULL paging params; ALB: 3 old 4-arg texts + 2 PREMIER/FAZGOLD NULL params (1 valid ALB per DB in 4 DBs). NEXT (Cursor lane, build_workload.py only): for each hash get query_store_query.object_id; if object_id<>0 -> Batch = EXEC parent proc (params via existing fallback chain, dedupe same proc per DB, Weight summed); skip DDL (CREATE/ALTER/DROP INDEX/STATISTICS) with Note 'ddl skipped'; ALB/fn calls: take text whose arg count matches sys.parameters count; paging params NULL -> page_num 1/page_size 25 pool. Then rebuild (6 min) + usp_ValidateWorkload; gate valid>=80 -> noise OLD_a/OLD_b -> NEW_ALB.
272026-12-05 Cursor lane harnessfixE running (build_workload.py: parent-proc replay, dedupe, DDL skip, stale ALB signature, paging defaults; prompt harness/fixE.txt, backup build_workload.py.preE, out ~/.claude/cursor-runs/apicrm-migration-harnessfixE.out RC= marker). NEXT: review diff, rebuild+validate (gate valid>=80), noise OLD_a/OLD_b, NEW_ALB vs OLD_a.
282026-12-05 harnessfixE DONE + reviewed (dedupe partition switched to HASHBYTES). chain_noise.sh running (rebuild ~6 min -> validate -> gate covered>=80/alb>=1/no NULL PF ALB -> OLD_a+OLD_b 20 sess 180 s -> report); log ~/.claude/cursor-runs/apicrm-migration-noise.log (BUILD_RC, GATE_PASS/FAIL, RUNS, NOISE_DONE), report apicrm-migration-noise-report.txt. NEXT: read noise band, then bash run_load.sh NEW_ALB 20 180 NEW_ALB vs OLD_a; CRUD gate.
292026-12-05 21:25 GATE_FAIL covered 47/110 (alb 4 ok). Cause: parent lookup took object_id 0 row of same hash; dynamic SQL in procs has object_id 0. Claude patched build_workload.py (MAX object_id per hash + #temp-name sql_modules fallback; backup .preF). chain_noise.sh re-running (log noise.log; old log noise.gatefail1.log). NEXT: gate -> noise -> NEW_ALB vs OLD_a. Replies Hinglish.
302026-12-05 21:40 owner: Dev_NullLedgerAutomationContactColumns (@Apply=1) DONE on all 12 local DBs (sqlserver 6 + sqlperf 6), remaining 0, log ~/.claude/cursor-runs/apicrm-migration-scrub.log. HYT_TH has no data -> NISHKA_TH (~/Downloads/NISHKA_TH_20261205_142129.bak) restoring into sqlperf (scratchpad nishka.sh, log apicrm-migration-nishka.log, NISHKA_DONE marker; scrub runs after restore). All work local only. NEXT: noise gate result; add NISHKA to workload only if its queries are in the heavy-queries CSV.
312026-12-05 21:45 NISHKA restore STOPPED + partial DB dropped: mdf preallocates 38.7 GB (+1.9 GB log), Mac disk hit 1.3 GB free. Disk back to 13 GB. Noise chain unaffected. NISHKA needs ~41 GB free (owner choice: free disk or skip). Repo scrub file unchanged (Apply=1 only in scratchpad copy).
322026-12-05 22:00 META_TH restored into sqlperf (ONLINE, 1.7 GB data + 1 GB log, Query Store ON) + contact scrub DONE (remaining 0). Zip/bak temp copies deleted. Disk 10 GB free.
33NOTE: heavy-queries CSV has 14 META_TH rows (were skipped, DB missing locally). After current noise chain: rebuild workload to include META, then noise + NEW_ALB.
342026-12-05 22:10 chain run 2 GATE_FAIL covered 44/104 (alb 4, no NULL PF). Notes (~/.claude/cursor-runs/apicrm-migration-gatefail2-notes.txt): ~45 still in-proc stmts not mapped to parent (@Result/@Article/@CURRENC/@StockCr tablevars, #FilteredStockPostin/#ALLPURCHASES/#ALLSALES/#JewelleryDiamonds/#SP_Base/#LedgerData/#DiamondItems) -> preF parent fallback (MAX object_id + #temp in sql_modules) not working: debug build_workload.py parent step on 1 hash (e.g. @Result) via Query Store object_id + sql_modules LIKE; also @tablevar names need same fallback; paging TOP/FETCH/OFFSET still 5 invalid (default not applied); 1 '@params' sp_executesql. META_TH restored but its 14 CSV rows need rebuild. NEXT: fix parent mapping (small Cursor run or Claude), rebuild, gate, noise, NEW_ALB.
352026-12-05 owner: LIVEMINIZ is a different application -> ignore (no restore; filter its 25 CSV rows out of workload + gate denominator). Optional restores: DHUNNA, JAYVIDIAM, TOTSMINE (then ANITA/ARMAAN/AJAL/JEDDAH).
362026-12-05 22:40 harness fix G (build_workload.py, backup .preG): root cause = QS object_ids of re-created procs no longer exist -> parent NULL + #temp fallback skipped. Now: only existing dbo objects (no TEST/old/bak), else statement-body snippet CHARINDEX in sql_modules (#temp+@tablevar), else #temp name. Paging: page_size compiled (0) -> override <=0 to defaults. META_TH added to DBS (124 rows). NEXT: rebuild+validate -> bash chain_noise.sh -> NEW_ALB vs OLD_a -> CRUD gate.
372026-12-05 22:15 rebuild (fix G, 124 rows incl META) still running (chain_noise.sh pid; watcher stops chain after GATE line, no load). Owner: fix ALL invalid rows (validate only) before any load; Claude must verify Cursor work by own sample run, never diff-only OK. NEXT: read noise.log GATE + Workload Notes of invalid rows -> group by cause -> small Cursor lanes (build_workload.py, one at a time) -> Claude sample-run check -> rebuild+validate until clean. Parallel Cursor lane meanwhile: CRUD write-path workload (new file crud_workload.py/sql: top write procs from QS, TRAN+ROLLBACK, lock/block deltas). Then Cursor --test: noise OLD_a/OLD_b, NEW_ALB vs OLD_a; then next heavy objects (ISHA OPENJSON @FoundIndex).
382026-12-05 22:20 rebuild (fix G) still running (since 22:01). Cursor lane crudA started (--lane crud; new files harness/crud_workload.py + crud_setup.sql: CrudWorkload table, usp_ValidateCrudWorkload TRAN+ROLLBACK, top 25 QS write procs + sp_InsertItemListCore/aggregates/LedgerPosting/StockPosting; out ~/.claude/cursor-runs/apicrm-migration-crudA.out). NEXT: GATE line -> invalid rows by cause -> fix lanes; review+own sample run of crudA.
392026-12-05 22:17 rebuild 119/124 rows; ETA GATE ~22:25; session cleared (long chat). Resume via ~/.ai/resume/apicrm-migration.txt.
402026-12-05 22:20 crudA DONE (files written, not reviewed/run yet).
412026-12-05 22:30 crudA reviewed: Claude fixed crud_setup.sql (BEGIN TRAN moved outside dynamic batch, else err 266 on every row; backup .preFix); write-filter heuristic broad but OK. Not yet run (run after main build finishes, same sqlperf). Rebuild (fix G) still running, background waiter for GATE. NEXT: GATE -> invalid rows by cause -> fix lanes; run crud_workload.py + crud_setup + validate.
422026-12-05 22:50 rebuild fix G DONE: GATE_PASS covered 107/114 (alb 4, no NULL PF ALB); chain stopped after validate (no load, as owner wants). crud_setup.sql fixed by Claude (BEGIN TRAN outside batch), crud not run yet. Seen: fn_GetImageList binding errors (schema drift in some DB). NEXT: list 7 invalid Workload rows (DbName, Note, ValidateError) -> group by cause -> small Cursor fix lanes on build_workload.py -> own sample run -> rebuild+validate until 114/114 (or justified skip); then python3 crud_workload.py + apply crud_setup.sql + crud_workload.sql + EXEC usp_ValidateCrudWorkload, sample-check; then noise OLD_a/OLD_b, NEW_ALB vs OLD_a, CRUD gate. Reply Hinglish.
432026-12-05 23:05 invalid rows triaged: 33 'ddl skipped' + 3 'stale signature' = justified skips; PREMIER #47 (@Result dropdown stmt, wt 2) source exists in no DB/repo = stale, justified skip; SOPHIE #85/#86 sp_GetDiamondAndStoneReport_Optimized NULL MakingRate = old DB copy, fix already on main (3df4cdbb01a HAVING COUNT(*)>0) -> repo version applied to sqlperf SOPHIE_TH (local only). Rebuild+validate running (chain_validate.sh, no load; log ~/.claude/cursor-runs/apicrm-migration-validate.log). NEXT: confirm SOPHIE rows valid -> crud_workload.py + crud_setup.sql + crud_workload.sql + usp_ValidateCrudWorkload + sample check -> noise OLD_a/OLD_b -> NEW_ALB vs OLD_a.
442026-12-05 23:10 owner: run CRUD after validate. Chained bg job: waits GATE in apicrm-migration-validate.log -> crud_workload.py + crud_setup.sql + crud_workload.sql + usp_ValidateCrudWorkload; log ~/.claude/cursor-runs/apicrm-migration-crud.log (VALIDATE:, CRUD_BUILD_RC, CRUD_VALIDATE_DONE). NEXT: check validate GATE (SOPHIE 85/86 valid), CRUD valid/invalid per DB + own sample run of 2-3 CrudWorkload rows -> noise OLD_a/OLD_b -> NEW_ALB vs OLD_a.
45Owner 2026-12-05 23:20: root cause first, low-spec target; settings A/B (MAXDOP 2, CTFP 50, adhoc 1) only after query fixes.
462026-12-05 23:30 validate GATE_PASS covered 85 (96 rows after merge), alb 4, SOPHIE 20/20 valid now; only invalid left = PREMIER @Result stale stmt (justified) + ddl/stale-signature skips. CRUD chain started automatically (apicrm-migration-crud.log). NEXT: CRUD result + own sample -> noise -> NEW_ALB.
472026-12-05 23:40 CRUD build failed (PRINT with subquery in crud_workload.py line 361) -> Claude fixed (backup .preP); CRUD build+validate re-running in bg (apicrm-migration-crud.log). NEXT: CRUD per-DB valid/invalid + own sample -> noise -> NEW_ALB.
48Owner 2026-12-05 23:55: scope add: (a) index review (missing/unused/duplicate indexes from QS + missing-index DMVs on local copies; each new index only if read win + write cost measured via CRUD gate); (b) column size review (NVARCHAR(MAX)/oversized cols that inflate grants, e.g. LedgerName) -> resize only if data fits + no truncation + EF model/migration (one migration at end, SQL script meanwhile; rule 22: no new columns). Both fully tested: output gate (EXCEPT 0) + CRUD gate + load gate. NEXT order unchanged: CRUD result -> noise -> NEW_ALB -> per-object loop (index/column checks inside each object).
492026-12-05 23:20 owner: after CRUD run noise then NEW_ALB. zz_fn_AccountLedgerBalance_v2 also created in sqlperf META_TH (source ~/.ai/apicrm-migration/alb_v2.sql). chain_alb.sh started (waits CRUD_VALIDATE_DONE -> OLD_a, OLD_b, NEW_ALB 20 sess 180 s each ~10 min -> reports apicrm-migration-noise-report.txt + apicrm-migration-alb-report.txt; log apicrm-migration-alb.log markers RUNS/ALB_CHAIN_DONE). NEXT: CRUD per-DB valid + own sample; read noise band; accept ALB only if p95/grant/RESOURCE_SEMAPHORE better beyond noise and nothing else worse.
502026-12-05 23:30 Cursor lane colsize started (analysis only, container sqlserver, not sqlperf): prompt ~/.ai/apicrm-migration/colsize/prompt.txt -> colsize/inventory.csv, candidates.csv, report.html (MAX/oversized cols, MaxLen across 5 DBs, heavy-object usage, EF config). Out ~/.claude/cursor-runs/apicrm-migration-colsize.out (COLSIZE_DONE). Column-size plan: candidates -> per heavy object test with narrowed type (CAST in v2 copy first, grant/sort win on sqlperf) -> if win: SQL ALTER script (local) + EF HasMaxLength, one migration at end; gates output EXCEPT 0 + CRUD (no truncation errors) + load.
512026-12-05 23:35 CRUD build RC 0 + validate DONE: 507/577 valid (FAZ 75/85, HYT 72/81, ISHA 81/92, JMSCRM 60/69, META 65/74, PREMIER 74/85, SOPHIE 80/91). 70 invalid by cause: param fill (nvarchar->bigint 17, NULL TVP JournalVoucherDetailCoreType 7, empty JSON 7, OperationTypeId 6, output param @GeneratedBarcodeNo 4, ItemIdColumnName 1) = crud_workload.py param fixes; procs referencing nishka_test/Nishka_Test DB 14 + missing procs 2 = stale test objects (justified skip, confirm names); column mismatch 7 + 'Invalid column VoucherTypeId' 5 = schema drift, check vs repo proc. Own sample run of 2-3 valid CRUD rows NOT yet done (wait until load chain ends; don't disturb sqlperf). NEXT: after ALB_CHAIN_DONE -> sample check, small Cursor lane for param fixes in crud_workload.py.
52Owner 2026-12-05 23:40: keep going until tests are 100% match/valid (CRUD + workload + output gates); don't stop for /clear.
532026-12-05 23:45 CRUD invalid = 12 procs. Finding (pre-existing, report owner): repo Stage/sp_InsertStockPosting.sql calls sp_InsertStockPostingFromInvoiceItems and sp_InsertStockPostingFromPayment.sql calls sp_GetPaymentMasterDetails; neither is defined anywhere in repo, yet C# StockPostingService.cs:537/553 calls them (via StockPostingFactoryServices.cs:1218/1242/1268, UpdateAllStockPostingCommandHandler.cs:81). Cursor lane crudfix running (crud_workload.py only: OUTPUT params, PROC_OVERRIDES from app call sites, skip no-caller/broken; prompt harness/crudfix.txt; out apicrm-migration-crudfix.out CRUDFIX_DONE). NEXT: after ALB_CHAIN_DONE: review crudfix + rebuild CRUD + validate -> 100% (or justified skip) + own sample run.
542026-12-05 23:45 load chain done (runs OLD_a=4, OLD_b=5, NEW_ALB=6) but NEW_ALB INVALID: run_load.sh ignores the 4th arg (no fn swap), and the 4 ALB workload rows are EXEC sp_GetAccountLedgerBalanceByMetals (calls fn_AccountLedgerBalance internally), so run 6 = a 3rd OLD run. Noise band too wide to judge: total p95 58.7 s vs 49.9 s, per-query +/-100%+ with only 3-10 execs each; 20 sessions saturate emulated sqlperf (THREADPOOL ~300 s, RESOURCE_SEMAPHORE ~1.5-1.9M ms, grant timeouts in 'internal' pool). crudfix lane DONE + reviewed OK (PROC_OVERRIDES from app call sites, OUTPUT params, skips; py syntax OK; backup .preQ), CRUD NOT rebuilt yet.
55NEXT: (1) CRUD rebuild: cd harness; python3 crud_workload.py; docker cp crud_workload.sql sqlperf:/tmp/c.sql; ./hsql.sh -d zz_PerfHarness -i /tmp/c.sql -b; EXEC usp_ValidateCrudWorkload -> target 100% valid or justified skip + own sample of 2-3 rows. (2) Small Cursor lane on run_load.sh: real NEW variant = before run, CREATE OR ALTER dbo.fn_AccountLedgerBalance from ~/.ai/apicrm-migration/alb_v2.sql in every sqlperf DB (save OLD def first to harness/alb_old_<db>.sql, restore after run; local sqlperf only). (3) Lower load: 8 sessions x 300 s, repeat OLD_a/OLD_b to get a usable noise band (target per-ALB-row p95 delta < 20%), then NEW_ALB vs OLD_a; judge ALB on its 4 ByMetals rows + grant section.
562026-12-05 23:55 started: CRUD rebuild+validate bg (log ~/.claude/cursor-runs/apicrm-migration-crud2.log, CRUD_VALIDATE_DONE) + Cursor lane loadswap (run_load.sh variant swap via harness/variants/<V>.map, OLD saved+trap restore; backup run_load.sh.preSwap; out apicrm-migration-loadswap.out). NEXT: CRUD 100%/justified + own sample; review swap + own sample (swap+restore on 1 DB); then 8 sess x 300 s OLD_a/OLD_b/NEW_ALB.
572026-12-05 PARKED: NISHKA restore. NISHKA_TH_SHRINK.bak = 29.4 GB mdf (25.5 GB real data) + 1.6 GB log, needs ~31 GB; Mac had 9.3 GB free. No NISHKA query in heavy-queries CSV. Later: external SSD container + separate NISHKA workload.
582026-12-06 00:05 loadswap DONE + Claude reviewed OK (restore uses CREATE OR ALTER: stored text differs from original header, body same; own swap+restore sample NOT done yet). Docker Desktop restarted ~23:59 -> sqlperf exited 255 (no restart policy), first CRUD rebuild died; sqlperf started again, all 8 DBs ONLINE. CRUD rebuild+validate re-running via nohup (log ~/.claude/cursor-runs/apicrm-migration-crud2.log, CRUD_BUILD_RC=0 / CRUD_VALIDATE_DONE). NEXT: (1) CRUD valid per DB -> 100% or justified skip + own sample of 2-3 rows; (2) own swap sample: bash run_load.sh SWAPTEST 1 10 NEW_ALB -> check SWAPPED/RESTORED lines for all 6 DBs + body of restored fn = old_fn_AccountLedgerBalance_<db>.sql except header; (3) 8 sess x 300 s: OLD_a, OLD_b, NEW_ALB (NEW_ALB arg 4) -> report.sql; judge ALB on 4 ByMetals rows + grants.
592026-12-06 00:10 owner: give work to Cursor too. Cursor --test lane verify1 (waits CRUD_VALIDATE_DONE -> CRUD summary per DB + invalid groups, 3-row CRUD sample, swap sample SWAPTEST 1 10 NEW_ALB + restored body MATCH x6); prompt harness/verify1.txt, out ~/.claude/cursor-runs/apicrm-migration-verify1.out + verify1.log. NEXT: Claude reviews verify1 RESULT (+ own spot-check 1 row), then 8x300 OLD_a/OLD_b/NEW_ALB.
60Owner 2026-12-06: keep working without stopping (local DB only) until results are 100%; do not stop for /clear.
612026-12-06 00:15 colsize lane had died (no out) -> re-run (lane colsize, container sqlserver; out apicrm-migration-colsize.out). verify1 running.
62Owner 2026-12-06: 2 Claude tabs open - do not mix work. Other tab runs task 'widecols' (column size). This chat stopped its colsize lane (no output written); column-size review is left to widecols tab - this task does NOT touch column sizes. This chat touches only: ~/.ai/apicrm-migration/harness, sqlperf container, apicrm-migration-* logs.
63Owner 2026-12-06: pehle normal tests 100% perfect (workload + CRUD validate + output gate), uske baad hi heavy/load testing (noise/NEW_ALB). Swap sample in verify1 is 1 sess x 10 s functional check only.
642026-12-06 00:10 CRUD build slow (~2.5 min/DB, 3/7 done) -> verify1 stopped (15-min wait would time out); chained: wait CRUD_VALIDATE_DONE -> re-launch verify1 (same prompt).
65Owner 2026-12-06: FINAL PHASE after all fixes + load pass: re-test every changed object with DIFFERENT request params - critical (big ledgers/branches, all metals, full date range, high-volume DBs) + edge cases (NULL/empty/0 ids, single/no rows, future/old dates, multi-currency, deleted/inactive masters, max paging); output gate EXCEPT 0 vs OLD + CRUD gate. Cursor --test lane builds the case matrix per object.
662026-12-06 00:45 DONE: CRUD 100% testable (534 valid; 42 justified skips: 14 broken-in-repo sub-proc missing, 21 no app caller, 7 no data [JV in 5 DBs w/o JournalDetails, ISHA no invoice items x2]); JV batch fix (@Now var instead of SYSUTCDATETIME() in EXEC args) in crud_workload.py (.preR) + table. Swap: fixed -y0/-h conflict + mktemp chmod 644 (restore was failing -> Claude restored manually); SWAPTEST x2 = 6 SWAPPED + 6 RESTORED, restored body == repo Stage/fn_AccountLedgerBalance.sql (only header spacing). verify1 (Cursor) Step1/2 PASS. Running: Cursor --test outgate1 (OLD vs zz_v2 EXCEPT, 6 DBs incl META, critical+edge cases; out apicrm-migration-outgate1.out). NEXT: outgate PASS -> load 8x300 OLD_a, OLD_b, NEW_ALB.
672026-12-06 00:55 outgate1 PASS 136/136 (6 DBs, critical+edge; Claude spot-check META 109/109, FAZGOLD 1642/1642 EXCEPT 0). Pre-existing finding: fn_AccountLedgerBalance with multi-metal CSV @MetalId raises 8114 in OLD and NEW alike (report owner, not changed). Normal tests 100% -> LOAD started 00:55: OLD_a, OLD_b, NEW_ALB 8 sess x 300 s (log ~/.claude/cursor-runs/apicrm-migration-load8.log, per-run apicrm-migration-load8-<label>.txt, LOAD8_DONE). NEXT: report.sql OLD_a vs OLD_b (noise) and OLD_a vs NEW_ALB; judge ALB 4 ByMetals rows + grants; then final edge test phase + repo fn write.
682026-12-06 01:05 LOAD8 runs 10 OLD_a / 11 OLD_b / 12 NEW_ALB (8 sess x 300 s, swap+restore clean). Noise: total avg 2187 vs 2785 ms (OLD vs OLD). ALB 4 ByMetals rows: NEW CPU ~2x (236->459, 275->499, 344->671, 294->549) and reads ~1.6x in ALL 4 DBs = beyond noise -> NEW_ALB v2 REJECTED (repo fn unchanged). Max single grant 241 MB in all runs = not ALB. zz_WideCols in zz_PerfHarness (created 23:29 by earlier colsize lane, not during load; left as is). Running Cursor --test albgrant (single exec OLD vs NEW grant/CPU per DB, out apicrm-migration-albgrant.out). NEXT: if ALB grant on sqlperf is small -> server 670 MB grant came from server plan/data: compare server QS plan (read-only) vs local; redesign ALB (keep LedgerName out of sort via join after ROW_NUMBER) as v3, same gates; then next heavy objects (ISHA OPENJSON @FoundIndex, biggest-grant query = find which WorkloadId gives 241 MB).
692026-12-06 01:10 QS (sqlperf, last hour of load): queries hitting ~240 MB max used memory (= per-query grant cap) = priority list for per-object loop: sp_GetAccountLedgerBalanceByMetals (ISHA/PREMIER/SOPHIE), sp_ProfitAndLossAnalysisUpToaDateForPreviousYears (FAZGOLD), sp_getInvoicesToUpdateLedgerPosting + sp_GetJournalMasters_BalancedLedgerPostingWithMatchingDetailPerAccount (JMSCRM/META), sp_GetDiamondCurrentStock_NS + sp_StockReportHistory (PREMIER), sp_GetAllInvoice + sp_GetAccountLedgerList (SOPHIE), sp_GetDiamondItemsByBarcodeOrderByStockPostingDate (JMSCRM). Plan cache on sqlperf gets flushed under load -> use QS for grant evidence.
702026-12-06 01:15 albgrant: fn itself grants only ~4 MB (OLD), v2 doubles reads (Bal referenced twice) -> v2 dropped. REAL root cause = caller sp_GetAccountLedgerBalanceByMetals: Req/Granted ~240 MB vs MaxUsed ~2 MB (ISHA/PREMIER/SOPHIE/FAZGOLD). NEXT: fix caller grant estimate (zero output change).
712026-12-06 01:20 Cursor lane bymetals running (root-cause plan of caller + variants V1 RECOMPILE / V2 typed locals / V3 MAX_GRANT_PERCENT as zz_ByMetals_* in sqlperf, measure + output gate; out apicrm-migration-bymetals.out). NEXT: review + own sample, pick variant, CRUD gate (read-only proc), load 8x300 OLD vs NEW (variant map for sp_GetAccountLedgerBalanceByMetals), then repo proc edit.
722026-12-06 01:25 bymetals lane stopped after 63 s without RESULT (Cursor early exit) -> resumed (--resume, out apicrm-migration-bymetals2.out).
732026-12-06 01:35 bymetals DONE: root cause = SELECT * wide rows (LedgerName nvarchar(max) + FORMAT outputs) through Sort/Hash/Window Agg in fn, AvgRowSize ~48 KB, DesiredMemory ~668 MB capped ~240 MB, MaxUsed ~2 MB. V1 RECOMPILE / V2 typed locals: grant unchanged; V3 MAX_GRANT_PERCENT=1: Req 5.3 MB, no spill, CPU same, gate PASS (fallback option). Cursor lane albv3 running: fn v3 (narrow keys through agg/sort, LedgerName+FORMAT in final SELECT, single pass) + gates G1 outgate matrix, G2 single-exec cost <= OLD+10%, G3 caller grant; out apicrm-migration-albv3.out, text ~/.ai/apicrm-migration/alb_v3.sql. NEXT: review+own sample -> map NEW_ALB3 -> load 8x300 vs OLD -> repo fn edit.
742026-12-06 01:50 albv3 DONE ALL_GATES PASS (G1 6 DBs, G2 cpu/reads = OLD, G3 caller): grant 240 -> 70-137 MB (MaxUsed 1-6 MB). Claude sample PREMIER 391/391 EXCEPT 0, column types same. Text ~/.ai/apicrm-migration/alb_v3.sql, zz_fn_AccountLedgerBalance_v3 in 6 sqlperf DBs. Cursor lane albv3b running (find remaining wide operators, target grant <= 20 MB; out apicrm-migration-albv3b.out). NEXT: pick v3 or v3b -> map NEW_ALB3 (fn_AccountLedgerBalance|alb_v3x.sql) -> load 8x300 OLD vs NEW -> repo fn edit + final edge phase.
752026-12-06 02:05 albv3b DONE: G1/G2/G3 PASS all 6 DBs; caller grant 240 MB -> ~7 MB (FAZGOLD 8.5 MB), CPU lower (PREMIER 146->103, SOPHIE 42->32), reads same. Root: MAX params (@ledgerId/@MetalId/@ShowInStockInvoices) residual-compared as (n)varchar(max) inside Sort/Hash -> typed param snapshots. Claude sample META 109/109, ISHA 4/4, SOPHIE 0/0 EXCEPT 0, types same. Text ~/.ai/apicrm-migration/alb_v3b.sql. LOAD started: chain_load9.sh OLD_c / NEW_ALB3B / OLD_d 8x300 (log apicrm-migration-load9.log, LOAD9_DONE). Note: pgrep -f '<pattern>' self-matches waiting loop -> use log markers instead. NEXT: compare (NEW vs avg OLD_c/OLD_d), accept -> repo fn edit (Stage/fn_AccountLedgerBalance.sql, CRLF) + final edge phase + next object.
76Owner 2026-12-06 02:20: reduce the ALB grant by another 7 MB. Plan v3c (after load9): A) caller OPTION(USE HINT('DISALLOW_BATCH_MODE')) per SELECT, B) remove remaining Sort/Window (SrNo sort only on final small set / index-provided order; any new index needs CRUD write-cost gate), C) MIN/MAX_GRANT_PERCENT only fallback. Target Requested <= 3 MB (actual MaxUsed 0.9-2 MB), CPU/reads <= OLD+10%, all gates.
77Owner 2026-12-06 02:30: decide by owner's stated rules, don't ask. Decision: accept v3b (after load9 pass) -> v3c = option B only (remove remaining Sort/Window from row flow, durable root fix; index only if CRUD write cost measured). A (DISALLOW_BATCH_MODE hint) and C (MAX_GRANT_PERCENT cap) NOT used: workarounds, not root cause.
782026-12-06 02:35 load9: runs 13 OLD_c / 14 NEW_ALB3B / 15 OLD_d. Totals NEW 996 q avg 2384 ms 0 err vs OLD 820/2924 (1 grant timeout) and 987/2456; RESOURCE_SEMAPHORE NEW 175k vs 208k/251k ms; THREADPOOL 66k vs 104k/41k. BUT ALB rows reads under load NEW 1.5-2.5x (single-exec equal) -> unexplained, v3b NOT yet accepted. Hypothesis: plan cache flush under memory pressure -> frequent recompiles, v3b compile costlier. Cursor lane albv3c running (Part 1 compile cost OLD vs v3b; Part 2 v3c option B, target <= 3 MB, compile <= OLD; out apicrm-migration-albv3c.out, LOG apicrm-migration-albv3c.log). Waiter: grep '== Cursor' in .out (not pgrep). NEXT: review, own sample, load OLD/NEW_ALB3C/OLD.
792026-12-06 02:45 coverage check (owner asked): server CSV 204 rows / 14 DBs (top-25 per DB, one snapshot). LIVEMINIZ 25 excluded. Local workload = 6 DBs (96 rows, 41 named procs) covers 128 CSV rows. NOT covered locally: DHUNNA 16, TOTSMINE 10, JAYVIDIAM 10, ANITA 8, ARMAAN 4, AJAL 3, JEDDAH 1 (=52 rows, DBs not restored). Fixed so far: ALB only (in progress). TODO after ALB: (1) map the 52 rows to object names (same repo procs -> fix once covers all DBs; restore a DB only if its object is unique to it, disk 13 GB free); (2) wider server QS pull read-only (top 100 per DB, 7-30 days, by total CPU + max grant + duration) so reports not in the one-day snapshot are included; (3) per-object loop over the full ranked list.
802026-12-06 02:55 owner: coverage work now. Started read-only server QS pull (30 days, top 100 per DB by total CPU, excl LIVEMINIZ; SQL ~/.ai/apicrm-migration/qs30d.sql via ssh stdin, no server files) -> ~/.ai/apicrm-migration/heavy-queries-30d-2026-12-06.csv (cols db|obj|qhash|execs|cpu_ms|avg_ms|max_used_mb|reads|txt). NEXT: rank objects across DBs (named procs + adhoc mapped to parent), merge with priority list, restore DB only if object unique to it.
812026-12-06 03:05 30-day QS ranking (~/.ai/apicrm-migration/heavy-objects-ranked-2026-12-06.txt; 271 objects, excl LIVEMINIZ/DevMiniz) by total CPU: #1 sp_GetDiamondAndStoneReport_Optimized dynamic SQL (15.9k s, avg up to 170 s/exec, 585 MB; JMSCRM/META/ISHA) + named same proc 2.3k s; #3 FcAmountCurrencySymbol report family (*_Optimized: DiamondAndStone/OnlyDiamond/ImitationWatches/OtherOrServices/ConsignmentOutByCustomer) 5.0k s, avg up to 313 s, 1130 MB grant; #4 @SearchText/@fromDate report 3.3k s; Elsa workflow polling (COUNT WorkflowInstances, KeyValuePairs, BookmarkQueue, batch deletes) ~14k s total across 15 DBs = app-side polling config, separate item; sp_GetObjectsByMultipleColumnsWithIn 1.5k s (3.8M execs); ALB only ~1% CPU (it was top by grant, 656 MB). NEW ORDER after ALB: DiamondAndStone report family -> #4 -> Elsa polling (app config) -> rest by rank.
82Owner 2026-12-06 03:10: do NOTHING on the LIVE DB, API or server (no access at all, not even read-only SELECT/ssh). All work only on local copies (sqlperf/sqlserver) + local files. Last server touch = 30-day QS SELECT pull 2026-12-06 02:55 (read-only, no files); none after this.
832026-12-06 03:15 Cursor lane dsrplan (read-only repo analysis of DiamondAndStone report family; no SQL; out apicrm-migration-dsrplan.out, findings ~/.ai/apicrm-migration/dsr/analysis.md) running in parallel with albv3c.
84Owner 2026-12-06 02:45: ALB < 1 MB possible? Plan v3d after v3c: zero-grant plan = no Sort/Hash at all (stream aggregate + order from an index on posting table keys). Needs index -> CRUD write-cost gate (ledger posting = rule 13 area) + disk; accept only if write p95 not worse beyond noise. Otherwise stop at v3c (below MaxUsed ~1-2 MB with sort/hash = spills).
852026-12-06 02:50 albv3c DONE: v3c (APPLY shape) grant <= 3 MB (1.1-1.5 MB) + G1 PASS 6/6 + G3 output PASS, BUT G2 reads FAIL on large DBs (NL worktable ~35k logical) -> v3c REJECTED. Set-based floor ~6 MB without index (v3b = 7 MB). Sub-3MB needs index (v3d) or reads cost. Cursor had added Shell(docker*) to ~/.cursor/cli-config.json during run -> Claude removed it, denied docker rm/stop/restart/kill/volume/system.
862026-12-06 03:00 Part1: compile CPU OLD ~200-226 ms vs v3b ~217-273 ms (+15-20%), compile mem 7.7 -> 10 MB => explains higher reads under load (plan cache flush -> recompiles). Net load result still better (RESOURCE_SEMAPHORE lower, throughput higher, 0 errors). DECISION: v3b ACCEPTED -> written to repo src/.../Functions/Stage/fn_AccountLedgerBalance.sql (LF like before, body identical to tested alb_v3b.sql, signature same; backup ~/.ai/apicrm-migration/fn_AccountLedgerBalance.repo-old.sql). NOT committed. v3c rejected. v3d (index, 0 MB) parked until after DSR family. NEXT: final edge-case phase for ALB (Cursor --test) + DSR family fix (analysis in dsr/analysis.md).
872026-12-06 03:10 other fn_AccountLedgerBalance callers in repo: sp_GetPartiesList, sp_GetAppraisalLedgerList (+ IDX_AccountLedger_ContactInvoice_LedgerBalance_RewardPoint_Scheme.sql mentions it) - not yet gated. Cursor --test albcallers running (OLD vs v3b swapped inside TRAN+ROLLBACK, output + cost; out apicrm-migration-albcallers.out). ALB repo edit stays uncommitted until this passes.
882026-12-06 03:15 Cursor lane dsrfix1 (write-only: dsr/dsr_v1.sql = zz_sp_GetDiamondAndStoneReport_v1 with R1 narrow rows before windows, R2 LOB/UDF after paging, R5 set-based category join; changes doc dsr_v1_changes.md; out apicrm-migration-dsrfix1.out). NEXT: after albcallers: review dsr_v1, deploy zz to sqlperf, output gate + cost on JMSCRM/META/ISHA/SOPHIE/PREMIER/FAZGOLD.
892026-12-06 03:30 dsrfix1 DONE + reviewed (dsr_v1.sql R1/R2/R5, change doc OK). chain dsr/chain_gate1.sh: waits albcallers end -> Cursor --test dsrgate1 (6 DBs, cases a-h, output + cost OLD vs v1; out apicrm-migration-dsrgate1.out).
902026-12-06 09:50 dsrgate1 RESULT: output identical in every case run (ISHA/JMSCRM/PREMIER/FAZGOLD) BUT v1 grant UP (~500 MB -> ~980 MB), reads -35-40%, CPU same -> v1 REJECTED. Even no-match case (1 row) requests ~500 MB, uses 5 MB -> big grant is data-independent (suspect VARCHAR(MAX) params/STRING_SPLIT match-flag matrix). Local live OLD != repo on FAZGOLD/ISHA/META/PREMIER (tested vs zz_..._repo copy). Mac disk filled (tempdb growth on GetAll) -> run broke; albcallers output lost. Fix: sqlperf tempdb capped (6x400 MB data + 600 MB log, local only). Relaunched Cursor --test albcallers; new Cursor --test dsrgrant1 (per-statement grant breakdown OLD vs v1, no GetAll; out apicrm-migration-dsrgrant1.out). Disk 5.1 GB free.
91Owner 2026-12-06 10:05: combined testing (widecols branch perf/widecols-resize + apicrm perf) from this chat. The widecols tab must stay idle. Code stays in 2 branches; temp combined worktree only for testing, no push. Plan: after albcallers+dsrgrant1 -> widecols precheck + migration SQL on sqlperf 6 DBs (in place, disk 3 GB) -> rerun workload/CRUD validate, widecols DB-level tests, ALB gates+load on new schema, DSR grant breakdown again, edge phase.
922026-12-06 10:20 dsrgrant1 DONE: OLD grant ~241 MB (cap) almost all from FooterRanked (repo L1154-1156; STRING_SPLIT + CONVERT(nvarchar(max),BranchId) PlanAffectingConvert, wide diamond cols through Sort/Hash; MaxUsed 2 MB); v1 doubled because RankedStockPosting L1351 (LOB/UDF/CategoryDropdown attach) desired 8.4 GB. DSR v2 = fix FooterRanked only (typed #BranchIds, no nvarchar(max) convert, narrow cols), keep v1 Ranked changes OUT. Combined setup: worktree ~/Documents/GitHub/AngularJMS-combined, branch test/apicrm-widecols-combined (from perf/widecols-resize = main + 3 index commits + widecols) + copied ALB fn + BarcodeNoColumnResizeSql.cs (uncommitted). sqlperf DB migration levels: FAZGOLD/META/PREMIER 20261130110418, ISHA/SOPHIE 20261202091616, JMSCRM 20261204122645. Deploy method = run combined API once per sqlperf DB (startup applies EF migrations + Programmability via DbHelper incl Indexing hash table), ConnectionStrings__db env (never print secrets). NEXT: wait albcallers -> dotnet build combined -> API per DB -> verify history=WideColumnSizes + widecols columns resized + ALB fn = v3b -> rebuild workload/CRUD validate -> gates. Disk 20 GB free.
932026-12-06 10:35 owner: AngularJMS-widecols worktree deleted after copying runs/+drift/ into AngularJMS-combined (verified diff) and API Logs/ImportedExcelFiles to ~/.ai/widecols/worktree-extra. Branch perf/widecols-resize kept. widecols status doc now at ~/Documents/GitHub/AngularJMS-combined/docs/ai/widecols-status.md.
942026-12-06 10:25 owner: 25-30 h too long, wants 1-2 h. Proposed fast plan (scope top ~50% CPU: ALB + DSR family 5 procs + Elsa plan; parallel lanes; output gate on ISHA+JMSCRM only, no GetAll; ONE combined load test OLD/NEW/OLD for all fixes; defer long tail, v3d, combined widecols schema test). Started 6 parallel Cursor lanes (write-only): v2_<proc> for sp_GetDiamondAndStoneReport_Optimized / sp_GetOnlyDiamondReport_Optimized / sp_GetImitationWatchesReport_Optimized / sp_GetOtherOrServicesReport_Optimized / sp_GetAllConsignmentOutReportByCustomerId -> dsr/v2_<proc>.sql+.md (zz_<proc>_v2; typed #filter temps instead of CHARINDEX/CONVERT nvarchar(max), wide cols out of sort/hash; no LOB attach in windows) + elsaplan (read-only -> elsa/plan.md). Outs ~/.claude/cursor-runs/apicrm-migration-v2_<proc>.out / -elsaplan.out. Waiting owner OK on scope trade-off.
952026-12-06 10:30 Claude recommendation to owner: 'kam objects, poore test' (no gate shortcuts on anything that ships). Phase 1 (~4 h): ALB + DSR family 5 procs, full gates (output 6 DBs incl edge, CRUD caller check, combined widecols schema, one combined load OLD/NEW/OLD) -> ship together with widecols. Phase 2: Elsa polling config (separate small app release). Phase 3: long tail in background over days. Waiting owner choice.
96Owner 2026-12-06 10:35: everything today, in less time (full gates, no shortcuts on shipped items). Speed plan: (1) Docker Desktop 4 CPU/8 GB -> 8 CPU/12 GB (settings-store.json Cpus/MemoryMiB, restart Docker after albcallers; local only; sqlperf keeps its own 4 CPU/4 GB caps = server-like); (2) correctness gates on 'sqlserver' container in parallel, cost/load gates on sqlperf; (3) all fix-writing in parallel lanes (<=10); (4) one combined load test at end; (5) combined widecols schema setup in parallel with fix writing. Estimate today ~6-8 h wall.
97Owner 2026-12-06 (after 10:35): settings must stay exactly as on the server. Speed-plan step (1) Docker bump CANCELLED (Docker Desktop stays 4 CPU/8 GB; never changed). sqlperf stays server-like: 4 CPU, max server memory 1312 MB (Express), MAXDOP 0, CTFP 5, adhoc 0 (= server defaults); no settings A/B tuning. Only local deviation: sqlperf tempdb max size capped (Mac disk), note it if any test hits it.
982026-12-06 10:50 5 DSR v2 procs written (dsr/v2_<proc>.sql+.md); elsaplan DONE (elsa/plan.md). chain_gate2.sh queued: after albcallers -> 5 parallel Cursor --test output gates (6 DBs, cases a-j, grant OLD vs v2; out apicrm-migration-g2_<proc>.out; GATE2_ALL_DONE in apicrm-migration-gate2.log). NEXT: albcallers result -> review gate2 -> combined widecols build/API per DB -> one combined load OLD/NEW/OLD.
992026-12-06 10:55 albcallers still in perf phase (FAZGOLD getall); chain_gate2.sh (nohup) waiting on it; combined Release build started (log apicrm-migration-combined-build.log). NEXT: read albcallers RESULT/OVERALL + build RC -> gate2 results (GATE2_ALL_DONE) -> API per sqlperf DB from combined -> load.
1002026-12-06 11:00 combined Release build: see RC in apicrm-migration-combined-build.log.
1012026-12-06 10:32 combined Release build RC 0 (0 warn/err). albcallers perf phase on last DB FAZGOLD (sp_GetAppraisalLedgerList getall OLD ~98 s CPU, 1.82M reads, grant 242 MB/MaxUsed 9.9 MB = new heavy candidate). chain_gate2.sh waiting. NEXT: albcallers OVERALL -> gate2 (GATE2_ALL_DONE) -> API per sqlperf DB from combined -> load.
1022026-12-06 10:40 sp_GetAppraisalLedgerList usage: AppraisalService.cs:43 <- GetAppraisalLedgerListQueryHandler <- POST api/app/appraisal/getAppraisalLedgerList (AppraisalController.cs:46) <- web Utilities > Appraisal screen (/utilities/appraisal, appraisal.component.ts getLedgerList, url-helper API_URL_GET_ALL_AACOUNTLEDGER_APPRAISAL). getall = Get All button. NEXT unchanged (albcallers OVERALL -> gate2 -> combined API per DB -> load).
1032026-12-06 11:15 albcallers OVERALL FAIL (fn restored 6/6). Causes: (1) REAL BUG v3b: Params CONVERT(NVARCHAR(4000), @ledgerId) truncates long CSV -> sp_GetPartiesList getall FAZGOLD (1667 ids, >4000 chars) gives Amount 0.00 for last ids 31476/31523/31682/31722 (OLD -1663.18/-584.05/5110.30/112.18). Fix v3e: no truncation; parse @ledgerId once to typed BIGINT set (STRING_SPLIT + TRY_CAST) and join Ledgers on it; re-run G1 + albcallers. ALB repo edit stays uncommitted. (2) sp_GetAppraisalLedgerList calls fn per row twice (L40 SELECT + L116 HAVING) -> cost mixed (PREMIER reads 166k->1.59M, SOPHIE CPU 14->32 s; JMSCRM/META better); grant 242 MB not from fn; OLD FAZGOLD getall 98 s CPU. Fix: make caller set-based (one fn call, join LedgerId, like sp_GetPartiesList) + output gate 6 DBs. (3) sp_GetPartiesList perf FAILs = tiny numbers (Req 4->6 MB, ms CPU) -> recheck SOPHIE branch (245->419 ms) only. Diff script: scratchpad diff_fazgold_parties.sql (copy of cmp + EXCEPT rows). gate2 started after albcallers (GATE2_ALL_DONE in apicrm-migration-gate2.log). NEXT: v3e fn fix + Appraisal set-based caller (Cursor lanes) -> gates -> review gate2 -> combined API per DB -> load.
1042026-12-06 10:55 (real clock) albcallers wrapper hung (cursor-agent idle) -> killed agent, gate2 5 lanes started 10:50 (GATE2_ALL_DONE in apicrm-migration-gate2.log). v3e written by Claude: ~/.ai/apicrm-migration/alb_v3e.sql (= v3b, but Ledgers filter uses full @ledgerId like OLD, no NVARCHAR(4000) snapshot). Test prompt harness/albcallers_v3e.txt (albcallers.txt also switched to v3e). NEXT: after GATE2_ALL_DONE -> review gate2 -> cursor-run.sh ~/.ai/apicrm-migration apicrm-migration albcallers_v3e harness/albcallers_v3e.txt --test --lane albcallers_v3e (+ G1 grant check v3e) -> Appraisal set-based caller lane -> repo fn = v3e -> combined API per DB -> load. If cursor-agent hangs after report: kill agent pid (child of cursor-run.sh).
1052026-12-06 10:55 (clock) gate2 5 lanes running (started 10:48). Cursor write lane apprfix1 started (appr/fix1.txt -> appr/appr_v1.sql zz_sp_GetAppraisalLedgerList_v1: #LedgerData once, one fn call via #Cand/#Bal, drop LP/OpeningData/AG joins; out apicrm-migration-apprfix1.out). NEXT: review apprfix1 + GATE2_ALL_DONE -> albcallers_v3e test + Appraisal output gate (6 DBs) -> repo fn = v3e -> combined API per DB -> load.
1062026-12-06 11:00 apprfix1 DONE + reviewed (appr/appr_v1.sql OK: #Cand -> one fn call (#Bal, skip if empty) -> #LedgerData once; LP/OpeningData/AG joins dropped; same final UNION). appr/chain.sh (nohup) queued: after GATE2_ALL_DONE -> Cursor --test apprgate (appr/gate1.txt, 6 DBs, cases a-k, pass B with v3e; out apicrm-migration-apprgate.out) -> albcallers_v3e (out apicrm-migration-albcallers_v3e.out) -> CHAIN_APPR_DONE in gate2.log. NEXT: review gate2 g2_*.out, apprgate, albcallers_v3e -> repo fn = v3e + Appraisal repo SP = v1 (if PASS) -> combined API per sqlperf DB -> one load OLD/NEW/OLD.
1072026-12-06 11:05 gate2 partial: Imitation v2 compile FAIL (Msg 319, missing ';' before WITH) and OtherOrServices v2 FAIL (Msg 209 ambiguous ItemCode after IMI_WIDE join) -> fixed by Claude (backups dsr/v2_<proc>.pre-fix.sql; ';' added; 57 bare cols in final SELECT qualified PR.) -> re-gate lanes g2b_<proc> running (outs apicrm-migration-g2b_<proc>.out). Consignment v2 REJECTED: output same but grant UP (ISHA 1.6->5.8 MB, PREMIER getall 43->216 MB); OLD itself small locally -> keep OLD, parked. Pre-existing: Consignment OLD multi-branch CSV raises 8114 (JMSCRM/META) - report owner, unchanged. DSR + OnlyDiamond lanes still running; chain.sh (apprgate -> albcallers_v3e) queued after GATE2_ALL_DONE. NEXT: review DSR/OnlyDiamond/g2b results + apprgate + albcallers_v3e -> repo edits (fn v3e, Appraisal v1, passing DSR v2s) -> combined API per sqlperf DB -> one load OLD/NEW/OLD.
1082026-12-06 11:10 gate2b: Imitation v2 output PASS 6 DBs but grant still ~241 MB cap (not lower) -> v2 no gain; OnlyDiamond v2 output PASS, grant same (~241/49-74 MB) -> no gain; OtherOrServices g2b FAIL = Claude fix bug (PR.CASE) -> fixed (CASE), compiles on FAZGOLD; not re-gated (pointless until grant root found). Started 3 Cursor --test lanes grant2_{ImitationWatches,OnlyDiamond,OtherOrServices} (per-statement grant breakdown OLD vs v2, PREMIER+SOPHIE; prompts dsr/grant2_<proc>.txt; outs apicrm-migration-grant2_<s>.out). DSR g2 still running; chain.sh (apprgate->albcallers_v3e) waits GATE2_ALL_DONE. NEXT: grant2 results -> v3 fixes for the real heavy statement -> output+grant gate; DSR g2 + apprgate + albcallers_v3e review -> repo edits -> combined API per DB -> one load OLD/NEW/OLD.
1092026-12-06 11:20 grant2 DONE (3 procs): same root = page/pagination Sort + final SUM_ROW UNION ORDER BY (+OnlyDiamond DIAMOND_ITEMS/#DiamondItemsDeduped sorts) carry fat rows (UDF1-30, FORMAT, varchar(max) Title/DetailedJson; AvgRow 60-395 KB) -> Req ~241 MB vs Used 1-9 MB. Started 3 Cursor write lanes v3_{ImitationWatches,OnlyDiamond,OtherOrServices} (dsr/v3_<proc>.txt -> dsr/v3_<proc>.sql/.md zz_<proc>_v3: narrow #PageKeys sort/page/sum, attach wide cols only in final SELECT). DSR g2 still running; chain.sh (apprgate->albcallers_v3e) waits GATE2_ALL_DONE. NEXT: review v3 -> deploy zz to sqlperf -> output+grant gate 6 DBs -> DSR g2/apprgate/albcallers_v3e review -> repo edits -> combined API per DB -> one load OLD/NEW/OLD.
1102026-12-06 11:35 v3 written for Imitation/OnlyDiamond/OtherOrServices (dsr/v3_<proc>.sql/.md: narrow #PageKeys/#SumRow, wide cols only in final SELECT; doubts: ProductName ties non-deterministic same as OLD; OnlyDiamond still builds wide #DiamondItemsDeduped). Gate3 lanes g3_{ImitationWatches,OnlyDiamond,OtherOrServices} running (--test, prompts dsr/gate3_<proc>.txt, outs ~/.claude/cursor-runs/apicrm-migration-g3_<s>.nohup; output 6 DBs + grant OLD vs v3). DSR g2 still running; chain.sh (apprgate->albcallers_v3e) waits GATE2_ALL_DONE. NEXT: review g3 (output PASS + grant lower) -> DSR g2/apprgate/albcallers_v3e review -> repo edits -> combined API per DB -> one load OLD/NEW/OLD.
1112026-12-06 11:55 g3 RESULTS: Imitation v3 PASS (output 6 DBs; grant PREMIER/SOPHIE 241 -> 72-74 MB), OtherOrServices v3 PASS (all DBs 241-244 -> 71-74 MB). OnlyDiamond v3 FAIL Msg 206: #SumRow untyped NULL AS X = int, final CASE SR.X/PR.X -> fixed by Claude (101 null cols emitted as bare NULL; backup dsr/v3_..OnlyDiamond..pre-fix.sql); re-gate lane g3b_OnlyDiamond running (prompt dsr/gate3b_OnlyDiamond.txt, + column types + max-grant statement). DSR g2 still running (META c_getall). chain.sh (apprgate->albcallers_v3e) waits GATE2_ALL_DONE. NEXT: g3b review -> DSR g2/apprgate/albcallers_v3e review -> repo edits (Imitation v3, OOS v3, fn v3e, Appraisal v1, passing DSR/OnlyDiamond) -> combined API per DB -> one load OLD/NEW/OLD.
1122026-12-06 12:00 owner: deferred items side by side. 5 parallel Cursor lanes started (no sqlperf use, gates later): side_consv3 (Consignment v3 narrow keys -> dsr/v3_sp_GetAllConsignmentOutReportByCustomerId.sql/.md), side_cons8114 (read-only root cause multi-branch 8114 -> side/cons8114.md), side_elsa (patch only -> side/elsa.patch/.md, repo untouched), side_albv3d (index+fn v3d scripts + CRUD write-cost plan -> side/albv3d_*), side_tail (7 unrestored DBs mapping + next top 15 objects -> side/tail.md). Prompts ~/.ai/apicrm-migration/side/*.txt, outs ~/.claude/cursor-runs/apicrm-migration-side_*.out. g2 DSR + g3b OnlyDiamond still running; chain apprgate->albcallers_v3e queued. NEXT: review g3b/g2/side outputs -> queue gates for side items after current gates (sqlperf one-at-a-time for cost) -> repo edits -> combined API -> load.
1132026-12-06 12:00 resume: DSR v2 g2 output PASS so far but grant NOT lower (PREMIER 240 -> 241 MB; FooterRanked fix not enough). OnlyDiamond v3 g3b output PASS but grant not lower (JMSCRM getall 241 -> 242 MB; wide #DiamondItemsDeduped). Started write lanes v3_sp_GetDiamondAndStoneReport_Optimized (narrow #PageKeys like Imitation v3) + v4_sp_GetOnlyDiamondReport_Optimized (narrow DIAMOND_ITEMS dedupe). 5 side lanes + chain apprgate->albcallers_v3e unchanged. NEXT: review v3 DSR / v4 OnlyDiamond -> gate (output 6 DBs + grant) after g2/g3b finish -> side outputs review -> repo edits -> combined API -> load.
1142026-12-06 12:10 owner asked: are tests on widecols migration + indexing schema? Checked: NO. sqlperf 6 DBs still old (FAZGOLD/META/PREMIER 20261130110418, ISHA/SOPHIE 20261202091616, JMSCRM 20261204122645; WideColumnSizes 0/6). All gates so far = old schema. Plan: when running sqlperf gates (g2 DSR, g3b, chain apprgate->albcallers_v3e) finish -> pause new sqlperf runs -> combined API (AngularJMS-combined, widecols+indexing, ALB v3e) once per local DB (sqlperf 6 + local 'sqlserver' DBs) -> verify history/columns/indexes -> re-run ALL output+grant gates of accepted fixes on new schema -> one load OLD/NEW/OLD.
1152026-12-06 12:15 GATE2_ALL_DONE. DSR v2: output PASS all 6 DBs x cases, grant NOT lower (PREMIER 240->241 MB) -> v2 no gain, DSR v3 lane running. OnlyDiamond v3 (g3b): grant not lower on PREMIER/ISHA (~241 MB; SOPHIE lower 74->51 MB) AND 1 OUTPUT DIFF: PREMIER c_getall 643/643 rows, 1 row only-OLD + 1 only-v3 (value diff in one row) -> must root-cause before v4 accept (v4 is based on v3). chain.sh started apprgate -> albcallers_v3e. NEXT: diff PREMIER getall row (OLD vs v3) -> fix in v4 -> gate v4 + DSR v3 -> then widecols/indexing combined schema on all local DBs (12:10 entry) -> re-gate -> load.
116Owner 2026-12-06 12:20 (standing, all tasks): ALL testing only on local DBs with widecols migration + new indexing applied. No more gates on old schema: after running lanes finish, apply combined schema to all local DBs FIRST, then gate DSR v3 / OnlyDiamond v4 / Appraisal / ALB v3e / side items + re-run earlier accepted gates (Imitation v3, OOS v3) on new schema.
1172026-12-06 12:03 resume: v3 DSR + v4 OnlyDiamond lanes had NOT started (relative prompt path) -> relaunched with absolute path (v4 prompt + must-fix PREMIER getall Title Id=126097). Old-schema chain apprgate->albcallers_v3e STOPPED (redundant, owner rule new schema only). side lanes done: consv3 (dsr/v3_sp_GetAllConsignmentOutReportByCustomerId.sql/.md), cons8114/elsa/albv3d/tail (side/*.md). Combined worktree fn reset to branch version (baseline OLD; fixes tested as zz/swap). Schema apply RUNNING: ~/.ai/apicrm-migration/combined/apply_schema.sh (combined Release API once per DB, wait /ready, check history) sqlperf 7 DBs (incl META/HYT) + sqlserver 6 _TH; log ~/.claude/cursor-runs/apicrm-migration-schema-<container>.log, SCHEMA_DONE <container>. NEXT: verify WideColumnSizes + indexes on all 13 -> rebuild workload/CRUD validate -> gates on new schema (Imitation v3, OOS v3, DSR v3, OnlyDiamond v4, Appraisal v1, ALB v3e callers, Consignment v3) -> one load OLD/NEW/OLD.
1182026-12-06 12:03 schema apply RUNNING (ISHA done both containers = WideColumnSizes, 4 migrations ~20 s, /ready ~1 min/DB). FOUND: ALB v3b/v3e file had trailing 'GO' -> app Programmability deployer fails ('Incorrect syntax near GO', old fn stays) -> GO removed from repo file + alb_v3e.sql; any fix file going to repo must have no GO. Combined bin fn = branch baseline (OLD). NEXT: check SCHEMA_DONE both logs + grep ERR in *.api.log -> verify indexes -> gates on new schema (list in previous line) -> load.
1192026-12-06 12:06 resume: DSR v3 + OnlyDiamond v4 written+reviewed (v4 Title = PII.Id ASC deterministic). Schema apply ISHA/SOPHIE done (ISHA fn GO fail = known, fn stays OLD). Procs unchanged in combined vs main (only IDX_* + fn_GetAllConsignmentOut changed); BarcodeNo now nvarchar(100). ns/launch.sh (nohup) waits SCHEMA_DONE both -> 7 Cursor --test lanes ns_{imitation,oos,dsr,onlydiamond,appr,albcallers,cons} on new schema (prompts ns/*.txt = ns/header.txt + old gate; truncation check; outs ~/.claude/cursor-runs/apicrm-migration-ns_<l>.nohup; NS_ALL_DONE in apicrm-migration-ns.log). NEXT: review ns results -> repo edits for PASS fixes (no GO) -> workload/CRUD validate -> one load OLD/NEW/OLD.
1202026-12-06 12:10 FOUND: ISHA_TH (both containers) has NO fn_AccountLedgerBalance (deploy dropped it, GO create failed). launch.sh replaced by ns/launch2.sh: after SCHEMA_DONE -> re-apply ISHA both -> verify fn exists (ISHA_FN / NS_ABORT in ns.log) -> launch.sh lanes. META/HYT apply still running. WC_BASE/WC_NEW (sqlserver) = widecols task DBs, not touched. NEXT: same as 12:06.
1212026-12-06 12:11 SCHEMA_DONE both containers (13 DBs = WideColumnSizes, no ERR/FTL in api logs). launch2.sh now re-applying ISHA both -> ISHA_FN check -> 7 ns lanes. NEXT: review ns_*.nohup results -> repo edits for PASS fixes (no GO) -> workload/CRUD validate -> one load OLD/NEW/OLD.
1222026-12-06 12:12 ISHA_FN sqlperf=1 sqlserver=1 -> 7 ns gate lanes launched (launch.sh). NEXT: wait NS_ALL_DONE in apicrm-migration-ns.log -> review ns_*.nohup -> repo edits for PASS fixes (no GO) -> workload/CRUD validate -> one load OLD/NEW/OLD.
1232026-12-06 12:20 ns_imitation + ns_oos PASS on new schema (output 6 DBs, truncation OK, grant PREMIER/SOPHIE ~243 -> 72-75 MB) -> repo SP files = v3 (renamed, LF, no GO; backups ~/.ai/apicrm-migration/repo-backup/). Uncommitted. 5 ns lanes still running (dsr, onlydiamond, appr, albcallers, cons). NEXT: wait NS_ALL_DONE -> review -> repo edits for PASS (fn v3e if albcallers PASS) -> workload/CRUD validate -> one load OLD/NEW/OLD.
1242026-12-06 12:30 ns_onlydiamond v4 FAIL (PREMIER getall Title Id=126097: OLD picks arbitrary row ORDER BY (SELECT NULL), v4 Id ASC; getall grant not lower ~242-246 MB PREMIER/ISHA/JMSCRM; RFID narrowed to 200 = truncation risk). Default paged grant lower (PREMIER 190->72 MB, SOPHIE getall 65->36 MB). Claude wrote dsr/v5 (= v4 + OLD Title block verbatim + RFID NVARCHAR(MAX)); lane ns_onlydiamond5 running (prompt ns/onlydiamond5.txt: output all, paged grant lower, getall not worse +5%, top-3 getall grant statements). 4 other ns lanes still running. NEXT unchanged.
1252026-12-06 12:35 ns_cons Consignment v3 FAIL (truncation BranchName/ProductName MAX->capped; ISHA e/h page diff on InvoiceDate ties; grant not lower PREMIER getall/SOPHIE; v3 inlines old pre-combined TVF body) -> REJECTED, keep OLD, parked (OLD small locally). Running: ns_onlydiamond5 (v5), ns_dsr, ns_appr, ns_albcallers. NEXT: review those 4 (outs ~/.claude/cursor-runs/apicrm-migration-ns_<l>.nohup) -> repo edits for PASS (fn v3e if albcallers PASS; Appraisal v1; DSR v3; OnlyDiamond v5) -> workload/CRUD validate -> one load OLD/NEW/OLD.
126Owner 2026-12-06 12:45: StockPosting.RFID -> NVARCHAR(250); find all other unsized NVARCHAR(MAX) string columns. Lane maxcols (read-only, prompt ~/.ai/apicrm-migration/maxcols/find.txt -> maxcols/report.html/.tsv; out ~/.claude/cursor-runs/apicrm-migration-maxcols.nohup). Code change goes on widecols branch perf/widecols-resize (worktree deleted -> recreate/use combined for test) as SQL script until feature done (one migration at end); needs owner OK on size list from report. NEXT also: 4 ns lanes (onlydiamond5/dsr/appr/albcallers) review.
1272026-12-06 12:25 resume check: still RUNNING ns_dsr, ns_appr, ns_albcallers, ns_onlydiamond5 (Cursor pids alive) + maxcols discovery (no report.html yet). No results to review. NEXT: when lanes end (no apicrm cursor-run.sh/cursor-agent in ps) -> review ~/.claude/cursor-runs/apicrm-migration-ns_<l>.{out,log,nohup} RESULT lines -> repo edits for PASS (no GO; fn v3e if albcallers PASS; Appraisal v1; DSR v3; OnlyDiamond v5) -> open maxcols/report.html for owner size OK -> workload/CRUD validate -> one load OLD/NEW/OLD.
1282026-12-06 12:24 resume: 4 ns lanes + maxcols still running (DSR/Appraisal mid-gate, OnlyDiamond5 at META grants). Background watcher waits for all to end. NEXT unchanged (review RESULT lines -> repo edits for PASS -> maxcols report for owner -> workload/CRUD -> load OLD/NEW/OLD).
1292026-12-06 12:28 ns_onlydiamond5 OVERALL PASS (output all 6 DBs incl PREMIER Title 126097; paged grant PREMIER 190->72 MB, SOPHIE 40->5 MB; getall <=+5%). NEXT: repo edit OnlyDiamond v5 after other lanes. Running: ns_dsr (FAZ PASS, ISHA in progress), ns_appr, ns_albcallers, maxcols (measuring).
1302026-12-06 12:35 ns_dsr v3 OVERALL FAIL: StoneWt/Weight double rounding (#temp DECIMAL(18,3) holds Carat/5; OLD keeps decimal(32,17)) -> JMSCRM/META b+c, PREMIER c. Grants v3 lower. Claude wrote dsr/v4 (2 cols -> DECIMAL(32,17)); lane ns_dsr4 running (ns/dsr4.txt). NEXT: wait ns_appr, ns_albcallers, ns_dsr4, maxcols -> repo edits for PASS.
1312026-12-06 12:40 session handoff. NEXT: when no apicrm cursor-run in ps -> review RESULT lines of ns_dsr4/ns_appr/ns_albcallers (~/.claude/cursor-runs/apicrm-migration-<l>.{nohup,out,log}) -> repo edits for PASS (no GO, LF, backups to repo-backup/): OnlyDiamond v5 (dsr/v5 file), DSR v4, Appraisal v1, fn v3e if albcallers PASS -> open maxcols/report.html for owner size OK -> workload/CRUD validate -> one load OLD/NEW/OLD.
1322026-12-06 12:52 repo edit DONE: OnlyDiamond v5 -> sp_GetOnlyDiamondReport_Optimized.sql (no GO, LF; backup repo-backup/). maxcols DONE (1362 SIZE / 931 KEEP_MAX; RFID max 0 -> NVARCHAR(250) OK) report opened for owner size OK. Running: ns_dsr4, ns_appr, ns_albcallers. NEXT: review their RESULT lines -> repo edits for PASS (DSR v4, Appraisal v1, fn v3e) -> owner size OK -> workload/CRUD validate -> one load OLD/NEW/OLD.
1332026-12-06 13:00 maxcols owner table built (widecols column-sizes.html format): ~/.ai/apicrm-migration/maxcols/column-sizes.html (input + CSV download maxcols-owner-sizes.csv). NEXT: owner CSV -> SQL script on widecols branch; lanes review as before.
1342026-12-06 13:10 ns_dsr4 OVERALL PASS (output 6 DBs a-j, truncation OK, grant PREMIER 241->215 MB, SOPHIE 241->208 MB, getall <=+5%) -> repo edit DONE: DSR v4 -> sp_GetDiamondAndStoneReport_Optimized.sql (no GO, LF; backup repo-backup/). Running: ns_appr (FAZGOLD pass A at case k), ns_albcallers (FAZGOLD parties). NEXT: review ns_appr/ns_albcallers RESULT -> repo edits for PASS (Appraisal v1, fn v3e) -> owner sizes CSV -> workload/CRUD validate -> one load OLD/NEW/OLD.
135Owner 2026-12-06 13:15: size table = dbo schema only. column-sizes.html now 2120 dbo cols (1261 resize / 859 stay MAX); 173 crm rows removed (full copy maxcols/work/column-sizes.all-schemas.html). crm schema out of this resize.
136Owner 2026-12-06 13:25: phone/mobile/mob/dial-code columns = 50 (rule for all such cols). Pre-filled 50 in column-sizes.html for 24 cols (none has data >50); backup maxcols/work/column-sizes.pre-phone.html.
137Owner 2026-12-06 13:30: phone rule = any phone/contact no col incl OfficeNo, ContactNo -> 50 (26 cols pre-filled).
138Owner 2026-12-06 13:40: all UDF columns -> 1000 (pre-filled in column-sizes.html; backup work/column-sizes.pre-udf.html). Also added 'Text fits (characters)' column next to Your size.
1392026-12-06 13:50 resume: ns_appr (PREMIER pass B, then SOPHIE) + ns_albcallers (FAZGOLD Appraisal perf, last) still running. albcallers so far: OUTPUT cmp=True in ALL cases/DBs (v3e truncation bug fixed). PartiesList grant "FAIL" = tiny (4->6 MB, ms CPU) = noise. REAL: fn v3e + OLD Appraisal proc on FAZGOLD = CPU 22 s -> 70 s, reads 216k -> 3.3M -> fn v3e must NOT go to repo alone; ship only together with Appraisal v1 (ns_appr pass B = v1+v3e). NEXT: ns_appr RESULT (need pass B FAZGOLD a/c cost) -> if PASS: repo fn v3e + Appraisal v1 together -> owner sizes CSV -> workload/CRUD validate -> load OLD/NEW/OLD.
1402026-12-06 14:00 ns_appr: output PASS all 6 DBs, cases a-k + pass B (v1 + fn v3e). Cost OLD->NEW CPU: FAZGOLD 154 s/22 s -> 1.9 s, PREMIER 44 s -> 0.4 s, SOPHIE 11.6 s -> 0.3 s, JMSCRM/META 4 s -> 0.25 s, ISHA 0.9 -> 0.16 s; reads 10-60x lower; grant lower on 5 DBs, SOPHIE 27 -> 71 MB (MaxUsed 2 MB) = only COST_FAIL -> ACCEPTED by Claude (huge CPU/read win, 71 MB < other DBs' OLD grants), follow-up: SOPHIE grant trim (QUERYTRACEON 9347 / narrow sort) in load phase. ns_albcallers: output PASS 60/60; grant deltas tiny (4->6 MB) = noise; fn v3e with OLD Appraisal proc FAZGOLD 22 -> 70 s (moot: ships with v1). Repo edit DONE (uncommitted, LF, no GO, backups repo-backup/*.pre-v3e/.pre-v1): fn_AccountLedgerBalance.sql = v3e (repo had v3b with 4000-char truncation bug), sp_GetAppraisalLedgerList.sql = v1. NEXT: owner sizes CSV (maxcols/column-sizes.html) -> workload/CRUD validate on new schema -> one load OLD/NEW/OLD.
1412026-12-06 14:15 owner set sizes on white rows of column-sizes.html (in browser localStorage, CSV not yet received). Owner asked: from orange Keep-MAX rows give the ones that CAN be sized -> ~/.ai/apicrm-migration/maxcols/column-sizes-keepmax.html (263 sizable with suggested size = max(2x longest, 250/500 for text) bucket 100..4000; 276 stay MAX: json/blob/image/html/xml/script/url/hash/longest>2000/owner keep/__ tables; 320 UDF already 1000). Own localStorage key + CSV maxcols-keepmax-sizes.csv. Script work/keepmax_split.py. NEXT: owner CSVs from both pages -> SQL resize script on widecols branch -> workload/CRUD validate -> load OLD/NEW/OLD.
142Owner 2026-12-06 14:30: free-text cols (Comment, CaratDetail, remark/note/desc/narration/reason/message/terms/detail/policy/error/info/ZPL etc) = stay MAX; address cols (Address, AddressLine1/2) = 1000. column-sizes-keepmax.html regenerated: 83 sizable / 456 stay MAX (backup work/column-sizes-keepmax.pre-freetext.html). NEXT unchanged: owner CSVs -> SQL resize script on widecols.
1432026-12-06 14:55 maxcols generator ready: AngularJMS-combined/tools/perf/maxcols/gen.py -> alter-maxcols.sql + precheck-maxcols.sql + final-sizes-maxcols.csv (widecols template; YourSize MAX/blank = stay MAX; stops on size<longest/conflict). keepmax CSV in (82 resize, 1 MAX). maxcols-owner-sizes.csv NOT in Downloads yet. NEXT: owner CSV -> rerun gen.py -> precheck+alter on local DBs -> workload/CRUD validate -> load OLD/NEW/OLD. EF/UI/import limits needed before ship (widecols rule).
1442026-12-06 owner asked why PortalRegistrations.Host suggestion not applied: gen.py now also takes orange-candidates.html suggestions as lowest-priority defaults (owner CSV values win; backup gen.py.preOrange). Run: resize 110 (82 keepmax CSV + 28 orange-only), Host=250 (owner keepmax CSV). Rule: every suggestion Claude gives is applied by default unless owner overrides. Still waiting maxcols-owner-sizes.csv. NEXT unchanged.
1452026-12-06 main page column-sizes.html now pre-filled with 110 suggestions (keepmax CSV + orange; green rows, Planned=size, placeholder 'Enter = <size>'; owner localStorage kept; backup work/column-sizes.pre-suggest.html). Waiting maxcols-owner-sizes.csv. NEXT: gen.py -> precheck -> alter local DBs -> validate -> load OLD/NEW/OLD.
1462026-12-06 15:10 owner CSV in (~/Downloads/maxcols-owner-sizes.csv). gen.py OK: resize 1693 / stay MAX 428, no conflict, no size<longest -> AngularJMS-combined/tools/perf/maxcols/alter-maxcols.sql + precheck-maxcols.sql + final-sizes-maxcols.csv. NEXT: precheck-maxcols.sql on all local DBs (sqlserver + sqlperf) -> 0 rows -> alter-maxcols.sql local -> workload/CRUD/output validate -> load OLD/NEW/OLD; later EF/UI/import limits + one migration.
1472026-12-06 owner: PlanetDetails.MobileNumber, Suppliers.MobileNo, WalkInCustomers.PhoneKey = 50 (owner CSV edited, backup maxcols/work/maxcols-owner-sizes.pre-phone50.csv); gen.py rerun. NEXT: precheck all local DBs -> alter local -> validate -> load.
1482026-12-06 resume: precheck failed Msg 10738 (>1000 VALUES rows) -> gen.py now chunks INSERT VALUES by 900 (alter+precheck regenerated, 1693/428). Precheck rerun RUNNING on 13 local DBs (outs ~/.ai/apicrm-migration/maxcols/precheck/<container>.<DB>.txt). NEXT: all 0 TOO_LONG/MISSING -> alter-maxcols.sql local (both containers) -> workload/CRUD/output validate (Cursor --test) -> load OLD/NEW/OLD.
1492026-12-06 precheck PASS 13 local DBs: TOO_LONG 0; MISSING = tables absent in that DB (ISHA-only WalkingCustomer*, ZZ_* backups) -> skipped by alter. alter RUNNING: ~/.ai/apicrm-migration/maxcols/alter_all.sh (outs maxcols/alter/<c>.<DB>.txt, log ~/.claude/cursor-runs/apicrm-migration-maxcols-alter.log, ALTER_ALL_DONE). NEXT: check FAIL/STOP per DB -> workload/CRUD/output validate (Cursor --test) -> load OLD/NEW/OLD.
1502026-12-06 15:15 alter try1 = no change (Msg 1934 QUOTED_IDENTIFIER: sqlcmd needs -I; log try1 kept). alter_all.sh fixed (-I) and RE-RUNNING on 13 DBs (log ~/.claude/cursor-runs/apicrm-migration-maxcols-alter.log, ALTER_ALL_DONE; outs maxcols/alter/<c>.<DB>.txt). NEXT: grep msg/FAIL/STOP per DB + verify sizes (sys.columns vs final-sizes-maxcols.csv) -> workload/CRUD/output validate (Cursor --test) -> load OLD/NEW/OLD.
1512026-12-06 15:40 alter try2 (-I) done 13 DBs msg/fail 0, but only ~827-884 resized; ~790 skipped by template table-level check (any computed col on table => all cols skipped). Real blockers JMSCRM = 193 cols used by computed cols (e.g. tbl_AccountLedger.LedgerName->LedgerNameKey), 0 schemabound views/fns. FIX: widecols/alter-template.sql check now column-level (sql_expression_dependencies referenced_minor_id=@colid; LIKE check removed; backup maxcols/work/alter-template.pre-colcheck.sql); gen.py rerun 1693/428. alter try3 RUNNING (log ~/.claude/cursor-runs/apicrm-migration-maxcols-alter.log, try2 log+outs kept). NEXT: check try3 OK/skip counts -> decide 193 computed-blocked cols (drop+recreate computed col/index, or keep MAX) -> verify sizes -> validate (Cursor --test) -> load OLD/NEW/OLD.
1522026-12-06 16:00 alter try3 (column-level dep check) working: sqlserver DBs resized OK ~786-827, computed-skip 0-1 (rest of 13 DBs was still running; check log ALTER_ALL_DONE + per-DB OK/skip).
153Owner 2026-12-06 16:00: REMOVE migration 20261205221906_WideColumnSizes (worktree AngularJMS-combined, branch test/apicrm-widecols-combined) and add ONE fresh migration (widecols 140 + maxcols 1693 cols), plus matching DB indexing changes/improvements. Facts: migration = migrationBuilder.Sql(WideColumnResizeSql.Up/Down, suppressTransaction) only; Helpers/WideColumnResizeSql.cs (401 lines) Columns list + guarded script (rebuilds dependent indexes/stats/constraints/computed keys, keeps MAX if data longer). Local DBs (JMSCRM_TH, ISHA_TH, ...) HAVE history row 20261205221906_WideColumnSizes.
154Owner 2026-12-06 16:10: after LedgerName resize, REMOVE LedgerNameKey and all its code. Facts: LedgerNameKey = persisted CONVERT(nvarchar(450),[LedgerName]) on tbl_AccountLedger (index-only copy, perf commit aefb78425d9 + ORDER BY [Id] fix 1028db517fd); LedgerName now nvarchar(150) locally (widecols final-sizes.csv) -> `LedgerName = @x` == `LedgerNameKey = @x` (zero output change). Usage in AngularJMS-combined src (excl. Migrations): 155 .sql (ledger posting SPs = rule 13, ~5 refs each), 1 .cs (EF config), 4 .txt. PLAN step 3b (in the same fresh migration, AFTER resize): drop index(es) on LedgerNameKey -> drop computed col -> create the same index(es) on LedgerName (same INCLUDE/filter); WideColumnResizeSql must not recreate LedgerNameKey. Code: SPs LedgerNameKey -> LedgerName (keep ORDER BY [Id]); remove EF property/config; .txt refs. Split Cursor runs by SP folder (disjoint files); Claude reviews each diff; test = SP output parity (Cursor --test, ledger SPs) on local DBs.
1552026-12-06 15:25 alter try3 DONE 13 DBs msg 0: ~1692/1693 resized (try2+try3); only skip SchemeDetails.SchemeName (computed SchemeNameNormalizedKey) -> migration helper drops/recreates computed cols, verify on apply. Step 1 DONE: WideColumnResizeSql.Columns = 1833 (140+1693, sorted, no dup), VALUES chunked by 900 (Msg 10738). 1617 of 1693 map to EF props (snapshot parse); 76 = non-EF tables (ZZ_* backups, ISHA WalkingCustomer*) -> SQL-only. NEXT: step 2 EF HasMaxLength block in AppDbContext -> LedgerNameKey removal -> delete old migration files, ef migrations add -> body Sql only.
1562026-12-06 15:35 step 2 DONE: AppDbContext maxcols block 1617 HasMaxLength (after widecols block; PermissionRoleMapping fully qualified); App.Persistence builds. NEXT: LedgerNameKey removal (29 SPs Stage + 2 Indexing/Stage + Helpers/WideColumnResizeSql.cs + EF config; ignore bin/obj) -> delete 20261205221906_WideColumnSizes .cs/.Designer.cs (keep snapshot) -> `dotnet ef migrations add WideColumnSizes` -> body = Sql(WideColumnResizeSql.Up/Down) + LedgerNameKey drop/index-on-LedgerName -> apply on 13 local DBs (Docker sqlserver:1433 6 DBs, sqlperf:14330 7 DBs) after deleting old history row.
157Owner 2026-12-06 15:45: old local `sqlserver` container REMOVED (volume sqlserver-data kept: has WC_BASE/WC_MIG/WC_NEW); `sqlperf` recreated as `sqlserver` on localhost:1433 (volume sqlperf-data, Express, 4 CPU/4.5 GB, restart unless-stopped). Only ONE local SQL now: sqlserver:1433 with 7 *_TH DBs + zz_PerfHarness. Active scripts (sqlq.sh, harness/*.sh, maxcols/alter_all.sh) switched to sqlserver/1433 (backup ~/.ai/apicrm-migration/pre-container-rename-scripts.tgz); old one-off cp_run.sh still say sqlperf.
158Owner 2026-12-06 16:00: EF sizes compact -> AppDbContext widecols (93) + maxcols (1617) HasMaxLength lines REPLACED by one loop at end of OnModelCreating (region "Short text column sizes") reading WideColumnResizeSql.Columns (single source; table/column case-insensitive; string props only). Builds 0 errors. Backup scratchpad AppDbContext.pre-loop.cs (session only). VERIFY at migration step: `ef migrations add` must show no AlterColumn for the 140 widecols and exactly the 1617 maxcols (+ LedgerNameKey changes), nothing else.
1592026-12-06 owner: ALL work only in AngularJMS-combined (test/apicrm-widecols-combined). Main worktree uncommitted WIP (4 report SP perf rewrites, fn_AccountLedgerBalance, sp_GetAppraisalLedgerList, performance SKILL.md, db-indexing docs/html) copied into combined (git apply --3way clean; docs cp). Main's working tree NOT cleaned yet (ask owner before discarding there).
1602026-12-06 LedgerNameKey removal IN PROGRESS (combined): DONE 28 ledger SPs (regex: drop `LedgerNameKey = N'x' AND` / `LedgerNameKey IN (...) AND`, output-identical) + sp_GetObjectsByMultipleColumnsWithIn (@IsAccountLedger/@LedgerNameFilterApplied, keeps ORDER BY [Id]). NEXT: (a) Indexing/Stage IDX_tbl_AccountLedger_LedgerNameKey.sql (keep filename, rule 23) -> IX_tbl_AccountLedger_LedgerName on LedgerName INCLUDE(Deleted,BranchId), only when LedgerName not MAX; IDX_..._SystemGenerated_LedgerName.sql + Dedupe_SystemAccountLedgers_Remap_AccountLedgerId_RunApply.sql EnsureUniqueIndex -> UX on LedgerName (no LedgerNameKey add); (b) WideColumnResizeSql: Up prefix drops IX/UX on LedgerNameKey + column before resize (doc comment line 9 update); Down: resize back then re-add LedgerNameKey+IX/UX; (c) delete 20261205221906_WideColumnSizes .cs/.Designer.cs -> `dotnet ef migrations add WideColumnSizes` -> body Sql(Up/Down), verify AlterColumn list; (d) apply on local sqlserver:1433 after deleting old history row; (e) Cursor --test SP parity.
1612026-12-06 owner: push completed+verified work to origin test/apicrm-widecols-combined as it goes (branch pushed at 00c3ee7d945; uncommitted WIP not pushed until verified).
1622026-12-06 (a)+(b) DONE (uncommitted, App.Persistence builds): IDX_tbl_AccountLedger_LedgerNameKey.sql -> IX_tbl_AccountLedger_LedgerName (LedgerName INCLUDE Deleted,BranchId; only when LedgerName max_length 1..900); SystemGenerated UX + Dedupe EnsureUniqueIndex -> UX on LedgerName (same size guard), no LedgerNameKey add. WideColumnResizeSql: Up prefix drops IX/UX on LedgerNameKey + column; Down prefix drops LedgerName IX/UX, suffix re-adds LedgerNameKey+IX+UX. NEXT (c) delete 20261205221906_WideColumnSizes .cs/.Designer.cs -> ef migrations add WideColumnSizes -> body Sql(Up/Down) -> verify AlterColumn list = 1617 maxcols only; (d) apply local sqlserver:1433; (e) Cursor --test SP parity; then commit+push.
1632026-12-06 (c) migration regenerated: 20261206100700_WideColumnSizes (old 20261205221906 .cs/.Designer.cs git rm'd; old body backup scratchpad). Scaffold had exactly 1617 AlterColumn, all in WideColumnResizeSql.Columns, nothing else -> body replaced by Sql(WideColumnResizeSql.Up/Down, suppressTransaction). Build re-check was backgrounded. NEXT (d) on local sqlserver:1433: DELETE __EFMigrationsHistory row 20261205221906_WideColumnSizes, apply new migration on all *_TH, check LedgerNameKey gone + IX/UX on LedgerName (after Indexing scripts); (e) Cursor --test SP parity; commit+push.
1642026-12-06 15:40 (d) RUNNING: script ~/.ai/apicrm-migration/combined/mig-20261206100700.sql applied via combined/apply_mig.sh (deletes old history row, sequential 7 DBs; logs combined/apply-logs/, summary.txt). NEXT: check logs (Msg/kept), LedgerNameKey gone, run Indexing scripts IDX_tbl_AccountLedger_* -> (e) Cursor --test parity -> commit+push.
1652026-12-06 (d) DONE local sqlserver:1433, 7 *_TH: old history row deleted, mig 20261206100700 applied (6-17s each, 0 Msg, 0 kept at max), LedgerNameKey gone; IDX LedgerName scripts run (sqlcmd needs -I = QUOTED_IDENTIFIER ON): IX_tbl_AccountLedger_LedgerName + filtered UX_..._SystemGenerated_LedgerName on all 7; 35 changed SP/fn files deployed (drop+create), 0 modules reference LedgerNameKey. LedgerName = nvarchar(150) (<450) so removed LedgerNameKey predicates are redundant -> 28 ledger SPs identical by construction. UX_SchemeDetails_Active_NameNormalized 8000-byte warning = pre-existing computed def (REPLACE types as 4000), data <=200 bytes, no action. NEXT (e) Cursor --test parity: sp_GetObjectsByMultipleColumnsWithIn (account ledger filter) vs WC_BASE/old def, + 4 report SP rewrites, fn_AccountLedgerBalance, sp_GetAppraisalLedgerList (if not already verified) -> commit+push.
1662026-12-06 (e) RUNNING: LedgerNameKey SP changes proven equivalent by reading (LedgerName nvarchar(150) <450; GetObjectsByMultipleColumnsWithIn keeps ORDER BY [Id] same conditions). Fresh output gate: zz_<name>_old (HEAD text) created in 7 DBs for 4 report SPs + sp_GetAppraisalLedgerList + fn_AccountLedgerBalance; Cursor --test prompt ~/.ai/apicrm-migration/ns/final_parity.txt, log ~/.claude/cursor-runs/apicrm-migration-final_parity.log. NEXT: read RESULT; PASS -> drop zz_*_old (7 DBs), commit (stage own files only, no docs/ai html clutter? include status md) + push origin test/apicrm-widecols-combined; FAIL -> fix.
1672026-12-06 16:20 main worktree WIP DISCARDED (owner OK; all in combined; backup ~/.ai/apicrm-migration/main-wip-backup-2026-12-06/; status history merged here). (e) final_parity Cursor run still RUNNING (pid 43624). NEXT: read RESULT in ~/.claude/cursor-runs/apicrm-migration-final_parity.log; PASS -> drop zz_*_old (7 DBs) + commit (own files incl. BarcodeNoColumnResizeSql A1) + push origin test/apicrm-widecols-combined (owner pre-approved 2026-12-06); FAIL -> fix. Then review+noise run, CRUD gate; LTS decisions (section 4 order, A1) pending owner.
1682026-12-06 16:30 owner: slowapi changes taken into combined (uncommitted, NOT in parity commit): 3 goldsilver SPs (sp_GetGoldSilverCurrentStockReport, _NS, _NS_VariantWise; Claude-reviewed equivalent 2026-12-03, output gate NOT run yet) + tools/perf/sp-compare. SKIPPED slowapi diamond SP diff (unreviewed; combined has own parity-tested rewrite). NEXT after final_parity commit: Cursor --test output parity of 3 goldsilver SPs (OLD=HEAD as zz_*_old) on 7 *_TH, PASS -> separate commit+push.
1692026-12-06 resume: goldsilver OLD (zz_*_old from HEAD) + NEW deployed on 7 local *_TH; Cursor --test lane gs (prompt ~/.ai/apicrm-migration/ns/gs_parity.txt, log ~/.claude/cursor-runs/apicrm-migration-gs_parity.log) running parallel to final_parity. NEXT: final_parity PASS -> drop zz (6 objs) + commit parity files; gs PASS -> drop gs zz + separate commit; push both.
1702026-12-06 slowapi worktree + local branch perf/slow-api-fixes removed (owner); goldsilver+sp-compare already identical in combined; diamond diff/docs backup ~/.ai/apicrm-migration/slowapi-backup-2026-12-06. Owner re-confirmed: LIVE zero touch, all local.
1712026-12-06 16:45 final_parity 27/42 PASS 0 FAIL (still running pid 43614); gs_parity running pid 48800 (lane gs). Owner: progress only on ~/.ai/apicrm-migration/progress-2026-12-06.html (A-Z; generator progress.py + progress-steps.tsv; auto-regenerates every 60s while runs alive). NEXT: read both logs RESULT/OVERALL; PASS -> drop zz (6 + 3 objs, 7 DBs), commit+push parity, separate goldsilver commit+push; update progress-steps.tsv + run progress.py.
1722026-12-06 owner: progress page now has OLD vs NEW sections (speed/memory from progress-perf.tsv; per-case output rows parsed from parity logs). Add new gate numbers to progress-perf.tsv.
173Owner 2026-12-06: LTS plan (docs/ai/apicrm-lts-plan-2026-12-05.html) section 4 order APPROVED: A1-A4 -> D1+E1-E4 -> C1+C4, C2, C3 -> B1-B4 -> A5-A6; A1 (BarcodeNoColumnResizeSql per-table @Skipped) KEEP; D2 (DevMiniz off prod) SKIP. Live steps still need per-action OK.
1742026-12-06 16:30 final_parity OVERALL PASS (6 objs x 7 DBs, 0 FAIL). 6 zz_*_old dropped (7 DBs; 3 gs zz kept). Build OK. Local commit 526ee8be205 (goldsilver/sp-compare/runs excluded). Push BLOCKED by auto-mode classifier -> owner must OK/allow. NEXT: gs_parity result -> drop 3 gs zz -> separate goldsilver commit; push both after owner OK.
1752026-12-06 16:50 526ee8be205 on origin (pushed). gs_parity still running (303 PASS 0 FAIL, pid 48800). NEXT: gs PASS -> drop 3 gs zz (7 DBs) -> separate commit (3 goldsilver SPs + tools/perf/sp-compare) + push (owner OK).
1762026-12-06 gs_parity ISHA/SOPHIE/PREMIER/JMSCRM PASS (run continues). Owner asked further quick perf; proposed #1 DSR grant 215/208->~72 MB (narrow #PageKeys), #2 Appraisal SOPHIE grant 71->~27 MB, #3 goldsilver speed gate; skip OnlyDiamond getall. Awaiting owner answer. NEXT: gs all PASS -> drop 3 gs zz (7 DBs) -> goldsilver commit+push.
1772026-12-06 DONE: goldsilver parity 3 SPs x 7 DBs PASS (0 FAIL); zz_sp_GetGoldSilverCurrentStockReport*_old dropped in 7 local DBs; commit 18ccfed4b4a pushed. NEXT: owner answer on quick extra perf (#1 DSR grant, #2 Appraisal SOPHIE grant, #3 goldsilver speed gate), then review+noise run, CRUD gate, LTS steps.
1782026-12-06 owner: do all 3 extra perf. Lanes dsr5, appr2 (code: v5/v2 in ~/.ai/apicrm-migration), gs_speed (test) launched on sqlserver. NEXT: review, full gates, repo edit if PASS.
1792026-12-06 16:50 owner asked: colSize validations in web/mobile? Answer: API guard (EF GuardTextLengths, 1833 cols) + SP truncation msg = DONE; web only 22 screens (widecols), mobile none. Proposed easy way: one API endpoint (column-limits map from WideColumnResizeSql.Columns) + one Angular directive on <form appColumnLimits="Table"> + mobile shared TextInput prop; awaiting owner go. Lanes dsr5/appr2/gs_speed still running (watcher). NEXT unchanged.
180Owner 2026-12-06 17:00: web/mobile maxlength = optional (not now). ADD to CRUD gate (Cursor --test): (1) too-long text save via API -> friendly TextTooLong msg, nothing partial saved; (2) mobile offline sync batch with one too-long record -> does whole batch fail? (3) integrations/background saves (ecommerce webhook, Tally/QuickBooks, scheduled jobs) with too-long text -> behaviour; (4) Excel import too-long row msg. Fix any break before LTS. Live precheck before deploy = LTS step.
181Owner 2026-12-06 17:05: import sample files (35 xlsx) must show max length per text header. Lane imp_map (read-only) -> ~/.ai/apicrm-migration/importsamples/limits.tsv + notes.md. NEXT: review map -> edit lane: add header cell comment 'Max N characters' only (no new rows/cols, parser unchanged; skip files openpyxl would damage) -> verify import still works (Cursor --test) -> commit.
1822026-12-06 17:15 lanes done: #1 DSR v5 grant PREMIER 215248->72928 KB, SOPHIE 207952->70016 KB, quick EXCEPT PASS 4/4 -> full gate RUNNING (lane dsr5g, prompt ns/dsr5_gate.txt, runner ns/dsr/run_nsgate5.py, 7 DBs). #2 Appraisal v2: peak grant = INSERT #Bal <- fn_AccountLedgerBalance (FAZGOLD 70 MB), flat v1->v2 -> SKIP (no repo change). #3 gs_speed OVERALL FAIL: NEW reads much lower but CPU +15-25% (most DBs), grant +1-3 MB small DBs (#ProductBarcode Hash Match); 18ccfed4b4a already pushed -> owner decides revert 3 SPs vs keep. INCIDENT: dsr5 lane dropped all zz_% on PREMIER+SOPHIE local incl. ZZ_KaratFix_* backup tables + zz_fn_AccountLedgerBalance_v* (local copies only; other 5 DBs still have them; live untouched). imp_map lane re-running. NEXT: dsr5g PASS -> repo edit v5 SP + commit/push; owner gs decision; imp_map review.
1832026-12-06 17:10 main-vs-versions gate: Cursor --test lanes mv_dsr, mv_io, mv_alb running (prompts ~/.ai/apicrm-migration/ns/mv_*.txt, common rules ns/mainvs_common.txt; copies zz_mv_<lane>_*; results ~/.ai/apicrm-migration/mainvs/<lane>.tsv). progress.py redesigned (sec 2 verdict main->HEAD, sec 3 per object main->vN->HEAD, sec 4 old gates collapsed, sec 5 history); status md Hinglish lines translated. gs_fix still running (new2 vs gs/old). NEXT: lane results -> review; gs_fix done -> launch mv_gs (new=v1, new2=v2, HEAD; repo edit new2 only if gate PASS vs main); then imp_fix review, review+noise run, CRUD gate, LTS.
1842026-12-06 17:15 imp_fix reviewed (613 same/25 changed/288 unresolved; TradeNo mis-map skipped). imp_hdr lane started (header comments, backups importsamples/backup, result hdr_result.tsv). mv_* + gs_fix still running.
1852026-12-06 17:30 imp_hdr DONE (381 comments, 26 xlsx, verify PASS, uncommitted). mv_* + gs_fix still running. NEXT per resume file.
1862026-12-06 17:20 gs_fix lane done; mv_gs auto-launched by watcher. HEAD DSR = v5 (eb9306d1d44); mv_dsr v2 output PASS but CPU +13-18% vs main. Profile lane dsr_cpu RUNNING (prompt ns/dsr_cpu.txt, out ns/dsrcpu/summary.tsv + stmts_*.tsv; main vs HEAD per-statement CPU, compile vs exec, FAZGOLD+HYT). progress.py: % deltas green=gain/red=loss (backup progress.py.bak-color). NEXT: dsr_cpu results -> fix top CPU statements in HEAD DSR (suspect v2 ~24 filter temps/recompiles), output identical -> re-gate main vs HEAD; review mv_* TSVs; mv_gs; then xlsx import test + commit, review+noise, CRUD gate, LTS.
1872026-12-06 17:25 gs_fix OVERALL PASS (new2, 7 DBs, 3 procs): cause = temp indexes + empty #*Filter EXISTS + deferred #ProductBarcode + NSW set-xfer -> back to OLD shapes. Same pattern to apply to DSR CPU fix. mv_gs running.
1882026-12-06 17:20 dsr_cpu profile DONE (ns/dsrcpu/summary.tsv, FAZGOLD+HYT, 3 runs): DSR CPU is ~90% COMPILE in both main and HEAD (FAZGOLD main compile 1602-1652 ms, HEAD 1209-1835; HYT main 1308-1364, HEAD 1192-1266); exec only ~60-150 ms. HEAD (v5) vs main CPU = within noise (no regression); main elapsed 17-22 s FAZGOLD vs HEAD ~2 s. The +13-18% CPU was v2 only. Compile drivers: OPTION(RECOMPILE) FilteredBarcodes stmt (HEAD 782 vs main 538 ms, refs ~43 filter temps) + temp-table recompiles. v6 (filter temps -> main inline STRING_SPLIT, keep v5 footer) ONLY if mv_dsr head rows show CPU FAIL. NEXT: mv_dsr head rows -> decide v6; review mv_io/mv_alb/mv_gs (mv_alb v2/v3 reads/grant FAIL, check head rows).
1892026-12-06 17:35 mv_* partial review: mv_alb HEAD fn_AccountLedgerBalance output PASS but grant 2x vs main (69->137 MB on FAZGOLD/JMSCRM/META/PREMIER/SOPHIE) + reads PREMIER 716->30160, SOPHIE 94->8131; CPU ok -> FIX not revert: lane alb_plan (Cursor --test, prompt ns/alb_plan.txt, out ns/albplan/summary.tsv + ops_*.tsv, main/head/v3c plans). mv_gs: v2(new2) 13/14 speed PASS, head CPU FAIL -> repo edit new2 when lane ends. mv_io head 2 tiny read fails (HYT 22->29). mv_dsr head rows + mv_alb appr rows pending. NEXT: alb_plan -> v4 alb fix (main shape + needed parts) -> gate; mv_dsr head -> v6 decision; gs new2 repo edit.

JewelSteps · all clients · generated 2026-12-06 17:30 · share: https://jewelsteps-sql-progress.pages.dev · live publish via Cloudflare Pages