[2026-05-14T17:55:39.427Z] RESULT
============================================================
{
  "success": true,
  "output": "## Test Coverage Analysis\n\nThis project has **no application source code** — it's a claude-flow agent orchestration runtime configuration. The entire codebase consists of:\n\n- `claude-flow.config.json` — framework configuration\n- `data/memory/schema.sql` — SQLite database schema\n- State/database files (`.claude-flow/`, `.swarm/`, `.claude/`)\n- `node_modules/` — third-party dependencies (not this project's code)\n\nThere are no functions, classes, or modules to measure coverage against. All test files found exist only inside `node_modules/`.\n\n---\n\n### What *Could* Be Tested (If Tests Were Written)\n\nThe only testable artifact is `data/memory/schema.sql`. Here are the gaps and skeleton tests:\n\n#### 1. Schema Constraints\n```sql\n-- Test: UNIQUE(namespace, key) enforced\nINSERT INTO memory_entries (id, key, namespace, content) VALUES ('a', 'k', 'ns', 'v1');\nINSERT INTO memory_entries (id, key, namespace, content) VALUES ('b', 'k', 'ns', 'v2');\n-- Expected: UNIQUE constraint violation\n\n-- Test: type CHECK constraint\nINSERT INTO memory_entries (id, key, namespace, content, type) VALUES ('c', 'k2', 'ns', 'v', 'invalid');\n-- Expected: CHECK constraint violation\n```\n\n#### 2. Edge Cases Not Covered\n```sql\n-- NULL expires_at (no expiry) should be valid\nINSERT INTO memory_entries (id, key, namespace, content, expires_at) VALUES ('d', 'k3', 'ns', 'v', NULL);\n\n-- pattern_type enum exhaustion (all 8 valid values)\n-- 'task-routing', 'error-recovery', 'optimization', 'learning',\n-- 'coordination', 'prediction', 'code-pattern', 'workflow'\n\n-- patterns.parent_id self-reference integrity\nINSERT INTO patterns (..., parent_id) VALUES (..., 'nonexistent-id');\n-- Expected: FK violation (PRAGMA foreign_keys = ON)\n```\n\n#### 3. Known Bug — vector_indexes dimension mismatch (#1947)\nThe schema comment at line 302–308 documents this explicitly:\n```sql\n-- Test: inserting a memory_entry with embedding_dimensions != 384\n-- should be rejected by HNSW layer (not SQL CHECK — gap exists here)\nINSERT INTO memory_entries (id, key, namespace, content, embedding_dimensions) \n  VALUES ('e', 'k4', 'ns', 'v', 768);\n-- Currently NO SQL constraint prevents this — the bug is in application code,\n-- not the schema. A CHECK constraint would close this gap:\n-- embedding_dimensions INTEGER CHECK(embedding_dimensions IS NULL OR embedding_dimensions = 384)\n```\n\n#### 4. Missing Error Handling Tests\n- `migration_state` status transitions: no CHECK prevents jumping from `pending` → `completed` (skipping `in_progress`)\n- `trajectories.verdict` can be set on an `active` trajectory (should require `status != 'active'`)\n\n#### 5. Configuration Validation (`claude-flow.config.json`)\n```js\n// No validation tests exist for:\n// - memory.vectorDimension must match vector_indexes.dimensions (384)\n// - agents.maxConcurrent <= swarm.maxAgents\n// - mcp.serverPort in valid range (1–65535)\n```\n\n---\n\n**Bottom line:** there is no application code to cover. If you plan to add source code to this project, I can analyze coverage at that point. The only actionable gap right now is the undocumented constraint for `embedding_dimensions` in the SQL schema (bug #1947 workaround).\n",
  "parsedOutput": {
    "sections": [
      {
        "title": "Test Coverage Analysis",
        "content": "\nThis project has **no application source code** — it's a claude-flow agent orchestration runtime configuration. The entire codebase consists of:\n\n- `claude-flow.config.json` — framework configuration\n- `data/memory/schema.sql` — SQLite database schema\n- State/database files (`.claude-flow/`, `.swarm/`, `.claude/`)\n- `node_modules/` — third-party dependencies (not this project's code)\n\nThere are no functions, classes, or modules to measure coverage against. All test files found exist only inside `node_modules/`.\n\n---\n\n",
        "level": 2
      },
      {
        "title": "What *Could* Be Tested (If Tests Were Written)",
        "content": "\nThe only testable artifact is `data/memory/schema.sql`. Here are the gaps and skeleton tests:\n\n",
        "level": 3
      },
      {
        "title": "1. Schema Constraints",
        "content": "```sql\n-- Test: UNIQUE(namespace, key) enforced\nINSERT INTO memory_entries (id, key, namespace, content) VALUES ('a', 'k', 'ns', 'v1');\nINSERT INTO memory_entries (id, key, namespace, content) VALUES ('b', 'k', 'ns', 'v2');\n-- Expected: UNIQUE constraint violation\n\n-- Test: type CHECK constraint\nINSERT INTO memory_entries (id, key, namespace, content, type) VALUES ('c', 'k2', 'ns', 'v', 'invalid');\n-- Expected: CHECK constraint violation\n```\n\n",
        "level": 4
      },
      {
        "title": "2. Edge Cases Not Covered",
        "content": "```sql\n-- NULL expires_at (no expiry) should be valid\nINSERT INTO memory_entries (id, key, namespace, content, expires_at) VALUES ('d', 'k3', 'ns', 'v', NULL);\n\n-- pattern_type enum exhaustion (all 8 valid values)\n-- 'task-routing', 'error-recovery', 'optimization', 'learning',\n-- 'coordination', 'prediction', 'code-pattern', 'workflow'\n\n-- patterns.parent_id self-reference integrity\nINSERT INTO patterns (..., parent_id) VALUES (..., 'nonexistent-id');\n-- Expected: FK violation (PRAGMA foreign_keys = ON)\n```\n\n",
        "level": 4
      },
      {
        "title": "3. Known Bug — vector_indexes dimension mismatch (#1947)",
        "content": "The schema comment at line 302–308 documents this explicitly:\n```sql\n-- Test: inserting a memory_entry with embedding_dimensions != 384\n-- should be rejected by HNSW layer (not SQL CHECK — gap exists here)\nINSERT INTO memory_entries (id, key, namespace, content, embedding_dimensions) \n  VALUES ('e', 'k4', 'ns', 'v', 768);\n-- Currently NO SQL constraint prevents this — the bug is in application code,\n-- not the schema. A CHECK constraint would close this gap:\n-- embedding_dimensions INTEGER CHECK(embedding_dimensions IS NULL OR embedding_dimensions = 384)\n```\n\n",
        "level": 4
      },
      {
        "title": "4. Missing Error Handling Tests",
        "content": "- `migration_state` status transitions: no CHECK prevents jumping from `pending` → `completed` (skipping `in_progress`)\n- `trajectories.verdict` can be set on an `active` trajectory (should require `status != 'active'`)\n\n",
        "level": 4
      },
      {
        "title": "5. Configuration Validation (`claude-flow.config.json`)",
        "content": "```js\n// No validation tests exist for:\n// - memory.vectorDimension must match vector_indexes.dimensions (384)\n// - agents.maxConcurrent <= swarm.maxAgents\n// - mcp.serverPort in valid range (1–65535)\n```\n\n---\n\n**Bottom line:** there is no application code to cover. If you plan to add source code to this project, I can analyze coverage at that point. The only actionable gap right now is the undocumented constraint for `embedding_dimensions` in the SQL schema (bug #1947 workaround).",
        "level": 4
      }
    ],
    "codeBlocks": [
      {
        "language": "sql",
        "code": "-- Test: UNIQUE(namespace, key) enforced\nINSERT INTO memory_entries (id, key, namespace, content) VALUES ('a', 'k', 'ns', 'v1');\nINSERT INTO memory_entries (id, key, namespace, content) VALUES ('b', 'k', 'ns', 'v2');\n-- Expected: UNIQUE constraint violation\n\n-- Test: type CHECK constraint\nINSERT INTO memory_entries (id, key, namespace, content, type) VALUES ('c', 'k2', 'ns', 'v', 'invalid');\n-- Expected: CHECK constraint violation"
      },
      {
        "language": "sql",
        "code": "-- NULL expires_at (no expiry) should be valid\nINSERT INTO memory_entries (id, key, namespace, content, expires_at) VALUES ('d', 'k3', 'ns', 'v', NULL);\n\n-- pattern_type enum exhaustion (all 8 valid values)\n-- 'task-routing', 'error-recovery', 'optimization', 'learning',\n-- 'coordination', 'prediction', 'code-pattern', 'workflow'\n\n-- patterns.parent_id self-reference integrity\nINSERT INTO patterns (..., parent_id) VALUES (..., 'nonexistent-id');\n-- Expected: FK violation (PRAGMA foreign_keys = ON)"
      },
      {
        "language": "sql",
        "code": "-- Test: inserting a memory_entry with embedding_dimensions != 384\n-- should be rejected by HNSW layer (not SQL CHECK — gap exists here)\nINSERT INTO memory_entries (id, key, namespace, content, embedding_dimensions) \n  VALUES ('e', 'k4', 'ns', 'v', 768);\n-- Currently NO SQL constraint prevents this — the bug is in application code,\n-- not the schema. A CHECK constraint would close this gap:\n-- embedding_dimensions INTEGER CHECK(embedding_dimensions IS NULL OR embedding_dimensions = 384)"
      },
      {
        "language": "js",
        "code": "// No validation tests exist for:\n// - memory.vectorDimension must match vector_indexes.dimensions (384)\n// - agents.maxConcurrent <= swarm.maxAgents\n// - mcp.serverPort in valid range (1–65535)"
      }
    ]
  },
  "durationMs": 53297,
  "model": "sonnet",
  "sandboxMode": "permissive",
  "workerType": "testgaps",
  "timestamp": "2026-05-14T17:55:39.401Z",
  "executionId": "testgaps_1778781286104_t5qy2v"
}
