yams/tests/unit/daemon
Trevon a3d065dd8d
feat(search): make topology-assisted retrieval the default (#57)
* fix(release): repair package repo publish

Arch repo metadata and R2 uploads need to be reproducible from CI, with retry hardening for transient Cloudflare failures.

* fix(daemon): stop shutdown log storm

Init waiter must treat ShuttingDown as terminal so daemon shutdown tests do not flood Meson logs while the daemon is stopping.

* refactor(cli): delegate serve to MCP binary

Keep yams serve UX while removing MCP server linkage from yams-cli. The standalone MCP binary owns stdio serving and exits on stdin EOF.

* refactor(cli): move daemon path helpers

Keep CLI path resolution out of YamsDaemon so later link cuts can separate CLI and daemon internals. Full yams_daemon removal still needs a socket-only daemon-client split.

* refactor(daemon): split embedded client

* perf(search): add lean-guided benchmark gates

Add Lean topology/search models, ingestion ablation docs, and focused regression tests for topology and compression threshold behavior.

Extract search observability, keep benchmark-only ablation controls, and make retrieval quality benchmarks default to Simeon while preserving explicit ONNX opt-in.

* refactor(config): move daemon policies

* refactor(daemon): extract plugin runtime

* refactor(daemon): untangle service coordinators

Untangle CLI/MCP from daemon service coordinators and the daemon static lib.

- MetadataRepository uses a daemon-neutral tree-diff callback. The
  GraphComponent wrapper moves to src/daemon/components/metadata_graph_bridge.cpp,
  owned by the daemon library.
- WriteCoordinator moves to a dedicated build-only yams_write_coordinator
  static lib. Drop ResourceGovernor coupling inside the writer loop; batch
  sizing still respects config.maxBatchSize.
- AppContext gains enqueuePostIngest callback. ServiceManager wires it to
  its own enqueuePostIngest; app services no longer call ServiceManager
  directly.
- Embedding repair uses BulkIngestLease/BeginBulkIngestCallback instead of
  concrete VectorIndexCoordinator::BulkScope. Daemon dispatchers provide a
  lease factory backed by the real coordinator.
- CLI daemon_command uses config helpers instead of YamsDaemon::getXDGRuntimeDir.
- Remove explicit dependency('yams_daemon') from src/cli and tools/yams-mcp.
- Declare missing yams_extraction/yams_ingest deps on yams_app_services so
  app services link cleanly without daemon.

Validated:
  meson compile -C build/release -j4 yams-daemon yams-cli yams-mcp-server
  ninja -C build/release -t commands tools/yams-cli/yams-cli tools/yams-mcp/yams-mcp-server | grep -c libyams_daemon.a -> 0
  yams-cli --version, yams-mcp-server init, yams serve --help smoke tests

Size drop on macOS release: yams-cli 41M -> 32M, yams-mcp-server 37M -> 22M.

* fix(cli): keep stdin add local fallback

No embedded daemon now. When yams add - buffers stdin and daemon IPC is missing, store via local app services instead of failing socket_missing.

Validated:
  meson compile -C build/debug -j4 yams-cli catch2_cli_commands
  MESON_BUILD_ROOT=/Users/trevon/work/tools/yams/build/debug build/debug/tests/catch2_cli_commands 'AddCommand - reads from piped stdin and stores content'
  MESON_BUILD_ROOT=/Users/trevon/work/tools/yams/build/debug build/debug/tests/catch2_cli_commands
  meson compile -C build/release -j4 yams-cli yams-mcp-server
  meson compile -C build/asan-api -j2 yams-cli catch2_cli_commands
  MESON_BUILD_ROOT=/Users/trevon/work/tools/yams/build/asan-api ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 build/asan-api/tests/catch2_cli_commands 'AddCommand - reads from piped stdin and stores content'
  ninja -C build/release -t commands tools/yams-cli/yams-cli tools/yams-mcp/yams-mcp-server | grep libyams_daemon.a -> no output

* feat(bench): add xplan multi-arm experiment harness

Unified plan runner, ablation axes, REPORT/ablation docs, and
KPI snapshot so optimization loops stop living in shell matrices.

* feat(formal): expand topology/search Lean contracts

Boundary models for search provenance, construction gates,
and cluster/route objectives so Lean guides correctness while
xplan ranks performance levers.

* feat(search,topology): construction purity + graph expansion path

Raise topology build defaults (min edge 0.25, max component 64) and
split oversized CC pieces so hybrid assist is quality-positive on
scifact. Add GraphNeighbors expansion with medoid-anchor fallback,
structured helpers instead of nested session logic, and BEIR-default
xplan plans. Search engine extraction (fanout/classic pipeline) rides
along as the integration surface for routing.

* feat(topology): add KMeans engine and SGC identity contracts

Register kmeans in the factory with deterministic spherical k-means
over embeddings, and enforce SGC document-identity invariants in
debug builds with matching unit coverage.

* feat(daemon): topology readiness gates and selectable reranker

Drive topologyReady from published epoch/freshness/rebuild/dirty
ingest state (not just KG drain), surface those fields in search
stats, and wire onnx|simeon|auto|none cross-reranker selection.

* chore(search): drop meta_path tuner knobs

Meta-path routing is gone; remove dead TunedParams fields and the
ConfigResolver test for [search.meta_path].

* feat(bench): add topology_purity_validate plan

Repeats=3 validation matrix for construction-purity winners vs
topo_off so MRR deltas can clear run-to-run noise.

* chore: format add_command and config include order

Mechanical clang-format / include reorder only; no behavior change.

* feat(bench): decision-grade xplan loop for search engine

Document search-engine measurement in AGENTS; harden xplan with
repeats=3 plans, quality×latency primaries, mechanism metrics from
debug.jsonl, multi-rep log promotion, and archive superseded topology
plans.

* feat(graph): denser product semantic_neighbor topK

Raise default YAMS_GRAPH_SEMANTIC_TOPK fallback from 4 to 8 so product
graphs leave fewer degree-0 docs for GraphNeighbors expansion.

* feat(search): extract topology assist and cross-rerank seams

Pull topology assist into search_topology_stage (seed merge, skip
reasons, optional vector seed probe default 0). Extract cross_rerank
compute from search_engine. Wire probe via typed config/ConfigResolver.

* feat(bench): product-path search engine ablation plans

Add topology-off component, vector-weight, and tiered-execution xplan
plans (repeats=3) and wire them into the AGENTS measurement loop table.

* fix(ci): repair pre-push fallbacks

* feat(bench): lock-free mid-run builds + multi-corpus gates

xplan skips meson rebuild when the quality binary exists (flock +
YAMS_BENCH_FORCE_BUILD override) to stop multi-arm link races. Add
graph_vector weight and nfcorpus transfer-gate plans; document in AGENTS.

* fix(daemon): keep SearchEngine alive via shared_ptr cache

getCachedEngine previously published a raw pointer that metrics polling
used through rebuild, racing destructor of SearchEngine::Impl (TSAN).
Store and return a shared_ptr snapshot so diagnostic readers pin the
engine for the duration of getConfig/health checks.

Also adds the cautious vectorWeight 0.30→0.20 multi-corpus xplan plan.

* feat(search): route vectors through cached topology

Build and reuse validated topology snapshots, rank routed members by query similarity, and narrow the vector leg to the accepted document set with explicit work diagnostics.

Remove the retired HDBSCAN engine and vendor dependency, preserve typed topology policy through search tuning, and cover the runtime/configuration contracts.

* feat(bench): consolidate search decision plans

Enforce deterministic experiment identity and declared baselines, expose routed/global vector work metrics, and register the focused benchmark contracts.

Promote the compact repeats=3 routing-budget gate, archive superseded topology mechanism screens, and add multi-corpus product calibration plans.

* feat(search): refine topology vector routing

* fix(search): propagate daemon readiness

* feat(bench): measure generalized memory health

* fix(cli): honor in-process fallbacks

* ci: harden smolvm debug builds

* perf(search): route topology through filtered ANN

* feat(bench): measure read-write pressure

* perf(metadata): index symbol lookups on read pool

* fix(daemon): isolate startup reads and maintenance

* feat(bench): replay isolated generalized corpora

* feat(search): add evidence routing pipeline

Replace the blocking smolvm pre-push path with host ASan/TSan validation, harden sanitizer-sensitive smoke tests, and add recovery cleanup for malformed SQLite WAL sidecars.

* refactor(search): unify topology evidence path

Remove classic and sidecar fusion lanes so topology augments the recall-preserving ANN and lexical candidate pool through one product path.

* refactor(bench): prune superseded search lanes

Measure the topology-plus-ANN product path with stable experiment identity and remove obsolete sidecar and tiered controls.

* docs(search): retire stale experiment notes

Keep the benchmark handoff focused on the topology-plus-ANN product lane and its active decision plans.

* refactor(search): prune dead search surfaces

Remove unused fusion, reranker, policy, and router abstractions.
Bound topology materialization and keep document trace payloads opt-in.

* fix(cli): clear build warnings

* fix(xplan): reject stale run identity

* refactor(search)!: remove legacy query stack

Replace the unused AST/ranker/post-processor surface with focused facet aggregation used by product search.

BREAKING CHANGE: removes query parser, result ranker, search filter, and SearchResults container APIs from yams_search.

* refactor(search): type value stage traces

Remove synthetic ComponentResult markers for embedding and concept stages. Preserve failure and timeout states instead of overwriting them with fake successful results.

* refactor(search): isolate benchmark env overlays

Move test-only search environment parsing behind an injectable internal adapter. Keep all existing overlay keys and tuner pin semantics while restoring SearchEngineBuilder to composition.

* refactor(search): unify topology routing options

Snapshot topology policy once at the assist boundary and pass it through routing sessions and diagnostics. Remove repeated scalar copying without changing routing behavior or metric keys.

* fix(search): unify tuner config ownership

Use one complete config-to-params overlay for runtime seeding and no-tuner policy resolution. Reseed attached tuners on setConfig so reported and executed configuration cannot diverge.

* fix(search): snapshot tuner state per query

Read tuned config, params, and state under one lock before routing. Add a TSAN correlation test so adaptive observation cannot produce a torn logical query snapshot.

* fix(search): enforce topology routing contract

Generated configs must preserve hybrid-assist shadow routing, while daemon-backed search must abstain when published topology artifacts are stale. Keep standalone validation and global ANN recall intact.

* fix(daemon): let SQLite reclaim its file

Directly resizing a live database from sampled page counts can truncate pages allocated by concurrent writers. VACUUM must remain the only file-reclamation mechanism.

* fix(metadata): tolerate missing symbol FTS

Readiness lookups can race an unavailable optional FTS migration. Retain the indexed fast path, but retry against the base table when prepare or cached-statement execution proves the capability absent.

* build(fuzz): drop removed query parser target

The optional AFL build still referenced the deleted legacy query parser API and could no longer compile.

* fix(bench): include writes in drain oracle

A zero post-ingest queue is not durable drain while coordinated writes remain queued or in flight.

* fix(daemon): vacuum padded WAL databases safely
2026-07-13 20:26:43 -04:00
..
components feat(search): make topology-assisted retrieval the default (#57) 2026-07-13 20:26:43 -04:00
abi_model_provider_dimension_catch2_test.cpp fix(security): harden fold-flagged guards 2026-05-17 23:50:32 -04:00
admission_policy_catch2_test.cpp feat: search / retrieval optimizations for performance and accuracy 2026-04-09 21:34:43 -04:00
asio_connection_pool_catch2_test.cpp test(daemon): wait for idle socket close 2026-05-19 11:38:49 -04:00
asio_transport_exhaustion_catch2_test.cpp feat: checkpoint for updated unit test for daemon communication / protobuf errors. Expanding untested surface with optimizations for communication and ingestion. Additional work for ci apt / rpm install improvements, systemd configuration for installs and improved validation testing of packaging logic to reduce gpg errors. 2026-04-08 11:39:15 -04:00
asio_transport_inflight_close_ipc_prefix_catch2_test.cpp fix: download logic improvements and ci test fixes. Stagging download fixes seperate from search features 2026-05-04 13:29:17 -04:00
daemon_background_processing_test.cpp feat(daemon): shutdown hardening + test helper linkage fixes (#44) 2026-06-08 16:29:44 -04:00
daemon_catch2_test.cpp fix(ci): stablize ci 2026-07-02 21:34:18 -04:00
daemon_client_list_status_catch2_test.cpp fix: fixing fragiling SocketServer loop 2026-05-01 12:07:40 -04:00
daemon_components_test.cpp feat: cleaning up request path and fixing checkpoint logic underload 2026-04-24 18:42:00 -04:00
daemon_fsm_suite_test.cpp fix(daemon): tolerate FSM shutdown reset race 2026-06-12 16:48:31 -04:00
daemon_idle_control_bench_catch2_test.cpp feat: Correctness fixes for flaky tests, improvements for linux build logic based on clion change. Improvement of tuning / governor daemon logic to simplify scaling logic 2026-04-09 11:45:57 -04:00
daemon_metrics_catch2_test.cpp chore: housekeeping — rm dead code, consolidate MCP tools, add tests, clean docs (#50) 2026-06-16 19:37:24 -04:00
daemon_metrics_status_test.cpp fix(testing): stabilize TSAN coverage, harden daemon shutdown, and speed up KG/storage paths (#53) 2026-06-26 17:57:02 -04:00
daemon_protocol_test.cpp test: lift coverage for core paths 2026-06-22 10:25:28 -04:00
daemon_warm_bench_catch2_test.cpp fix: windows test fixes 2026-02-20 22:51:41 -05:00
db_recovery_test.cpp test(metadata): add corruption fixture + suites: page smash (header 2026-07-01 20:11:03 -04:00
db_recovery_vacuum_catch2_test.cpp Search/grep UX, runtime hardening, and CI stabilization (#39) 2026-05-27 12:15:17 -04:00
db_salvage_catch2_test.cpp test(metadata): add corruption fixture + suites: page smash (header 2026-07-01 20:11:03 -04:00
dispatch_response_mapper_catch2_test.cpp fix: improvement of graph node source and retrieval logic and sandbox fixes in add command 2026-02-25 12:23:25 -05:00
dynamic_cap_sentinel_catch2_test.cpp fix(daemon): WAL flush on shutdown, corrupt-DB salvage, test hardening, ASAN fix (#27) 2026-05-09 23:03:23 -04:00
embedding_lifecycle_manager_catch2_test.cpp fix: HNSW and topology rebuilds are now batched in repair. Cleaning up from previous migration work 2026-04-21 13:58:10 -04:00
embedding_provider_recovery_catch2_test.cpp fix: license header file updates, mcp improvements, windows build fixes 2026-01-30 17:23:33 -05:00
entity_graph_service_catch2_test.cpp fix: license header file updates, mcp improvements, windows build fixes 2026-01-30 17:23:33 -05:00
external_plugin_host_test.cpp feat: security fixes for plugin install and adding additional UTF-8 string sanitization 2026-02-28 10:17:03 -05:00
frame_reader_catch2_test.cpp feat: checkpoint for updated unit test for daemon communication / protobuf errors. Expanding untested surface with optimizations for communication and ingestion. Additional work for ci apt / rpm install improvements, systemd configuration for installs and improved validation testing of packaging logic to reduce gpg errors. 2026-04-08 11:39:15 -04:00
graph_component_catch2_test.cpp fix(testing): stabilize TSAN coverage, harden daemon shutdown, and speed up KG/storage paths (#53) 2026-06-26 17:57:02 -04:00
health_check_isolation_catch2_test.cpp feat: adding perf optimizations for search and grep based on previous commit. Improving model logic for future embeddinggemma and improved colbert support. Re-ranking fixes for search to improve retrieval accuracy. 2026-03-11 14:15:33 -04:00
idle_zero_concurrency_catch2_test.cpp fix: correctness fix for abalation test, fixes for daemon response (regression is present underload/repair) 2026-04-20 13:20:24 -04:00
in_process_transport_catch2_test.cpp feat(daemon): shutdown hardening + test helper linkage fixes (#44) 2026-06-08 16:29:44 -04:00
ingest_metrics_publisher_catch2_test.cpp feat: extracted public and categorized methods from service manager. 2026-04-16 10:39:10 -04:00
metrics_consistency_catch2_test.cpp fix: testing improvements and bug fixes in daemon logic for lifecycle management 2026-02-17 15:55:29 -05:00
model_provider_registry_catch2_test.cpp feat: tuning topology system to work better with simeon via configuration 2026-04-19 20:10:46 -04:00
multiplex_client_catch2_test.cpp feat: optimizations based on profile runs in hashing and work coordinator. test updates and correctness fixes 2026-02-24 21:06:43 -05:00
onnx_embedding_diagnostic_test.cpp experimental → main: MCP timeout fix + doctor integrity checks + search/perf improvements (#31) 2026-05-14 23:29:44 -04:00
onnx_gpu_provider_catch2_test.cpp fix: make Gemma CoreML fallback automatic 2026-04-02 13:56:42 -04:00
onnx_model_pool_catch2_test.cpp fix: download logic improvements and ci test fixes. Stagging download fixes seperate from search features 2026-05-04 13:29:17 -04:00
onnx_model_provider_config_test.cpp feat: massive commit. Download logic updates with expanding controls (stop, start, resume etc.) from daemon control. This is used in my archive openclaw agent. This commit also includes work to harden onnxruntime abi access. this should allow loading newer abi's when builds are pinned to 1.23.0. 2026-03-21 17:12:47 -04:00
onnx_plugin_harness_test.cpp feat: removing experiments and unifying compression in embeddings storage. 2026-04-21 18:13:37 -04:00
physical_walk_ttl_test.cpp feat(daemon): adaptive physical-walk TTL + statvfs fast-path, hot-tier getenv→TuningSnapshot, RepairScheduling/RepairTuning slice extractions 2026-04-28 15:39:11 -04:00
plugin_content_extractor_adapter_test.cpp fix: license header file updates, mcp improvements, windows build fixes 2026-01-30 17:23:33 -05:00
plugin_infrastructure_test.cpp feat: cleaning up test suite 2026-04-14 10:25:54 -04:00
plugin_manager_config_test.cpp fix: license header file updates, mcp improvements, windows build fixes 2026-01-30 17:23:33 -05:00
post_ingest_dynamic_cap_recovery_catch2_test.cpp feat: adding perf optimizations for search and grep based on previous commit. Improving model logic for future embeddinggemma and improved colbert support. Re-ranking fixes for search to improve retrieval accuracy. 2026-03-11 14:15:33 -04:00
proto_serializer_catch2_test.cpp chore: housekeeping — rm dead code, consolidate MCP tools, add tests, clean docs (#50) 2026-06-16 19:37:24 -04:00
repair_binary_filter_catch2_test.cpp fix: license header file updates, mcp improvements, windows build fixes 2026-01-30 17:23:33 -05:00
repair_hold_hints_test.cpp optimizations: throughput optimizations, bug fixes, docs updates and benchmark cleanup 2026-04-26 21:43:00 -04:00
repair_scheduling_adapter_catch2_test.cpp feat: repair logic improvements, expanding config options to disable rebuilding/repair for memory constrained systems 2026-04-24 10:53:15 -04:00
repair_service_post_ingest_channel_catch2_test.cpp feat(daemon): shutdown hardening + test helper linkage fixes (#44) 2026-06-08 16:29:44 -04:00
request_handler_admission_reuse_catch2_test.cpp feat: search / retrieval optimizations for performance and accuracy 2026-04-09 21:34:43 -04:00
request_handler_io_edge_catch2_test.cpp fix: fixing leakage of build artifacts in release, unifying repair path, adding cache to tuning path and bumping simeon version 2026-04-23 10:20:25 -04:00
request_handler_lifetime_catch2_test.cpp feat: optimizations based on profile runs in hashing and work coordinator. test updates and correctness fixes 2026-02-24 21:06:43 -05:00
request_handler_repair_cancel_catch2_test.cpp test: expand storage-readiness coverage — 48.1%→59.8% broad, 74.3% narrow (#38) 2026-05-25 22:58:15 -04:00
request_handler_status_unary_catch2_test.cpp feat: recovery test improvements 2026-02-09 23:27:12 -05:00
request_handler_writer_drain_cleanup_catch2_test.cpp fix: windows test fixes 2026-02-20 22:51:41 -05:00
resource_governance_test.cpp perf: cleaning up search experiments, moving to new routing system for search for larger corpus improvements, repair system now triggers semantic / graph repair 2026-04-29 20:36:02 -04:00
sandbox_detection_catch2_test.cpp fix(asan): Addressing asan test regressions and suite failures from recent changes 2026-05-01 09:18:39 -04:00
search_admission_controller_catch2_test.cpp feat: extracted public and categorized methods from service manager. 2026-04-16 10:39:10 -04:00
service_manager_catch2_test.cpp feat(search): make topology-assisted retrieval the default (#57) 2026-07-13 20:26:43 -04:00
service_manager_provider_degraded_catch2_test.cpp feat: test fixes, metric expansion, build improvements for gliner 2026-04-23 08:48:33 -04:00
service_manager_shutdown_ownership_catch2_test.cpp fix: license header file updates, mcp improvements, windows build fixes 2026-01-30 17:23:33 -05:00
simeon_model_provider_catch2_test.cpp feat: bumping simeon, improving graph building, clustering, configuration tuning of said system and updating benchmark files. Additional fixes for daemon readiness and status return underload. 2026-04-20 09:31:45 -04:00
status_readiness_vector_usable_catch2_test.cpp feat: adding instrumentation and config options for build and repair system. Bumping simeon and improving topology system with experimental findings 2026-04-24 17:38:24 -04:00
storage_preflight_test.cpp fix(ci): stablize ci 2026-07-02 21:34:18 -04:00
streaming_handlers_catch2_test.cpp cleaning up code 2026-01-21 16:54:16 -05:00
streaming_processor_catch2_test.cpp ci improvements. streaming processor bug and test fixes 2025-12-28 17:13:54 -05:00
timing_audit_catch2_test.cpp feat: cleaning up test suite 2026-04-14 10:25:54 -04:00
topology_manager_catch2_test.cpp feat: extracted public and categorized methods from service manager. 2026-04-16 10:39:10 -04:00
tune_advisor_snapshot_test.cpp test: instrumentation expansions for ingestion speed experiments and tuning improvements 2026-04-26 19:55:29 -04:00
tune_advisor_threshold_test.cpp fix: fixing leakage of build artifacts in release, unifying repair path, adding cache to tuning path and bumping simeon version 2026-04-23 10:20:25 -04:00
tuning_allocation_catch2_test.cpp feat: cleaning up test suite 2026-04-14 10:25:54 -04:00
tuning_loop_wakeup_catch2_test.cpp feat: cleaning up test suite 2026-04-14 10:25:54 -04:00
tuning_reconciliation_catch2_test.cpp feat: cleaning up test suite 2026-04-14 10:25:54 -04:00
vector_index_coordinator_bulk_scope_catch2_test.cpp feat: continued extraction from serach engine and vector improvements. This allows for better testing and experimentation 2026-04-22 12:24:28 -04:00
vector_index_coordinator_coalesce_catch2_test.cpp fix: text fixes, connection handingly fixes and continued refactor work 2026-04-22 13:20:18 -04:00
vector_index_coordinator_telemetry_catch2_test.cpp feat: continued extraction from serach engine and vector improvements. This allows for better testing and experimentation 2026-04-22 12:24:28 -04:00
work_coordinator_test.cpp fix(test): prevent stack-use-after-scope in work-coordinator coroutine 2026-06-28 22:27:14 -04:00
write_coordinator_catch2_test.cpp feat(search): make topology-assisted retrieval the default (#57) 2026-07-13 20:26:43 -04:00