Handoff Packet

Here’s the handoff from 9/27/20225 at 8:15 pm:

# Stella Quotes — Project Handoff Packet (TX, 2025-Q1, GoDaddy MWP)

_Last updated: 2025-09-27 • Author: Eric + Assistant • Status: **Working exporter**; performance: **host-limited save/zip**; caching now enabled (repeat exports are fast)._

## 0) TL;DR (for the next dev)
– **Goal:** Keep the **styled Excel template output** and get exports as fast as possible. We now have **working XLSX, PDF, HTML** exporters. **Caching** added → repeat XLSX downloads are **near-instant**.
– **Reality check:** On this GoDaddy MWP host, **saving/zipping** the XLSX costs **~14–17s** even when we do **no edits** (dry-save). Code path is not the bottleneck.
– **Decision:** Accept current speed for now, finish the product features; revisit performance later (host change or host exemption for XLSX responses).
– **What changed today:**
– Added a **speed-tuned writer** (ZipArchive, compression 0, disk caching).
– Added **export caching** keyed on inputs, template, broker/employer meta, and day.
– Shortcodes now pass test flags (`dry_save`, `stream`, etc.) and preserve `sheet=…` fast path.
– **Action for reviewer:** Eric will upload the latest `class-stq-export-compare.php` and `class-stq-shortcodes.php`. Review the writer/save block and the hidden field forwarding.

