tetrabench 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. tetrabench-0.1.0/.github/workflows/ci.yml +118 -0
  2. tetrabench-0.1.0/.github/workflows/release.yml +82 -0
  3. tetrabench-0.1.0/.gitignore +13 -0
  4. tetrabench-0.1.0/.gitleaksignore +2 -0
  5. tetrabench-0.1.0/.python-version +1 -0
  6. tetrabench-0.1.0/AGENTS.md +51 -0
  7. tetrabench-0.1.0/CLAUDE.md +1 -0
  8. tetrabench-0.1.0/IMPLEMENTATION_PLAN.md +729 -0
  9. tetrabench-0.1.0/LICENSE +21 -0
  10. tetrabench-0.1.0/NOTES.md +1978 -0
  11. tetrabench-0.1.0/PKG-INFO +322 -0
  12. tetrabench-0.1.0/README.md +295 -0
  13. tetrabench-0.1.0/benchmarks/README.md +701 -0
  14. tetrabench-0.1.0/benchmarks/catalog.toml +11 -0
  15. tetrabench-0.1.0/benchmarks/github-workflow/README.md +6 -0
  16. tetrabench-0.1.0/benchmarks/systems-design/README.md +6 -0
  17. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/README.md +66 -0
  18. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/authority.py +161 -0
  19. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/contract.toml +102 -0
  20. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/environment/Dockerfile +8 -0
  21. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/environment/seed/README.md +66 -0
  22. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/environment/seed/authority.py +161 -0
  23. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/environment/seed/contract.toml +102 -0
  24. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/environment/seed/test_public.py +133 -0
  25. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/instruction.md +18 -0
  26. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/solution/solve.sh +225 -0
  27. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/task.toml +24 -0
  28. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/test_public.py +133 -0
  29. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/tests/.dockerignore +2 -0
  30. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/tests/Dockerfile +11 -0
  31. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/tests/cases.toml +135 -0
  32. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/tests/contract.toml +102 -0
  33. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/tests/model.py +374 -0
  34. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/tests/mutants.toml +43 -0
  35. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/tests/schedule.py +72 -0
  36. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/tests/test.sh +12 -0
  37. tetrabench-0.1.0/benchmarks/tasks/systems-design/authority-fencing/tests/verify.py +1079 -0
  38. tetrabench-0.1.0/docs/cli-reference.md +352 -0
  39. tetrabench-0.1.0/pyproject.toml +78 -0
  40. tetrabench-0.1.0/src/tetrabench/__init__.py +28 -0
  41. tetrabench-0.1.0/src/tetrabench/artifact_policy.py +20 -0
  42. tetrabench-0.1.0/src/tetrabench/artifacts.py +531 -0
  43. tetrabench-0.1.0/src/tetrabench/authoring.py +507 -0
  44. tetrabench-0.1.0/src/tetrabench/calibration_opencode.py +20 -0
  45. tetrabench-0.1.0/src/tetrabench/canonical_json.py +107 -0
  46. tetrabench-0.1.0/src/tetrabench/catalog.py +48 -0
  47. tetrabench-0.1.0/src/tetrabench/cli.py +1151 -0
  48. tetrabench-0.1.0/src/tetrabench/config.py +202 -0
  49. tetrabench-0.1.0/src/tetrabench/context.py +891 -0
  50. tetrabench-0.1.0/src/tetrabench/controller.py +532 -0
  51. tetrabench-0.1.0/src/tetrabench/controller_runtime.py +982 -0
  52. tetrabench-0.1.0/src/tetrabench/docker_lifecycle.py +280 -0
  53. tetrabench-0.1.0/src/tetrabench/engines/__init__.py +75 -0
  54. tetrabench-0.1.0/src/tetrabench/engines/docker.py +312 -0
  55. tetrabench-0.1.0/src/tetrabench/engines/modal.py +275 -0
  56. tetrabench-0.1.0/src/tetrabench/harbor.py +285 -0
  57. tetrabench-0.1.0/src/tetrabench/harbor_api.py +504 -0
  58. tetrabench-0.1.0/src/tetrabench/harbor_runner.py +178 -0
  59. tetrabench-0.1.0/src/tetrabench/integration.py +384 -0
  60. tetrabench-0.1.0/src/tetrabench/lifecycle.py +943 -0
  61. tetrabench-0.1.0/src/tetrabench/local_control.py +180 -0
  62. tetrabench-0.1.0/src/tetrabench/local_execution.py +219 -0
  63. tetrabench-0.1.0/src/tetrabench/modal_app.py +513 -0
  64. tetrabench-0.1.0/src/tetrabench/models.py +556 -0
  65. tetrabench-0.1.0/src/tetrabench/plan.py +112 -0
  66. tetrabench-0.1.0/src/tetrabench/receipts.py +290 -0
  67. tetrabench-0.1.0/src/tetrabench/records.py +538 -0
  68. tetrabench-0.1.0/src/tetrabench/remote.py +331 -0
  69. tetrabench-0.1.0/src/tetrabench/rewards.py +373 -0
  70. tetrabench-0.1.0/src/tetrabench/run_reference.py +277 -0
  71. tetrabench-0.1.0/src/tetrabench/s3.py +1331 -0
  72. tetrabench-0.1.0/src/tetrabench/storage.py +146 -0
  73. tetrabench-0.1.0/src/tetrabench/submission.py +542 -0
  74. tetrabench-0.1.0/tests/conftest.py +33 -0
  75. tetrabench-0.1.0/tests/fixtures/harbor_authority_task/environment/Dockerfile +29 -0
  76. tetrabench-0.1.0/tests/fixtures/harbor_authority_task/environment/FORGE.md +20 -0
  77. tetrabench-0.1.0/tests/fixtures/harbor_authority_task/environment/Forge.Dockerfile +10 -0
  78. tetrabench-0.1.0/tests/fixtures/harbor_authority_task/environment/docker-compose.yaml +26 -0
  79. tetrabench-0.1.0/tests/fixtures/harbor_authority_task/environment/forge.py +487 -0
  80. tetrabench-0.1.0/tests/fixtures/harbor_authority_task/environment/forge_cli.py +78 -0
  81. tetrabench-0.1.0/tests/fixtures/harbor_authority_task/environment/initial_state.json +1 -0
  82. tetrabench-0.1.0/tests/fixtures/harbor_authority_task/environment/repo/app.py +1 -0
  83. tetrabench-0.1.0/tests/fixtures/harbor_authority_task/instruction.md +12 -0
  84. tetrabench-0.1.0/tests/fixtures/harbor_authority_task/solution/solve.sh +17 -0
  85. tetrabench-0.1.0/tests/fixtures/harbor_authority_task/task.toml +30 -0
  86. tetrabench-0.1.0/tests/fixtures/harbor_authority_task/tests/Dockerfile +17 -0
  87. tetrabench-0.1.0/tests/fixtures/harbor_authority_task/tests/artifact_contract.json +1 -0
  88. tetrabench-0.1.0/tests/fixtures/harbor_authority_task/tests/expected_initial.json +1 -0
  89. tetrabench-0.1.0/tests/fixtures/harbor_authority_task/tests/test.sh +11 -0
  90. tetrabench-0.1.0/tests/fixtures/harbor_authority_task/tests/verify.py +712 -0
  91. tetrabench-0.1.0/tests/fixtures/harbor_task/environment/Dockerfile +3 -0
  92. tetrabench-0.1.0/tests/fixtures/harbor_task/instruction.md +1 -0
  93. tetrabench-0.1.0/tests/fixtures/harbor_task/solution/solve.sh +38 -0
  94. tetrabench-0.1.0/tests/fixtures/harbor_task/task.toml +43 -0
  95. tetrabench-0.1.0/tests/fixtures/harbor_task/tests/test.sh +8 -0
  96. tetrabench-0.1.0/tests/test_artifacts.py +582 -0
  97. tetrabench-0.1.0/tests/test_authoring.py +719 -0
  98. tetrabench-0.1.0/tests/test_canonical_json.py +114 -0
  99. tetrabench-0.1.0/tests/test_catalog.py +45 -0
  100. tetrabench-0.1.0/tests/test_clean_verifier_fixture.py +703 -0
  101. tetrabench-0.1.0/tests/test_cli.py +1681 -0
  102. tetrabench-0.1.0/tests/test_config.py +163 -0
  103. tetrabench-0.1.0/tests/test_context.py +194 -0
  104. tetrabench-0.1.0/tests/test_controller.py +510 -0
  105. tetrabench-0.1.0/tests/test_controller_runtime.py +1010 -0
  106. tetrabench-0.1.0/tests/test_docker_lifecycle.py +470 -0
  107. tetrabench-0.1.0/tests/test_engine_review.py +192 -0
  108. tetrabench-0.1.0/tests/test_engines.py +704 -0
  109. tetrabench-0.1.0/tests/test_fixture_sealing.py +719 -0
  110. tetrabench-0.1.0/tests/test_harbor.py +257 -0
  111. tetrabench-0.1.0/tests/test_harbor_runner.py +608 -0
  112. tetrabench-0.1.0/tests/test_lifecycle.py +1182 -0
  113. tetrabench-0.1.0/tests/test_modal_app.py +833 -0
  114. tetrabench-0.1.0/tests/test_models.py +277 -0
  115. tetrabench-0.1.0/tests/test_package_fixture.py +126 -0
  116. tetrabench-0.1.0/tests/test_plan.py +107 -0
  117. tetrabench-0.1.0/tests/test_provider_consistency_probe.py +231 -0
  118. tetrabench-0.1.0/tests/test_receipts.py +159 -0
  119. tetrabench-0.1.0/tests/test_records.py +598 -0
  120. tetrabench-0.1.0/tests/test_remote.py +415 -0
  121. tetrabench-0.1.0/tests/test_rewards.py +400 -0
  122. tetrabench-0.1.0/tests/test_run_identity.py +332 -0
  123. tetrabench-0.1.0/tests/test_s3.py +1492 -0
  124. tetrabench-0.1.0/tests/test_smoke_fixture.py +73 -0
  125. tetrabench-0.1.0/tests/test_submission.py +299 -0
  126. tetrabench-0.1.0/tetrabench.toml +27 -0
  127. tetrabench-0.1.0/tools/__init__.py +1 -0
  128. tetrabench-0.1.0/tools/distribution_smoke.py +278 -0
  129. tetrabench-0.1.0/tools/provider_consistency_probe.py +272 -0
  130. tetrabench-0.1.0/tools/smoke_fixture.py +104 -0
  131. tetrabench-0.1.0/uv.lock +2123 -0
