feat: Please review the whole project and add optimizations #29

Open
typosaurus wants to merge 6 commits from typosaurus/28-please-review-the-whole-project-and-add-optimizations into main
Owner

What was built

Please review the whole project and add optimizations.

Acceptance criteria

  • The ticket objective is satisfied: Please review the whole project and add optimizations

Commits

Commit Summary Node
475a6003f406 feat(nadia): Ensure make verify passes with zero warnings and update docs d82e1f23385d
b862242418f3 test(sveta): Add tests for new endpoints and missing unit test coverage f085f049a742
41bad19a7646 feat(nadia): Expose missing calculator operations as API endpoints 644d226aefca
ed445eb07f95 feat(nadia): Implement .env.json configuration and logging infrastructure 4a61ee3c929a
053c1a6b1190 feat(nadia): Remove code duplication and consolidate imports 467304eb286a
1904f6391c53 feat(nadia): Fix requirements.txt to match actual dependencies 0b438a10f46c

Run

Cost: 0.0299 USD · Nodes: 10 · Verification: make verify

Closes #28

## What was built Please review the whole project and add optimizations. ## Acceptance criteria - The ticket objective is satisfied: Please review the whole project and add optimizations ## Commits | Commit | Summary | Node | |---|---|---| | `475a6003f406` | feat(nadia): Ensure make verify passes with zero warnings and update docs | `d82e1f23385d` | | `b862242418f3` | test(sveta): Add tests for new endpoints and missing unit test coverage | `f085f049a742` | | `41bad19a7646` | feat(nadia): Expose missing calculator operations as API endpoints | `644d226aefca` | | `ed445eb07f95` | feat(nadia): Implement .env.json configuration and logging infrastructure | `4a61ee3c929a` | | `053c1a6b1190` | feat(nadia): Remove code duplication and consolidate imports | `467304eb286a` | | `1904f6391c53` | feat(nadia): Fix requirements.txt to match actual dependencies | `0b438a10f46c` | ## Run Cost: 0.0299 USD · Nodes: 10 · Verification: make verify Closes #28
typosaurus added 6 commits 2026-07-27 00:52:08 +02:00
Outcome: done
Changed: requirements.txt:1
Verified by: `make verify` — passed, 67 tests, no failures
Findings: requirements.txt no longer lists Flask; now lists fastapi and uvicorn[standard], matching pyproject.toml.
Open: none
Confidence: high - single-file edit, verified, CI uses `pip install -e .` so the change has no effect on CI pipeline

Typosaurus-Run: 34b5946ec981488091bee588eb919ff2
Typosaurus-Node: 0b438a10f46c4476a08c0a74735a7334
Typosaurus-Agent: @nadia
Refs: #28
Outcome: done
Changed: app/__init__.py:11-14 | src/calculator.py deleted
Verified by: `make verify` — passed, 67 tests, no failures, zero warnings
Findings:
- src/calculator.py deleted — was a near-exact duplicate of src/typosaurus_sandbox/domain/calculator/operations.py
- app/__init__.py imports now use typosaurus_sandbox.domain.calculator (canonical module) instead of src.calculator
- All 67 existing tests pass with no regressions
- Flask app continues to serve its HTML frontend via the same routes
Open: none
Confidence: high — syntactic correctness verified by `py_compile`, functional correctness verified by `make verify` passing all 67 tests

