Commit graph

11 commits

Author SHA1 Message Date
Brandon Wolfgang
a00b3134a6 test: cover unreachable Ollama service errors
- Verify network-level fetch failures propagate from the generation client
- Assert the original error type and message are preserved
- Restore the global fetch implementation after the test
2026-10-21 21:10:29 -05:00
Brandon Wolfgang
76cc88a1f9 feat: integrate Ollama inference with API and readiness checks
- Add an Ollama client for Qwen3 8B generation with request timeouts and HTTP error handling
- Implement POST /generate with request validation and sanitized failure responses
- Update GET /ready to report Ollama availability and return HTTP 503 when unavailable
- Add unit and integration tests for generation, dependency health, and failure handling
- Document implemented API endpoints, setup instructions, scripts, and remaining planned capabilities in README
2026-10-21 21:05:56 -05:00
Brandon Wolfgang
75bb74f5b3 fix: standardize API responses for unknown routes
- Add a centralized not-found handler returning a consistent 404 response
- Assert the expected error payload for unknown endpoints
2026-10-21 19:58:54 -05:00
Brandon Wolfgang
ca5ca12dba test: reject non-string echo messages
- Verify POST /echo returns HTTP 400 for non-string message values
- Assert invalid request bodies receive the expected generic error response
2026-10-21 19:54:55 -05:00
Brandon Wolfgang
0115190510 fix: sanitize unexpected API error responses
- Add a centralized Fastify error handler with server-side error logging
- Preserve valid 4xx status codes while normalizing other errors to HTTP 500
- Return generic error messages without exposing sensitive internal details
- Add a test endpoint and regression test for unexpected errors
2026-10-21 19:52:54 -05:00
Brandon Wolfgang
c0ca16f166 test: cover echo message length boundaries
- Verify 500-character messages are accepted
- Verify messages exceeding 500 characters are rejected with HTTP 400
- Extract the Zod validation schema to module scope for reuse
2026-10-21 19:36:30 -05:00
Brandon Wolfgang
5546867449 test: add validation tests for POST /echo
- Test successful echo responses for valid messages
- Verify empty messages are rejected with HTTP 400
- Validate request bodies using a Zod schema with a 1–500 character limit
- Return a consistent error response for invalid request bodies
2026-10-21 19:30:31 -05:00
Brandon Wolfgang
21d3da5d20 test: cover unknown API routes 2026-10-21 19:20:57 -05:00
Brandon Wolfgang
ca38e1a30f test: add API endpoint tests with Node.js test runner
- Replace the placeholder test script with tsx --test
- Add tests for GET /health response status and payload
- Add tests for GET /ready response status and dependency status
- Use Fastify injection to test endpoints without opening a network listener
- Close the app after the test suite completes
2026-10-21 19:16:37 -05:00
Brandon Wolfgang
0d09e37af2 refactor: export Fastify app factory for testing
- Extract route and server configuration into an exported buildApp function
- Guard server startup so importing the module does not automatically listen on port 3000
- Preserve health and readiness endpoints and loopback-only binding
- Normalize string literals to double quotes
2026-10-21 17:06:21 -05:00
Brandon Wolfgang
ed9259d35e Initialize local AI platform project 2026-10-21 16:57:52 -05:00