@@ -0,0 +1,118 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ workflow_call:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ env:
13
+ UV_PYTHON: "3.12"
14
+
15
+ concurrency:
16
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
17
+ cancel-in-progress: true
18
+
19
+ jobs:
20
+ test:
21
+ name: Python 3.12
22
+ runs-on: ubuntu-latest
23
+ timeout-minutes: 45
24
+ steps:
25
+ - name: Check out repository
26
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
27
+ with:
28
+ persist-credentials: false
29
+
30
+ - name: Set up Python
31
+ uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
32
+ with:
33
+ python-version: "3.12"
34
+
35
+ - name: Set up uv
36
+ uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
37
+ with:
38
+ version: "0.11.21"
39
+ enable-cache: true
40
+
41
+ - name: Check lockfile
42
+ run: uv lock --check
43
+
44
+ - name: Validate workflow syntax and shell commands
45
+ run: >-
46
+ docker run --rm
47
+ --volume "$PWD:/repo:ro"
48
+ --workdir /repo
49
+ rhysd/actionlint@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667
50
+ .github/workflows/ci.yml .github/workflows/release.yml
51
+ # rhysd/actionlint:1.7.12
52
+
53
+ - name: Install locked dependencies
54
+ run: uv sync --locked --all-groups
55
+
56
+ - name: Lint
57
+ run: uv run ruff check .
58
+
59
+ - name: Check formatting
60
+ run: uv run ruff format --check .
61
+
62
+ - name: Type-check
63
+ run: uv run ty check
64
+
65
+ - name: Scan production source
66
+ run: uv run bandit --quiet --recursive src tools
67
+
68
+ - name: Check Docker daemon
69
+ run: docker info
70
+
71
+ - name: Run required Docker tests
72
+ run: TETRABENCH_EXPECT_DOCKER_TESTS=11 uv run pytest --strict-markers -m docker
73
+
74
+ - name: Run non-Docker test suite
75
+ run: uv run pytest --strict-markers -m "not docker"
76
+
77
+ - name: Build wheel and source distribution
78
+ run: uv build
79
+
80
+ - name: Validate distribution metadata and README rendering
81
+ run: uv run --locked twine check --strict dist/*.whl dist/*.tar.gz
82
+
83
+ - name: Smoke-test isolated wheel, Docker, and offline Modal graph
84
+ run: >-
85
+ uv run python tools/distribution_smoke.py
86
+ --wheel dist/tetrabench-*.whl
87
+ --sdist dist/tetrabench-*.tar.gz
88
+ --work-dir "${{ runner.temp }}/tetrabench-wheel-smoke"
89
+ --category release-smoke --docker
90
+
91
+ - name: Audit all locked dependencies
92
+ shell: bash
93
+ run: |
94
+ set -euo pipefail
95
+ requirements="$(mktemp)"
96
+ trap 'rm -f "$requirements"' EXIT
97
+ uv export --quiet --locked --all-groups --no-emit-project > "$requirements"
98
+ uv run pip-audit --strict --require-hashes --disable-pip -r "$requirements"
99
+
100
+ secrets:
101
+ name: Full-history secret scan
102
+ runs-on: ubuntu-latest
103
+ timeout-minutes: 10
104
+ steps:
105
+ - name: Check out full history
106
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
107
+ with:
108
+ fetch-depth: 0
109
+ persist-credentials: false
110
+
111
+ - name: Scan with Gitleaks
112
+ run: >-
113
+ docker run --rm
114
+ --volume "$PWD:/repo:ro"
115
+ --workdir /repo
116
+ ghcr.io/gitleaks/gitleaks@sha256:c00b6bd0aeb3071cbcb79009cb16a60dd9e0a7c60e2be9ab65d25e6bc8abbb7f
117
+ detect --source=/repo --redact --verbose --no-banner
118
+ # ghcr.io/gitleaks/gitleaks:v8.30.1
@@ -0,0 +1,82 @@
1
+ name: Release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ concurrency:
11
+ group: release-${{ github.event.release.tag_name }}
12
+ cancel-in-progress: false
13
+
14
+ jobs:
15
+ checks:
16
+ if: ${{ !github.event.release.prerelease && !github.event.release.draft }}
17
+ uses: ./.github/workflows/ci.yml
18
+
19
+ build:
20
+ needs: checks
21
+ runs-on: ubuntu-latest
22
+ timeout-minutes: 30
23
+ steps:
24
+ - name: Check out released commit
25
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
26
+ with:
27
+ persist-credentials: false
28
+ - name: Set up uv
29
+ uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
30
+ with:
31
+ version: "0.11.21"
32
+ enable-cache: false
33
+ - name: Build distributions
34
+ run: |
35
+ uv lock --check
36
+ uv build --python 3.12
37
+ uv run --python 3.12 --locked twine check --strict dist/*.whl dist/*.tar.gz
38
+ - name: Verify release version and test exact wheel
39
+ env:
40
+ RELEASE_TAG: ${{ github.event.release.tag_name }}
41
+ run: >-
42
+ uv run --python 3.12 --locked python tools/distribution_smoke.py
43
+ --wheel dist/tetrabench-*.whl
44
+ --sdist dist/tetrabench-*.tar.gz
45
+ --work-dir "${{ runner.temp }}/tetrabench-release-smoke"
46
+ --tag "$RELEASE_TAG" --category release-smoke --docker
47
+ - name: Seal tested artifact checksums
48
+ run: sha256sum dist/*.whl dist/*.tar.gz > SHA256SUMS
49
+ - name: Retain tested release artifacts
50
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
51
+ with:
52
+ name: release-dist
53
+ path: |
54
+ dist/*.whl
55
+ dist/*.tar.gz
56
+ SHA256SUMS
57
+ if-no-files-found: error
58
+ retention-days: 90
59
+
60
+ publish:
61
+ needs: build
62
+ runs-on: ubuntu-latest
63
+ timeout-minutes: 10
64
+ environment:
65
+ name: pypi
66
+ url: https://pypi.org/project/tetrabench/
67
+ permissions:
68
+ id-token: write
69
+ steps:
70
+ - name: Set up uv
71
+ uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
72
+ with:
73
+ version: "0.11.21"
74
+ enable-cache: false
75
+ - name: Download tested artifacts without checking out source
76
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
77
+ with:
78
+ name: release-dist
79
+ - name: Verify and publish unchanged distributions through OIDC
80
+ run: |
81
+ sha256sum --check --strict SHA256SUMS
82
+ uv publish --trusted-publishing always dist/*.whl dist/*.tar.gz
@@ -0,0 +1,13 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # Local agent and operator notes
13
+ tmp/
@@ -0,0 +1,2 @@
1
+ 46837cd5ccf076d488867bd1236ad3b6abedeb79:IMPLEMENTATION_PLAN.md:generic-api-key:315
2
+ e66496e8e832ae4bee372326d00e4f9e39237b69:NOTES.md:generic-api-key:1476
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,51 @@
1
+ # Tetrabench Agent Contract
2
+
3
+ ## Session Start
4
+
5
+ At the start of every session, read these files in order:
6
+
7
+ 1. the applicable global `AGENTS.md`;
8
+ 2. [README.md](README.md);
9
+ 3. [IMPLEMENTATION_PLAN.md](IMPLEMENTATION_PLAN.md);
10
+ 4. [NOTES.md](NOTES.md).
11
+
12
+ Read questionnaire-meme.png.
13
+
14
+ Inspect the repository state before editing. Apply the global Systems Design gate to pinned interfaces, lifecycle boundaries, canonical state, distributed mutation, destructive actions, and other high-blast-radius work.
15
+
16
+ ## Planning Record
17
+
18
+ [IMPLEMENTATION_PLAN.md](IMPLEMENTATION_PLAN.md) is the canonical scope, decision, progress, and evidence record.
19
+
20
+ - Update its current state, checklists, evidence, and blockers periodically during work and before every session ends.
21
+ - Preserve completed and superseded information. Mark it completed or superseded instead of deleting it.
22
+ - Keep stable IDs stable. Add new IDs rather than renumbering old ones.
23
+ - Do not mark implementation complete without the stated acceptance evidence.
24
+ - Surface correctness-critical unknowns as `unproven`.
25
+
26
+ ## Notes
27
+
28
+ [NOTES.md](NOTES.md) is append-only.
29
+
30
+ - Add dated, timestamped, and provenanced entries. Each entry is append-only immediately after creation.
31
+ - Correct an entry by appending a correction; never rewrite history.
32
+ - Promote durable decisions into the plan while retaining the originating note.
33
+ - Separate user-provided contracts, primary-source research, observations, and inference.
34
+
35
+ ## User Documentation
36
+
37
+ [README.md](README.md) contains only verified user-facing behavior. Do not document planned commands, APIs, or capabilities as working. Keep design detail, progress, and unresolved evidence in the plan.
38
+
39
+ Edit existing human-facing documentation in place. Preserve its facts, intent, voice, structure, links, and caveats, and inspect the old/new diff for loss. Rewrite only when requested or structurally necessary.
40
+
41
+ ## Change Discipline
42
+
43
+ - Once the user authorizes an eval or calibration budget, continue paid attempts within each invocation's implemented cap without asking again. Stop only on success or when another recorded safety boundary blocks execution.
44
+ - Prefer native Harbor, Modal, S3, and Docker mechanisms over custom control planes.
45
+ - Do not add a custom run database.
46
+ - Never deliberately serialize credentials into plans, receipts, logs, fixtures, or committed configuration.
47
+ - Treat native Harbor logs and artifacts as sensitive private bytes; tetrabench guarantees only that it does not deliberately serialize credentials.
48
+ - Keep submitter and controller storage credentials separate. Do not give child agent or verifier sandboxes S3 publication credentials.
49
+ - Do not write controller code until E-019 proves child ID/tag observation through a supported Harbor v0.22.0 extension surface.
50
+ - Preserve unrelated changes and use the smallest reviewable mutation.
51
+ - Before ending work, run the strongest practical checks named by the current plan and record their evidence.
@@ -0,0 +1 @@
1
+ AGENTS.md