## 1) Environment & Constraints
– **Plugin:** “Stella Quotes” base v0.3.3 + patches (informal 0.3.4+).
– **Active rate set:** 2025-Q1 (Texas).
– **Hosting:** **GoDaddy Managed WordPress** (tight memory/IO; edge/origin malware scan on ZIPs suspected).
– **Composer autoload:** `/wp-content/plugins/stella-quotes/vendor/autoload.php`.
– **Template (single source of truth):**
`/wp-content/uploads/stq-templates/Sample Output Pages.xlsx`
– Tabs in play: `SxS_FLAT` (original), `SxS_RUNTIME` (light copy), `SxS_EMPTY` (minimal test tab).
– **Export endpoints (admin-post.php):**
– `stq_export_compare_xlsx` ✅
– `stq_export_compare_pdf` ✅
– `stq_export_compare_html` ✅
– `stq_export_compare_ping` ✅ (CSV sanity check)
– **Shortcodes:**
– `

 
Plan #
Plan Name
Network Name
Network Type
Plan Type
Deductible - Individual
Deductible - Family
Coinsurance - Member
Coinsurance - Plan
Out-of-Pocket - Individual
Out-of-Pocket - Family
Virtual Visits
PCP <19
Primary
Specialist
Urgent Care
Emergency
Lab/X-Ray
Imaging
Inpatient Services
Outpatient Surgery
Prescriptions
OON Deductible (Individual/Family)
OON Coinsurance (Member)
OON Out-of-Pocket (Individual/Family)
` renders table + **three** export buttons (XLSX/PDF/HTML).
– `
` plan selector; forwards `sheet=…`.
– `
CarrierPlan #Plan NameFundingTierNetwork NameNetwork TypePlan TypeDeductible - IndividualDeductible - FamilyCoinsurance - MemberCoinsurance - PlanOut-of-Pocket - IndividualOut-of-Pocket - FamilyVirtual VisitsPCP <19PrimarySpecialistPrescriptionsEOESECEFTotal
BCBSTXB001P9M1CHCFIPBlue ChoicePPOCopay
BCBSTXB002P620CHCFIPBlue ChoicePPOCopay
BCBSTXB003P9K3CHCFIPBlue ChoicePPOCopay
BCBSTXB004P9O3CHCFIPBlue ChoicePPOCopay
BCBSTXB005P621CHCFIPBlue ChoicePPOCopay
BCBSTXB006G9K8CHCFIGBlue ChoicePPOCopay
BCBSTXB007G654CHCFIGBlue ChoicePPOCopay
BCBSTXB008G652CHCFIGBlue ChoicePPOCopay
BCBSTXB009G653CHCFIGBlue ChoicePPOCopay
BCBSTXB010G9K6CHCFIGBlue ChoicePPOCopay
BCBSTXB011G9L1CHCFIGBlue ChoicePPOCopay
BCBSTXB012G9L7CHCFIGBlue ChoicePPOCopay
BCBSTXB013G9L5CHCFIGBlue ChoicePPOCopay
BCBSTXB014G650CHCFIGBlue ChoicePPOCopay
BCBSTXB015S663CHCFISBlue ChoicePPOCopay
BCBSTXB016S661CHCFISBlue ChoicePPOCopay
BCBSTXB017S665CHCFISBlue ChoicePPOCopay
BCBSTXB018S9M2CHCFISBlue ChoicePPOCopay
BCBSTXB019S9L9CHCFISBlue ChoicePPOCopay
BCBSTXB020S9N3CHCFISBlue ChoicePPOCopay
BCBSTXB021S9N1CHCFISBlue ChoicePPOCopay
BCBSTXB022S666CHCFISBlue ChoicePPOCopay
BCBSTXB023S9K1CHCFISBlue ChoicePPOCopay
BCBSTXB024S667CHCFISBlue ChoicePPOCopay
BCBSTXB025S660CHCFISBlue ChoicePPOCopay
BCBSTXB026S9L7CHCFISBlue ChoicePPOCopay
BCBSTXB027B662CHCFIBBlue ChoicePPOCopay
BCBSTXB028G651CHCFIGBlue ChoicePPOHSA
BCBSTXB029G656CHCFIGBlue ChoicePPOHSA
BCBSTXB030S9L5CHCFISBlue ChoicePPOHSA
BCBSTXB031S9L3CHCFISBlue ChoicePPOHSA
BCBSTXB032S662CHCFISBlue ChoicePPOHSA
BCBSTXB033S9M4CHCFISBlue ChoicePPOHSA
BCBSTXB034B660CHCFIBBlue ChoicePPOHSA
BCBSTXB035B661CHCFIBBlue ChoicePPOHSA
BCBSTXB036P9M1ADTFIPBlue AdvantageHMOCopay
BCBSTXB037P610ADTFIPBlue AdvantageHMOCopay
BCBSTXB038P9K3ADTFIPBlue AdvantageHMOCopay
BCBSTXB039P9O5ADTFIPBlue AdvantageHMOCopay
BCBSTXB040P611ADTFIPBlue AdvantageHMOCopay
BCBSTXB041G665ADTFIGBlue AdvantageHMOCopay
BCBSTXB042G662ADTFIGBlue AdvantageHMOCopay
BCBSTXB043G9E5ADTFIGBlue AdvantageHMOCopay
BCBSTXB044G663ADTFIGBlue AdvantageHMOCopay
BCBSTXB045G9E3ADTFIGBlue AdvantageHMOCopay
BCBSTXB046G661ADTFIGBlue AdvantageHMOCopay
BCBSTXB047G664ADTFIGBlue AdvantageHMOCopay
BCBSTXB048G9K7ADTFIGBlue AdvantageHMOCopay
BCBSTXB049G9K5ADTFIGBlue AdvantageHMOCopay
BCBSTXB050G660ADTFIGBlue AdvantageHMOCopay
BCBSTXB051S9J7ADTFISBlue AdvantageHMOCopay
BCBSTXB052S643ADTFISBlue AdvantageHMOCopay
BCBSTXB053S9J9ADTFISBlue AdvantageHMOCopay
BCBSTXB054S9E3ADTFISBlue AdvantageHMOCopay
BCBSTXB055S642ADTFISBlue AdvantageHMOCopay
BCBSTXB056S9N3ADTFISBlue AdvantageHMOCopay
BCBSTXB057S9N1ADTFISBlue AdvantageHMOCopay
BCBSTXB058S641ADTFISBlue AdvantageHMOCopay
BCBSTXB059S9L1ADTFISBlue AdvantageHMOCopay
BCBSTXB060S9E5ADTFISBlue AdvantageHMOCopay
BCBSTXB061S640ADTFISBlue AdvantageHMOCopay
BCBSTXB062S644ADTFISBlue AdvantageHMOCopay
BCBSTXB063B661ADTFIBBlue AdvantageHMOCopay
BCBSTXB064G9E1ADTFIGBlue AdvantageHMOHSA
BCBSTXB065G666ADTFIGBlue AdvantageHMOHSA
BCBSTXB066S9J5ADTFISBlue AdvantageHMOHSA
BCBSTXB067S9J3ADTFISBlue AdvantageHMOHSA
BCBSTXB068S9E1ADTFISBlue AdvantageHMOHSA
BCBSTXB069S9K2ADTFISBlue AdvantageHMOHSA
BCBSTXB070B9E1ADTFIBBlue AdvantageHMOHSA
BCBSTXB071B660ADTFIBBlue AdvantageHMOHSA
BSWS001PPO Access Copay 0 7000FIGAccess PPOPPOCopay
BSWS002PPO Access 80 750FIGAccess PPOPPOCopay
BSWS003PPO Access 90 750FISAccess PPOPPOCopay
BSWS004PPO Access 80 1000FIGAccess PPOPPOCopay
BSWS005PPO Access 80 1500FIGAccess PPOPPOCopay
BSWS006PPO Access 90 1900FIGAccess PPOPPOCopay
BSWS007PPO Access 90 2000FIGAccess PPOPPOCopay
BSWS008PPO Access 100 2300FIGAccess PPOPPOCopay
BSWS009PPO Access 100 3000FIGAccess PPOPPOCopay
BSWS010PPO Access 80 3000FIGAccess PPOPPOCopay
BSWS011PPO Access 60 3250FISAccess PPOPPOCopay
BSWS012PPO Access 100 3500FIGAccess PPOPPOCopay
BSWS013PPO Access 70 3800FISAccess PPOPPOCopay
BSWS014PPO Access 100 4000FIGAccess PPOPPOCopay
BSWS015PPO Access 60 4200FISAccess PPOPPOCopay
BSWS016PPO Access 80 4250FISAccess PPOPPOCopay
BSWS017PPO Access 90 4500FIGAccess PPOPPOCopay
BSWS018PPO Access 70 4500FISAccess PPOPPOCopay
BSWS019PPO Access 80 5000FISAccess PPOPPOCopay
BSWS020PPO Access 90 5900FISAccess PPOPPOCopay
BSWS021PPO Access 80 6250FISAccess PPOPPOCopay
BSWS022PPO Access 90 6500FISAccess PPOPPOCopay
BSWS023PPO Access 70 6700FISAccess PPOPPOCopay
BSWS024PPO Access 80 6900FISAccess PPOPPOCopay
BSWS025PPO Access 90 7000FISAccess PPOPPOCopay
BSWS026PPO Access 100 7300FISAccess PPOPPOCopay
BSWS027PPO Access 80 7500FISAccess PPOPPOCopay
BSWS028PPO Access 80 7500FIBAccess PPOPPOCopay
BSWS029PPO Access 90 7900FIBAccess PPOPPOCopay
BSWS030PPO Access 80 8900FISAccess PPOPPOCopay
BSWS031PPO Access 100 9200FIBAccess PPOPPOCopay
BSWS032PPO Access HSA 3300FIGAccess PPOPPOHSA
BSWS033PPO Access HSA 3700FIGAccess PPOPPOHSA
BSWS034PPO Access HSA 5100FISAccess PPOPPOHSA
BSWS035PPO Access HSA 6200FISAccess PPOPPOHSA
BSWS036PPO Access HSA 7300FIBAccess PPOPPOHSA
BSWS037PPO+ Copay 0 7000FIGBSW+ PPOPPOCopay
BSWS038PPO+ 80 750FIGBSW+ PPOPPOCopay
BSWS039PPO+ 90 750FISBSW+ PPOPPOCopay
BSWS040PPO+ 80 1000FIGBSW+ PPOPPOCopay
BSWS041PPO+ 80 1500FIGBSW+ PPOPPOCopay
BSWS042PPO+ 90 1900FIGBSW+ PPOPPOCopay
BSWS043PPO+ 90 2000FIGBSW+ PPOPPOCopay
BSWS044PPO+ 100 2300FIGBSW+ PPOPPOCopay
BSWS045PPO+ 100 3000FIGBSW+ PPOPPOCopay
BSWS046PPO+ 80 3000FIGBSW+ PPOPPOCopay
BSWS047PPO+ 60 3250FISBSW+ PPOPPOCopay
BSWS048PPO+ 100 3500FIGBSW+ PPOPPOCopay
BSWS049PPO+ 70 3800FISBSW+ PPOPPOCopay
BSWS050PPO+ 100 4000FIGBSW+ PPOPPOCopay
BSWS051PPO+ 60 4200FISBSW+ PPOPPOCopay
BSWS052PPO+ 80 4250FISBSW+ PPOPPOCopay
BSWS053PPO+ 90 4500FIGBSW+ PPOPPOCopay
BSWS054PPO+ 70 4500FISBSW+ PPOPPOCopay
BSWS055PPO+ 80 5000FISBSW+ PPOPPOCopay
BSWS056PPO+ 90 5900FISBSW+ PPOPPOCopay
BSWS057PPO+ 80 6250FISBSW+ PPOPPOCopay
BSWS058PPO+ 90 6500FISBSW+ PPOPPOCopay
BSWS059PPO+ 70 6700FISBSW+ PPOPPOCopay
BSWS060PPO+ 80 6900FISBSW+ PPOPPOCopay
BSWS061PPO+ 90 7000FISBSW+ PPOPPOCopay
BSWS062PPO+ 100 7300FISBSW+ PPOPPOCopay
BSWS063PPO+ 80 7500FISBSW+ PPOPPOCopay
BSWS064PPO+ 80 7500FIBBSW+ PPOPPOCopay
BSWS065PPO+ 90 7900FIBBSW+ PPOPPOCopay
BSWS066PPO+ 80 8900FISBSW+ PPOPPOCopay
BSWS067PPO+ 100 9200FIBBSW+ PPOPPOCopay
BSWS068PPO+ HSA 3300FIGBSW+ PPOPPOHSA
BSWS069PPO+ HSA 3700FIGBSW+ PPOPPOHSA
BSWS070PPO+ HSA 5100FISBSW+ PPOPPOHSA
BSWS071PPO+ HSA 6200FISBSW+ PPOPPOHSA
BSWS072PPO+ HSA 7300FIBBSW+ PPOPPOHSA
BSWS073HMO+ Copay 0 7000FIGBSW+ HMOHMOCopay
BSWS074HMO+ SM 0 9200FIGBSW+ HMOHMOCopay
BSWS075HMO+ 80 750FIGBSW+ HMOHMOCopay
BSWS076HMO+ 90 750FISBSW+ HMOHMOCopay
BSWS077HMO+ 80 1000FIGBSW+ HMOHMOCopay
BSWS078HMO+ 80 1500FIGBSW+ HMOHMOCopay
BSWS079HMO+ 90 1900FIGBSW+ HMOHMOCopay
BSWS080HMO+ 90 2000FIGBSW+ HMOHMOCopay
BSWS081HMO+ 100 2300FIGBSW+ HMOHMOCopay
BSWS082HMO+ 100 3000FIGBSW+ HMOHMOCopay
BSWS083HMO+ 80 3000FIGBSW+ HMOHMOCopay
BSWS084HMO+ 60 3250FISBSW+ HMOHMOCopay
BSWS085HMO+ 100 3500FIGBSW+ HMOHMOCopay
BSWS086HMO+ 70 3800FISBSW+ HMOHMOCopay
BSWS087HMO+ 100 4000FIGBSW+ HMOHMOCopay
BSWS088HMO+ 60 4200FISBSW+ HMOHMOCopay
BSWS089HMO+ 80 4250FISBSW+ HMOHMOCopay
BSWS090HMO+ 90 4500FIGBSW+ HMOHMOCopay
BSWS091HMO+ 70 4500FISBSW+ HMOHMOCopay
BSWS092HMO+ 80 5000FISBSW+ HMOHMOCopay
BSWS093HMO+ 90 5900FISBSW+ HMOHMOCopay
BSWS094HMO+ 80 6250FISBSW+ HMOHMOCopay
BSWS095HMO+ 90 6500FISBSW+ HMOHMOCopay
BSWS096HMO+ 70 6700FISBSW+ HMOHMOCopay
BSWS097HMO+ 80 6900FISBSW+ HMOHMOCopay
BSWS098HMO+ 90 7000FISBSW+ HMOHMOCopay
BSWS099HMO+ 100 7300FISBSW+ HMOHMOCopay
BSWS100HMO+ 80 7500FISBSW+ HMOHMOCopay
BSWS101HMO+ 80 7500FIBBSW+ HMOHMOCopay
BSWS102HMO+ 90 7900FIBBSW+ HMOHMOCopay
BSWS103HMO+ 80 8900FISBSW+ HMOHMOCopay
BSWS104HMO+ 100 9200FIBBSW+ HMOHMOCopay
BSWS105HMO+ HSA 3300FIGBSW+ HMOHMOHSA
BSWS106HMO+ HSA 3700FIGBSW+ HMOHMOHSA
BSWS107HMO+ HSA 5100FISBSW+ HMOHMOHSA
BSWS108HMO+ HSA 6200FISBSW+ HMOHMOHSA
BSWS109HMO+ HSA 7300FIBBSW+ HMOHMOHSA
BSWS110HMO Premier Copay 0 7000FIGPremier HMOHMOCopay
BSWS111HMO Premier SM 0 9200FIGPremier HMOHMOCopay
BSWS112HMO Premier 80 750FIGPremier HMOHMOCopay
BSWS113HMO Premier 90 750FISPremier HMOHMOCopay
BSWS114HMO Premier 80 1000FIGPremier HMOHMOCopay
BSWS115HMO Premier 80 1500FIGPremier HMOHMOCopay
BSWS116HMO Premier 90 1900FIGPremier HMOHMOCopay
BSWS117HMO Premier 90 2000FIGPremier HMOHMOCopay
BSWS118HMO Premier 100 2300FIGPremier HMOHMOCopay
BSWS119HMO Premier 100 3000FIGPremier HMOHMOCopay
BSWS120HMO Premier 80 3000FIGPremier HMOHMOCopay
BSWS121HMO Premier 60 3250FISPremier HMOHMOCopay
BSWS122HMO Premier 100 3500FIGPremier HMOHMOCopay
BSWS123HMO Premier 70 3800FISPremier HMOHMOCopay
BSWS124HMO Premier 100 4000FIGPremier HMOHMOCopay
BSWS125HMO Premier 60 4200FISPremier HMOHMOCopay
BSWS126HMO Premier 80 4250FISPremier HMOHMOCopay
BSWS127HMO Premier 90 4500FIGPremier HMOHMOCopay
BSWS128HMO Premier 70 4500FISPremier HMOHMOCopay
BSWS129HMO Premier 80 5000FISPremier HMOHMOCopay
BSWS130HMO Premier 90 5900FISPremier HMOHMOCopay
BSWS131HMO Premier 80 6250FISPremier HMOHMOCopay
BSWS132HMO Premier 90 6500FISPremier HMOHMOCopay
BSWS133HMO Premier 70 6700FISPremier HMOHMOCopay
BSWS134HMO Premier 80 6900FISPremier HMOHMOCopay
BSWS135HMO Premier 90 7000FISPremier HMOHMOCopay
BSWS136HMO Premier 100 7300FISPremier HMOHMOCopay
BSWS137HMO Premier 80 7500FISPremier HMOHMOCopay
BSWS138HMO Premier 80 7500FIBPremier HMOHMOCopay
BSWS139HMO Premier 90 7900FIBPremier HMOHMOCopay
BSWS140HMO Premier 80 8900FISPremier HMOHMOCopay
BSWS141HMO Premier 100 9200FIBPremier HMOHMOCopay
BSWS142HMO Premier HSA 3300FIGPremier HMOHMOHSA
BSWS143HMO Premier HSA 3700FIGPremier HMOHMOHSA
BSWS144HMO Premier HSA 5100FISPremier HMOHMOHSA
BSWS145HMO Premier HSA 6200FISPremier HMOHMOHSA
BSWS146HMO Premier HSA 7300FIBPremier HMOHMOHSA
UHCU001DY-AKFIPChoice +PPOCopay
UHCU002DX-9JFIPChoiceEPOCopay
UHCU003DY-A3FIPNavigateHMOCopay
UHCU004DX-9QFIPChoice +PPOCopay
UHCU005DX-9RFIPChoiceEPOCopay
UHCU006DY-APFIPNavigateHMOCopay
UHCU007DX-9UFIPChoice +PPOCopay
UHCU008DX-9VFIPChoiceEPOCopay
UHCU009DY-ARFIPNavigateHMOCopay
UHCU010DX-95FIGChoice +PPOCopay
UHCU011DX-96FIGChoiceEPOCopay
UHCU012DY-AWFIGNavigateHMOCopay
UHCU013DY-ABFIGChoice +PPOCopay
UHCU014DY-ACFIGChoiceEPOCopay
UHCU015DY-A8FIGNavigateHMOCopay
UHCU016DX-9HFIGChoice +PPOCopay
UHCU017DX-9IFIGChoiceEPOCopay
UHCU018DY-A2FIGNavigateHMOCopay
UHCU019DX-9MFIGChoice +PPOCopay
UHCU020DY-AFFIGChoiceEPOCopay
UHCU021DY-A5FIGNavigateHMOCopay
UHCU022DX-92FIPChoice +PPOCopay
UHCU023DX-93FIPChoiceEPOCopay
UHCU024DY-AUFIPNavigateHMOCopay
UHCU025DX-9LFIPChoice +PPOCopay
UHCU026DX-9KFIPChoiceEPOCopay
UHCU027DY-A4FIPNavigateHMOCopay
UHCU028DY-AMFIPChoice +PPOCopay
UHCU029DX-9SFIPChoice +PPOCopay
UHCU030DX-9TFIPChoiceEPOCopay
UHCU031DY-AQFIPNavigateHMOCopay
UHCU032DX-9WFIGChoice +PPOCopay
UHCU033DX-9XFIGChoiceEPOCopay
UHCU034DY-ASFIGNavigateHMOCopay
UHCU035DX-9YFIGChoice +PPOCopay
UHCU036DX-9ZFIGChoiceEPOCopay
UHCU037DY-ATFIGNavigateHMOCopay
UHCU038DY-ALFIGChoice +PPOCopay
UHCU039DX-94FIGChoiceEPOCopay
UHCU040DY-AVFIGNavigateHMOCopay
UHCU041DX-97FIGChoice +PPOCopay
UHCU042DX-98FIGChoiceEPOCopay
UHCU043DY-AXFIGNavigateHMOCopay
UHCU044DY-AAFIGChoice +PPOCopay
UHCU045DX-99FIGChoiceEPOCopay
UHCU046DY-A9FIGNavigateHMOCopay
UHCU047DY-ANFIGChoice +PPOCopay
UHCU048DX-9FFIGChoice +PPOCopay
UHCU049DX-9GFIGChoiceEPOCopay
UHCU050DY-AYFIGNavigateHMOCopay
UHCU051DY-AEFIGChoice +PPOCopay
UHCU052DY-ADFIGChoiceEPOCopay
UHCU053DY-AZFIGNavigateHMOCopay
UHCU054DY-AOFIGChoice +PPOCopay
UHCU055DY-AGFISChoice +PPOCopay
UHCU056DY-AHFISChoiceEPOCopay
UHCU057DY-A6FISNavigateHMOCopay
UHCU058DY-AIFISChoice +PPOCopay
UHCU059DY-AJFISChoiceEPOCopay
UHCU060DY-A7FISNavigateHMOCopay
UHCU061DX-83FIGChoice +PPOHSA
UHCU062DX-84FIGChoiceEPOHSA
UHCU063DX-9BFIGNavigateHMOHSA
UHCU064DX-8RFISChoice +PPOHSA
UHCU065DX-8SFISChoiceEPOHSA
UHCU066DX-9AFISNavigateHMOHSA
UHCU067DX-8VFISChoice +PPOHSA
UHCU068DX-8WFISChoiceEPOHSA
UHCU069DX-86FISNavigateHMOHSA
UHCU070DX-8ZFIBChoice +PPOHSA
UHCU071DX-82FIBChoiceEPOHSA
UHCU072DX-88FIBNavigateHMOHSA
UHCU073DX-8TFISChoice +PPOHSA
UHCU074DX-8UFISChoiceEPOHSA
UHCU075DX-85FISNavigateHMOHSA
UHCU076DX-8XFISChoice +PPOHSA
UHCU077DX-8YFISChoiceEPOHSA
UHCU078DX-87FISNavigateHMOHSA
UHCU079DX-9CFIGChoice +PPOCopay
UHCU080DX-9DFIGChoiceEPOCopay
UHCU081DX-9EFISChoice +PPOCopay
UHCU082DX-9NFISChoiceEPOCopay
UHCU083DX-9OFISChoice +PPOCopay
UHCU084DX-9PFISChoiceEPOCopay
` (grid listing).
– `Provide carrier and plan, e.g. [stq_diag_benefits carrier="BCBSTX" plan="B046"]` (debug).

