yams/tests/integration/daemon/meson.build
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

734 lines
27 KiB
Meson

# Daemon integration tests - Catch2 socket/client integration tests
#
# IMPORTANT: Each test case runs in its own process to avoid static pool state
# issues (RepairThreadPool, ConnectionRegistry, GlobalIOContext) that cause
# std::future_error crashes when multiple daemon instances are created/destroyed
# within a single process.
if not catch2_dep.found()
message('Catch2 not found; skipping daemon integration tests (PBI-066).')
else
daemon_catch2_srcs = files(
'daemon_socket_client_test.cpp',
)
daemon_shutdown_srcs = files(
'daemon_shutdown_test.cpp',
)
post_ingest_queue_validation_srcs = files(
'post_ingest_queue_validation_test.cpp',
)
post_ingest_queue_benchmark_srcs = files(
'post_ingest_queue_benchmark_test.cpp',
)
post_ingest_trace_srcs = files(
'post_ingest_trace.cpp',
)
client_timeout_recovery_srcs = files(
'client_timeout_recovery_test.cpp',
)
codex_sandbox_embedding_regression_srcs = files(
'codex_sandbox_embedding_regression_test.cpp',
)
# idle_streaming and writer_drain tests removed - timing-sensitive and flaky in CI
# See git history for original implementation if needed
socket_memory_pressure_srcs = files(
'socket_memory_pressure_test.cpp',
)
stats_command_crash_srcs = files(
'stats_command_crash_test.cpp',
)
daemon_db_corruption_recovery_srcs = files(
'daemon_db_corruption_recovery_test.cpp',
)
cli_responsiveness_under_load_srcs = files(
'cli_responsiveness_under_load_test.cpp',
)
entity_graph_integration_srcs = files(
'entity_graph_service_integration_catch2_test.cpp',
)
ghidra_kg_entity_ingestion_srcs = files(
'ghidra_kg_entity_ingestion_test.cpp',
)
daemon_sigterm_srcs = files(
'daemon_sigterm_test.cpp',
)
proxy_slot_starvation_srcs = files(
'proxy_slot_starvation_test.cpp',
)
lifecycle_single_instance_srcs = files(
'lifecycle_single_instance_test.cpp',
)
dbg = (get_option('buildtype') == 'debug')
if (get_option('enable-integration-tests') or dbg) and (get_option('enable-daemon-integration') or dbg)
# catch2_main_dep is inherited from parent tests/meson.build - no need to redeclare
# Common environment for daemon tests
_daemon_test_env = {
'YAMS_TEST_SAFE_SINGLE_INSTANCE': '1',
'YAMS_DISABLE_VECTORS': '1',
'YAMS_DISABLE_SESSION_WATCHER': '1',
'TSAN_OPTIONS': _test_tsan_options,
}
daemon_catch2_exe = executable('yams_daemon_socket_tests_catch2',
daemon_catch2_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
# Split socket tests into individual processes to avoid static pool state issues
# Each test case creates/destroys a daemon, and static singletons (RepairThreadPool,
# ConnectionRegistry) don't reset properly between runs, causing future_error crashes.
test('daemon_socket_connection_lifecycle',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon socket connection lifecycle', '--allow-running-no-tests'],
)
test('daemon_socket_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon client request execution', '--allow-running-no-tests'],
)
test('daemon_socket_download_job_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket', 'download-jobs'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon client download job request execution', '--allow-running-no-tests'],
)
test('daemon_socket_model_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon client model request execution', '--allow-running-no-tests'],
)
test('daemon_socket_plugin_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon client plugin request execution', '--allow-running-no-tests'],
)
test('daemon_socket_prune_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon client prune request execution', '--allow-running-no-tests'],
)
test('daemon_socket_graph_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon client graph maintenance request execution', '--allow-running-no-tests'],
)
test('daemon_socket_collection_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon client collection request execution', '--allow-running-no-tests'],
)
test('daemon_socket_tree_diff_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon client tree diff request execution', '--allow-running-no-tests'],
)
test('daemon_socket_session_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon client session request execution', '--allow-running-no-tests'],
)
test('daemon_socket_repair_request_execution',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon client repair request execution', '--allow-running-no-tests'],
)
test('daemon_socket_error_handling',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon client error handling', '--allow-running-no-tests'],
)
test('daemon_socket_concurrent_requests',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon client concurrent requests', '--allow-running-no-tests'],
)
test('daemon_socket_timeout_behavior',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon client timeout behavior', '--allow-running-no-tests'],
)
test('daemon_socket_move_semantics',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon client move semantics', '--allow-running-no-tests'],
)
test('daemon_socket_file_lifecycle',
daemon_catch2_exe,
suite: ['integration', 'daemon', 'catch2', 'socket'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon socket file lifecycle', '--allow-running-no-tests'],
)
daemon_shutdown_exe = executable('yams_daemon_shutdown_tests_catch2',
daemon_shutdown_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
# Split shutdown tests into individual processes
test('daemon_shutdown_timing',
daemon_shutdown_exe,
suite: ['integration', 'daemon', 'catch2', 'shutdown'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon shutdown timing', '--allow-running-no-tests'],
)
test('daemon_shutdown_inflight_ops',
daemon_shutdown_exe,
suite: ['integration', 'daemon', 'catch2', 'shutdown'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon shutdown with in-flight operations', '--allow-running-no-tests'],
)
# Removed flaky shutdown tests (idempotency, after_ops, under_load, graceful)
# Core shutdown behavior is covered by timing and inflight_ops tests above
post_ingest_queue_validation_exe = executable('yams_post_ingest_queue_validation',
post_ingest_queue_validation_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('post_ingest_queue_validation',
post_ingest_queue_validation_exe,
suite: ['integration', 'daemon', 'catch2', 'post-ingest'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['--allow-running-no-tests'],
)
if get_option('enable-bench-tests')
post_ingest_queue_benchmark_exe = executable('yams_post_ingest_queue_benchmark',
post_ingest_queue_benchmark_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('post_ingest_queue_benchmark',
post_ingest_queue_benchmark_exe,
suite: ['integration', 'daemon', 'catch2', 'post-ingest', 'benchmark'],
env: _daemon_test_env,
is_parallel: false,
timeout: 600, # Longer timeout for benchmark
args: ['--allow-running-no-tests'],
)
endif
client_timeout_recovery_exe = executable('yams_client_timeout_recovery_tests_catch2',
client_timeout_recovery_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('client_timeout_recovery',
client_timeout_recovery_exe,
suite: ['integration', 'daemon', 'catch2', 'timeout'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['--allow-running-no-tests'],
)
# idle_streaming and writer_drain executables/tests removed (flaky)
socket_memory_pressure_exe = executable('yams_socket_memory_pressure_tests_catch2',
socket_memory_pressure_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('socket_memory_pressure',
socket_memory_pressure_exe,
suite: ['integration', 'daemon', 'catch2', 'socket', 'memory-pressure', 'crash'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['--allow-running-no-tests'],
)
stats_command_crash_exe = executable('yams_stats_command_crash_tests_catch2',
stats_command_crash_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('stats_command_crash',
stats_command_crash_exe,
suite: ['integration', 'daemon', 'catch2', 'stats', 'crash'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
)
daemon_db_corruption_recovery_exe = executable('yams_daemon_db_corruption_recovery_tests_catch2',
daemon_db_corruption_recovery_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('daemon_db_corruption_recovery',
daemon_db_corruption_recovery_exe,
suite: ['integration', 'daemon', 'catch2', 'db_recovery'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['--allow-running-no-tests'],
)
cli_responsiveness_under_load_exe = executable('yams_cli_responsiveness_under_load_tests_catch2',
cli_responsiveness_under_load_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('cli_responsiveness_under_load',
cli_responsiveness_under_load_exe,
suite: ['integration', 'daemon', 'catch2', 'cli', 'responsiveness', 'load'],
env: _daemon_test_env,
is_parallel: false,
timeout: 120, # 2 minutes for load testing
args: ['--allow-running-no-tests'],
)
entity_graph_integration_exe = executable('yams_entity_graph_integration_tests_catch2',
entity_graph_integration_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
# KG tests need vectors enabled, but still disable session watcher
_kg_test_env = {
'YAMS_TEST_SAFE_SINGLE_INSTANCE': '1',
'YAMS_DISABLE_SESSION_WATCHER': '1',
'TSAN_OPTIONS': _test_tsan_options,
}
test('entity_graph_integration',
entity_graph_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'kg', 'pbi-009'],
env: _kg_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['--allow-running-no-tests'],
)
ghidra_kg_entity_ingestion_exe = executable('yams_ghidra_kg_entity_ingestion_tests_catch2',
ghidra_kg_entity_ingestion_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('ghidra_kg_entity_ingestion',
ghidra_kg_entity_ingestion_exe,
suite: ['integration', 'daemon', 'catch2', 'kg', 'ghidra', 'pbi-3jb'],
env: _kg_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['--allow-running-no-tests'],
)
codex_sandbox_embedding_regression_exe = executable('yams_codex_sandbox_embedding_regression_tests_catch2',
codex_sandbox_embedding_regression_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps,
dependency('yams_daemon_client_embedded'), catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('codex_sandbox_embedding_regression',
codex_sandbox_embedding_regression_exe,
suite: ['integration', 'daemon', 'catch2', 'sandbox', 'embeddings'],
env: _kg_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['--allow-running-no-tests'],
)
# SIGTERM signal handling tests (yams-qe6r)
daemon_sigterm_exe = executable('yams_daemon_sigterm_tests_catch2',
daemon_sigterm_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
proxy_slot_starvation_exe = executable('yams_proxy_slot_starvation_tests_catch2',
proxy_slot_starvation_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('proxy_slot_starvation',
proxy_slot_starvation_exe,
suite: ['integration', 'daemon', 'catch2', 'proxy', 'slots'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['--allow-running-no-tests'],
)
test('daemon_sigterm_external_flag',
daemon_sigterm_exe,
suite: ['integration', 'daemon', 'catch2', 'sigterm'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon responds to external shutdown flag', '--allow-running-no-tests'],
)
test('daemon_sigterm_timing',
daemon_sigterm_exe,
suite: ['integration', 'daemon', 'catch2', 'sigterm'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Daemon shutdown timing with external flag', '--allow-running-no-tests'],
)
# Data-dir single-instance enforcement tests
lifecycle_single_instance_exe = executable('yams_lifecycle_single_instance_tests_catch2',
lifecycle_single_instance_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('lifecycle_single_instance_lock',
lifecycle_single_instance_exe,
suite: ['integration', 'daemon', 'catch2', 'lifecycle', 'single-instance'],
env: _daemon_test_env,
is_parallel: false,
timeout: 120, # 2 minutes for takeover scenarios
args: ['Data-dir lock prevents concurrent access', '--allow-running-no-tests'],
)
test('lifecycle_single_instance_release',
lifecycle_single_instance_exe,
suite: ['integration', 'daemon', 'catch2', 'lifecycle', 'single-instance'],
env: _daemon_test_env,
is_parallel: false,
timeout: 60, # 1 minute for sequential start/stop
args: ['Data-dir lock released on shutdown', '--allow-running-no-tests'],
)
test('lifecycle_repair_hysteresis',
lifecycle_single_instance_exe,
suite: ['integration', 'daemon', 'catch2', 'lifecycle', 'repair'],
env: _daemon_test_env,
is_parallel: false,
timeout: 120,
args: ['Repair lifecycle hysteresis does not leak across daemon instances', '--allow-running-no-tests'],
)
# ONNX Concurrency / TuneAdvisor integration tests
onnx_tuning_integration_srcs = files(
'onnx_tuning_integration_test.cpp',
)
onnx_tuning_integration_exe = executable('yams_onnx_tuning_integration_tests_catch2',
onnx_tuning_integration_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
# Split ONNX tuning tests into separate test cases to avoid state leakage
test('onnx_tuning_env_settings',
onnx_tuning_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'onnx', 'tuning'],
env: _daemon_test_env,
is_parallel: false,
timeout: 300, # 5 sections, ~32s/section (EmbeddingService quiesce dominates)
args: ['OnnxConcurrencyRegistry respects TuneAdvisor env settings', '--allow-running-no-tests'],
)
test('onnx_tuning_embedding_lanes',
onnx_tuning_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'onnx', 'embedding'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Embedding lane slots are configured correctly', '--allow-running-no-tests'],
)
test('onnx_tuning_fsm_metrics',
onnx_tuning_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'onnx', 'metrics'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['FSM metrics reflect ONNX configuration', '--allow-running-no-tests'],
)
test('onnx_tuning_lifecycle',
onnx_tuning_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'onnx', 'lifecycle'],
env: _daemon_test_env,
is_parallel: false,
timeout: 120, # 2 minutes for daemon restarts
args: ['OnnxConcurrencyRegistry state resets on daemon restart', '--allow-running-no-tests'],
)
test('onnx_tuning_lanes',
onnx_tuning_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'onnx', 'lanes'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Lane metrics update during slot acquisition', '--allow-running-no-tests'],
)
# Adapter test needs vectors ENABLED to test real ONNX plugin path
# Use _kg_test_env which doesn't have YAMS_DISABLE_VECTORS=1
test('onnx_tuning_adapter',
onnx_tuning_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'onnx', 'adapter'],
env: _kg_test_env,
is_parallel: false,
timeout: 300, # 5 minutes - real ONNX model loading is slow
args: ['AbiModelProviderAdapter acquires SlotGuard during real embedding', '--allow-running-no-tests'],
)
test('onnx_tuning_config_backend',
onnx_tuning_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'onnx', 'config'],
env: _kg_test_env,
is_parallel: false,
timeout: 300,
args: ['Config selecting onnx backend uses ONNX provider for embeddings', '--allow-running-no-tests'],
)
test('onnx_tuning_timeout',
onnx_tuning_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'onnx', 'timeout'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['ONNX slot exhaustion causes graceful timeout', '--allow-running-no-tests'],
)
# ResourceGovernor integration tests - verify throttling behavior during real operations
resource_governor_integration_srcs = files(
'resource_governor_integration_test.cpp',
)
resource_governor_integration_exe = executable('yams_resource_governor_integration_tests_catch2',
resource_governor_integration_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
# Split governor tests into separate test cases to avoid state leakage
test('resource_governor_status_metrics',
resource_governor_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'governor', 'status'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['ResourceGovernor metrics exposed in daemon status', '--allow-running-no-tests'],
)
test('resource_governor_singleton',
resource_governor_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'governor', 'singleton'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['ResourceGovernor singleton is accessible during daemon operation', '--allow-running-no-tests'],
)
test('resource_governor_pressure_detection',
resource_governor_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'governor', 'pressure'],
env: _daemon_test_env,
is_parallel: false,
timeout: 120, # 2 minutes for ingest + processing
args: ['Governor detects pressure with low CPU threshold', '--allow-running-no-tests'],
)
test('resource_governor_scaling_caps',
resource_governor_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'governor', 'scaling'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Governor scaling caps adjust based on pressure level', '--allow-running-no-tests'],
)
test('resource_governor_ingest_metrics',
resource_governor_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'governor', 'ingest'],
env: _daemon_test_env,
is_parallel: false,
timeout: 120, # 2 minutes for ingest + processing
args: ['Status response contains governor metrics during ingest', '--allow-running-no-tests'],
)
test('resource_governor_snapshot',
resource_governor_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'governor', 'snapshot'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['ResourceGovernor snapshot contains valid metrics', '--allow-running-no-tests'],
)
test('resource_governor_concurrent',
resource_governor_integration_exe,
suite: ['integration', 'daemon', 'catch2', 'governor', 'concurrent'],
env: _daemon_test_env,
is_parallel: false,
timeout: get_option('integration-daemon-timeout'),
args: ['Concurrent status queries return consistent governor data', '--allow-running-no-tests'],
)
# Diagnostic tool (not a test, but helpful for debugging)
post_ingest_trace_exe = executable('yams_post_ingest_trace',
post_ingest_trace_srcs,
include_directories: incs,
dependencies: test_deps,
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
# HNSW Retrieval Diagnostic - tests vector search quality with known corpus
hnsw_retrieval_diagnostic_srcs = files(
'../vector/hnsw_retrieval_diagnostic.cpp',
)
hnsw_retrieval_diagnostic_exe = executable('hnsw_retrieval_diagnostic',
hnsw_retrieval_diagnostic_srcs,
include_directories: incs,
dependencies: [catch2_dep, catch2_main_dep, test_deps, catch2_trailing_link_deps],
cpp_args: ['-DYAMS_TESTING=1'],
install: false,
)
test('hnsw_retrieval_diagnostic',
hnsw_retrieval_diagnostic_exe,
suite: ['integration', 'daemon', 'catch2', 'hnsw', 'vector', 'diagnostic'],
env: _kg_test_env,
is_parallel: false,
timeout: 300, # 5 minutes for embedding generation
args: ['--allow-running-no-tests'],
)
else
message('daemon_socket_client test disabled (enable with -Denable-daemon-integration=true).')
endif
endif