fix(rt): restart fxRt khi chain VST doi trong luc realtime dang chay

- masteringSettings effect goi fxRtStart() khong dieu kien: early-return
  khi active + cung chainKey, stop+start lai khi chain doi (insert/remove/
  bypass/reorder VST trong MASTER FX CHAIN) — truoc day nhanh chainKey
  chet vi branch chi chay khi !fxRt.active
- test list_scan_all: path plugin phai ton tai tren dia (loc entry chet
  truoc cache); dung _scan_json helper voi file that trong tmp_path
- bump cache-bust app.precompiled.js -> 202608212300
This commit is contained in:
2026-08-22 16:13:10 +07:00
parent eef8603f98
commit edc647ded6
4 changed files with 18 additions and 6 deletions
+15 -3
View File
@@ -63,15 +63,26 @@ class TestFxScanCache:
"type": "VST3", "is_fx": True, "is_instrument": False},
]})
def _scan_json(self, d):
"""JSON scan với path plugin THẬT tồn tại trên đĩa — list_scan_all lọc
entry plugin đã xóa khỏi đĩa (os.path.exists) trước khi cache; path ảo
(C:\\VST3\\Ozone Pro.vst3) bị lọc hết → test không thể assert entry."""
return json.dumps({"plugins": [
{"path": os.path.join(d, "Ozone Pro.vst3"), "name": "Ozone Pro",
"type": "VST3", "is_fx": True, "is_instrument": False},
]})
def _pm(self, tmp_path):
d = str(tmp_path)
return PluginManager(vst_dir=d, sf_dir=d, extra_vst_dirs=[])
def test_scan_caches_with_bridge(self, tmp_path):
pm = self._pm(tmp_path)
# Plugin phải tồn tại trên đĩa — list_scan_all lọc entry chết trước cache.
open(os.path.join(str(tmp_path), "Ozone Pro.vst3"), "w").close()
with patch("app.core.native_render.find_fx_bridge_exe", return_value="fx_bridge.exe"), \
patch("subprocess.run", return_value=MagicMock(
returncode=0, stdout=self.SCAN_JSON, stderr="")) as mrun:
returncode=0, stdout=self._scan_json(str(tmp_path)), stderr="")) as mrun:
r1 = pm.list_scan_all()
assert len(r1) == 1 and r1[0]["name"] == "Ozone Pro"
assert pm._fx_scan_all is not None and len(pm._fx_scan_all) == 1
@@ -88,10 +99,11 @@ class TestFxScanCache:
with patch("app.core.native_render.find_fx_bridge_exe", return_value=""):
assert pm.list_scan_all() == []
assert pm._fx_scan_all is None # KHÔNG cache rỗng
# Có bridge → scan thật chạy
# Có bridge → scan thật chạy (plugin tồn tại trên đĩa)
open(os.path.join(str(tmp_path), "Ozone Pro.vst3"), "w").close()
with patch("app.core.native_render.find_fx_bridge_exe", return_value="fx_bridge.exe"), \
patch("subprocess.run", return_value=MagicMock(
returncode=0, stdout=self.SCAN_JSON, stderr="")):
returncode=0, stdout=self._scan_json(str(tmp_path)), stderr="")):
r = pm.list_scan_all()
assert len(r) == 1