## 2) Template Design Rules (how the exporter fills sheets)
– **Column Mode (SxS style)** — current SxS tabs use this:
– Put literal `[[STQ_TABLE]]` at the **top-left cell** of the plan grid.
– **Benefit labels** sit **one column left** of that marker.
– Exporter writes **header row (plan names)** on the marker row and **plan values** below.
– **Row Mode (wide pages)**:
– Put `[[STQ_TABLE_ROWS]]` in the **first plan row**.
– One row **above** it is the **unmerged short-header row** (e.g., `Ded-Ind`, `Coins-Plan`).
– You can mix modes across sheets.
– **Placeholders** (auto-fill in top ~120 rows):
`[[STQ_EMPLOYER]]`, `[[STQ_COMPANY]]`, `[[STQ_BROKER_*]]`, `[[STQ_EFFECTIVE]]`,
`[[STQ_RATE_SET]]`, `[[STQ_AREA]]`, `[[STQ_COUNTY]]`, `[[STQ_DATE_TODAY]]`,
`[[STQ_PLANS]]`, `[[STQ_DISCLAIMER]]`.
If no disclaimer provided, a safe default is injected.

## 3) Label Mapping (aliases → canonical keys)
Normalization lets templates use familiar labels. Examples:
– `plannumber` → `plan#`, `plan id`, `planid`
– `planname` → `name`
– `tier` ↔ `metal` (P/G/S/B)
– `networkname` → `network`
– `plantype` → `plan type`
– `deductibleindividual` → `ded-ind`, `individual`
– `outofpocketindividual` → `oop-ind`
– OON group: ded/coins/oop (auto “N/A” for HMO/EPO via helpers).
Unrecognized rows/cols are ignored so divider bars remain.

