typosaurus dab3bb2437 feat(nadia): @nadia: Fix the two review findings in the research engine: (1) retry failed wor
Outcome: done
Changed: src/typosaurus_sandbox/research/engine.py:108-111,156-163,173-177, src/typosaurus_sandbox/research/pipeline.py:20-23,187-234,296-312, tests/test_research_engine.py:186-290, tests/test_research_pipeline.py:292-354
Verified by: verify() -> "make verify" exit_code 0, "Ran 226 tests OK verification passed"; only pre-existing StarletteDeprecationWarning from fastapi/testclient.py import in tests/test_api.py, none introduced
Findings: Retry: pipeline.py:192-211 retries RsearchError status>=500 with backoff min(0.5*2^(attempt-1),8.0) up to RETRY_MAX_ATTEMPTS=3 (pipeline.py:20-23); status<500 or None not retried. Unexpected exceptions recorded as failure WorkOutcome in consume (pipeline.py:296-312), appended to outcomes. Closure gated on requests_failed==0 (engine.py:159-163); report.closed=requests_failed==0 (engine.py:177); failed round prevents closure, later clean round keeps report.closed False (tests/test_research_engine.py:229-290). Deep/ai wired: every popped query yields WorkItem("web",query,deep=True,ai=True) (engine.py:111); pipeline passes deep/ai to client.search and cache probe (pipeline.py:157-158,170-176); test proves seed+subtopic web calls all carry deep=True and ai=True (tests/test_research_engine.py:203-222). Fix committed as 472a59e; this node's working-tree delta is only trailing-blank cleanup; no new dependencies, client.py/cache.py/config.py/frontier.py untouched.
Open: none
Confidence: high - all six acceptance criteria met with direct

Typosaurus-Run: 4e2afb673c7f4578a12276d9181b982d
Typosaurus-Node: e6071c7595ab487b84f99476243abe28
Typosaurus-Agent: @nadia
Refs: #31
2026-08-08 02:56:05 +00:00

retoor retoor@molodetz.nl

typosaurus-sandbox

Sandbox for Typosaurus end-to-end verification.

A FastAPI application serving arithmetic operations over HTTP with JSON request/response bodies.

Configuration

The application uses a single .env.json file at the project root as its central point of truth for configuration. Defaults are plug-and-play and require no setup:

{
    "host": "127.0.0.1",
    "port": 8000
}

When no .env.json is present, the application starts with these defaults. To customise, create .env.json in the project root and populate only the keys that differ.

Usage

Start the server

python -m typosaurus_sandbox

The server listens on http://127.0.0.1:8000 by default.

Health check

GET /health

Response:

{"status": "ok"}

API endpoints

All calculator endpoints accept POST requests with a JSON body and return a JSON response.

POST /api/v1/calculator/add

Add two integers.

Request:

{"left": 3, "right": 5}

Response:

{"result": 8}

POST /api/v1/calculator/subtract

Subtract the right integer from the left.

Request:

{"left": 10, "right": 3}

Response:

{"result": 7}

POST /api/v1/calculator/clamp

Clamp a value between a low and high bound.

Request:

{"value": 15, "low": 0, "high": 10}

Response:

{"result": 10}

Boundaries are inclusive. A low > high combination produces a 422 validation response.

POST /api/v1/calculator/clamp-to-byte

Clamp an integer to the byte range [0, 255].

Request:

{"value": 300}

Response:

{"result": 255}

POST /api/v1/calculator/average

Compute the arithmetic mean of a list of values.

Request:

{"values": [1, 2, 3, 4, 5]}

Response:

{"result": 3.0}

An empty list produces a 422 validation response.

POST /api/v1/calculator/median

Compute the median of a list of values. Values are sorted internally; an even-length list returns the average of the two middle values as a float.

Request:

{"values": [1, 3, 5]}

Response:

{"result": 3.0}

Request (even length):

{"values": [1, 2, 3, 4]}

Response:

{"result": 2.5}

An empty list produces a 422 validation response.

POST /api/v1/calculator/variance

Compute the population variance of a list of values.

Request:

{"values": [1, 2, 3, 4, 5]}

Response:

{"result": 2.0}

An empty list produces a 422 validation response.

POST /api/v1/calculator/percentage

Compute what percentage value is of total.

Request:

{"value": 50, "total": 100}

Response:

{"result": 50.0}

A zero total produces a 422 validation response.

Verification

make verify

Runs compile-all checks against all source and test files, then executes the full test suite. Zero warnings are tolerated.

S
Description
Sandbox for Typosaurus end-to-end verification
Readme
236 KiB
Languages
Python 92%
HTML 7.3%
Makefile 0.7%