An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Recognize direct class version assignments in release verification
Daniel7cd07ec93826
diff --git a/scripts/test_verify_release.py b/scripts/test_verify_release.pyindex 633d249d00..07e41e851c 100644--- a/scripts/test_verify_release.py+++ b/scripts/test_verify_release.py@@ -404,10 +404,24 @@ class DirectReleaseTests(unittest.TestCase):with self.assertRaisesRegex(release.VerificationError, "导出前端版本不匹配"):release.verify_package(self.package(), version="3.8.4")+ def test_minified_export_direct_class_version(self):+ self.resources["stage/build/export/protyle-method.js"] = (+ b'const wn="3.8.4",Sn="production",Tn=()=>{const t={};return t},f=class{};'+ b'f.SIYUAN_VERSION=wn,f.NODE_ENV=Sn;')+ result = release.verify_package(self.package(), version="3.8.4")+ self.assertEqual(result["frontend_versions"]["stage/build/export/protyle-method.js"], ["3.8.4"])+ self.resources["stage/build/export/protyle-method.js"] = (+ self.resources["stage/build/export/protyle-method.js"].replace(b"3.8.4", b"3.8.3"))+ with self.assertRaisesRegex(release.VerificationError, "导出前端版本不匹配"):+ release.verify_package(self.package(), version="3.8.4")+def test_minified_export_rejects_unrelated_or_conflicting_version_bindings(self):for text in (b'const gn="3.8.4",me=class{};let u=other;u.SIYUAN_VERSION=gn;',b'const gn="3.8.4";function f(){const gn="3.8.3";}const me=class{};let u=me;u.SIYUAN_VERSION=gn;',+ b'const gn="3.8.4",me=class{};other.SIYUAN_VERSION=gn;',+ b'const gn="3.8.4";function f(){const gn="3.8.3";}const me=class{};me.SIYUAN_VERSION=gn;',+ b'const me=class{};me.SIYUAN_VERSION=gn;',):with self.subTest(text=text):self.resources["stage/build/export/protyle-method.js"] = textdiff --git a/scripts/verify-release.py b/scripts/verify-release.pyindex fe815eb8b8..252084cf1f 100644--- a/scripts/verify-release.py+++ b/scripts/verify-release.py@@ -353,6 +353,8 @@ def frontend_versions(text):marker = prefix.rfind("class Constants")if marker < 0:minified = re.search(+ r"\b(?P<binding>[A-Za-z_$][\w$]*)\s*=\s*class\s*\{\s*\}\s*;\s*"+ r"(?P=binding)\.\s*$", prefix) or re.search(r"\b(?P<binding>[A-Za-z_$][\w$]*)\s*=\s*class\s*\{\s*\}\s*;\s*"r"(?:let|const|var)\s+(?P<receiver>[A-Za-z_$][\w$]*)\s*=\s*(?P=binding)\s*;\s*"r"(?P=receiver)\.\s*$", prefix)