## 4) Where we started (this session)
– We already had a reliability fix that **scanned all sheets** for markers. Reliable, but slow on GoDaddy.
– Ask: **restore speed** while **keeping styling**.
– We switched to **direct-write into the loaded template workbook** (no deep copy). Preserved style; helped a bit.

## 5) What we changed **today**
### 5.1 Shortcodes (`class-stq-shortcodes.php`)
– Added hidden fields so exports can use the **fast path** (`sheet=`).
– Added test/ops flags (forwarded through forms):
– `dry_save=1` → open + save (no edits) to time pure ZIP step.
– `stream=1` → stream directly to `php://output` (optional branch).
– `drop_names`, `fast_strip` (placeholders for future experiments; harmless if unused).
– Export buttons under the table post all selection/meta safely (nonce).

**Example shortcodes to run:**
“`text

 B001 — P9M1CHCB002 — P620CHCB003 — P9K3CHC
Plan #B001B002B003
Plan NameP9M1CHCP620CHCP9K3CHC
Network NameBlue ChoiceBlue ChoiceBlue Choice
Network TypePPOPPOPPO
Plan TypeCopayCopayCopay
Deductible - Individual$0$350$600
Deductible - Family$0$1,050$1,200
Coinsurance - Member10%20%20%
Coinsurance - Plan90%80%80%
Out-of-Pocket - Individual$6,300$1,600$1,800
Out-of-Pocket - Family$12,600$4,800$3,600
Virtual Visits$20$35$35
PCP <19$20$35$35
Primary$20$35$35
Specialist$40$70$70
Urgent Care$75$35$75
Emergency$500 + D&C$300 + D&C$300 + D&C
Lab/X-RayD&CD&CD&C
ImagingD&C$250$250
Inpatient ServicesD&C$150 + D&C$150 + D&C
Outpatient SurgeryD&C$100 + D&C$100 + D&C
Prescriptions$0-10-50-100-150-250$0-10-35-75-150-250$0-10-50-100-150-250
OON Deductible (Individual/Family)$5,000 / $10,000$700 / $2,100$1,200 / $2,400
OON Coinsurance (Member)50%40%40%
OON Out-of-Pocket (Individual/Family)Unlimited / UnlimitedUnlimited / UnlimitedUnlimited / Unlimited

 B001 — P9M1CHCB002 — P620CHCB003 — P9K3CHC
Plan #B001B002B003
Plan NameP9M1CHCP620CHCP9K3CHC
Network NameBlue ChoiceBlue ChoiceBlue Choice
Network TypePPOPPOPPO
Plan TypeCopayCopayCopay
Deductible - Individual$0$350$600
Deductible - Family$0$1,050$1,200
Coinsurance - Member10%20%20%
Coinsurance - Plan90%80%80%
Out-of-Pocket - Individual$6,300$1,600$1,800
Out-of-Pocket - Family$12,600$4,800$3,600
Virtual Visits$20$35$35
PCP <19$20$35$35
Primary$20$35$35
Specialist$40$70$70
Urgent Care$75$35$75
Emergency$500 + D&C$300 + D&C$300 + D&C
Lab/X-RayD&CD&CD&C
ImagingD&C$250$250
Inpatient ServicesD&C$150 + D&C$150 + D&C
Outpatient SurgeryD&C$100 + D&C$100 + D&C
Prescriptions$0-10-50-100-150-250$0-10-35-75-150-250$0-10-50-100-150-250
OON Deductible (Individual/Family)$5,000 / $10,000$700 / $2,100$1,200 / $2,400
OON Coinsurance (Member)50%40%40%
OON Out-of-Pocket (Individual/Family)Unlimited / UnlimitedUnlimited / UnlimitedUnlimited / Unlimited

 B001 — P9M1CHCB002 — P620CHCB003 — P9K3CHC
Plan #B001B002B003
Plan NameP9M1CHCP620CHCP9K3CHC
Network NameBlue ChoiceBlue ChoiceBlue Choice
Network TypePPOPPOPPO
Plan TypeCopayCopayCopay
Deductible - Individual$0$350$600
Deductible - Family$0$1,050$1,200
Coinsurance - Member10%20%20%
Coinsurance - Plan90%80%80%
Out-of-Pocket - Individual$6,300$1,600$1,800
Out-of-Pocket - Family$12,600$4,800$3,600
Virtual Visits$20$35$35
PCP <19$20$35$35
Primary$20$35$35
Specialist$40$70$70
Urgent Care$75$35$75
Emergency$500 + D&C$300 + D&C$300 + D&C
Lab/X-RayD&CD&CD&C
ImagingD&C$250$250
Inpatient ServicesD&C$150 + D&C$150 + D&C
Outpatient SurgeryD&C$100 + D&C$100 + D&C
Prescriptions$0-10-50-100-150-250$0-10-35-75-150-250$0-10-50-100-150-250
OON Deductible (Individual/Family)$5,000 / $10,000$700 / $2,100$1,200 / $2,400
OON Coinsurance (Member)50%40%40%
OON Out-of-Pocket (Individual/Family)Unlimited / UnlimitedUnlimited / UnlimitedUnlimited / Unlimited

 B001 — P9M1CHCB002 — P620CHCB003 — P9K3CHC
Plan #B001B002B003
Plan NameP9M1CHCP620CHCP9K3CHC
Network NameBlue ChoiceBlue ChoiceBlue Choice
Network TypePPOPPOPPO
Plan TypeCopayCopayCopay
Deductible - Individual$0$350$600
Deductible - Family$0$1,050$1,200
Coinsurance - Member10%20%20%
Coinsurance - Plan90%80%80%
Out-of-Pocket - Individual$6,300$1,600$1,800
Out-of-Pocket - Family$12,600$4,800$3,600
Virtual Visits$20$35$35
PCP <19$20$35$35
Primary$20$35$35
Specialist$40$70$70
Urgent Care$75$35$75
Emergency$500 + D&C$300 + D&C$300 + D&C
Lab/X-RayD&CD&CD&C
ImagingD&C$250$250
Inpatient ServicesD&C$150 + D&C$150 + D&C
Outpatient SurgeryD&C$100 + D&C$100 + D&C
Prescriptions$0-10-50-100-150-250$0-10-35-75-150-250$0-10-50-100-150-250
OON Deductible (Individual/Family)$5,000 / $10,000$700 / $2,100$1,200 / $2,400
OON Coinsurance (Member)50%40%40%
OON Out-of-Pocket (Individual/Family)Unlimited / UnlimitedUnlimited / UnlimitedUnlimited / Unlimited

### 5.2 Exporter (`class-stq-export-compare.php`)
– **Direct-write** into the loaded template (keeps all styles).
– **Writer/save tuned for speed:**
– `ZipArchive` if available (faster than PclZip).
– `setCompressionLevel(0)` to lower CPU at save time.
– `setPreCalculateFormulas(false)`, `setIncludeCharts(false)`.
– Disk caching directory under `/uploads/stq-tmp`.
– **Added export caching**:
– Cache dir: `/uploads/stq-cache`.
– Cache key includes: `sheet`, `plans`, `rate_set`, `area`, **broker/employer meta**, `disclaimer`, **today** (keeps date fresh), and **template mtime/MD5** (auto-busts if template changes).
– Cache hit streams instantly; logs mark `(cache hit)`.
– **Diagnostics**:
– Log file: `/wp-content/uploads/stq-tmp/stq-export.log`
– Instrumented spans: `matrix`, `load_fast`, `placeholders`, `write`, `save`, `total`.

## 6) Timings we observed (selected)
> These are **server-side** times from the log. We focused on `save=…s` to isolate bottlenecks.

– Early runs on `SxS_FLAT` (after direct-write; before tweaks):
`save≈15–18s`, `total≈21–24s`.
– After removing **named cells** from template:
Still `save≈17.3s`, `total≈23.7s` → **no meaningful change**.
– After **writer tweaks** (ZipArchive, compression 0, etc.):
`save≈14.6–17.0s` (slight improvement).
– **Dry save** on totally minimal tab `SxS_EMPTY` (no writes at all):
`save=16.367s` → **host save/zip is the bottleneck** (not our writes; not sheet complexity).
– **Caching enabled** (same selection twice):
– First run: `save≈16.1s`, `total≈22s`.
– Second run: `save=0.000s`, `total≈6.019s (cache hit)` → **repeat exports are fast**.

**Conclusion:** Code path is efficient (`placeholders/write ≈ 0s`). The time is burned in **PhpSpreadsheet ZIP save** under GoDaddy MWP (likely CPU/IO and/or malware scanning on ZIP responses). This matches intermittent past behavior: it _did_ run in ~2s before; shared hosting variability can swing this without code changes.

7) Host notes & optional ops steps
– **Suspect**: edge/origin **ZIP/malware scanning** or noisy neighbors throttling CPU/IO.
– **Optional support ticket text** (paste to GoDaddy):

 

 

– **Alternatives later** (not for this weekend):
– Move only the export endpoint to a tiny VPS (PHP 8.x + ZipArchive).
– Offer a “Legacy XLS (fast)” fallback (BIFF/XLS) if ever acceptable (not a current goal).

## 8) Current state (2025-09-27)
– **Works:** XLSX/PDF/HTML exports, styled output preserved, runtime tab option, **caching** for repeats.
– **Performance:** First-run XLSX save ~15–17s on this host; **cache hits** are near-instant.
– **Diagnostics:** Logging active; easy to compare runs.

## 9) What’s next (we will circle back to speed later)
Eric has ~**12 hours** left this weekend and needs a **working quoting tool by end of that time**. The exporter is functional; we’ll **prioritize features** now and revisit speed later if needed.

### 9.1 Immediate feature roadmap (ship this weekend)
1. **Save Case** (high value)
– New “Save Case” button under compare table stores: plans, rate set, area, employer/broker meta, disclaimer.
– Reopen a Case → re-render compare and export in one click (benefits from cache).
2. **Compare Picker “Choose-for-me”** defaults
– Already wired to optional `STQ_Compare_Picker_Plus::auto_select(…)`.
– Provide sensible defaults (count, bucket, anchor, balance).
3. **PDF packet polish**
– Headers/footers with logo, page numbers, disclaimer footer; ensure 1-click print quality.
4. **Placeholders pass**
– Confirm all `[[STQ_*]]` fill correctly across current/future tabs.
5. **Q1 2026 Rates hookup**
– Wire import path and table lookups so new data can drop in with minimal code changes.

### 9.2 After that (perf revisit)
– If GoDaddy grants exemption → we should see **~2–4s** saves again.
– Else consider the small VPS export microservice or a more aggressive runtime tab (fewer merges/styles) if we want to squeeze more speed without host change.

## 10) Repro steps for reviewers

### 10.1 Template tabs
– **SxS_FLAT**: original styled tab with `[[STQ_TABLE]]`.
– **SxS_RUNTIME**: light copy of `SxS_FLAT` (CF removed, print area & breaks reset).
– **SxS_EMPTY**: test tab created with only `[[STQ_TABLE]]` at `B5` (labels optional; use `dry_save=1` for save-only test).

### 10.2 Shortcodes to exercise
“`text

 B001 — P9M1CHCB002 — P620CHCB003 — P9K3CHC
