Skip to main content

Repository-intelligence offline evaluation contract

Status: implemented development evaluator for core#4739. This contract does not activate a production index, retrieval service, model, or repository-map format.

Purpose​

This evaluator provides a reproducible structural check for repository-intelligence experiments. It answers a narrow question: did a result represent its execution outcome honestly and cite source spans that exist in the exact local Git commit named by the task contract?

A valid span establishes only that the pinned regular blob contains those bytes at those lines. It does not establish that the answer interprets the span correctly. The v1 report therefore always records semantic adjudication as not_assessed. Human or model-based semantic grading can be designed later, outside this offline validator.

The development suite contains four questions tied to immutable upsquad-core source at commit c51a6988c7adcd2975a8da29bdeb39f5a51c72af and four synthetic controls for timeout, denial, not-run, and partial evidence. These published cases exercise the contract; they are not a secret or statistically representative benchmark.

Versioned inputs​

The CLI accepts separate JSON documents so a candidate-visible task file does not expose gold spans. Inputs must be bounded regular files; FIFOs, devices, directories, and symbolic links are rejected before reading.

  • repository-intelligence-tasks/v1 names one GitHub repository and one full commit object ID, a suite ID, and 1–32 tasks. Each task has an ID, a real-source or synthetic-control kind, a question, and required evidence categories.
  • repository-intelligence-results/v1 binds to the same suite, task schema, repository, and commit. Each submitted result declares execution status, claim status, an answer, zero or more source spans, and measurements.
  • repository-intelligence-gold/v1 is optional and read independently. It contains exact acceptable spans with required source hashes. Matching those spans is reported as a structural comparison and never upgrades semantic support.
  • repository-intelligence-report/v1 is the source-free command receipt. It includes repository identity, contract versions, limits, task IDs, statuses, aggregate evidence coverage, known-measurement counts, and optional span-match counts. It omits questions, answers, paths, source text, and source bytes.

Unknown fields, missing required fields, duplicate JSON keys, duplicate IDs, unknown task IDs, mixed repositories or commits, and unsupported versions are invalid. Repository identity includes the github.com host as well as owner and name; a same-named repository on another host is not equivalent.

Result semantics and denominator​

Execution statuses are completed, partial, timeout, not_run, and denied. Claim statuses are observed, inferred, and unresolved.

Timeout, not-run, and denied results must have no evidence and must remain unresolved. A completed result must cover every required evidence category. Observed or inferred claims require at least one evidence span. An evidence-free partial result must remain unresolved. These are consistency checks, not semantic grading.

Every task stays in the denominator. Missing results are emitted as missing and unresolved. Partial, timeout, not-run, denied, or missing entries make evaluation_complete false while remaining structurally valid. They do not become zero-valued observations.

Measurements use integer file/task units for inventory, represented, retrieved, and inspected, milliseconds for latency_ms, provider-reported token units for tokens, and millionths of a US dollar for cost_microusd. null means unknown. Represented and retrieved are independent because retrieval can include lexical fallback outside an index. When known, represented and retrieved cannot exceed inventory, and inspected cannot exceed retrieved. Absence stays unknown in the report.

Immutable evidence validation​

The evaluator validates the named commit and reads its tree and blobs directly. Each evidence record includes its own repository/commit binding, canonical repository-relative path, positive inclusive line range, category, and optional exact source text or SHA-256. A line boundary is one LF byte; CR bytes remain source content and a final unterminated segment is a line. A span is at most 200 lines. Only regular 100644 and 100755 blobs are eligible; trees, symlinks, and gitlinks are rejected.

Working-tree content and the index are irrelevant. Git replacement refs are disabled. Git directory, work-tree, index, object-store, alternate-object, namespace, shallow-file, replacement-ref, and GIT_CONFIG or GIT_CONFIG_* environment overrides are removed. System config, prompts, credential helpers, hooks, and all protocols are disabled for the child commands. Path lookup uses literal pathspecs. Lazy promisor fetching is disabled, so a missing commit or blob fails locally instead of contacting a remote.

The evaluator runs fixed Git argv without a shell. It does not checkout source, execute repository files, invoke hooks, update configuration, or issue a fetch. The local repository must have an origin matching the task's GitHub owner/name and must already contain the exact commit and referenced blobs.

Frozen finite limits​

  • Each tasks, results, or gold input is at most 1 MiB. The report is at most 1 MiB.
  • A suite has at most 32 tasks, 16 evidence records per result, and 256 result or gold evidence records in total.
  • Identifiers are at most 128 UTF-8 bytes, paths 512 bytes, and questions/answers 8 KiB. Optional source text is at most 256 KiB.
  • A referenced source blob is at most 1 MiB and a span at most 200 lines.
  • Validation has a 45-second whole-command deadline and at most 514 Git children. Each child receives at most five seconds or the remaining whole-command time, whichever is smaller. Standard output and error are incrementally bounded; a child that times out or exceeds a bound is killed and reaped.

These ceilings are contract values, not measured production sizing recommendations.

Exit and failure contract​

A structurally valid report exits zero even when results are incomplete. Invalid JSON/contracts, repository or object mismatches, invalid spans, contradictory statuses, duplicate identifiers, and finite-limit failures exit 2 with a bounded source-free error receipt. The evaluator never silently skips a missing historical commit and never fetches it.

Run the self-contained tests, which create tiny local repositories and do not depend on historical objects:

PYTHONDONTWRITEBYTECODE=1 python3 -m unittest tests.scripts.test_repository_intelligence_eval

Run the published development fixture only in a checkout whose local object database contains the pinned commit:

PYTHONDONTWRITEBYTECODE=1 python3 scripts/repository_intelligence_eval.py validate \
--tasks scripts/testdata/repository-intelligence/tasks.json \
--results scripts/testdata/repository-intelligence/results.json \
--repo .

Add --gold scripts/testdata/repository-intelligence/gold.json to exercise independent structural span comparison.

Deliberate limits​

This slice does not score answer truth, compare retrieval or agent products, measure search relevance, build symbols or caller graphs, establish authorization behavior from synthetic denial data, retain source, or make a production repository-map/index decision. It provides the bounded evidence and measurement contract needed before a larger benchmark or indexing direction can be assessed honestly.