Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(storage): 缩小写锁范围并跳过父目录刷新冲突 (#5014)

Qin Haojiea9d908e1313d
diff --git a/docs/en/api/12-content.md b/docs/en/api/12-content.md
index 5d4bc1643..f1bf45ccc 100644
--- a/docs/en/api/12-content.md
+++ b/docs/en/api/12-content.md
@@ -231,7 +231,8 @@ Write a file and automatically refresh related semantics and vectors.
- Explicit `create` only accepts text-writable extensions: `.md`, `.txt`, `.json`, `.yaml`, `.yml`, `.toml`, `.py`, `.js`, `.ts`. Parent directories are created automatically for every write mode.
- Existing `.abstract.md` and `.overview.md` bodies may be updated, but public APIs cannot create them. A body-only request preserves stored OKF metadata; a full-OKF request must match the stored metadata. Unknown metadata fields are silently dropped. A sidecar body write rebuilds only the directory's existing L0/L1 vectors and does not regenerate semantics.
- File content is updated before the API returns. `wait` only controls whether the call waits for semantic/vector refresh to finish.
-- The public API no longer accepts `regenerate_semantics` or `revectorize`; write always refreshes related semantics and vectors.
+- The public API no longer accepts `regenerate_semantics` or `revectorize`; write automatically schedules related semantic and vector processing.
+- Parent L0/L1 refreshes for resource writes are best-effort: a parent lock conflict skips that directory refresh while preserving the file write and its own summary/vector work. Skipping L0/L1 persistence also skips directory vector updates; a later refresh is not guaranteed. Locks on the written file itself still raise conflicts. Contention detected before enqueueing returns `semantic_status: "skipped"`; skips during background execution are logged, and `wait=true` does not guarantee updated parent summaries.
- When `tags` is supplied, tags are included in the file's first vector upsert rather than updated after processing. Omitting `tags` preserves existing tags; explicit `tags: []` with `tag_mode: "replace"` clears them.
@@ -365,10 +366,11 @@ Each operation contains:
- All targets must be files below `root_uri`, use the same context type, and have unique canonical URIs.
- Resource targets may use any safe file extension; Memory targets retain the text extension allowlist and do not accept binary content.
- `replace`, `append`, and `create` match `write()` semantics. `upsert` replaces an existing file or creates a missing file.
-- The batch holds one target tree lock while writing. Semantic processing starts only after every file is written and the lock is released, so `.overview.md` and `.abstract.md` are refreshed once for the batch.
+- The batch acquires exact locks for all target files before validating file state and writing. Writes to disjoint files in the same directory can proceed concurrently; overlapping writes and parent-directory deletion or moves still conflict. Semantic processing starts after all writes finish and the locks are released, refreshing the affected `.overview.md` and `.abstract.md` files together.
+- Resource parent refreshes use the same best-effort behavior as `write()`: L0/L1 lock conflicts skip the directory refresh and its vector updates while preserving file writes and file processing. A later refresh is not guaranteed.
- An underlying I/O failure can still leave writes completed earlier in the batch visible.
- Existing `.abstract.md` and `.overview.md` bodies may be replaced or appended. OpenViking preserves and validates protected OKF metadata and rebuilds only the directory's existing L0/L1 vectors for these operations.
-- In the response body, `semantic_status` (`queued`, `complete`, or `deferred`) reports the directory aggregation status, while `vector_status` reports vector maintenance for changed files.
+- In the response body, `semantic_status` (`queued`, `complete`, `deferred`, or `skipped`) reports the directory aggregation status; it is `skipped` if any directory encounters contention before enqueueing. Meanwhile, `vector_status` reports vector maintenance for changed files.
**Python SDK**
diff --git a/docs/zh/api/12-content.md b/docs/zh/api/12-content.md
index c2b765010..9d9556841 100644
--- a/docs/zh/api/12-content.md
+++ b/docs/zh/api/12-content.md
@@ -231,7 +231,8 @@ openviking read viking://resources/docs/api.md
- 显式 `create` 只允许以下文本类扩展名:`.md`、`.txt`、`.json`、`.yaml`、`.yml`、`.toml`、`.py`、`.js`、`.ts`。所有写入模式都会自动创建父目录。
- 已存在的 `.abstract.md` / `.overview.md` 可以修改正文,但不能通过公共 API 创建;只提交正文时会保留现有 OKF metadata,提交完整 OKF 时 metadata 必须与存量值一致。未知 metadata 字段会静默丢弃。sidecar 正文写入只重建该目录实际存在的 L0/L1 向量,不触发语义重新生成。
- 文件内容会在 API 返回前完成更新;`wait` 只控制是否等待语义/向量刷新完成。
-- 公共 API 已不再接受 `regenerate_semantics` 或 `revectorize`;写入后一定会自动刷新相关语义与向量。
+- 公共 API 已不再接受 `regenerate_semantics` 或 `revectorize`;写入后会自动调度相关语义与向量处理。
+- 资源写入附带的父目录 L0/L1 刷新采用尽力更新:父目录锁冲突时跳过本次目录刷新,保留原文写入及文件自身的摘要、向量处理。跳过 L0/L1 写回时也跳过目录向量更新,不保证自动补刷;原文文件本身的锁冲突仍报错。提交任务前发现冲突时返回 `semantic_status: "skipped"`;后台运行期间的跳过记录在日志中,`wait=true` 也不保证父目录摘要更新。
- 提供 `tags` 时,标签会在该文件首次向量 upsert 时写入,而非在处理完成后再单独更新。省略 `tags` 不改变已有标签;显式 `tags: []` 配合 `tag_mode: "replace"` 可清空标签。
@@ -365,10 +366,11 @@ openviking write viking://resources/docs/api.md \
- 所有目标必须是 `root_uri` 下的文件、属于同一 context type,且 canonical URI 不能重复。
- Resource 目标允许任意安全文件扩展名;Memory 目标仍使用文本扩展名白名单,且不接受二进制内容。
- `replace`、`append`、`create` 与 `write()` 语义一致;`upsert` 会覆盖已有文件或创建缺失文件。
-- 写入期间整批共用一个目标 tree lock。所有文件写完并释放锁后才启动语义处理,因此 `.overview.md` / `.abstract.md` 每批只统一刷新一次。
+- 整批先获取所有目标文件的精确锁,再校验文件状态并写入;同一目录下不涉及相同文件的写入可以并行,重叠文件的写入或父目录删除、移动仍会冲突。所有文件写完并释放锁后才启动语义处理,统一刷新受影响的 `.overview.md` / `.abstract.md`。
+- 资源父目录刷新与 `write()` 一样采用尽力更新:L0/L1 锁冲突时跳过目录刷新及对应目录向量更新,保留原文和文件自身的处理,不保证自动补刷。
- 底层 I/O 中途失败时,本批次较早完成的写入仍可能已经可见。
- 已存在的 `.abstract.md` / `.overview.md` 可以 replace 或 append;系统会保留并校验受保护的 OKF metadata,并只重建对应目录实际存在的 L0/L1 向量。
-- 响应体中,通过 `semantic_status`(`queued`、`complete` 或 `deferred`)表达目录聚合状态,通过 `vector_status` 表达变化文件的向量维护状态。
+- 响应体中,通过 `semantic_status`(`queued`、`complete`、`deferred` 或 `skipped`)表达目录聚合状态;提交任务前任一目录因锁冲突跳过时为 `skipped`,通过 `vector_status` 表达变化文件的向量维护状态。
**Python SDK**
diff --git a/openviking/storage/content_write.py b/openviking/storage/content_write.py
index 90b0e2cbf..a236d20ff 100644
--- a/openviking/storage/content_write.py
+++ b/openviking/storage/content_write.py
@@ -95,7 +95,9 @@ class _BatchRefreshOutcome:
embedding_requested: bool = False
def statuses(self, *, wait: bool) -> tuple[str, str]:
- if self.semantic_actions:
+ if FreshnessAction.NOOP in self.semantic_actions:
+ semantic_status = "skipped"
+ elif self.semantic_actions:
semantic_status = (
"deferred"
if all(action is FreshnessAction.MARK_PENDING for action in self.semantic_actions)
@@ -215,8 +217,8 @@ class ContentWriteCoordinator:
Each operation follows the same create/replace/append semantics as ``write``;
``upsert`` is available for callers that already hold the desired final tree.
- Refresh runs only after every write and after releasing the tree lock, so derived
- summaries are generated once per batch.
+ All target files stay locked from state validation through the last write,
+ while unrelated files remain writable. Refresh starts after the locks are released.
"""
normalized_root = self._validate_uri_path(root_uri, field_name="root_uri")
await self._validate_batch_root(normalized_root, ctx=ctx)
@@ -224,9 +226,12 @@ class ContentWriteCoordinator:
normalized_root, operations, ctx=ctx
)
- root_path = self._viking_fs._uri_to_path(normalized_root, ctx=ctx)
+ target_paths = [
+ self._viking_fs._uri_to_path(operation["uri"], ctx=ctx)
+ for operation in normalized_operations
+ ]
try:
- lease = await self._viking_fs._async_agfs.pathlock_acquire_tree(root_path)
+ lease = await self._viking_fs._async_agfs.pathlock_acquire_exact_batch(target_paths)
except LockAcquisitionError as exc:
raise ResourceBusyError(
f"resource is busy and cannot be written now: {normalized_root}",
@@ -578,19 +583,25 @@ class ContentWriteCoordinator:
) -> FreshnessAction:
changed_entries = len({uri for values in changes.values() for uri in values})
semantic_config = get_openviking_config().semantic
- decision = await plan_abstract_overview_refresh(
- viking_fs=self._viking_fs,
- dir_uri=root_uri,
- changed_entries=changed_entries,
- ctx=ctx,
- overview_sample_limit=getattr(semantic_config, "overview_sample_limit", 32),
- refresh_ratio=getattr(semantic_config, "freshness_refresh_ratio", 0.10),
- force_refresh=force_refresh,
- )
- aggregate_directory = decision.action is FreshnessAction.REFRESH_NOW
+ try:
+ decision = await plan_abstract_overview_refresh(
+ viking_fs=self._viking_fs,
+ dir_uri=root_uri,
+ changed_entries=changed_entries,
+ ctx=ctx,
+ overview_sample_limit=getattr(semantic_config, "overview_sample_limit", 32),
+ refresh_ratio=getattr(semantic_config, "freshness_refresh_ratio", 0.10),
+ force_refresh=force_refresh,
+ )
+ action = decision.action
+ except LockAcquisitionError:
+ # Parent aggregation is best-effort; changed-file work must still run.
+ logger.info("Skipping busy parent semantic refresh: %s", root_uri)
+ action = FreshnessAction.NOOP
+ aggregate_directory = action is FreshnessAction.REFRESH_NOW
has_live_files = any(changes.get(kind) for kind in ("added", "modified"))
if not aggregate_directory and not has_live_files:
- return decision.action
+ return action
queue_manager = get_queue_manager()
semantic_queue = queue_manager.get_queue(queue_manager.SEMANTIC, allow_create=True)
telemetry = get_current_telemetry()
@@ -632,7 +643,7 @@ class ContentWriteCoordinator:
if msg.telemetry_id:
get_request_wait_tracker().mark_semantic_failed(msg.telemetry_id, msg.id, str(exc))
raise
- return decision.action
+ return action
@staticmethod
def _raise_refresh_errors(queue_status: Dict[str, Any]) -> None:
@@ -865,12 +876,14 @@ class ContentWriteCoordinator:
"semantic_status": "skipped",
"vector_status": vector_status,
}
- elif refresh_action is FreshnessAction.MARK_PENDING:
+ elif refresh_action in {FreshnessAction.MARK_PENDING, FreshnessAction.NOOP}:
# Changed-file semantic/vector work may still be queued, while
- # the directory aggregation itself is intentionally deferred.
+ # directory aggregation is deferred or skipped on contention.
_, vector_status = self._refresh_statuses(wait=wait, queue_status=queue_status)
result_kwargs = {
- "semantic_status": "deferred",
+ "semantic_status": (
+ "skipped" if refresh_action is FreshnessAction.NOOP else "deferred"
+ ),
"vector_status": vector_status,
}
return self._build_write_result(
diff --git a/openviking/storage/queuefs/semantic_dag.py b/openviking/storage/queuefs/semantic_dag.py
index 0ddccfbd4..95ca59a1b 100644
--- a/openviking/storage/queuefs/semantic_dag.py
+++ b/openviking/storage/queuefs/semantic_dag.py
@@ -23,6 +23,7 @@ from openviking.storage.abstract_overview import (
write_abstract_overview,
)
from openviking.storage.acl import CreatorAclGrant
+from openviking.storage.errors import LockAcquisitionError
from openviking.storage.viking_fs import LS_ALL_NODES, get_viking_fs
from openviking.telemetry import bind_telemetry, get_current_telemetry
from openviking.utils.ingest_options import IngestOptions
@@ -403,16 +404,21 @@ class SemanticDagExecutor:
sampled_entries = deterministic_sample(direct_entries, sample_limit)
sampled_children_dirs = {uri for kind, uri in sampled_entries if kind == "directory"}
sampled_file_paths = {uri for kind, uri in sampled_entries if kind == "file"}
- pending_snapshot = (
- await read_abstract_overview_pending_snapshot(
- viking_fs=self._viking_fs,
- dir_uri=dir_uri,
- ctx=self._ctx,
- lock=self._lock,
- )
- if self._aggregate_directory
- else 0
- )
+ pending_snapshot = 0
+ if self._aggregate_directory:
+ try:
+ pending_snapshot = await read_abstract_overview_pending_snapshot(
+ viking_fs=self._viking_fs,
+ dir_uri=dir_uri,
+ ctx=self._ctx,
+ lock=self._lock,
+ )
+ except LockAcquisitionError:
+ if self._generation_trigger != "content_write":
+ raise
+ # Content writes run one directory; retain their file work.
+ self._aggregate_directory = False
+ logger.info("Skipping busy parent semantic refresh: %s", dir_uri)
file_index = {path: idx for idx, path in enumerate(file_paths)}
child_index = {path: idx for idx, path in enumerate(children_dirs)}
# Recursive/initial work still maintains every file. Incremental
@@ -1056,7 +1062,7 @@ class SemanticDagExecutor:
if self._closed:
return
- # Write directly, protected by the outer semantic lock.
+ # Persist sidecars before publishing their directory vectors.
if should_write:
assert overview is not None and abstract is not None
try:
@@ -1076,6 +1082,7 @@ class SemanticDagExecutor:
except AbstractOverviewFormatError:
raise
except Exception:
+ need_vectorize = False
logger.info(f"[SemanticDag] {dir_uri} write failed, skipping")
except AbstractOverviewFormatError:
diff --git a/tests/server/test_content_batch_write.py b/tests/server/test_content_batch_write.py
index 085f39214..0d2384927 100644
--- a/tests/server/test_content_batch_write.py
+++ b/tests/server/test_content_batch_write.py
@@ -23,8 +23,8 @@ class _PathLockClient:
self.held = False
self.releases = 0
- async def pathlock_acquire_tree(self, path):
- del path
+ async def pathlock_acquire_exact_batch(self, paths):
+ del paths
self.held = True
return {"lease_ref": "lock-1"}
@@ -156,7 +156,7 @@ async def test_batch_validates_all_modes_before_any_write(monkeypatch):
@pytest.mark.asyncio
-async def test_batch_releases_tree_lock_before_one_aggregated_refresh(monkeypatch):
+async def test_batch_releases_file_locks_before_one_aggregated_refresh(monkeypatch):
root = "viking://resources/wiki"
a = f"{root}/a.md"
b = f"{root}/b.md"
@@ -230,20 +230,15 @@ async def test_batch_replace_memory_preserves_metadata(monkeypatch):
@pytest.mark.asyncio
-async def test_batch_reports_deferred_directory_and_queued_file_vectors(monkeypatch):
+async def test_batch_reports_skipped_directory_and_queued_file_vectors(monkeypatch):
root = "viking://resources/wide"
page = f"{root}/page.md"
coordinator = ContentWriteCoordinator(_VFS(root))
- async def resolve_root(uri, **kwargs):
- del uri, kwargs
- return root
-
async def enqueue(**kwargs):
del kwargs
- return FreshnessAction.MARK_PENDING
+ return FreshnessAction.NOOP
- monkeypatch.setattr(coordinator, "_resolve_root_uri", resolve_root)
monkeypatch.setattr(coordinator, "_enqueue_semantic_refresh_changes", enqueue)
ctx = RequestContext(user=UserIdentifier.the_default_user(), role=Role.USER)
@@ -260,7 +255,7 @@ async def test_batch_reports_deferred_directory_and_queued_file_vectors(monkeypa
wait=False,
)
- assert result["semantic_status"] == "deferred"
+ assert result["semantic_status"] == "skipped"
assert result["vector_status"] == "queued"
assert result["queue_status"] is None
diff --git a/tests/server/test_content_write_service.py b/tests/server/test_content_write_service.py
index 136570bc2..a2c093d31 100644
--- a/tests/server/test_content_write_service.py
+++ b/tests/server/test_content_write_service.py
@@ -20,7 +20,6 @@ from openviking.session.memory.utils.content_visibility import visible_content
from openviking.storage.acl import AclMode
from openviking.storage.content_write import ContentWriteCoordinator
from openviking.storage.errors import LockAcquisitionError, ResourceBusyError
-from openviking.storage.queuefs.semantic_ops.freshness_policy import FreshnessAction
from openviking_cli.exceptions import (
AlreadyExistsError,
DeadlineExceededError,
@@ -640,28 +639,6 @@ async def test_resource_write_semantic_refresh_uses_coalesce_key(monkeypatch):
assert queue.messages[0].lock_handoff is None
-async def test_resource_write_wait_forces_directory_refresh(monkeypatch):
- file_uri = "viking://resources/demo/doc.md"
- root_uri = "viking://resources/demo"
- ctx = RequestContext(user=UserIdentifier.the_default_user(), role=Role.USER)
- coordinator = ContentWriteCoordinator(
- viking_fs=_FakeVikingFS(file_uri=file_uri, root_uri=root_uri)
- )
- enqueue = AsyncMock(return_value=FreshnessAction.REFRESH_NOW)
- monkeypatch.setattr(coordinator, "_enqueue_semantic_refresh", enqueue)
- monkeypatch.setattr(coordinator, "_wait_for_request", AsyncMock(return_value=None))
-
- await coordinator.write(
- uri=file_uri,
- content="updated",
- ctx=ctx,
- wait=True,
- )
-
- assert enqueue.await_args.kwargs["force_refresh"] is True
-
-
@pytest.mark.asyncio
async def test_write_timeout_after_enqueue_releases_resource_lock(monkeypatch):
file_uri = "viking://resources/demo/doc.md"
@@ -793,36 +770,35 @@ async def test_write_direct_reuses_outer_lease_for_viking_fs(monkeypatch):
@pytest.mark.asyncio
[email protected]("path", ["demo/doc.md", "demo#1/a#one.md"])
-async def test_resource_write_updates_target_and_queues_refresh_before_return(monkeypatch, path):
- file_uri = f"viking://resources/{path}"
[email protected]("wait", [False, True])
+async def test_resource_write_skips_busy_parent_and_keeps_file_work(monkeypatch, wait):
+ file_uri = "viking://resources/demo/doc.md"
root_uri = file_uri.rsplit("/", 1)[0]
ctx = RequestContext(user=UserIdentifier.the_default_user(), role=Role.USER)
viking_fs = _FakeVikingFS(file_uri=file_uri, root_uri=root_uri)
coordinator = ContentWriteCoordinator(viking_fs=viking_fs)
- captured_enqueue = {}
-
- async def _fake_enqueue_semantic_refresh(**kwargs):
- captured_enqueue.update(kwargs)
-
- monkeypatch.setattr(coordinator, "_enqueue_semantic_refresh", _fake_enqueue_semantic_refresh)
-
- result = await coordinator.write(
- uri=file_uri,
- content="updated",
- ctx=ctx,
- mode="replace",
- wait=False,
+ queue = _FakeSemanticQueue()
+ monkeypatch.setattr(
+ "openviking.storage.content_write.get_queue_manager", lambda: _FakeQueueManager(queue)
)
+ plan = AsyncMock(side_effect=LockAcquisitionError("parent sidecars are busy"))
+ monkeypatch.setattr("openviking.storage.content_write.plan_abstract_overview_refresh", plan)
+ monkeypatch.setattr(
+ "openviking.storage.content_write.get_openviking_config",
+ lambda: SimpleNamespace(semantic=SimpleNamespace()),
+ )
+ monkeypatch.setattr(coordinator, "_wait_for_request", AsyncMock(return_value=None))
+ result = await coordinator.write(uri=file_uri, content="updated", ctx=ctx, wait=wait)
+
+ assert plan.await_args.kwargs["force_refresh"] is wait
assert viking_fs.content[file_uri] == "updated"
assert result["content_updated"] is True
- assert result["semantic_status"] == "queued"
- assert result["vector_status"] == "queued"
- assert captured_enqueue["root_uri"] == root_uri
- assert captured_enqueue["changed_uri"] == file_uri
- assert captured_enqueue["change_type"] == "modified"
- assert viking_fs.delete_temp_calls == []
+ assert result["semantic_status"] == "skipped"
+ assert result["vector_status"] == ("complete" if wait else "queued")
+ assert len(queue.messages) == 1
+ assert queue.messages[0].changes == {"modified": [file_uri]}
+ assert queue.messages[0].aggregate_directory is False
assert viking_fs._async_agfs.release_calls == ["lock-1"]
diff --git a/tests/storage/test_semantic_dag_incremental.py b/tests/storage/test_semantic_dag_incremental.py
index 898873b14..308f6c741 100644
--- a/tests/storage/test_semantic_dag_incremental.py
+++ b/tests/storage/test_semantic_dag_incremental.py
@@ -15,6 +15,7 @@ from openviking.storage.abstract_overview import (
parse_abstract_overview,
render_abstract_overview,
)
+from openviking.storage.errors import LockAcquisitionError
from openviking.storage.queuefs.semantic_dag import SemanticDagExecutor
from openviking.utils.ingest_options import IngestOptions
from openviking_cli.session.user_id import UserIdentifier
@@ -340,15 +341,7 @@ async def test_directory_vectorization_retries_after_matching_sidecar_write(monk
file_path = f"{root_uri}/a.txt"
fake_fs = _FakeVikingFS(
tree={root_uri: [{"name": "a.txt", "isDir": False}]},
- file_contents={
- file_path: "new content",
- f"{root_uri}/.overview.md": render_abstract_overview(
- ContextLevel.OVERVIEW, root_uri, "FILES:\n- a.txt: old-summary"
- ),
- f"{root_uri}/.abstract.md": render_abstract_overview(
- ContextLevel.ABSTRACT, root_uri, "old abstract"
- ),
- },
+ file_contents={file_path: "new content"},
)
monkeypatch.setattr("openviking.storage.queuefs.semantic_dag.get_viking_fs", lambda: fake_fs)
monkeypatch.setattr(
@@ -373,6 +366,16 @@ async def test_directory_vectorization_retries_after_matching_sidecar_write(monk
changes={"modified": [file_path]},
)
+ acquire = fake_fs.pathlock_acquire_exact_batch
+ fake_fs.pathlock_acquire_exact_batch = AsyncMock(
+ side_effect=[{"paths": []}, LockAcquisitionError("parent sidecars are busy")]
+ )
+ await make_executor().run(root_uri)
+ assert fake_fs.writes == []
+ assert processor.vectorized_files == [file_path]
+ vectorize_directory.assert_not_awaited()
+ fake_fs.pathlock_acquire_exact_batch = acquire
+
with pytest.raises(RuntimeError, match="temporary failure"):
await make_executor().run(root_uri)
await make_executor().run(root_uri)
diff --git a/tests/storage/test_semantic_dag_stats.py b/tests/storage/test_semantic_dag_stats.py
index f4cfc9471..145597e43 100644
--- a/tests/storage/test_semantic_dag_stats.py
+++ b/tests/storage/test_semantic_dag_stats.py
@@ -3,6 +3,7 @@
import asyncio
from types import SimpleNamespace
+from unittest.mock import AsyncMock
import pytest
@@ -14,6 +15,7 @@ from openviking.service.task_work_index import (
get_task_context,
)
from openviking.storage.abstract_overview import parse_abstract_overview
+from openviking.storage.errors import LockAcquisitionError
from openviking.storage.queuefs.named_queue import NamedQueue
from openviking.storage.queuefs.semantic_dag import (
DagStats,
@@ -323,7 +325,7 @@ async def test_non_recursive_memory_samples_files_and_reads_child_abstracts(monk
@pytest.mark.asyncio
-async def test_deferred_aggregation_processes_only_changed_files(monkeypatch):
+async def test_busy_parent_snapshot_preserves_changed_file_work(monkeypatch):
root_uri = "viking://resources/wide"
changed = f"{root_uri}/file-020.txt"
tree = {
@@ -332,6 +334,9 @@ async def test_deferred_aggregation_processes_only_changed_files(monkeypatch):
fake_fs = _FakeVikingFS(tree)
monkeypatch.setattr("openviking.storage.queuefs.semantic_dag.get_viking_fs", lambda: fake_fs)
_patch_semantic_config(monkeypatch, overview_sample_limit=4)
+ monkeypatch.setattr(
+ fake_fs, "pathlock_acquire_exact_batch", AsyncMock(side_effect=LockAcquisitionError("busy"))
+ )
processor = _FakeProcessor()
ctx = RequestContext(user=UserIdentifier("acc1", "user1"), role=Role.USER)
@@ -344,7 +349,7 @@ async def test_deferred_aggregation_processes_only_changed_files(monkeypatch):
target_uri=root_uri,
recursive=False,
changes={"modified": [changed]},
- aggregate_directory=False,
+ generation_trigger="content_write",
)
await executor.run(root_uri)