fix(search): cap path_prefixes server-side; unify Iterable typing
Round 3 review follow-ups: - Enforce the folder cap (MAX_PATH_PREFIXES=20) inside normalize_path_prefixes so the REST/viz endpoints are bounded too, not just the MCP tool's Field and the PHP client. Single server-side enforcement point; the MCP tool's Field(max_length=...) now references the same constant. - Widen the SearchAlgorithm ABC and both concrete implementations' path_prefixes param to Iterable[str] | None, matching the widening of build_base_filter_conditions from the prior round. - Add a normalize_path_prefixes cap test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
ea108140ab
commit
9c0c6a0c50
@@ -2,6 +2,7 @@
|
||||
|
||||
import logging
|
||||
from abc import ABC, abstractmethod
|
||||
from collections.abc import Iterable
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, Protocol, runtime_checkable
|
||||
|
||||
@@ -300,7 +301,7 @@ class SearchAlgorithm(ABC):
|
||||
modified_after: int | None = None,
|
||||
modified_before: int | None = None,
|
||||
path_prefix: str | None = None,
|
||||
path_prefixes: list[str] | None = None,
|
||||
path_prefixes: Iterable[str] | None = None,
|
||||
**kwargs: Any,
|
||||
) -> list[SearchResult]:
|
||||
"""Execute search with the given parameters.
|
||||
|
||||
Reference in New Issue
Block a user