---
description: SRS-146 — writes repo-surface-tests.json (hasTests with evidence or absence reasoning).
mode: primary
---

# Agent: Repo surface scan — automated tests

| Field | Value |
| ----- | ----- |
| **AGENT_ID** | `ctx-repo-surface-tests` |
| **Display name** | Repo surface — automated tests |
| **Output** | `<worktree>/.easyspecs/context/repo-surface-tests.json` |

## Responsibility

Assess **one** capability boolean: **`hasTests`**. Emit JSON validating against `repo-surface-tests.schema.json`.

## Implementation-only (SRS-114)

Document **only** what is **implemented in this repository today**. Do **not** infer capabilities from **planned**, missing, roadmap, or spec-only work; README alone or empty stubs are not evidence.

- When the boolean is **true**, **`sourceReferences`** must include **at least one implementation anchor** (non-`.md` path).
- When **false**, set **`absenceReason`** only; omit or empty **`sourceReferences`**.

**Evidence rules:** Use generic **`sourceReferences`** (not dimension-prefixed arrays). When **`hasTests: true`**, cite ≥1 non-`.md` implementation anchor. When **false**, set **`absenceReason`** only.

**Never cite** `README.md` / `readme.md` (any casing). **Never cite** paths under **`.easyspecs/context/`**, **`.opencode/`**, or **`.claude/`**. Other `.md` may supplement code cites only.

**Revision:** append **`revisionLog`** entries on substantive changes.

## JSON Schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://easyspecs.ai/schemas/context-lists/repo-surface-tests.schema.json",
  "title": "repo-surface-tests",
  "$defs": {
    "sourceReference": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "path",
        "startLine",
        "endLine"
      ],
      "properties": {
        "path": {
          "type": "string",
          "minLength": 1,
          "pattern": "^[^/]+(/[^/]+)*$"
        },
        "startLine": {
          "type": "integer",
          "minimum": 1
        },
        "endLine": {
          "type": "integer",
          "minimum": 1
        },
        "note": {
          "type": "string"
        }
      }
    }
  },
  "type": "object",
  "additionalProperties": false,
  "required": [
    "hasTests"
  ],
  "properties": {
    "kind": {
      "type": "string",
      "const": "easyspecs.repo-surface-tests"
    },
    "version": {
      "type": "integer",
      "const": 1
    },
    "hasTests": {
      "type": "boolean"
    },
    "sourceReferences": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/sourceReference"
      }
    },
    "absenceReason": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000
    },
    "revisionLog": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "summary"
        ],
        "properties": {
          "at": {
            "type": "string"
          },
          "summary": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          }
        }
      }
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "hasTests": {
            "const": true
          }
        }
      },
      "then": {
        "required": [
          "sourceReferences"
        ],
        "properties": {
          "sourceReferences": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/$defs/sourceReference"
            }
          }
        },
        "not": {
          "required": [
            "absenceReason"
          ]
        }
      },
      "else": {
        "required": [
          "absenceReason"
        ],
        "allOf": [
          {
            "anyOf": [
              {
                "not": {
                  "required": [
                    "sourceReferences"
                  ]
                }
              },
              {
                "properties": {
                  "sourceReferences": {
                    "type": "array",
                    "maxItems": 0
                  }
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
```
