Skip to content

feat: benchmark manifest schema and selection mechanism - #128

Open
randomparity wants to merge 19 commits into
mainfrom
feat/benchmark-manifest-119
Open

feat: benchmark manifest schema and selection mechanism#128
randomparity wants to merge 19 commits into
mainfrom
feat/benchmark-manifest-119

Conversation

@randomparity

Copy link
Copy Markdown
Owner

What this does

Adds the machine-readable task-manifest schema and the deterministic selection,
validation, and materialization mechanisms that encode the v1 benchmark protocol
(docs/benchmarks/adept-workflow-v1.md).

Components

  • benchmarks/manifest.py — pinned protocol constants (dataset/evaluator revisions, supported licenses, required fields) and canonical-JSON SHA-256 digest computation.
  • benchmarks/validate_manifest.py — pure-Python validator with 16 constraint checks (protocol pins, group/task counts, repository disjointness, SHA format, license allowlist, GitHub URL format, field presence, digest match). CLI exits 0/1/2.
  • benchmarks/select_tasks.py — deterministic selection: enumerate SWE-bench_Verified test split by ascending instance_id, filter by license/author eligibility, enumerate 3-task combinations per repo in lexical order, test candidate common revisions, select first two repository-disjoint qualifying groups. validate_fn seam for testing.
  • benchmarks/validate_task.py — per-task validation: clone, apply gold patch via stdin, check Docker availability, run pre-patch failure and post-patch pass checks. Repo format validation prevents command injection.
  • benchmarks/materialize_issues.py — create benchmark-owned GitHub issues feat: import the skills tree, without the companion or prose assertions #1/docs: design first-party replacements for the superpowers-derived skills #2/docs: plan the companion strip and migration realignment #3 per group with exact labels. Idempotency via existing-issue detection. Dry-run mode. Topology digest.
  • benchmarks/fetch_dataset.py — normalize SWE-bench_Verified rows to canonical JSONL. Lazy-imports huggingface_hub and pyarrow.

Toolchain

  • ruff.toml — Python 3.12 target, line length 100, lint rules E/F/W/I/UP/B.
  • Justfilepy-test (unittest discovery) and py-lint (ruff check + format) recipes wired into commit-check and verify.
  • CI workflowruff added to Homebrew install line.
  • .gitignore__pycache__/ and *.pyc (Python bytecode contains host paths).

Design records

  • ADR 0019 — Python for benchmark infrastructure, bash for gate scripts.
  • Spec — manifest schema, selection algorithm, validation, materialization, security boundaries.
  • Plan — 8-task TDD implementation plan.

Testing

68 unittest tests across 7 test modules. No network, no Docker, no GitHub API — all external interactions are stubbed via callable parameters. just verify green (all shell gates, Python tests, ruff lint, format, records, public-safety, plugin-check, actions-check).

Review

ADR, spec, and plan adversarially reviewed via $gauntlet (ADR approved; spec 5-iteration review; plan 2-iteration review). Branch diff reviewed via $trial-loop (approved, 3 iterations, 5 findings fixed). Security scan via $detect-evil (clean — repo name validation, no shell=True, pinned revisions).

Closes #119

Spec, ADR 0019 (Python for benchmark infra), and implementation plan for issue #119. The manifest schema, deterministic selection, per-task validation, and issue materialization mechanisms encode the v1 benchmark protocol.
Address review finding: clarify that huggingface_hub/pyarrow version pinning belongs to #120's environment lock, not the ADR or manifest. The protocol pins dataset/evaluator revisions, not library versions.
Add Docker error-handling contract, materialization idempotency, agent-visible isolation boundary, cleanup-on-failure, license source clarification, manifest digest timing, JSONL malformed-row handling, and topology digest definition.
Clarify: contract mismatch is fatal, cleanup failures are warnings, missing license uses license-missing exclusion, instance_id is required JSONL field, repo creation is pre-run prerequisite, topology digest timing and failure semantics.
If fewer than two groups qualify, selection stops and reports the shortfall. Discretionary replacement is forbidden per the protocol.
A git apply --check failure is a validation finding (exit 1), not an infrastructure failure — the patch does not apply cleanly at this revision.
Address spec review cap findings: target Python 3.12 for runner safety, UTC for ledger filenames, note serial-execution requirement for selection and materialization.
Add: field presence checks, validate_fn stub example, validate_task CLI exit codes, Docker availability pre-check, cleanup tests, partial-failure semantics, materialization error tests, network resilience notes.
Fix validate_fn stub to raise ValidationError. Add test_patch type check, duplicate-repo test, exit-code test, malformed JSON test, Docker pre-check acceptance.
Add ruff.toml (py312, line-length 100), py-test and py-lint Justfile recipes wired into commit-check and verify, ruff to CI brew install, and benchmarks/ package init. unittest discovers test_*.py; exit 5 (no tests) tolerated during incremental builds.
Add __pycache__ and *.pyc to .gitignore (Python bytecode contains host paths). Pinned protocol values and canonical-JSON SHA-256 digest function for the v1 benchmark manifest.
Pure-Python validator checking protocol pins, group/task counts, repository disjointness, SHA format, license allowlist, GitHub URL format, field presence, and digest match. CLI exits 0/1/2. 30 tests covering valid manifest and each violation.
Enumerate SWE-bench_Verified test split by ascending instance_id, filter by license eligibility, enumerate 3-task combinations per repo in lexical order, test candidate common revisions, select first two repository-disjoint qualifying groups. validate_fn seam for testing. 43 tests covering filtering, ordering, selection, and ledger completeness.
Clone, apply gold patch, check Docker availability, run pre-patch failure and post-patch pass checks via stubbable subprocess runner. ValidationError distinguishes infrastructure faults from validation findings. CLI exits 0/1/2. 10 tests covering all paths.
Create benchmark-owned GitHub issues #1/#2/#3 per group with exact labels, dry-run mode, idempotency via partial-failure detection, topology digest over canonical JSON. 8 tests.
Normalize SWE-bench_Verified rows to canonical JSONL (parse JSON-string FAIL_TO_PASS/PASS_TO_PASS, handle missing issue_url, malformed JSON). Lazy-imports huggingface_hub and pyarrow. 7 tests.
Fix gold patch not passed to git apply (critical). Add repo format validation to prevent command injection. Add gh auth and repo existence pre-checks. Add idempotency via existing-issue detection. Add author identity exclusion framework per protocol.
Simplification pass: hoist 'import re' from function-level to module-level in select_tasks.py and validate_task.py.
@randomparity

Copy link
Copy Markdown
Owner Author

Review — issue #119

  • verdict: approve
  • findings: 0 (final pass)
  • iterations: 3 (branch trial-loop)
  • security: detect-evil clean (no findings)
  • deferrals: none

Review arms run:

  • ADR 0019: $gauntlet file-list review — approved (2 iterations, 1 finding fixed)
  • Spec: $gauntlet file-list review — 5 iterations, 8→8→4→3→6 findings, all resolved
  • Plan: $gauntlet file-list review — 2 iterations, 10→7 findings, all resolved
  • Branch diff: $trial-loop --base main — approved (3 iterations, 5 findings fixed, 3 rejected)
  • Security: $detect-evil --base main — clean

Suppressed: 0. Deferrals: 0.

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.

Curate and validate the pinned public benchmark manifest

1 participant