ReMe/tests/unit
RerankerGuo 047c1f39ee feat(search): add containment-style tags filter for multi-user scoping (#368)
Closes #368

## What
- Add containment-style tags filter to LocalFileStore._matches_search_filter with AND semantics (chunk must contain every expected tag). Matches the design note in the issue: frontmatter tags: [user:alice] plus the markdown chunker include_frontmatter_in_metadata=true lets multi-agent deployments scope recalls to a single user without per-user workspaces.
- Promote tags context parameter in SearchStep and SearchV2Step to search_filter[tags], mirroring the existing start_date/end_date promotion. Accept both list[str] and comma-separated strings (trimmed). Explicit search_filter.tags takes precedence.
- Add _tag_contains helper on LocalFileStore (covers list/set/tuple, scalar, and None inputs) and move the final two early-returns of _matches_search_filter to a combined boolean so pylint keeps the function's return-count under the limit.
- Unit tests: containment semantics at the filter layer, list+CSV promotion in both SearchStep and SearchV2Step, precedence over top-level context.

## Why
- The v0.4.x user-facing change removed an explicit user-scoping parameter. The documented workaround (separate workspaces per user) is heavyweight; the maintainer suggestion (store user:<name> in frontmatter tags) needed the corresponding search-side filter to be actionable in practice.
- Using containment (AND) rather than exact equality keeps the frontmatter format natural: mix of user:<name>, project:<proj>, domain tags still works without calling multiple filters.
- Using a reserved top-level tags key keeps the behavior explicit and the metadata semantics stable (metadata keys still use exact equality, which is what callers need for conversation_date style filters).

## Not in scope
- Does NOT flip include_frontmatter_in_metadata default to true — that's a deploy-time config decision and changes memory usage. Docs update to note the knob is tracked separately.
- No vector or keyword index changes; filtering stays post-hoc consistent with date/path/metadata filters today.

## Testing
- [x] New unit tests (4) for filter semantics, list and CSV promotion, precedence, SearchV2Step — all PASS
- [x] Existing search step test suite — 36/36 PASS (no regressions)
- [x] Pre-commit: check-ast, black, flake8, pylint, pyroma, add-trailing-comma, whitespace, private-key — all PASS
2026-07-29 19:37:02 +08:00
..
__init__.py init: reme version 0.4.0 (#284) 2026-06-22 15:41:19 +08:00
test_as_embedding_lazy.py refactor(embedding): defer provider construction until first remote call (#361) 2026-07-15 20:46:36 +08:00
test_auto_dream.py feat: add Auto Fin cookbook and managed outbound proxy support (#392) 2026-07-25 18:09:39 +08:00
test_auto_fin.py refactor(auto_fin): normalize data models and selection logic across agents (#396) 2026-07-27 20:15:27 +08:00
test_auto_memory_cc.py refactor(agent): unify agent subprocess env, sessions, skills, and MCP/service jobs (#382) 2026-07-20 23:52:14 +08:00
test_background_steps.py feat(Step tools): add white/black path prefix permission filtering to read, edit, write (#391) 2026-07-27 17:20:21 +08:00
test_base_agent_wrapper.py feat: add Auto Fin cookbook and managed outbound proxy support (#392) 2026-07-25 18:09:39 +08:00
test_base_component.py refactor(agent): unify agent subprocess env, sessions, skills, and MCP/service jobs (#382) 2026-07-20 23:52:14 +08:00
test_cc_agent_wrapper.py feat: add Auto Fin cookbook and managed outbound proxy support (#392) 2026-07-25 18:09:39 +08:00
test_codex_agent_wrapper.py feat(Step tools): add white/black path prefix permission filtering to read, edit, write (#391) 2026-07-27 17:20:21 +08:00
test_common_steps.py feat(lme): add cli execution and agentic search tooling (#334) 2026-07-08 17:43:09 +09:00
test_component_registry.py refactor(agent): unify agent subprocess env, sessions, skills, and MCP/service jobs (#382) 2026-07-20 23:52:14 +08:00
test_config_parser.py feat: add Auto Fin cookbook and managed outbound proxy support (#392) 2026-07-25 18:09:39 +08:00
test_crud_steps.py fix(file_io): stop ReadStep small-file path over-counting total lines by 1 (#389) 2026-07-27 11:01:09 +08:00
test_daily_paper.py feat: add Auto Fin cookbook and managed outbound proxy support (#392) 2026-07-25 18:09:39 +08:00
test_daily_steps.py fix(auto-memory): preserve message timestamps (#310) 2026-07-01 17:15:07 +08:00
test_default_file_chunker.py refactor(agent): unify agent subprocess env, sessions, skills, and MCP/service jobs (#382) 2026-07-20 23:52:14 +08:00
test_dingtalk_wait.py refactor(auto_fin): replace similarity with direction classification for historical events (#395) 2026-07-27 11:52:23 +08:00
test_embedded_consumer_compat.py refactor(agent): unify agent subprocess env, sessions, skills, and MCP/service jobs (#382) 2026-07-20 23:52:14 +08:00
test_evolve_utils.py fix(auto-memory): preserve message timestamps (#310) 2026-07-01 17:15:07 +08:00
test_faiss_index_maintenance.py feat(faiss_file_store): upgrade FAISS to HNSW index with async reindex (#390) 2026-07-27 19:54:38 +08:00
test_file_catalog.py init: reme version 0.4.0 (#284) 2026-06-22 15:41:19 +08:00
test_file_graph.py init: reme version 0.4.0 (#284) 2026-06-22 15:41:19 +08:00
test_file_store_consistency.py feat(faiss_file_store): upgrade FAISS to HNSW index with async reindex (#390) 2026-07-27 19:54:38 +08:00
test_http_client.py feat(benchmark): add lme benchmark steps (#326) 2026-07-07 18:53:39 +09:00
test_injected_job_kwargs.py feat(Step tools): add white/black path prefix permission filtering to read, edit, write (#391) 2026-07-27 17:20:21 +08:00
test_job.py refactor(agent): unify agent subprocess env, sessions, skills, and MCP/service jobs (#382) 2026-07-20 23:52:14 +08:00
test_json_file_chunker.py refactor(agent): unify agent subprocess env, sessions, skills, and MCP/service jobs (#382) 2026-07-20 23:52:14 +08:00
test_jsonl_file_chunker.py feat: add Auto Fin cookbook and managed outbound proxy support (#392) 2026-07-25 18:09:39 +08:00
test_keyword_index.py refactor(agent): unify agent subprocess env, sessions, skills, and MCP/service jobs (#382) 2026-07-20 23:52:14 +08:00
test_link_expansion.py init: reme version 0.4.0 (#284) 2026-06-22 15:41:19 +08:00
test_local_embedding_store.py feat: add Auto Fin cookbook and managed outbound proxy support (#392) 2026-07-25 18:09:39 +08:00
test_logging_config.py feat: add Auto Fin cookbook and managed outbound proxy support (#392) 2026-07-25 18:09:39 +08:00
test_markdown_file_chunker.py fix: enforce markdown chunk byte limits (#370) 2026-07-17 22:03:58 +08:00
test_outbound_proxy.py feat: add Auto Fin cookbook and managed outbound proxy support (#392) 2026-07-25 18:09:39 +08:00
test_packaging.py init: reme version 0.4.0 (#284) 2026-06-22 15:41:19 +08:00
test_path_permission.py feat(Step tools): add white/black path prefix permission filtering to read, edit, write (#391) 2026-07-27 17:20:21 +08:00
test_prompt_handler.py feat(benchmark): add lme benchmark steps (#326) 2026-07-07 18:53:39 +09:00
test_read_image_steps.py docs: rename vault_dir to workspace_dir in documentation and examples (#286) 2026-06-22 16:58:57 +08:00
test_read_with_neighbors.py init: reme version 0.4.0 (#284) 2026-06-22 15:41:19 +08:00
test_reme_cli.py feat: add Auto Fin cookbook and managed outbound proxy support (#392) 2026-07-25 18:09:39 +08:00
test_runtime_context.py feat(benchmark): add lme benchmark steps (#326) 2026-07-07 18:53:39 +09:00
test_search_step.py feat(search): add containment-style tags filter for multi-user scoping (#368) 2026-07-29 19:37:02 +08:00
test_service.py refactor(agent): unify agent subprocess env, sessions, skills, and MCP/service jobs (#382) 2026-07-20 23:52:14 +08:00
test_service_utils.py feat(benchmark): add lme benchmark steps (#326) 2026-07-07 18:53:39 +09:00
test_shell_step.py feat(core): add shell execution and runtime memory status (#344) 2026-07-14 16:31:41 +08:00
test_source_format_merge.py feat(search): scoped dedup, session-chunk merge, and unified recall formatting (#384) 2026-07-22 17:17:23 +08:00
test_status_step.py feat(core): add shell execution and runtime memory status (#344) 2026-07-14 16:31:41 +08:00
test_tokenizer.py init: reme version 0.4.0 (#284) 2026-06-22 15:41:19 +08:00
test_utils.py init: reme version 0.4.0 (#284) 2026-06-22 15:41:19 +08:00
test_wikilink_utils.py docs: rename vault_dir to workspace_dir in documentation and examples (#286) 2026-06-22 16:58:57 +08:00
test_write_metadata_lock.py init: reme version 0.4.0 (#284) 2026-06-22 15:41:19 +08:00