Local, full Windows search replacement, clipboard manager, and launcher: files, apps, settings and semantic media search with Google's EmbeddingGemma 2.
Rust clipboard-historyembedding-modelsembeddinggemma-2embeddinggemma2embeddingslocal-firstmcp-serversearchsemantic-searchwindows-11
import hashlib
from pathlib import Path
import tempfile
import unittest
import zipfile
from release_gate import authorize_run, verify_assets
class ReleaseGateTests(unittest.TestCase):
def bundle(self, root, extra=None):
installer=root/"VectorDash-Rust-Setup-1.2.3-x64.exe";installer.write_bytes(b"MZfixture")
archive=root/"VectorDash-Rust-1.2.3-x64.zip"
with zipfile.ZipFile(archive,"w") as z:
for name in ["VectorDash.exe","pdfium.dll","portable.flag"]:z.writestr(name,b"fixture")
if extra:z.writestr(extra,b"unwanted")
(root/"RUST-SHA256SUMS.txt").write_text("".join(hashlib.sha256(p.read_bytes()).hexdigest()+" "+p.name+"\n" for p in [installer,archive]),encoding="ascii")
def test_clean_package_and_corrupt_download(self):
with tempfile.TemporaryDirectory() as folder:
root=Path(folder);self.bundle(root);self.assertEqual(len(verify_assets(root,"1.2.3")),3)
(root/"VectorDash-Rust-Setup-1.2.3-x64.exe").write_bytes(b"MZcorrupt")
with self.assertRaises(ValueError):verify_assets(root,"1.2.3")
def test_models_private_data_and_traversal_are_rejected(self):
for extra in ["settings.json","data/private.txt","models/model.gguf","../escape.txt","index.sqlite","index.key","index.sqlite-wal","index.sqlite-shm","cache.db-wal"]:
with self.subTest(extra=extra),tempfile.TemporaryDirectory() as folder:
root=Path(folder);self.bundle(root,extra)
with self.assertRaises(ValueError):verify_assets(root,"1.2.3")
def test_beta_package_is_validated_without_publishing(self):
with tempfile.TemporaryDirectory() as folder:
root=Path(folder);self.bundle(root)
for p in list(root.iterdir()):
if p.name != "RUST-SHA256SUMS.txt":p.rename(root/p.name.replace("1.2.3","1.2.3-beta.1").replace("Rust-Setup", "Beta-Setup"))
manifest=root/"RUST-SHA256SUMS.txt"
manifest.write_text(manifest.read_text().replace("1.2.3","1.2.3-beta.1").replace("Rust-Setup", "Beta-Setup"))
self.assertEqual(len(verify_assets(root,"1.2.3-beta.1")),3)
def test_failed_stale_fork_and_wrong_workflow_cannot_publish(self):
run={"status":"completed","conclusion":"success","head_branch":"main","head_sha":"abc","head_repository":{"full_name":"owner/repo"},"path":".github/workflows/native-windows.yml","event":"push"}
authorize_run(run,"abc","owner/repo")
for key,value in [("conclusion","failure"),("head_sha","old"),("event","pull_request"),("path","other.yml"),("head_branch","feature"),("head_repository",{"full_name":"fork/repo"})]:
with self.subTest(key=key),self.assertRaises(ValueError):authorize_run({**run,key:value},"abc","owner/repo")
if __name__=="__main__":unittest.main()