Commit Graph

14 Commits

Author SHA1 Message Date
7e76456599 feat(nadia): Implement median function in src/calculator.py
**Outcome:** done

**Changed:** src/calculator.py:28-34

**Verified by:** make verify — exit code 0, 16 tests passed, verification passed.

**Findings:**
- src/calculator.py:28-34 — median(values: list[float]) -> float function added after clamp_to_byte. Full type annotations, no comments/docstrings. Raises ValueError on empty sequence. Returns middle element for odd-length sequences and average of two middle elements for even-length sequences.

**Open:** Tests for the new function need to be written by @sveta.

**Confidence:** high

Typosaurus-Run: 529efb295dd94e799a5e47a9ef0c6c16
Typosaurus-Node: d0a2754c13cc4742bb46790341416bd6
Typosaurus-Agent: @nadia
Refs: #13
2026-07-26 21:14:45 +00:00
c5999afcad test(sveta): Write tests for average function
Outcome: done
Changed: tests/test_calculator.py:1 (import line), tests/test_calculator.py:88-107 (new class)
Verified by: `make verify` passed (22 tests, OK); `python3 -m compileall -q tests/test_calculator.py` passed (no warnings)
Findings: TestAverageFunction class with 6 test methods added to tests/test_calculator.py:88-107 covering empty, single-element, positive, negative, mixed, and float input cases.
Open: none
Confidence: high - all 6 acceptance criteria tests exist, all pass, no comments/docstrings, conventions followed

Typosaurus-Run: 32dcefafeb39422b82cbd65f56833df7
Typosaurus-Node: cc947cb8b24b47139b0a1b6e10d6384a
Typosaurus-Agent: @sveta
Refs: #11
2026-07-26 20:12:16 +00:00
3ad3dc517f feat(nadia): Implement average function in src/calculator.py
Outcome: done
Changed: src/calculator.py:29-32
Verified by: `make verify` passed (16 tests, OK); `python3 -m compileall -q src/calculator.py` passed; manual assertion of all acceptance criteria passed
Findings: average(values: list[int | float]) -> float was added to src/calculator.py:29-32
Open: none
Confidence: high - all acceptance criteria met, header present, type annotations present, no comments/docstrings, compile passes, tests pass, manual verification confirms every criterion

Typosaurus-Run: 32dcefafeb39422b82cbd65f56833df7
Typosaurus-Node: 7a52f9800aff4d4396b35d10ada3aacf
Typosaurus-Agent: @nadia
Refs: #11
2026-07-26 20:09:43 +00:00
a4a436c020 test(sveta): Write API integration tests for calculator endpoints
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
2026-07-26 19:57:37 +00:00
1278d5c332 feat(nadia): Implement FastAPI application with calculator endpoints
```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
2026-07-26 19:57:06 +00:00
e11ca4b376 feat(nadia): Implement percentage function in calculator.py
Outcome: done
Changed: src/calculator.py:1 (import Union), src/calculator.py:31-34 (percentage function)
Verified by: `make verify` — exit 0, all 16 tests passed, compilation clean
Findings: src/calculator.py:31-34 — percentage(value: Union[int, float], total: Union[int, float]) -> float added, returning (value/total)*100, raising ValueError on total==0
Open: none
Confidence: high — all acceptance criteria met, verification passed

Typosaurus-Run: ff52a86851934fd293e2f4493c5a9a46
Typosaurus-Node: baf30844321745fb8a1aabe91a33823b
Typosaurus-Agent: @nadia
Refs: #16
2026-07-26 17:44:38 +00:00
3c5079a9d8 feat(nadia): Implement variance function in calculator.py
Outcome: done

Changed: src/calculator.py:3, src/calculator.py:33-37

Verified by: python3 -m compileall -q src tests && python3 -m unittest discover -s tests -q — exit 0, compilation passed, 16 tests pass, smoke test confirms correctness

Findings: from typing import Sequence added at line 3 of src/calculator.py
Findings: variance(values: Sequence[float]) -> float added at lines 33-37 of src/calculator.py
Findings: Population variance formula implemented: sum of squared deviations from mean divided by N
Findings: Empty sequence raises bare ValueError matching existing clamp convention
Findings: Single-element sequence returns 0.0
Findings: File header retoor line preserved
Findings: Full type annotations present, no comments or docstrings

Open: Test class for variance could be added by sveta

Confidence: high - implementation is 5 lines, matches all acceptance criteria, verified by compilation and smoke test

Typosaurus-Run: 918d38b1535b44bea9a86b82deae5233
Typosaurus-Node: 50845c1644c5421fb80ab933d382bc90
Typosaurus-Agent: @nadia
Refs: #19
2026-07-26 17:06:20 +00:00
c7f0712d12 feat(nadia): Implement clamp function
**Outcome:** done
**Changed:** src/calculator.py:11-18
**Verified by:** python3 -m compileall -q src — passed; python3 -c with five acceptance assertions — passed. make verify fails because tests/ directory does not exist.
**Findings:** clamp(value: int, low: int, high: int) -> int added at src/calculator.py:11 with no docstrings or comments. File header at src/calculator.py:1 is present. All functions use full int type annotations.
**Open:** Test writer (sveta) should create tests/ directory and add unit tests for clamp.
**Confidence:** high

Typosaurus-Run: 5b5c36bf38254bf4bfcdbde317991a5a
Typosaurus-Node: bf41377d70c446b1b80b9e058fe81fb8
Typosaurus-Agent: @nadia
Refs: #7
2026-07-25 19:04:03 +02:00
65ce7f1994 feat: add clamp_to_byte at the end of calculator 2026-07-25 19:01:02 +02:00
f5363514bf chore: reset calculator to a clean baseline 2026-07-25 18:58:10 +02:00
ff830c6fb8 feat: add gcd at the end of the file 2026-07-25 18:51:44 +02:00
cb4c5516ad feat: add modulo and ignore build artifacts 2026-07-25 18:49:12 +02:00
3f2a5c8a07 feat(nadia): Implement multiply and divide in calculator.py
Outcome: done
Changed: src/calculator.py:11-19
Verified by: `make verify` — exit 0, "verification passed"
Findings: src/calculator.py now defines multiply(left: int, right: int) -> int and divide(left: int, right: int) -> int.
           divide raises ValueError('division by zero') when the divisor is zero, using integer floor division (//) to preserve the int return type.
Open: none
Confidence: high — both functions added, header preserved, no comments/docstrings, full type annotations, verify passed.

Typosaurus-Run: d9404e45783a42b586e07fc0342eee5c
Typosaurus-Node: 430bbdd86efb4f16a1c90433f0667e6b
Typosaurus-Agent: @nadia
Refs: #2
2026-07-25 17:08:02 +02:00
380ac7f40f chore: seed sandbox project 2026-07-25 16:58:41 +02:00