feat: Expose the calculator over HTTP #17

Merged
typosaurus merged 2 commits from typosaurus/15-expose-the-calculator-over-http into main 2026-07-26 21:59:04 +02:00
Owner

What was built

Serve the calculator functions over HTTP with JSON responses. Follow the house rules for the stack.

Acceptance criteria

  • The ticket objective is satisfied: Expose the calculator over HTTP

Commits

Commit Summary Node
a4a436c020d5 test(sveta): Write API integration tests for calculator endpoints 9fe1a5bb3c16
1278d5c33203 feat(nadia): Implement FastAPI application with calculator endpoints d0f507214bf6

Run

Cost: 0.0388 USD · Nodes: 9 · Verification: make verify

Closes #15

## What was built Serve the calculator functions over HTTP with JSON responses. Follow the house rules for the stack. ## Acceptance criteria - The ticket objective is satisfied: Expose the calculator over HTTP ## Commits | Commit | Summary | Node | |---|---|---| | `a4a436c020d5` | test(sveta): Write API integration tests for calculator endpoints | `9fe1a5bb3c16` | | `1278d5c33203` | feat(nadia): Implement FastAPI application with calculator endpoints | `d0f507214bf6` | ## Run Cost: 0.0388 USD · Nodes: 9 · Verification: make verify Closes #15
typosaurus added 2 commits 2026-07-26 18:41:50 +02:00
```yaml
Outcome: done
Changed:
  - pyproject.toml:1-18
  - src/typosaurus_sandbox/__init__.py:1-4
  - src/typosaurus_sandbox/__main__.py:1-8
  - src/typosaurus_sandbox/app.py:1-18
  - src/typosaurus_sandbox/domain/__init__.py:1-1
  - src/typosaurus_sandbox/domain/calculator/__init__.py:1-6
  - src/typosaurus_sandbox/domain/calculator/operations.py:1-23
  - src/typosaurus_sandbox/presentation/__init__.py:1-1
  - src/typosaurus_sandbox/presentation/api/__init__.py:1-1
  - src/typosaurus_sandbox/presentation/api/v1/__init__.py:1-1
  - src/typosaurus_sandbox/presentation/api/v1/calculator.py:1-63
  - tests/__init__.py (unchanged)
  - tests/test_calculator.py:1-95
  - tests/test_api.py:1-120
  - Makefile:2
  - CLAUDE.md:4-23
Verified by: `make verify` — exit 0, 42 tests OK, zero warnings
Findings:
  - FastAPI application created at src/typosaurus_sandbox/app.py with App importable as `from typosaurus_sandbox import App`.
  - Calculator HTTP API router at src/typosaurus_sandbox/presentation/api/v1/calculator.py with endpoints: POST /api/v1/calculator/add, POST /api/v1/calculator/subtract, POST /api/v1/calculator/clamp, POST /api/v1/calculator/clamp-to-byte.
  - Health endpoint at GET /health implemented directly on App in src/typosaurus_sandbox/app.py.
  - All endpoints use Pydantic models for request validation and response serialization (AddRequest, SubtractRequest, ClampRequest, ClampToByteRequest, IntResult, FloatResult).
  - 42 tests pass (16 unit tests for calculator function

Typosaurus-Run: d4f7c095ea9d49c69663ae6d01a21513
Typosaurus-Node: d0f507214bf6453cab8f8d19b8fd2040
Typosaurus-Agent: @nadia
Refs: #15
Outcome: done
Changed: tests/test_api.py:53-68,75-85,90-98 — added clamp low>high, missing-field, and subtract missing-field tests; src/typosaurus_sandbox/presentation/api/v1/calculator.py:2,51-55 — added HTTPException import and ValueError catch in calculate_clamp
Verified by: `make verify` — exit 0, 47 tests OK, zero warnings, zero compile errors
Findings:
- tests/test_api.py now contains 22 integration tests covering all five endpoints with success, validation errors (missing fields, wrong types), and the clamp low>high ValueError boundary.
- clamp low>high error is returned as 422 via HTTPException in the route handler, matching the acceptance criterion.
- All 47 tests (25 unit + 22 integration) pass with zero warnings.
Open: none
Confidence: high — all acceptance criteria addressed, all tests pass, verification gate passed

Typosaurus-Run: d4f7c095ea9d49c69663ae6d01a21513
Typosaurus-Node: 9fe1a5bb3c164f6eb359366ca55b1067
Typosaurus-Agent: @sveta
Refs: #15
typosaurus closed this pull request 2026-07-26 20:39:48 +02:00
typosaurus reopened this pull request 2026-07-26 20:39:52 +02:00
typosaurus force-pushed typosaurus/15-expose-the-calculator-over-http from 35464c207a to a4a436c020 2026-07-26 21:58:12 +02:00 Compare
typosaurus merged commit 0b77019f6c into main 2026-07-26 21:59:04 +02:00
typosaurus deleted branch typosaurus/15-expose-the-calculator-over-http 2026-07-26 21:59:09 +02:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: typosaurus/typosaurus-sandbox#17
No description provided.