Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion openviking/core/directories.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from openviking.core.namespace import (
canonical_user_root,
context_type_for_uri,
is_session_uri,
user_space_fragment,
)
from openviking.server.identity import RequestContext
Expand Down Expand Up @@ -258,7 +259,7 @@ async def _ensure_directory(

# 2. Seed directory L0/L1 vectors only during fresh initialization.
owner_space = self._owner_space_for_scope(scope=scope, ctx=ctx)
if agfs_created:
if agfs_created and not is_session_uri(uri):
await self._ensure_directory_l0_l1_vectors(
uri=uri,
parent_uri=parent_uri,
Expand Down
6 changes: 0 additions & 6 deletions openviking/core/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,6 @@ def _resolve_user_uri(
) -> ResolvedNamespace:
normalized = "viking://" + "/".join(parts)
if len(parts) == 1:
if ctx is not None:
return ResolvedNamespace(
uri=canonical_user_root(ctx),
scope="user",
owner_user_id=ctx.user.user_id,
)
return ResolvedNamespace(uri="viking://user", scope="user", is_container=True)

if _is_current_user_relative_uri(parts, ctx):
Expand Down
6 changes: 6 additions & 0 deletions openviking/storage/viking_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,12 @@ def _ensure_mutable_access(self, uri: str, ctx: Optional[RequestContext]) -> Non

def _ensure_supported_write_namespace(self, normalized_uri: str) -> None:
parts = [p for p in normalized_uri[len("viking://") :].strip("/").split("/") if p]
if parts == ["user"]:
raise PermissionDeniedError(
"Writing viking://user is not supported; use an explicit user namespace "
"or current-user content path instead.",
resource=normalized_uri,
)
if parts and parts[0] in {"agent", "session"}:
raise PermissionDeniedError(
f"Writing {normalized_uri} is not supported; use user-owned namespaces instead.",
Expand Down
8 changes: 0 additions & 8 deletions tests/unit/test_namespace_uri_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,3 @@ def test_current_user_short_content_roots_are_canonicalized_from_content_segment
assert is_content_root_uri("viking://resources", ctx, kind="resource")
assert not is_content_namespace_root_uri("viking://user/resources/docs", ctx)


def test_user_root_short_form_uses_current_identity():
ctx = RequestContext(
user=UserIdentifier(account_id="acct", user_id="alice"),
role=Role.ROOT,
)

assert canonicalize_uri("viking://user", ctx) == "viking://user/alice"
Loading