> ## Documentation Index
> Fetch the complete documentation index at: https://docs.supermodeltools.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Test coverage map

> Upload a zipped repository snapshot to identify functions with zero test coverage by tracing call graph reachability from test files to production code. This is static analysis — no test execution or instrumentation required.



## OpenAPI

````yaml /openapi.yaml post /v1/analysis/test-coverage-map
openapi: 3.0.0
info:
  title: Supermodel
  description: Code Graphing & Analysis API
  version: 0.9.6
  license:
    name: Supermodel API Terms of Service
    url: https://supermodeltools.com/legal/api-terms
servers:
  - url: https://api.supermodeltools.com
    description: Production server
security: []
tags:
  - name: Data Plane
    description: >-
      Calls the data plane to retrieve Supermodel analysis artifacts derived
      from repositories.
paths:
  /v1/analysis/test-coverage-map:
    post:
      tags:
        - Data Plane
      summary: Test coverage map
      description: >-
        Upload a zipped repository snapshot to identify functions with zero test
        coverage by tracing call graph reachability from test files to
        production code. This is static analysis — no test execution or
        instrumentation required.
      operationId: generateTestCoverageMap
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: Zipped repository archive containing the code to analyze.
      responses:
        '200':
          description: Test coverage map (job completed)
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-API-Version:
              $ref: '#/components/headers/X-API-Version'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            X-Usage-Units:
              $ref: '#/components/headers/X-Usage-Units'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TestCoverageMapResponseAsync'
              example:
                status: completed
                jobId: abc-123-def
                result:
                  metadata:
                    totalFiles: 142
                    testFiles: 28
                    productionFiles: 114
                    totalFunctions: 891
                    testedFunctions: 342
                    untestedFunctions: 549
                    coveragePercentage: 38.4
                    analysisMethod: static_call_graph_test_reachability
                    analysisStartTime: '2026-02-09T12:00:00Z'
                    analysisEndTime: '2026-02-09T12:01:00Z'
                  untestedFunctions:
                    - file: src/services/billing.ts
                      name: calculateRefund
                      line: 89
                      type: function
                      confidence: high
                      reason: >-
                        No test file calls this function directly or
                        transitively
                  testedFunctions:
                    - file: src/services/billing.ts
                      name: calculateTotal
                      line: 45
                      type: function
                      testFiles:
                        - tests/billing.test.ts
                      directTestCallers: 3
                      transitiveTestCallers: 7
                  testFiles:
                    - file: tests/billing.test.ts
                      testFunctions: 12
                      productionFunctionsCovered: 8
                      productionFilesCovered: 3
                  coverageByFile:
                    - file: src/services/billing.ts
                      totalFunctions: 12
                      testedFunctions: 8
                      untestedFunctions: 4
                      coveragePercentage: 66.7
        '202':
          description: Job accepted and processing
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-API-Version:
              $ref: '#/components/headers/X-API-Version'
            Retry-After:
              description: Recommended wait time in seconds before polling again.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TestCoverageMapResponseAsync'
              example:
                status: processing
                jobId: abc-123-def
                retryAfter: 5
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
        '502':
          description: Bad Gateway
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: >
            curl -X POST
            'https://api.supermodeltools.com/v1/analysis/test-coverage-map' \
              -H 'Idempotency-Key: <idempotency-key>' \
              -H 'X-Api-Key: <api-key>' \
              -F 'file=@/path/to/your/repo-snapshot.zip;type=application/zip'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      description: Unique identifier for this request for idempotency and tracing.
      schema:
        type: string
  headers:
    X-Request-Id:
      description: Unique request identifier echoed back from the Idempotency-Key header.
      schema:
        type: string
    X-API-Version:
      description: Semantic version of the API service handling the request.
      schema:
        type: string
    RateLimit-Limit:
      description: Maximum number of requests allowed in the current rate limit window.
      schema:
        type: integer
        format: int32
    RateLimit-Remaining:
      description: Remaining number of requests available in the current rate limit window.
      schema:
        type: integer
        format: int32
    RateLimit-Reset:
      description: UTC epoch seconds when the current rate limit window resets.
      schema:
        type: integer
        format: int64
    X-Usage-Units:
      description: Metered usage units consumed by this request.
      schema:
        type: number
        format: float
  schemas:
    TestCoverageMapResponseAsync:
      allOf:
        - $ref: '#/components/schemas/JobStatus'
        - type: object
          description: Async response envelope for test coverage map operations.
          properties:
            result:
              $ref: '#/components/schemas/TestCoverageMapResponse'
              description: The result (present when status is completed).
    Error:
      type: object
      description: Standardized error payload returned by the API.
      required:
        - status
        - code
        - message
        - timestamp
      properties:
        status:
          type: integer
          format: int32
          description: HTTP status code associated with the error.
          minimum: 100
          maximum: 599
        code:
          type: string
          description: Stable, machine-readable error identifier.
        message:
          type: string
          description: Human-readable description of the error.
        timestamp:
          type: string
          format: date-time
          description: ISO-8601 timestamp indicating when the error occurred.
        requestId:
          type: string
          description: Correlation identifier for tracing the failing request.
        details:
          type: array
          description: Optional list of contextual error details.
          items:
            type: object
            required:
              - field
              - issue
            properties:
              field:
                type: string
                description: Name of the field or parameter related to the error.
              issue:
                type: string
                description: Description of the specific issue encountered.
              location:
                type: string
                description: Where the field resides (e.g., query, path, body).
    JobStatus:
      type: object
      description: Common fields for async job status tracking.
      required:
        - status
        - jobId
      properties:
        status:
          type: string
          description: Current status of the job.
          enum:
            - pending
            - processing
            - completed
            - failed
        jobId:
          type: string
          description: Unique identifier for the job.
        retryAfter:
          type: integer
          format: int32
          description: Recommended seconds to wait before polling again.
        error:
          type: string
          description: Error message (present when status is failed).
    TestCoverageMapResponse:
      type: object
      description: >-
        Test coverage map result identifying tested and untested functions via
        static call graph reachability from test files.
      required:
        - metadata
        - untestedFunctions
        - testedFunctions
        - testFiles
        - coverageByFile
      properties:
        metadata:
          $ref: '#/components/schemas/TestCoverageMapMetadata'
        untestedFunctions:
          type: array
          description: >-
            Production functions with no test coverage (not reachable from any
            test function).
          items:
            $ref: '#/components/schemas/UntestedFunction'
        testedFunctions:
          type: array
          description: >-
            Production functions with test coverage (reachable from at least one
            test function).
          items:
            $ref: '#/components/schemas/TestedFunction'
        testFiles:
          type: array
          description: Detected test files with coverage statistics.
          items:
            $ref: '#/components/schemas/TestFileInfo'
        coverageByDomain:
          type: array
          description: Coverage breakdown by domain classification.
          items:
            $ref: '#/components/schemas/CoverageByDomain'
        coverageByFile:
          type: array
          description: Coverage breakdown by production file.
          items:
            $ref: '#/components/schemas/CoverageByFile'
    TestCoverageMapMetadata:
      type: object
      description: Summary statistics for the test coverage map analysis.
      required:
        - totalFiles
        - testFiles
        - productionFiles
        - totalFunctions
        - testedFunctions
        - untestedFunctions
        - coveragePercentage
        - analysisMethod
      properties:
        totalFiles:
          type: integer
          format: int64
          description: Total number of files in the repository.
        testFiles:
          type: integer
          format: int64
          description: Number of files identified as test files.
        productionFiles:
          type: integer
          format: int64
          description: Number of non-test (production) files.
        totalFunctions:
          type: integer
          format: int64
          description: Total number of functions in production files.
        testedFunctions:
          type: integer
          format: int64
          description: Number of production functions reachable from test functions.
        untestedFunctions:
          type: integer
          format: int64
          description: Number of production functions not reachable from any test function.
        coveragePercentage:
          type: number
          format: double
          description: Percentage of production functions with test coverage.
        analysisMethod:
          type: string
          description: Method used for analysis.
        analysisStartTime:
          type: string
          format: date-time
          description: Timestamp when analysis started.
        analysisEndTime:
          type: string
          format: date-time
          description: Timestamp when analysis completed.
    UntestedFunction:
      type: object
      description: A production function with no test coverage.
      required:
        - file
        - name
        - line
        - type
        - confidence
        - reason
      properties:
        file:
          type: string
          description: File path relative to repository root.
        name:
          type: string
          description: Name of the function or method.
        line:
          type: integer
          format: int32
          description: Line number where the function is declared.
        type:
          type: string
          description: Type of code element.
          enum:
            - function
            - class
            - method
            - interface
            - type
            - variable
            - constant
        confidence:
          type: string
          description: Confidence level of the untested classification.
          enum:
            - high
            - medium
            - low
        reason:
          type: string
          description: Explanation of why this function is classified as untested.
        nearestTestedCaller:
          $ref: '#/components/schemas/NearestTestedCaller'
        suggestedTestFile:
          type: string
          description: >-
            The test file that covers the most sibling functions in the same
            production file. This is the recommended file in which to add a test
            for this untested function.
        testedSiblings:
          type: array
          description: >-
            Other functions in the same file that ARE tested, along with which
            test files cover them. Use this to see existing test patterns you
            can follow.
          items:
            $ref: '#/components/schemas/TestedSibling'
    TestedFunction:
      type: object
      description: A production function reachable from at least one test function.
      required:
        - file
        - name
        - line
        - type
        - testFiles
        - directTestCallers
        - transitiveTestCallers
      properties:
        file:
          type: string
          description: File path relative to repository root.
        name:
          type: string
          description: Name of the function or method.
        line:
          type: integer
          format: int32
          description: Line number where the function is declared.
        type:
          type: string
          description: Type of code element.
          enum:
            - function
            - class
            - method
            - interface
            - type
            - variable
            - constant
        testFiles:
          type: array
          description: Test files that cover this function (directly or transitively).
          items:
            type: string
        directTestCallers:
          type: integer
          format: int32
          description: Number of test functions that directly call this function.
        transitiveTestCallers:
          type: integer
          format: int32
          description: Number of test functions that transitively reach this function.
    TestFileInfo:
      type: object
      description: Information about a detected test file.
      required:
        - file
        - testFunctions
        - productionFunctionsCovered
        - productionFilesCovered
      properties:
        file:
          type: string
          description: File path relative to repository root.
        testFunctions:
          type: integer
          format: int32
          description: Number of test functions defined in this file.
        productionFunctionsCovered:
          type: integer
          format: int32
          description: Number of unique production functions covered by tests in this file.
        productionFilesCovered:
          type: integer
          format: int32
          description: Number of unique production files covered by tests in this file.
    CoverageByDomain:
      type: object
      description: Test coverage breakdown for a domain.
      required:
        - domain
        - totalFunctions
        - testedFunctions
        - coveragePercentage
      properties:
        domain:
          type: string
          description: Domain name from domain classification.
        totalFunctions:
          type: integer
          format: int32
          description: Total functions in the domain.
        testedFunctions:
          type: integer
          format: int32
          description: Number of tested functions in the domain.
        coveragePercentage:
          type: number
          format: double
          description: Coverage percentage for the domain.
    CoverageByFile:
      type: object
      description: Test coverage breakdown for a production file.
      required:
        - file
        - totalFunctions
        - testedFunctions
        - untestedFunctions
        - coveragePercentage
      properties:
        file:
          type: string
          description: File path relative to repository root.
        totalFunctions:
          type: integer
          format: int32
          description: Total functions in the file.
        testedFunctions:
          type: integer
          format: int32
          description: Number of tested functions in the file.
        untestedFunctions:
          type: integer
          format: int32
          description: Number of untested functions in the file.
        coveragePercentage:
          type: number
          format: double
          description: Coverage percentage for the file.
    NearestTestedCaller:
      type: object
      description: The nearest function in the call graph that has test coverage.
      required:
        - file
        - name
        - distance
      properties:
        file:
          type: string
          description: File path of the nearest tested function.
        name:
          type: string
          description: Name of the nearest tested function.
        distance:
          type: integer
          format: int32
          description: Number of call graph hops to the nearest tested function.
    TestedSibling:
      type: object
      description: A sibling function in the same file that has test coverage.
      required:
        - name
        - line
        - testFiles
      properties:
        name:
          type: string
          description: Name of the tested sibling function.
        line:
          type: integer
          format: int32
          description: Line number where the sibling function is declared.
        testFiles:
          type: array
          description: Test files that cover this sibling function.
          items:
            type: string
  responses:
    BadRequest:
      description: The request could not be processed because of a client error.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
        X-API-Version:
          $ref: '#/components/headers/X-API-Version'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        X-Usage-Units:
          $ref: '#/components/headers/X-Usage-Units'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: 400
            code: invalid_request
            message: Missing required query parameter 'repo'.
            timestamp: '2025-02-05 16:35:12.000000000 Z'
            requestId: req_01HZYJ9CE0ABCDEF1234
            details:
              - field: repo
                issue: This field is required.
                location: query
    Unauthorized:
      description: Authentication failed or was not provided.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
        X-API-Version:
          $ref: '#/components/headers/X-API-Version'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        X-Usage-Units:
          $ref: '#/components/headers/X-Usage-Units'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: 401
            code: unauthorized
            message: Provide a valid OAuth token to access this resource.
            timestamp: '2025-02-05 16:35:12.000000000 Z'
            requestId: req_01HZYJ9CE0ABCDEFXYZ1
    Forbidden:
      description: The authenticated principal lacks the required permissions.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
        X-API-Version:
          $ref: '#/components/headers/X-API-Version'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        X-Usage-Units:
          $ref: '#/components/headers/X-Usage-Units'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: 403
            code: forbidden
            message: The token lacks the required keys:write scope.
            timestamp: '2025-02-05 16:35:12.000000000 Z'
            requestId: req_01HZYJ9CE0ABCDEFFORB
    TooManyRequests:
      description: The rate limit for the resource has been exceeded.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
        X-API-Version:
          $ref: '#/components/headers/X-API-Version'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        X-Usage-Units:
          $ref: '#/components/headers/X-Usage-Units'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: 429
            code: rate_limit_exceeded
            message: Too many requests. Try again after the reset window.
            timestamp: '2025-02-05 16:35:12.000000000 Z'
            requestId: req_01HZYJ9CE0ABCDEFRATE
    InternalError:
      description: The server encountered an unexpected condition.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
        X-API-Version:
          $ref: '#/components/headers/X-API-Version'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        X-Usage-Units:
          $ref: '#/components/headers/X-Usage-Units'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: 500
            code: internal_error
            message: Unexpected error processing request. Please retry.
            timestamp: '2025-02-05 16:35:12.000000000 Z'
            requestId: req_01HZYJ9CE0ABCDEFFAIL
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: API key issued by the control plane for accessing data plane resources.

````