Plan #B001B002B003
Plan NameP9M1CHCP620CHCP9K3CHC
Network NameBlue ChoiceBlue ChoiceBlue Choice
Network TypePPOPPOPPO
Plan TypeCopayCopayCopay
Deductible - Individual$0$350$600
Deductible - Family$0$1,050$1,200
Coinsurance - Member10%20%20%
Coinsurance - Plan90%80%80%
Out-of-Pocket - Individual$6,300$1,600$1,800
Out-of-Pocket - Family$12,600$4,800$3,600
Virtual Visits$20$35$35
PCP <19$20$35$35
Primary$20$35$35
Specialist$40$70$70
Urgent Care$75$35$75
Emergency$500 + D&C$300 + D&C$300 + D&C
Lab/X-RayD&CD&CD&C
ImagingD&C$250$250
Inpatient ServicesD&C$150 + D&C$150 + D&C
Outpatient SurgeryD&C$100 + D&C$100 + D&C
Prescriptions$0-10-50-100-150-250$0-10-35-75-150-250$0-10-50-100-150-250
OON Deductible (Individual/Family)$5,000 / $10,000$700 / $2,100$1,200 / $2,400
OON Coinsurance (Member)50%40%40%
OON Out-of-Pocket (Individual/Family)Unlimited / UnlimitedUnlimited / UnlimitedUnlimited / Unlimited

 B001 — P9M1CHCB002 — P620CHCB003 — P9K3CHC