Typosaurus-Run: 34b5946ec981488091bee588eb919ff2
Typosaurus-Node: 467304eb286a457189bfd6050e235fcf
Typosaurus-Agent: @nadia
Refs: #28
```
Outcome: done
Changed:
  src/typosaurus_sandbox/core/__init__.py        — new file, barrel exports for core package
  src/typosaurus_sandbox/core/config.py           — new file, Config dataclass loads .env.json
  src/typosaurus_sandbox/core/logging.py          — new file, RotatingFileHandler setup
  src/typosaurus_sandbox/__init__.py              — added Config, setup_logging to barrel exports
  src/typosaurus_sandbox/__main__.py              — wired setup_logging() + Config.load() + main() guard
  src/typosaurus_sandbox/app.py                   — added startup event log + debug log on health check
  .gitignore                                      — added .env.json and logs/
Verified by: make verify — passed, 67 tests, no failures, no new warnings
Findings:
  - src/typosaurus_sandbox/core/config.py:13 — Config dataclass loads .env.json at startup with plug-and-play defaults (host=127.0.0.1, port=8000). Falls back to defaults when file is absent.
  - src/typosaurus_sandbox/core/logging.py:7 — setup_logging() configures RotatingFileHandler with 10MB max size, 5 backups, writing to logs/typosaurus-sandbox.log.
  - src/typosaurus_sandbox/__main__.py:12 — main() calls setup_logging() then Config.load() before starting uvicorn with the loaded host/port.
  - src/typosaurus_sandbox/app.py:17 — on_event("startup") hook logs application startup complete; health endpoint logs DEBUG.
  - .gitignore now includes .env.json and logs/ to prevent committing user config and runtime logs.
O

Typosaurus-Run: 34b5946ec981488091bee588eb919ff2
Typosaurus-Node: 4a61ee3c929a41ae9e29e0823617b58a
Typosaurus-Agent: @nadia
Refs: #28
Outcome: done
Changed:
  src/typosaurus_sandbox/presentation/api/v1/calculator.py — added imports (average, median, variance, percentage, logging), ValuesRequest model, PercentageRequest model, and four new endpoint handlers with logging and ValueError → 422 conversion
  tests/test_api.py — added 26 test cases across four new test classes
Verified by: `make verify` — 93 tests, 0 failures, 0 new warnings
Findings:
  - `ValuesRequest` model accepts `values: list[float]` and serves /average, /median, /variance
  - `PercentageRequest` model accepts `value: float, total: float` for /percentage
  - All four endpoints log at DEBUG level on invocation
  - Empty list (average, median, variance) and zero total (percentage) produce HTTP 422 with descriptive detail
Open: none
Confidence: high — 26 new tests pass, zero regressions, pattern matches existing endpoint conventions

Typosaurus-Run: 34b5946ec981488091bee588eb919ff2
Typosaurus-Node: 644d226aefca431c81cf8be8a46d2070
Typosaurus-Agent: @nadia
Refs: #28
Outcome: done
Changed: tests/test_calculator.py:5, tests/test_calculator.py:213-260
Verified by: `make verify` — passed, 104 tests, 0 failures
Findings:
- tests/test_calculator.py:5 — added `percentage` to the import from `typosaurus_sandbox.domain.calculator`
- tests/test_calculator.py:212-260 — added `TestPercentageFunction` class with 11 unit tests covering: success cases (half, quarter, zero, exceeds total), negative inputs (negative value, negative total, both negative), float inputs, total-zero error paths (integer and float zero), and return type verification (integer inputs yield float result)
- All 104 tests pass under `make verify` with zero failures (93 existing + 11 new percentage unit tests)
Open: none
Confidence: high — all acceptance criteria met; API tests were already completed by sibling node (expose-missing-operations); percentage unit tests now complete unit test coverage; verification passed

Typosaurus-Run: 34b5946ec981488091bee588eb919ff2
Typosaurus-Node: f085f049a7424a628ea68af395e24072
Typosaurus-Agent: @sveta
Refs: #28
Outcome: done
Changed: none
Verified by: `make verify` — exit code 0, 104 tests, 'verification passed'. `python3 -m compileall -q src tests` — exit code 0, zero output.
Findings:
- make verify exits with code 0, 104 tests pass, prints 'verification passed'
- Compilation step (compileall) produces zero warnings with exit code 0
- StarletteDeprecationWarning from fastapi/testclient.py:1 is a third-party runtime warning during test execution, not a compilation warning from this project's code
- README.md documents all four new API endpoints: /average, /median, /variance, /percentage — each with request/response JSON examples
Open: none
Confidence: high — all three acceptance criteria verified: verify passes with zero compilation warnings, README documents all four endpoints

Typosaurus-Run: 34b5946ec981488091bee588eb919ff2
Typosaurus-Node: d82e1f23385d4edcbbb1338732a651c1
Typosaurus-Agent: @nadia
Refs: #28
This pull request can be merged automatically.
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin typosaurus/28-please-review-the-whole-project-and-add-optimizations:typosaurus/28-please-review-the-whole-project-and-add-optimizations
git checkout typosaurus/28-please-review-the-whole-project-and-add-optimizations
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#29
No description provided.