Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: tests

on:
push:
branches: [main]
pull_request:

jobs:
pytest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install pytest
- run: python -m pytest -v
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__pycache__/
.pytest_cache/
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
# evoforge-demo
# evoforge-target

Demo target repository for EvoForge (verifiable AI engineering collective).
`calc.add` has a deliberate bug for the Builder/Critic loop to fix.
Demo target repository for [EvoForge](https://evoforge-web-230852112787.asia-northeast3.run.app/), a verifiable AI engineering collective.

EvoForge takes a mission written in plain language, has a Builder write the change and a Critic check it, runs the visible tests plus a sealed held-out suite, and opens a pull request here only when every gate passes. Each PR carries an evidence id and an Ed25519-signed proof certificate that anyone can check on the EvoForge verify page.

## The demo mission

`stats.median` has a deliberate bug: for a list of even length it returns the upper middle element instead of the average of the two middle elements. The visible test only covers an odd-length list, so a change that merely passes the visible tests is not enough; the held-out suite decides.

Example mission:

> In stats.py, fix median(xs) so that for an even number of items it returns the average of the two middle items. Keep mean unchanged.

`calc.py` (add, sub, mul) is the history of earlier missions: each of those bugs was fixed by a merged EvoForge PR.

## Checking a PR

1. Open the `Verify:` link in the PR body and confirm the verdict is VERIFIED.
2. Compare the certificate id, public key fingerprint and signature shown there with the ones in the PR body.
3. The `tests` workflow runs `pytest` on every PR independently of EvoForge.

## Running the tests

```
pip install pytest
python -m pytest -v
```
6 changes: 6 additions & 0 deletions stats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def mean(xs):
return sum(xs) / len(xs)

def median(xs):
ordered = sorted(xs)
return ordered[len(xs) // 2]
2 changes: 1 addition & 1 deletion tests/evoforge_gen/test_7a0ab91b_1.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def test_mul_returns_product():
from calc import mul
assert mul(2, 3) == 6
assert mul(2, 3) == 6
2 changes: 1 addition & 1 deletion tests/evoforge_gen/test_7a0ab91b_2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def test_add_unchanged():
from calc import add
assert add(2, 3) == 5
assert add(2, 3) == 5
2 changes: 1 addition & 1 deletion tests/evoforge_gen/test_7a0ab91b_3.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def test_sub_unchanged():
from calc import sub
assert sub(5, 3) == 2
assert sub(5, 3) == 2
2 changes: 1 addition & 1 deletion tests/evoforge_gen/test_813100b8_1.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def test_sub_basic():
from calc import sub
assert sub(5, 3) == 2
assert sub(5, 3) == 2
2 changes: 1 addition & 1 deletion tests/evoforge_gen/test_813100b8_2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def test_sub_negative_result():
from calc import sub
assert sub(2, 5) == -3
assert sub(2, 5) == -3
2 changes: 1 addition & 1 deletion tests/evoforge_gen/test_813100b8_3.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def test_sub_zero():
from calc import sub
assert sub(0, 0) == 0
assert sub(0, 0) == 0
2 changes: 1 addition & 1 deletion tests/evoforge_gen/test_gen_1.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def test_add_positive():
from calc import add
assert add(2, 3) == 5
assert add(2, 3) == 5
2 changes: 1 addition & 1 deletion tests/evoforge_gen/test_gen_2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def test_add_negative():
from calc import add
assert add(-2, -3) == -5
assert add(-2, -3) == -5
2 changes: 1 addition & 1 deletion tests/evoforge_gen/test_gen_3.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def test_add_zero():
from calc import add
assert add(0, 5) == 5
assert add(0, 5) == 5
7 changes: 7 additions & 0 deletions tests/test_stats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def test_mean_basic():
from stats import mean
assert mean([1, 2, 3, 4]) == 2.5

def test_median_odd_length():
from stats import median
assert median([3, 1, 2]) == 2
Loading