Plan #B001B002B003
Plan NameP9M1CHCP620CHCP9K3CHC
Network NameBlue ChoiceBlue ChoiceBlue Choice
Network TypePPOPPOPPO
Plan TypeCopayCopayCopay
Deductible - Individual$0$350$600
Deductible - Family$0$1,050$1,200
Coinsurance - Member10%20%20%
Coinsurance - Plan90%80%80%
Out-of-Pocket - Individual$6,300$1,600$1,800
Out-of-Pocket - Family$12,600$4,800$3,600
Virtual Visits$20$35$35
PCP <19$20$35$35
Primary$20$35$35
Specialist$40$70$70
Urgent Care$75$35$75
Emergency$500 + D&C$300 + D&C$300 + D&C
Lab/X-RayD&CD&CD&C
ImagingD&C$250$250
Inpatient ServicesD&C$150 + D&C$150 + D&C
Outpatient SurgeryD&C$100 + D&C$100 + D&C
Prescriptions$0-10-50-100-150-250$0-10-35-75-150-250$0-10-50-100-150-250
OON Deductible (Individual/Family)$5,000 / $10,000$700 / $2,100$1,200 / $2,400
OON Coinsurance (Member)50%40%40%
OON Out-of-Pocket (Individual/Family)Unlimited / UnlimitedUnlimited / UnlimitedUnlimited / Unlimited

 B001 — P9M1CHCB002 — P620CHCB003 — P9K3CHC
