chore: import upstream snapshot with attribution
Integ / changes (push) Has been skipped
Pre-commit / pre-commit (push) Failing after 1s
CLI exit codes / changes (push) Has been skipped
Test (Install) / changes (push) Has been skipped
Test (Python) / changes (push) Has been skipped
Test (TypeScript) / changes (push) Has been skipped
CLI exit codes / cli-gate (push) Has been cancelled
Test (Install) / test-install-gate (push) Has been cancelled
Integ / integ-gate (push) Has been cancelled
Test (Python) / test-python-gate (push) Has been cancelled
Test (TypeScript) / test-typescript-gate (push) Has been cancelled
Test (Install) / python-minimal (3.12) (push) Has been cancelled
Test (Install) / python-minimal (3.11) (push) Has been cancelled
Test (Install) / python-extra (agno, mirage.agents.agno) (push) Has been cancelled
Test (Install) / python-extra (chroma, mirage.resource.chroma) (push) Has been cancelled
Test (Install) / python-extra (pdf, mirage.core.filetype.pdf) (push) Has been cancelled
Integ / integ (push) Has been cancelled
Integ / integ-database (push) Has been cancelled
Integ / integ-database-ts (push) Has been cancelled
Integ / integ-data (push) Has been cancelled
Integ / integ-ssh (push) Has been cancelled
Integ / integ-ssh-ts (push) Has been cancelled
Test (Python) / audit (push) Has been cancelled
Test (TypeScript) / test (push) Has been cancelled
Test (TypeScript) / python-fs-shim (push) Has been cancelled
CLI exit codes / Python CLI (push) Has been cancelled
CLI exit codes / TypeScript CLI (push) Has been cancelled
CLI exit codes / Cross-language snapshot interop (push) Has been cancelled
Test (Python) / test (push) Has been cancelled
Test (Python) / import-isolation (deepagents, openai, mirage.agents.openai_agents) (push) Has been cancelled
Test (Python) / import-isolation (deepagents, pydantic-ai, mirage.agents.pydantic_ai) (push) Has been cancelled
Integ / integ-ts (push) Has been cancelled
Integ / integ-fuse (push) Has been cancelled
Test (Install) / python-extra (databricks, mirage.resource.databricks_volume) (push) Has been cancelled
Test (Install) / python-extra (deepagents, mirage.agents.langchain) (push) Has been cancelled
Test (Install) / python-extra (email, mirage.resource.email) (push) Has been cancelled
Test (Install) / python-extra (fuse, mirage.fuse.mount) (push) Has been cancelled
Test (Install) / python-extra (hdf5, mirage.core.filetype.hdf5) (push) Has been cancelled
Test (Install) / python-extra (hf, mirage.resource.hf_buckets) (push) Has been cancelled
Test (Install) / python-extra (lancedb, mirage.resource.lancedb) (push) Has been cancelled
Test (Install) / python-extra (langfuse, mirage.resource.langfuse) (push) Has been cancelled
Test (Install) / python-extra (mongodb, mirage.resource.mongodb) (push) Has been cancelled
Test (Install) / python-extra (nextcloud, mirage.resource.nextcloud) (push) Has been cancelled
Test (Install) / python-extra (openai, mirage.agents.openai_agents) (push) Has been cancelled
Test (Install) / python-extra (openhands, mirage.agents.openhands, 3.12) (push) Has been cancelled
Test (Install) / python-extra (parquet, mirage.core.filetype.parquet) (push) Has been cancelled
Test (Install) / python-extra (postgres, mirage.resource.postgres) (push) Has been cancelled
Test (Install) / python-extra (pydantic-ai, mirage.agents.pydantic_ai) (push) Has been cancelled
Test (Install) / python-extra (qdrant, mirage.resource.qdrant) (push) Has been cancelled
Test (Install) / python-extra (redis, mirage.resource.redis) (push) Has been cancelled
Test (Install) / python-extra (s3, mirage.resource.s3) (push) Has been cancelled
Test (Install) / python-extra (ssh, mirage.resource.ssh) (push) Has been cancelled
Test (Install) / ts-minimal (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 12:30:44 +08:00
commit bcbd1bdb22
5748 changed files with 562488 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
from types import SimpleNamespace
import pytest
from mirage.cache.index import RAMIndexCacheStore
from mirage.types import FileStat, FileType, PathSpec
from mirage.utils.key_prefix import mount_key
@pytest.fixture
def dify_accessor() -> SimpleNamespace:
return SimpleNamespace(config=SimpleNamespace(dataset_id="dataset-1",
slug_metadata_name="slug"))
@pytest.fixture
def dify_index() -> RAMIndexCacheStore:
return RAMIndexCacheStore()
@pytest.fixture
def guide_path() -> PathSpec:
return PathSpec.from_str_path(
"/knowledge/guides/quickstart",
mount_key("/knowledge/guides/quickstart", "/knowledge"))
def sample_stat() -> FileStat:
return FileStat(name="quickstart", type=FileType.TEXT, size=12)
+23
View File
@@ -0,0 +1,23 @@
import importlib
import pytest
from mirage.ops.dify.grep import grep
op_grep = importlib.import_module("mirage.ops.dify.grep")
async def grep_bytes(accessor, paths, pattern, index):
return b"match", {paths[0].virtual: b"content"}
@pytest.mark.asyncio
async def test_grep_op_delegates_to_core(monkeypatch, dify_accessor,
dify_index, guide_path):
monkeypatch.setattr(op_grep, "grep_bytes", grep_bytes)
result = await grep(dify_accessor, [guide_path],
"pattern",
index=dify_index)
assert result == b"match"
+21
View File
@@ -0,0 +1,21 @@
import importlib
import pytest
from mirage.ops.dify.read import read
op_read = importlib.import_module("mirage.ops.dify.read")
async def read_bytes(accessor, path, index):
return path.virtual.encode()
@pytest.mark.asyncio
async def test_read_op_delegates_to_core(monkeypatch, dify_accessor,
dify_index, guide_path):
monkeypatch.setattr(op_read, "read_bytes", read_bytes)
result = await read(dify_accessor, guide_path, index=dify_index)
assert result == guide_path.virtual.encode()
+24
View File
@@ -0,0 +1,24 @@
import importlib
import pytest
from mirage.ops.dify.readdir import readdir
op_readdir = importlib.import_module("mirage.ops.dify.readdir")
async def core_readdir_result(accessor, path, index):
return [path.child("a"), path.child("b")]
@pytest.mark.asyncio
async def test_readdir_op_delegates_to_core(monkeypatch, dify_accessor,
dify_index, guide_path):
monkeypatch.setattr(op_readdir, "core_readdir", core_readdir_result)
result = await readdir(dify_accessor, guide_path, index=dify_index)
assert result == [
"/knowledge/guides/quickstart/a",
"/knowledge/guides/quickstart/b",
]
+37
View File
@@ -0,0 +1,37 @@
from types import SimpleNamespace
import pytest
from mirage.cache.index import RAMIndexCacheStore
from mirage.types import PathSpec
@pytest.mark.asyncio
async def test_search_op_delegates_to_core(monkeypatch):
from mirage.core.dify import search
from mirage.ops.dify.search import search as search_op
calls: list[tuple[str, list[PathSpec], dict]] = []
async def search_segments(accessor, query, paths, index, **kwargs):
calls.append((query, paths, kwargs))
return b"result"
monkeypatch.setattr(search, "search_segments", search_segments)
paths = [
PathSpec(resource_path="knowledge/a",
virtual="/knowledge/a",
directory="/knowledge/a")
]
result = await search_op(SimpleNamespace(),
paths,
"query",
index=RAMIndexCacheStore(),
method="keyword")
assert result == b"result"
assert calls == [("query", paths, {
"method": "keyword",
"mount_prefix": ""
})]
+23
View File
@@ -0,0 +1,23 @@
import importlib
import pytest
from mirage.ops.dify.stat import stat
from .conftest import sample_stat
op_stat = importlib.import_module("mirage.ops.dify.stat")
async def core_stat_result(accessor, path, index):
return sample_stat()
@pytest.mark.asyncio
async def test_stat_op_delegates_to_core(monkeypatch, dify_accessor,
dify_index, guide_path):
monkeypatch.setattr(op_stat, "core_stat", core_stat_result)
result = await stat(dify_accessor, guide_path, index=dify_index)
assert result == sample_stat()