@davoodmehraban89 / VELYQOR / commits / 381ba28
Fork 0

Intelligence, Advanced Charting & Trading Platform

perf(chartnova): preserve tested progressive loading hotfix and rollback (#29)

* fix(chartnova): add precise progressive-loader patch leaving backend untouched * test(chartnova): verify bootstrap patch syntax, fail-closed guards and unchanged API code * ci(chartnova): guard progressive bootstrap optimizer without touching production * test(perf): compare live and staged initial quotes plus mobile navigation smoke * ci(perf): browser-check staged Worker before any production rollout * test(perf): verify progressive prices during deliberately stalled market feed * ci(perf): prove mobile main prices remain visible during slow market feed * docs(ops): record live performance fix, safety evidence and one-step Worker rollback * docs(state): record successfully deployed ChartNova performance hotfix and rollback

davoodmehraban89 committed Oct 15, 2026 at 08:56 UTC 381ba284d47f284f034afacc7d6cc41fc31af8f9
7 files changed +336
.github/workflows/chartnova-progressive-loading.yml new
+26
@@ -0,0 +1,26 @@
1 +name: ChartNova progressive loading safety
2 +on:
3 + pull_request:
4 + workflow_dispatch:
5 +
6 +permissions:
7 + contents: read
8 +jobs:
9 + optimize-smoke:
10 + runs-on: ubuntu-latest
11 + timeout-minutes: 8
12 + steps:
13 + - uses: actions/checkout@v4
14 + - uses: actions/setup-node@v4
15 + with:
16 + node-version: '22'
17 + - name: Unit test fail-closed Worker bootstrap patch
18 + run: node --test scripts/optimize-chartnova-worker.test.mjs
19 + - name: Install diagnostic browser
20 + run: |
21 + npm install --no-save --ignore-scripts --no-audit --no-fund playwright@1.58.2
22 + npx playwright install --with-deps chromium
23 + - name: Compare staged candidate to current production in mobile Chromium
24 + run: node scripts/check-chartnova-staged-performance.mjs
25 + - name: Simulate ten-second market-feed delay and validate first contentful prices
26 + run: node scripts/check-chartnova-slow-feed.mjs
PROJECT_STATE.md
+14
@@ -1,5 +1,19 @@
1 # VELYQOR Project State
2
3 +
4 +## 2026-10-15 — ChartNova production performance hotfix (deployed, verified)
5 +
6 +- **User request:** fix delayed/blank-to-loaded ChartNova initial data, prioritizing visible quote cards and avoiding unnecessary waiting.
7 +- **Actual live Worker fixed:** `velyqor-preview` Cloudflare **v27** `2cbeb4e2-4a3e-414f-b3ad-035e2378650b`, deployment `c68b8340-398a-462b-9fe0-c635aba405fe`, rolled out at 100% on `2026-10-15T05:22:32Z`. Original v26 `85177f9d-09c0-4763-b28c-2c6ba5ae5be5` is retained for immediate rollback.
8 +- **Change scope:** only production homepage inline JavaScript; progressive main-card render; explicit partial loading; lazy hidden market/technical rendering and de-duplicated refresh. **No change to API response contracts, data prices/units, provider licensing, KV namespace, secrets, cron, DNS, database, trades or Worktrees.**
9 +- **Verification:** 4/4 isolated JS patch tests passed. Staged mobile browser found 58/58 cards and working technical chart; quotes exactly matched previous production and no JS/network failures. Under intentionally delayed 10-second `/api/markets`, main USD/Gold cards and partial status appeared before the slow feed finished. Following deployment, public `/`, `/api/domestic`, `/api/markets` (58), `/api/xau`, `/api/widget` all responded successfully.
10 +- **Risk controls:** Cloudflare API verified full binding/handler parity between versions. No secret values were read. Keep old version for one-step rollback if post-deploy errors appear. User's actual device experience still requires confirmation.
11 +- **Traceability:** [PR #29](https://github.com/davoodmehraban89/VELYQOR/pull/29) and [operations/rollback guide](docs/operations/chartnova-production-progressive-loading-2026-10-15.md). GitHub `main` was not changed during the direct Cloudflare rollout; PR #29 is reviewed independently.
12 +- **Not completed:** universal network speed guarantee; shrink of 85KB full market-history payload; new Paper Trading live deployment; Neon/WS real trading/feeds. These are separate staged milestones.
13 +
14 +---
15 +
16 +
17 Last updated: 2026-10-07
18
19 Last checked (GitHub-only): 2026-10-14
docs/operations/chartnova-production-progressive-loading-2026-10-15.md new
+60
@@ -0,0 +1,60 @@
1 +# ChartNova — Production Initial-Load Performance Fix (2026-10-15)
2 +
3 +## Verified incident and cause
4 +
5 +User reported that `https://app.chartnova.ir/` eventually opened but initial prices loaded late. Direct external API checks confirmed successful market data with 58 symbols, but `/api/markets` returned approximately 85 KB and response durations fluctuated.
6 +
7 +Read-only inspection of the **actual Cloudflare-deployed** `velyqor-preview` Worker version 26 found that the browser:
8 +- initiated independent `/api/domestic`, `/api/xau` and `/api/markets` requests;
9 +- waited for `Promise.allSettled` on **all three** before replacing the loading status;
10 +- rendered the 58-card market grid and technical chart even when their tabs were hidden, and rendered them again after the batch finished.
11 +
12 +This is a client rendering bottleneck on slow networks. It is not evidence of provider-data corruption or a DNS outage.
13 +
14 +## Production change (performed)
15 +
16 +- PR: [#29](https://github.com/davoodmehraban89/VELYQOR/pull/29)
17 +- Cloudflare zone: `chartnova.ir`; existing app/root Worker routing preserved
18 +- Worker: `velyqor-preview`
19 +- **Previous deployed Worker version:** `85177f9d-09c0-4763-b28c-2c6ba5ae5be5` (v26, 100%).
20 +- **New deployed Worker version:** `2cbeb4e2-4a3e-414f-b3ad-035e2378650b` (v27, 100%).
21 +- **Deployment ID:** `c68b8340-398a-462b-9fe0-c635aba405fe`
22 +- Deploy date/time (UTC): `2026-10-15T05:22:32.348955Z`.
23 +- This was a *direct Cloudflare version upload/deployment* using exact fetched production code as baseline; the GitHub patcher and tests are the reviewable source of the change.
24 +
25 +The scoped change **only** modifies the HTML page's inline JavaScript. The page now displays the main price-card values as soon as their separate requests finish, shows an explicit partial-load status, does not repeatedly render market grids/technical charts while their tabs are hidden, and prevents overlapping refresh cycles. All original Worker API route logic, KV reads/writes, scheduler, quote units/source/rights handling, P0 trading prohibition, DNS, hosting, and cron behavior are unchanged.
26 +
27 +## Independent verification
28 +
29 +**Before production release**:
30 +- GitHub Actions: 4/4 patcher tests passed.
31 +- Actual Chromium mobile browser opened both Worker Version URL and production, verified identical real quote values, all 58 market cards, technical view, zero JS exceptions, zero failed requests.
32 +- The controlled *10-second intentionally delayed market-feed* test demonstrated the behavior improvement:
33 + - **Old production:** USD and gold had populated, but status stayed `در حال دریافت داده‌های ذخیره‌شده...`.
34 + - **New staged version:** USD and gold were populated and status advanced to `قیمت‌های اصلی بررسی شدند · در حال دریافت نمادها...`; it did not build hidden market cards.
35 + - Both eventually rendered all 58 cards when the market tab was visited.
36 +- Worker v27 binding parity confirmed via Cloudflare API: `MARKET_CACHE` (identical KV namespace), `NAVASAN_API_KEY` and `OANOR_API_KEY` (names/types only; **secret values were not accessed**); `fetch` and `scheduled` handlers preserved.
37 +
38 +**Immediately after production release:** Cloudflare deployment API confirmed v27 at 100%; external GET requests succeeded for `/`, `/api/domestic`, `/api/markets` (58 symbols), `/api/xau` and `/api/widget`. Data quality flags were `ok:true` and non-stale where applicable.
39 +
40 +CI browser revalidation following this documentation update must be checked separately; no user-device check can be inferred from cloud-side tests.
41 +
42 +## Rollback
43 +
44 +If the public site starts showing missing quotes, syntax errors, or fails to render, revert deployment to **existing v26** (no need to delete/alter KV or DNS):
45 +
46 +`POST /accounts/{account_id}/workers/scripts/velyqor-preview/deployments`
47 +
48 +Body:
49 +```json
50 +{"strategy":"percentage","versions":[{"version_id":"85177f9d-09c0-4763-b28c-2c6ba5ae5be5","percentage":100}],"annotations":{"workers/message":"Rollback ChartNova progressive loading hotfix"}}
51 +```
52 +
53 +Only the Worker deployment percentage should change; KV, secrets and DNS remain untouched. Verify `GET /deployments` and real HTTP/browser tests afterward.
54 +
55 +## Limits / following improvements
56 +
57 +- This fix improves *perceived* load and avoids unnecessary rendering. It does **not** make ISP/VPN/Cloudflare network transport uniformly faster or shrink the existing 85KB all-symbol history payload.
58 +- Next optimization should introduce a small, licensed and unit-consistent summary endpoint with on-demand historic series for the selected chart, but must be staged and tested without confusing reference points with executable OHLC or weakening price integrity checks.
59 +- The Windows Desktop Commander still requires reconnection for local validation; do not reset dirty worktrees.
60 +- ChartNova live site runs an earlier preview UI; Paper Trading PR #27 remains separate and **is not deployed**.
scripts/check-chartnova-slow-feed.mjs new
+42
@@ -0,0 +1,42 @@
1 +import { chromium } from 'playwright';
2 +
3 +const browser=await chromium.launch({headless:true});
4 +const tested=[];
5 +let failed=false;
6 +try{
7 + for(const target of [
8 + {name:'candidate-progressive',url:'https://2cbeb4e2-velyqor-preview.davoodmehraban89.workers.dev/',expectsProgressive:true},
9 + {name:'prior-production',url:'https://app.chartnova.ir/',expectsProgressive:false}
10 + ]){
11 + const ctx=await browser.newContext({viewport:{width:390,height:844},isMobile:true,serviceWorkers:'block'});
12 + const page=await ctx.newPage(),errors=[];
13 + page.on('pageerror',x=>errors.push(x.message));
14 + await page.route('**/api/markets',async route=>{
15 + await new Promise(done=>setTimeout(done,10000));
16 + try{await route.continue()}catch{}
17 + });
18 + const response=await page.goto(target.url,{waitUntil:'domcontentloaded',timeout:15000});
19 + await page.waitForFunction(()=>{
20 + const usd=document.getElementById('usd')?.textContent||'';
21 + const gold=document.getElementById('gold18')?.textContent||'';
22 + return usd.includes('تومان')&&gold.includes('تومان');
23 + },undefined,{timeout:8000});
24 + const early=await page.evaluate(()=>({
25 + usd:document.getElementById('usd')?.textContent,
26 + gold:document.getElementById('gold18')?.textContent,
27 + status:document.getElementById('status')?.textContent,
28 + hiddenMarketCards:document.querySelectorAll('#marketgrid .marketitem').length
29 + }));
30 + await page.waitForFunction(()=>document.getElementById('status')?.textContent?.includes('داده بازار به‌روز'),undefined,{timeout:15000});
31 + const finalState=await page.evaluate(()=>({status:document.getElementById('status')?.textContent,
32 + hiddenMarketCards:document.querySelectorAll('#marketgrid .marketitem').length}));
33 + await page.locator('[data-nav="markets"]').first().click();
34 + const displayedMarketCards=await page.locator('#marketgrid .marketitem').count();
35 + tested.push({name:target.name,httpStatus:response?.status(),early,finalState,displayedMarketCards,errors});
36 + if(target.expectsProgressive && (!early.status?.includes('قیمت‌های اصلی')||
37 + early.hiddenMarketCards!==0||displayedMarketCards<50||errors.length))failed=true;
38 + await ctx.close();
39 + }
40 +}finally{await browser.close()}
41 +console.log('CHARTNOVA_SLOW_FEED_TEST '+JSON.stringify(tested));
42 +if(failed)process.exitCode=1;
scripts/check-chartnova-staged-performance.mjs new
+66
@@ -0,0 +1,66 @@
1 +import { chromium } from 'playwright';
2 +
3 +const candidates=[
4 + {name:'candidate-version-27',url:'https://2cbeb4e2-velyqor-preview.davoodmehraban89.workers.dev/'},
5 + {name:'current-production',url:'https://app.chartnova.ir/'}
6 +];
7 +const browser=await chromium.launch({headless:true});
8 +let failed=false;
9 +const results=[];
10 +try{
11 + for(const target of candidates){
12 + const ctx=await browser.newContext({viewport:{width:390,height:844},isMobile:true,hasTouch:true,serviceWorkers:'block'});
13 + const page=await ctx.newPage();
14 + const errors=[],badRequests=[];
15 + page.on('pageerror',e=>errors.push(String(e.message).slice(0,280)));
16 + page.on('requestfailed',r=>badRequests.push({path:new URL(r.url()).pathname,reason:r.failure()?.errorText}));
17 + await page.addInitScript(()=>{
18 + window.__chartnovaPaint={};
19 + document.addEventListener('DOMContentLoaded',()=>{
20 + for(const name of ['usd','gold18','xau','status']){
21 + const el=document.getElementById(name);
22 + if(!el)continue;
23 + const observe=()=>{
24 + const content=el.textContent||'';
25 + const p=window.__chartnovaPaint;
26 + if(name==='status'&&content.includes('قیمت‌های اصلی')&&!p.primaryStatusMs)p.primaryStatusMs=Math.round(performance.now());
27 + if(name==='status'&&content.includes('داده بازار به‌روز')&&!p.completeMs)p.completeMs=Math.round(performance.now());
28 + if(name==='usd'&&!content.includes('در حال دریافت')&&content.trim()&&!p.usdMs)p.usdMs=Math.round(performance.now());
29 + if(name==='gold18'&&!content.includes('در حال دریافت')&&content.trim()&&!p.goldMs)p.goldMs=Math.round(performance.now());
30 + if(name==='xau'&&!content.includes('در حال دریافت')&&content.trim()&&!p.xauMs)p.xauMs=Math.round(performance.now());
31 + };
32 + new MutationObserver(observe).observe(el,{characterData:true,childList:true,subtree:true});
33 + observe();
34 + }
35 + },{once:true});
36 + });
37 + let stats={name:target.name};
38 + try{
39 + const res=await page.goto(target.url,{waitUntil:'domcontentloaded',timeout:18000});
40 + stats.htmlStatus=res?.status();
41 + await page.waitForFunction(()=>{
42 + const m=document.getElementById('status')?.textContent||'';
43 + return m.includes('به‌روز')||m.includes('غیرلحظه‌ای')||m.includes('در دسترس نیستند');
44 + },{timeout:15000}).catch(()=>{});
45 + await page.waitForTimeout(1000);
46 + stats.ui=await page.evaluate(()=>({
47 + title:document.title,visible:!!document.querySelector('.shell')?.getBoundingClientRect().width,
48 + quoteUsd:document.getElementById('usd')?.textContent?.slice(0,80),
49 + quoteGold:document.getElementById('gold18')?.textContent?.slice(0,80),
50 + quoteXau:document.getElementById('xau')?.textContent?.slice(0,80),
51 + status:document.getElementById('status')?.textContent?.slice(0,140),
52 + markets:document.getElementById('marketCount')?.textContent?.slice(0,120),
53 + marks:window.__chartnovaPaint
54 + }));
55 + await page.locator('[data-nav="markets"]').first().click();
56 + stats.marketTab=await page.locator('#marketgrid .marketitem').count();
57 + await page.locator('[data-nav="technical"]').first().click();
58 + stats.technicalTab=await page.locator('#techTitle').textContent();
59 + stats.errors=errors;stats.failedRequests=badRequests.slice(0,8);
60 + if(stats.htmlStatus!==200||!stats.ui.visible||stats.marketTab<10||errors.length)failed=true;
61 + }catch(e){failed=true;stats.error=String(e).slice(0,430);}
62 + results.push(stats);await ctx.close();
63 + }
64 +}finally{await browser.close()}
65 +console.log('CHARTNOVA_PRODUCTION_VS_STAGED_PERFORMANCE '+JSON.stringify(results));
66 +if(failed)process.exitCode=1;
scripts/optimize-chartnova-worker.mjs new
+72
@@ -0,0 +1,72 @@
1 +/**
2 + * Reversible and fail-closed patch of the deployed ChartNova HTML bootstrap.
3 + * Leaves provider APIs, cached values, bindings and market data untouched.
4 + */
5 +const beforeMarkets=' renderMarkets();renderTechnical();renderSelected();\n}\nasync function refresh(){';
6 +const afterMarkets=[
7 + ' // Render only the visible view; do not repeatedly build hidden 58-card grids.',
8 + ' if(!el("markets").hidden)renderMarkets();',
9 + ' if(!el("technical").hidden)renderTechnical();',
10 + ' if(!el("dashboard").hidden)renderSelected();',
11 + ' if(!el("widget").hidden)renderWidget();',
12 + '}',
13 + 'async function refresh(){'
14 +].join('\n');
15 +const beforeRefresh=[
16 + 'async function refresh(){',
17 + ' el("status").textContent="در حال دریافت داده‌های ذخیره‌شده...";',
18 + ' await Promise.allSettled([loadDomestic(),loadGold(),loadMarkets()]);',
19 + ' renderSelected();renderMarkets();renderTechnical();',
20 + ' const age=Date.parse(marketState.receivedAt||"");',
21 + ' el("status").textContent=marketState.loaded?(Number.isFinite(age)&&Date.now()-age<=45*60000?"داده بازار به‌روز · بررسی هر ۱۵ دقیقه":"آخرین داده ذخیره‌شده · غیرلحظه‌ای"):"در انتظار داده نمادها · قیمت‌های موجود";',
22 + '}'
23 +].join('\n');
24 +const afterRefresh=[
25 + 'let chartnovaRefreshInFlight=null;',
26 + 'function refresh(){',
27 + ' if(chartnovaRefreshInFlight)return chartnovaRefreshInFlight;',
28 + ' const status=el("status");',
29 + ' status.textContent="در حال دریافت قیمت‌های اصلی...";',
30 + ' const onPrimaryLoaded=()=>{',
31 + ' if(!el("dashboard").hidden)renderSelected();',
32 + ' if(!marketState.loaded)status.textContent="قیمت‌های اصلی بررسی شدند · در حال دریافت نمادها...";',
33 + ' };',
34 + ' chartnovaRefreshInFlight=Promise.allSettled([',
35 + ' loadDomestic().finally(onPrimaryLoaded),',
36 + ' loadGold().finally(onPrimaryLoaded),',
37 + ' loadMarkets()',
38 + ' ]).then(()=>{',
39 + ' const age=Date.parse(marketState.receivedAt||"");',
40 + ' status.textContent=marketState.loaded?(Number.isFinite(age)&&Date.now()-age<=45*60000?',
41 + ' "داده بازار به‌روز · بررسی هر ۱۵ دقیقه":"آخرین داده ذخیره‌شده · غیرلحظه‌ای"):',
42 + ' "داده قیمت بررسی شد · نمادها در دسترس نیستند";',
43 + ' }).finally(()=>{chartnovaRefreshInFlight=null});',
44 + ' return chartnovaRefreshInFlight;',
45 + '}'
46 +].join('\n');
47 +
48 +function replaceExactlyOnce(value,oldPart,newPart,label){
49 + const count=value.split(oldPart).length-1;
50 + if(count!==1)throw new Error(label+' expected once, got '+count);
51 + return value.replace(oldPart,newPart);
52 +}
53 +export function optimizeChartNovaWorker(worker){
54 + if(typeof worker!=='string'||worker.length<10000)throw new Error('Unexpected Worker size');
55 + const anchor='return new Response("<!doctype html>';
56 + const start=worker.indexOf(anchor);
57 + const end=worker.indexOf('",{headers:{"content-type":"text/html; charset=utf-8"',start);
58 + if(start<0||end<0)throw new Error('Expected production HTML literal not found');
59 + const literalStart=start+'return new Response('.length;
60 + const htmlLiteral=worker.slice(literalStart,end+1);
61 + let html;try{html=JSON.parse(htmlLiteral)}catch{throw new Error('HTML literal is not valid JSON string')}
62 + const first=html.indexOf('<script>'),last=html.indexOf('</script>',first);
63 + if(first<0||last<0||html.indexOf('<script>',first+1)!==-1)throw new Error('Unexpected inline script count');
64 + const js=html.slice(first+8,last);
65 + let updated=replaceExactlyOnce(js,beforeMarkets,afterMarkets,'lazy view');
66 + updated=replaceExactlyOnce(updated,beforeRefresh,afterRefresh,'progressive refresh');
67 + const newHTML=html.slice(0,first+8)+updated+html.slice(last);
68 + if(newHTML.replace(updated,js)!==html)throw new Error('Unexpected HTML mutation');
69 + const result=worker.slice(0,literalStart)+JSON.stringify(newHTML)+worker.slice(end+1);
70 + if(result===worker)throw new Error('No source update');
71 + return {source:result,oldHTML:html,newHTML,oldJS:js,newJS:updated};
72 +}
scripts/optimize-chartnova-worker.test.mjs new
+56
@@ -0,0 +1,56 @@
1 +import test from 'node:test';
2 +import assert from 'node:assert/strict';
3 +import { Script } from 'node:vm';
4 +import { optimizeChartNovaWorker } from './optimize-chartnova-worker.mjs';
5 +
6 +const oldJS=[
7 + 'const marketState={loaded:false,receivedAt:null};',
8 + 'function el(id){return document.getElementById(id)}',
9 + 'function renderMarkets(){} function renderTechnical(){} function renderSelected(){} function renderWidget(){}',
10 + 'async function loadDomestic(){} async function loadGold(){}',
11 + 'async function loadMarkets(){',
12 + ' marketState.loaded=true;',
13 + ' renderMarkets();renderTechnical();renderSelected();',
14 + '}',
15 + 'async function refresh(){',
16 + ' el("status").textContent="در حال دریافت داده‌های ذخیره‌شده...";',
17 + ' await Promise.allSettled([loadDomestic(),loadGold(),loadMarkets()]);',
18 + ' renderSelected();renderMarkets();renderTechnical();',
19 + ' const age=Date.parse(marketState.receivedAt||"");',
20 + ' el("status").textContent=marketState.loaded?(Number.isFinite(age)&&Date.now()-age<=45*60000?"داده بازار به‌روز · بررسی هر ۱۵ دقیقه":"آخرین داده ذخیره‌شده · غیرلحظه‌ای"):"در انتظار داده نمادها · قیمت‌های موجود";',
21 + '}'
22 +].join('\n');
23 +function fixture(js=oldJS){
24 + const html='<!doctype html><html><body><div id="status"></div><script>'+js+'</script></body></html>';
25 + const boiler='const OTHER_API_ROUTE="/api/markets";\nconst untouched='+JSON.stringify('x'.repeat(10500))+';\n';
26 + return 'export default { async fetch(request,env){'+boiler+
27 + 'return new Response('+JSON.stringify(html)+',{headers:{"content-type":"text/html; charset=utf-8"}})},'+
28 + 'async scheduled(event,env){} }';
29 +}
30 +test('changes only HTML inline JS; keeps Worker API and scheduler exact',()=>{
31 + const source=fixture();
32 + const result=optimizeChartNovaWorker(source);
33 + assert.ok(result.newJS.includes('chartnovaRefreshInFlight'));
34 + assert.ok(result.newJS.includes('if(!el("markets").hidden)renderMarkets()'));
35 + assert.ok(result.newJS.includes('loadDomestic().finally(onPrimaryLoaded)'));
36 + assert.ok(!result.newJS.includes('renderSelected();renderMarkets();renderTechnical();'));
37 + assert.ok(result.source.includes('const OTHER_API_ROUTE="/api/markets"'));
38 + assert.ok(result.source.includes('async scheduled(event,env){}'));
39 + assert.equal(result.newHTML.replace(result.newJS,result.oldJS),result.oldHTML);
40 + assert.doesNotThrow(()=>new Script(result.newJS));
41 + const originalPrefix=source.slice(0,source.indexOf('return new Response("<!doctype html>'));
42 + const modifiedPrefix=result.source.slice(0,result.source.indexOf('return new Response("<!doctype html>'));
43 + assert.equal(modifiedPrefix,originalPrefix);
44 +});
45 +test('blocks nonmatching source instead of speculative regex modification',()=>{
46 + assert.throws(()=>optimizeChartNovaWorker('bad source'),/size/);
47 + assert.throws(()=>optimizeChartNovaWorker(fixture(oldJS.replace('renderMarkets();renderTechnical();renderSelected();','renderMarkets();'))),/expected once/);
48 +});
49 +test('does not apply twice; protects against hidden drift',()=>{
50 + const newSource=optimizeChartNovaWorker(fixture()).source;
51 + assert.throws(()=>optimizeChartNovaWorker(newSource),/expected once/);
52 +});
53 +test('prevents accidental modification of multiple scripts',()=>{
54 + const js=oldJS+'</script><script>window.alert(2)';
55 + assert.throws(()=>optimizeChartNovaWorker(fixture(js)),/script count/);
56 +});