Plan #B001B002B003
Plan NameP9M1CHCP620CHCP9K3CHC
Network NameBlue ChoiceBlue ChoiceBlue Choice
Network TypePPOPPOPPO
Plan TypeCopayCopayCopay
Deductible - Individual$0$350$600
Deductible - Family$0$1,050$1,200
Coinsurance - Member10%20%20%
Coinsurance - Plan90%80%80%
Out-of-Pocket - Individual$6,300$1,600$1,800
Out-of-Pocket - Family$12,600$4,800$3,600
Virtual Visits$20$35$35
PCP <19$20$35$35
Primary$20$35$35
Specialist$40$70$70
Urgent Care$75$35$75
Emergency$500 + D&C$300 + D&C$300 + D&C
Lab/X-RayD&CD&CD&C
ImagingD&C$250$250
Inpatient ServicesD&C$150 + D&C$150 + D&C
Outpatient SurgeryD&C$100 + D&C$100 + D&C
Prescriptions$0-10-50-100-150-250$0-10-35-75-150-250$0-10-50-100-150-250
OON Deductible (Individual/Family)$5,000 / $10,000$700 / $2,100$1,200 / $2,400
OON Coinsurance (Member)50%40%40%
OON Out-of-Pocket (Individual/Family)Unlimited / UnlimitedUnlimited / UnlimitedUnlimited / Unlimited

 B001 — P9M1CHCB002 — P620CHCB003 — P9K3CHC
Plan #B001B002B003
Plan NameP9M1CHCP620CHCP9K3CHC
Network NameBlue ChoiceBlue ChoiceBlue Choice
Network TypePPOPPOPPO
Plan TypeCopayCopayCopay
Deductible - Individual$0$350$600
Deductible - Family$0$1,050$1,200
Coinsurance - Member10%20%20%
Coinsurance - Plan90%80%80%
Out-of-Pocket - Individual$6,300$1,600$1,800
Out-of-Pocket - Family$12,600$4,800$3,600
Virtual Visits$20$35$35
PCP <19$20$35$35
Primary$20$35$35
Specialist$40$70$70
Urgent Care$75$35$75
Emergency$500 + D&C$300 + D&C$300 + D&C
Lab/X-RayD&CD&CD&C
ImagingD&C$250$250
Inpatient ServicesD&C$150 + D&C$150 + D&C
Outpatient SurgeryD&C$100 + D&C$100 + D&C
Prescriptions$0-10-50-100-150-250$0-10-35-75-150-250$0-10-50-100-150-250
OON Deductible (Individual/Family)$5,000 / $10,000$700 / $2,100$1,200 / $2,400
OON Coinsurance (Member)50%40%40%
OON Out-of-Pocket (Individual/Family)Unlimited / UnlimitedUnlimited / UnlimitedUnlimited / Unlimited

 B001 — P9M1CHCB002 — P620CHCB003 — P9K3CHC
Plan #B001B002B003
Plan NameP9M1CHCP620CHCP9K3CHC
Network NameBlue ChoiceBlue ChoiceBlue Choice
Network TypePPOPPOPPO
Plan TypeCopayCopayCopay
Deductible - Individual$0$350$600
Deductible - Family$0$1,050$1,200
Coinsurance - Member10%20%20%
Coinsurance - Plan90%80%80%
Out-of-Pocket - Individual$6,300$1,600$1,800
Out-of-Pocket - Family$12,600$4,800$3,600
Virtual Visits$20$35$35
PCP <19$20$35$35
Primary$20$35$35
Specialist$40$70$70
Urgent Care$75$35$75
Emergency$500 + D&C$300 + D&C$300 + D&C
Lab/X-RayD&CD&CD&C
ImagingD&C$250$250
Inpatient ServicesD&C$150 + D&C$150 + D&C
Outpatient SurgeryD&C$100 + D&C$100 + D&C
Prescriptions$0-10-50-100-150-250$0-10-35-75-150-250$0-10-50-100-150-250
OON Deductible (Individual/Family)$5,000 / $10,000$700 / $2,100$1,200 / $2,400
OON Coinsurance (Member)50%40%40%
OON Out-of-Pocket (Individual/Family)Unlimited / UnlimitedUnlimited / UnlimitedUnlimited / Unlimited

10.3 Logs to inspect

/wp-content/uploads/stq-tmp/stq-export.log

