Commit Graph

15 Commits

Author SHA1 Message Date
Oleksandr Bezdieniezhnykh 834f846dc8 [AZ-180] Enhance setup and improve inference logging
- Added a new Cython extension for the engine factory to the setup configuration.
- Updated the inference module to include additional logging for video batch processing and annotation callbacks.
- Refactored test cases to standardize the detection endpoint responses and include channel IDs in headers for better event handling.
2026-04-03 05:58:55 +03:00
Oleksandr Bezdieniezhnykh 8baa96978b [AZ-180] Refactor detection event handling and improve SSE support
- Updated the detection image endpoint to require a channel ID for event streaming.
- Introduced a new endpoint for streaming detection events, allowing clients to receive real-time updates.
- Enhanced the internal buffering mechanism for detection events to manage multiple channels.
- Refactored the inference module to support the new event handling structure.

Made-with: Cursor
2026-04-03 02:42:05 +03:00
Oleksandr Bezdieniezhnykh 097811a67b [AZ-178] Fix Critical/High security findings: auth, CVEs, non-root containers, per-job SSE
- Pin all deps; h11==0.16.0 (CVE-2025-43859), python-multipart>=1.3.1 (CVE-2026-28356), PyJWT==2.12.1
- Add HMAC JWT verification (require_auth FastAPI dependency, JWT_SECRET-gated)
- Fix TokenManager._refresh() to use ADMIN_API_URL instead of ANNOTATIONS_URL
- Rename POST /detect → POST /detect/image (image-only, rejects video files)
- Replace global SSE stream with per-job SSE: GET /detect/{media_id} with event replay buffer
- Apply require_auth to all 4 protected endpoints
- Fix on_annotation/on_status closure to use mutable current_id for correct post-upload event routing
- Add non-root appuser to Dockerfile and Dockerfile.gpu
- Add JWT_SECRET to e2e/docker-compose.test.yml and run-tests.sh
- Update all e2e tests and unit tests for new endpoints and HMAC token signing
- 64/64 tests pass

Made-with: Cursor
2026-04-02 06:32:12 +03:00
Oleksandr Bezdieniezhnykh 07c2afb62e [AZ-178] Add real-video streaming test, update e2e tests, mark task done
- Add tests/test_az178_realvideo_streaming.py: integration test that validates
  frame decoding begins while upload is still in progress using a real video fixture
- Add conftest.py: pytest plugin for per-test duration reporting
- Update e2e tests (async_sse, performance, security, streaming_video_upload, video)
  and run-tests.sh for updated test suite
- Move AZ-178 task to done/; add data/ to .gitignore (StreamingBuffer temp files)
- Update autopilot state to step 12 (Security Audit) for new feature cycle

Made-with: Cursor
2026-04-01 05:02:25 +03:00
Oleksandr Bezdieniezhnykh be4cab4fcb [AZ-178] Implement streaming video detection endpoint
- Added `/detect/video` endpoint for true streaming video detection, allowing inference to start as upload bytes arrive.
- Introduced `run_detect_video_stream` method in the inference module to handle video processing from a file-like object.
- Updated media hashing to include a new function for computing hashes directly from files with minimal I/O.
- Enhanced documentation to reflect changes in video processing and API behavior.

Made-with: Cursor
2026-04-01 03:11:43 +03:00
Oleksandr Bezdieniezhnykh 6c24d09eab [AZ-173] [AZ-174] Stream-based detection API and DB-driven AI config
Made-with: Cursor
2026-03-31 06:30:22 +03:00
Oleksandr Bezdieniezhnykh 86b8f076b7 Update health endpoint and refine test documentation
- Modified the health endpoint to return "None" for AI availability when inference is not initialized, improving clarity on system status.
- Enhanced the test documentation to include handling of skipped tests, emphasizing the need for investigation before proceeding.
- Updated test assertions to ensure proper execution order and prevent premature engine initialization.
- Refactored test cases to streamline performance testing and improve readability, removing unnecessary complexity.

These changes aim to enhance the robustness of the health check and improve the overall testing framework.
2026-03-30 01:17:53 +03:00
Oleksandr Bezdieniezhnykh 5a968edcba Update .gitignore and refine documentation for execution environment
- Added Cython generated files to .gitignore to prevent unnecessary tracking.
- Updated paths in `inference.c` and `coreml_engine.c` to reflect the correct virtual environment.
- Revised the execution environment documentation to clarify hardware dependency checks and local execution instructions, ensuring accurate guidance for users.
- Removed outdated Docker suitability checks and streamlined the assessment process for test execution environments.
2026-03-30 00:53:46 +03:00
Oleksandr Bezdieniezhnykh 27f4aceb52 Refactor inference and AI configuration handling
- Updated the `Inference` class to replace the `get_onnx_engine_bytes` method with `download_model`, allowing for dynamic model loading based on a specified filename.
- Modified the `convert_and_upload_model` method to accept `source_bytes` instead of `onnx_engine_bytes`, enhancing flexibility in model conversion.
- Introduced a new property `engine_name` to the `Inference` class for better access to engine details.
- Adjusted the `AIRecognitionConfig` structure to include a new method pointer `from_dict`, improving configuration handling.
- Updated various test cases to reflect changes in model paths and timeout settings, ensuring consistency and reliability in testing.
2026-03-30 00:22:56 +03:00
Oleksandr Bezdieniezhnykh 6269a7485c fix some cython code 2026-03-29 21:18:18 +03:00
Oleksandr Bezdieniezhnykh 5be53739cd Refactor inference engine and task management: Remove obsolete inference engine and ONNX engine files, update inference processing to utilize batch handling, and enhance task management structure in documentation. Adjust paths for task specifications to align with new directory organization. 2026-03-28 01:04:28 +02:00
Oleksandr Bezdieniezhnykh 861d4f083b [AZ-143] [AZ-145] [AZ-148] Implement video, resilience, and resource limit integration tests
Made-with: Cursor
2026-03-23 22:34:14 +02:00
Oleksandr Bezdieniezhnykh a469579882 [AZ-144] [AZ-146] [AZ-147] Implement negative input, performance, and security integration tests
Made-with: Cursor
2026-03-23 22:28:59 +02:00
Oleksandr Bezdieniezhnykh 5418bd7d35 [AZ-139] [AZ-140] [AZ-141] [AZ-142] Implement integration tests for health, single image, tiling, and async SSE
Made-with: Cursor
2026-03-23 22:23:28 +02:00
Oleksandr Bezdieniezhnykh 86d8e7e22d [AZ-137] [AZ-138] Decompose test tasks and scaffold E2E test infrastructure
Made-with: Cursor
2026-03-23 14:07:54 +02:00