Skip to content

Integration tests for annotation, audit, cache, and CallGraphFromTo tools#170

Draft
data-douser wants to merge 9 commits intodd/sqlite-annotation-cachefrom
dd/integration-tests
Draft

Integration tests for annotation, audit, cache, and CallGraphFromTo tools#170
data-douser wants to merge 9 commits intodd/sqlite-annotation-cachefrom
dd/integration-tests

Conversation

@data-douser
Copy link
Copy Markdown
Collaborator

Summary

Add client integration test fixtures and extension integration tests for all new annotation, audit, cache, and CallGraphFromTo tools introduced in #169.

Changes

Client integration test fixtures (16 new test cases)

  • annotation_create/basic_create — verify annotation creation with categories
  • annotation_delete/delete_by_prefix — verify prefix-based deletion
  • annotation_list/filter_by_category_and_prefix — verify filtered listing
  • annotation_search/full_text_search — verify full-text search across annotations
  • audit_store_findings/mrva_findings_across_repos — verify MRVA finding storage
  • audit_list_findings/mrva_findings_for_repo — verify per-repo listing
  • audit_add_notes/mrva_triage_notes — verify triage note attachment
  • audit_clear_repo/clear_single_repo — verify per-repo cleanup
  • query_results_cache_lookup/lookup_by_query_name — verify cache key lookup
  • query_results_cache_retrieve/retrieve_with_subset — verify subset retrieval
  • query_results_cache_clear/clear_all — verify cache clearing
  • query_results_cache_compare/compare_across_databases — verify cross-DB comparison
  • codeql_query_run/cpp_call_graph_from_to_example1 — CallGraphFromTo for C++
  • codeql_query_run/javascript_call_graph_from_to_example1 — CallGraphFromTo for JS
  • codeql_query_run/python_call_graph_from_to_example1 — CallGraphFromTo for Python

Workflow integration test

  • mrva_finding_triage/mrva_triage_workflow — end-to-end MRVA finding triage

Extension integration test

  • Updated mcp-tool-e2e.integration.test.ts with tool availability checks and MRVA e2e workflow

Test runner update

  • client/scripts/run-integration-tests.sh — added annotation mode support

Dependencies

Review order

Review after #169 is merged.

Closes #166
Part of #163

data-douser and others added 7 commits March 25, 2026 05:48
Replace lowdb with sql.js (asm.js build) for zero-dependency SQLite persistence.
Bundle inline with esbuild — no native modules, no external deps at runtime.

SqliteStore provides three tables:
- sessions: session tracking (migrated from lowdb)
- annotations: key-value annotation store with categories and metadata
- query_result_cache: BQRS/SARIF result caching with subset retrieval

New tools (gated by ENABLE_ANNOTATION_TOOLS env var):
- annotation_create, annotation_list, annotation_search, annotation_delete
- audit_store_findings, audit_list_findings, audit_add_notes, audit_clear_repo
- query_results_cache_lookup, query_results_cache_retrieve,
  query_results_cache_clear, query_results_cache_compare

Code refactoring for maintainability:
- Extract database-resolver.ts from cli-tool-registry.ts
- Extract query-resolver.ts from cli-tool-registry.ts
- Extract result-processor.ts from cli-tool-registry.ts
- Extract codeql-version.ts from cli-executor.ts

Bug fixes:
- Fix params.output not propagated to proce- Fix params.output not propagated to proce- Fix params.output not propagated txternal predicate conditions for direct query paths

Closes #165
…To tools

Client integration test fixtures:
- annotation_create, annotation_delete, annotation_list, annotation_search
- audit_store_findings, audit_list_findings, audit_add_notes, audit_clear_repo
- query_results_cache_lookup, query_results_cache_retrieve,
  query_results_cache_clear, query_results_cache_compare
- codeql_query_run CallGraphFromTo for cpp, javascript, python

Workflow integration test:
- mrva_finding_triage end-to-end workflow

Extension integration tests:
- mcp-tool-e2e: tool availability and MRVA workflow validation

Updated client/scripts/run-integration-tests.sh with annotation mode support.

Closes #166
- Fix TOCTOU in query-results-evaluator (openSync/fstatSync/readFileSync(fd))
- Use datetime('now') consistently for annotation timestamps
- Debounce flush() with 200ms coalescing via scheduleFlush()
- Fix resultIndices to inclusive [start, end] range with clamping
- Fix WASM→asm.js comments in session-data-manager
- Fix audit-tools header comment (no separate ENABLE_AUDIT_TOOLS flag)
- Add separate maxResults parameter for SARIF in cache-tools
- Use createProjectTempDir() in all test files
- Fix monitoring-tools test init order (mock before initialize)
- Add store.close() in session-data-manager test afterEach
- Bound metadataCache to 256 entries with oldest-first eviction
- Make SqliteStore.initialize() idempotent (close existing db first)
- Fix TOCTOU in initialize(): try readFileSync directly instead of existsSync
- Atomic flush: write to temp file + renameSync to prevent corruption
- Clarify annotation_search uses substring LIKE matching, not FTS
- Close store in monitoring-tools test afterEach to prevent timer leaks
…fallback, JSON.parse fallback

Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/7ff5a5d7-9ac1-4964-8b54-e233d7253301

Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
@data-douser data-douser force-pushed the dd/sqlite-annotation-cache branch 2 times, most recently from 7c71547 to 5c4f5b8 Compare March 27, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integration tests for annotation, audit, cache, and CallGraphFromTo tools

2 participants