Look for:
– `save=…s` — host ZIP time
– `(cache hit)` — confirm caching path

## 11) Files to review (Eric will upload)
– `wp-content/plugins/stella-quotes/includes/class-stq-export-compare.php`
– Verify **writer/save (speed-tuned + cache)** block present.
– Verify cache key includes **meta + today + template hash/mtime**.
– Verify log lines include `(cache hit)` on cached runs.
– `wp-content/plugins/stella-quotes/includes/class-stq-shortcodes.php`
– Verify hidden inputs include `sheet`, `plans`, `rate_set`, `area`, meta fields, and **flags** (`dry_save`, `stream`, `drop_names`, `fast_strip`).
– Verify export forms post to `admin-post.php` with nonce.

## 12) Known issues / Non-goals
– **Non-goal:** “Ugly/raw” spreadsheets or disabling styling. We keep broker-ready outputs.
– **Performance:** First-run XLSX save is host-limited right now; caching mitigates repeat exports.
– **Template complexity:** Named ranges removal did not materially change save time on this host.
– **`SxS_EMPTY` write error:** Expected when labels are missing; only used for dry-save timing.

## 13) Support snippets (copy/paste)

**GoDaddy support ask:**

**Bypass cache (when needed):** add `nocache=1` as a POST field; the exporter honors it if enabled.

## 14) Appendix — Quick reference

### 14.1 Placeholders supported
`[[STQ_EMPLOYER]]`, `[[STQ_COMPANY]]`, `[[STQ_BROKER_NAME]]`, `[[STQ_BROKER_AGENCY]]`,
`[[STQ_BROKER_EMAIL]]`, `[[STQ_BROKER_PHONE]]`, `[[STQ_BROKER_WEBSITE]]`,
`[[STQ_BROKER_LINE]]`, `[[STQ_BROKER_CONTACT]]`, `[[STQ_EFFECTIVE]]`, `[[STQ_RATE_SET]]`,
`[[STQ_AREA]]`, `[[STQ_COUNTY]]`, `[[STQ_DATE_TODAY]]`, `[[STQ_PLANS]]`, `[[STQ_DISCLAIMER]]`.

### 14.2 OON helpers
– Pair rows show “N/A” for HMO/EPO (`na_if_oonsuppressed_pair`).
– Coins row shows “N/A” for HMO/EPO (`na_if_oonsuppressed_coins`).

14.3 Diagnostics sample line

[2025-09-27 23:46:05] path=FAST-cols sheet=SxS_RUNTIME matrix=0.018s load_fast=0.136s load_scan=0.000s placeholders=0.019s write=0.002s save=17.754s total=24.126s

15) Final notes
– We will **circle back** on first-run speed once either (a) GoDaddy exempts the XLSX response from scanning, or (b) we decide to move the export endpoint to a small VPS. Neither is required to keep building.
– Priority now: ship a **working quoting tool** this weekend (exporter ✅, features next). The caching added today keeps the UX snappy for repeated compares while we demo and iterate.

 


# XLSX Export Caching — What we did and why

## Why we needed it
– Your logs showed the **only slow part** is the final **XLSX save/zip** on the server (`save ≈ 14–17s`), even when we do **no cell edits**. That’s host I/O/CPU/scanning, not our code.
– We can’t speed the **first** save if the host is slow, but we can avoid **repeating** that slow operation for the **same** export.

## What we implemented
We added a **file cache** so that after one export is generated and saved once, **subsequent exports with the same inputs** are served directly from disk **without re-saving** the workbook.

– **Cache folder:** `/wp-content/uploads/stq-cache`
– **Temp/caching workspace:** `/wp-content/uploads/stq-tmp`
– **Writer tuning:** use `ZipArchive` (if available), compression level `0`, no formula precalc, no charts → marginally faster first save.

## How it works (flow)
1. **Build a cache key** (a SHA-1 hash) from all inputs that affect the file:
– `sheet` (e.g., `SxS_FLAT` / `SxS_RUNTIME`)
– `plans` (order-sensitive list)
– `rate_set`, `area`
– **Broker/employer meta & disclaimer** (so headers/footers + placeholders match)
– **Today’s date** (`[[STQ_DATE_TODAY]]`) → daily refresh
– **Template fingerprint** (mtime + MD5) → auto-bust cache when template changes
2. **Check cache folder** for `stq-.xlsx`.
– **If present (cache hit):** stream that file immediately (near-instant), log `(cache hit)`.
– **If missing (cache miss):**
– Save the current workbook to a temp file (incurs the slow host save once)
– Copy it into the cache as `stq-.xlsx`
– Stream to the user

### Pseudocode (simplified)

## What this achieves
– **First export** for a given selection: still ~host-limited (e.g., ~16s).
– **Repeat export** for the same selection (same page, inputs, meta, template, same day):
– **Instant** (no re-save), your log will show `save=0.000s` and `(cache hit)`.

## Cache invalidation (when we intentionally miss)
A new file is generated when **any** of these change:
– Template (mtime/MD5), `sheet`, `plans`, `rate_set`, `area`
– Broker/employer/meta fields or `[[STQ_DISCLAIMER]]`
– **New day** (to keep `[[STQ_DATE_TODAY]]` accurate)

### Manual bypass (optional switch)
If enabled in code:
– Add POST `nocache=1` to **force refresh** (skip cache even if present).

## Operational notes
– **Clear cache:** delete `/uploads/stq-cache/*` (safe to remove; it repopulates on demand).
– **Disk usage:** each unique selection produces one XLSX; clean up occasionally if needed.
– **Security:** files are in the private uploads path; access is only via your export endpoint streaming.

## What to look for in logs
File: `/wp-content/uploads/stq-tmp/stq-export.log`
– First run (miss): `save=14.646s total=20.158s`
– Repeat (hit): `save=0.000s total=6.019s (cache hit)`

Example:

## FAQ
– **Why is the first one still slow?**
The host spends ~15–17s zipping the XLSX once. Caching avoids doing that again for the same inputs.
– **Will different plans or a new disclaimer be fast?**
No; those change the cache key → a new file is generated (slow once), then fast thereafter.
– **What if I update the template file?**
The cache auto-busts because we include template mtime + md5 in the key.
– **What about the date in the header?**
We include `today` in the key → a fresh file is generated each day.

## Where this code lives
– In `class-stq-export-compare.php`, the **writer/save** section is replaced with a block that:
– Tunes the writer (ZipArchive, compression 0)
– Computes the cache key & checks `/uploads/stq-cache`
– Streams cached file on hits, saves+stores on misses