Skip to content

Conversation

@simonvanlierde
Copy link
Contributor

@simonvanlierde simonvanlierde commented Nov 8, 2025

  • Backend:
    • Fixed backup scripts
    • Move to mjml email templates and fastapi-mail over custom smtp setup
    • Using Redis for disposable email checking cache, can use later for session mgmt
    • Fixed pydantic 2.12 compatibility issues
    • Add order_by in products endpoint
    • Linting and other small fixes
  • Frontend
    • Fix registration flow
    • Remove redundant hardcoded data (products.json, data.json)
    • Fix issue where product cannot be saved even on valid product
    • Add tooltip on save button showing validation issues

Copilot AI review requested due to automatic review settings November 8, 2025 10:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces significant infrastructure improvements and refactoring across the ReLab application stack:

Purpose: Add Redis caching support, improve email handling with MJML templates, enhance validation, update dependencies, and refactor database models for Pydantic 2.12+ compatibility.

Key Changes:

  • Infrastructure: Added Redis cache service with health checks and persistence
  • Email System: Migrated from plain text to MJML-compiled HTML templates with FastAPI-Mail integration
  • Dependencies: Updated Expo/Metro/React ecosystem, upgraded Pydantic constraints, added Redis/MJML libraries
  • Database: Fixed SQLModel relationship issues for Pydantic 2.12+ compatibility
  • Validation: Improved frontend user/product validation with better error messages

Reviewed Changes

Copilot reviewed 87 out of 92 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
renovate.json Formatting changes and added :preserveSemverRanges preset
frontend-web/package.json Updated expo-image from ~2.3.0 to ~2.4.0
frontend-web/package-lock.json Dependency updates for Expo/Metro ecosystem and peer dependencies
frontend-app/package.json Updated expo from 54.0.13 to 54.0.15
frontend-app/package-lock.json Updated Expo dependencies and added yaml package
frontend-app/src/services/api/validation/*.ts New validation utilities with structured error messages
frontend-app/src/components/product/ProductComponents.tsx Updated to use new validation functions
frontend-app/src/app/products/[id]/index.tsx Added tooltip for validation errors and useMemo
frontend-app/src/app/(auth)/new-account.tsx Complete refactor with real-time validation and improved UX
compose.yml Added Redis service with health checks and updated image digests
compose.prod.yml Added cache volume persistence and updated backup compression
compose.override.yml Exposed Redis port 6379 for development
backend/pyproject.toml Added Redis, FastAPI-Mail, MJML; upgraded Pydantic/SQLModel
backend/app/core/config.py Added Redis settings and converted passwords to SecretStr
backend/app/core/redis.py New Redis connection management with graceful degradation
backend/app/main.py Added lifespan manager for Redis and email checker initialization
backend/app/templates/emails/src/*.mjml New MJML email templates for all email types
backend/app/templates/emails/build/*.html Compiled HTML email templates
backend/tests/conftest.py Added email testing fixtures and mock utilities
backend/tests/tests/emails/*.py New comprehensive email tests
backend/scripts/seed/migrations_entrypoint.sh Improved environment variable handling with lowercase helper
backend/scripts/create_superuser.py Fixed to use SecretStr.get_secret_value()
backend/scripts/compile_email_templates.py New script to compile MJML templates
backend/scripts/backup/*.sh New backup scripts for PostgreSQL and user uploads with rsync/rclone support
backend/app/api/*/models.py Added explicit relationship kwargs for Pydantic 2.12+ compatibility
Files not reviewed (2)
  • frontend-app/package-lock.json: Language not supported
  • frontend-web/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 87 out of 92 changed files in this pull request and generated 2 comments.

Files not reviewed (2)
  • frontend-app/package-lock.json: Language not supported
  • frontend-web/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 87 out of 92 changed files in this pull request and generated 3 comments.

Files not reviewed (2)
  • frontend-app/package-lock.json: Language not supported
  • frontend-web/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@simonvanlierde
Copy link
Contributor Author

simonvanlierde commented Nov 17, 2025

@mrvisscher I just added a basic circularity_properties model (7e614f5), I think we can start with implementing this in the frontend.

- Add CircularityPropertiesBase and CircularityProperties database models
  with fields for recyclability, repairability, and remanufacturability
- Each property has observation (required), comment (optional), and
  reference (optional) fields
- Add one-to-one relationship between Product and CircularityProperties
- Create full CRUD operations for circularity properties
- Add REST API endpoints (GET, POST, PATCH, DELETE) for managing
  circularity properties
- Update product schemas to support circularity_properties in
  create/read/update operations
- Update API documentation and examples to include circularity properties
- Add alembic migration script for new circularity properties model
except RequestError as e:
# Network-level errors (DNS, connection refused, timeouts).
logger = logging.getLogger(__name__)
logger.warning("Network error contacting camera %s%s: %s", camera.url, endpoint, e)

Check failure

Code scanning / CodeQL

Log Injection High

This log entry depends on a
user-provided value
.

Copilot Autofix

AI 24 days ago

To fix the log injection vulnerability, we must ensure any user-provided input logged is sanitized. For text logs, this typically involves stripping line breaks and carriage returns from the logged representation. Thus, in utils.py inside fetch_from_camera_url, before logging the network error with the endpoint, we should sanitize endpoint by removing or replacing newline (\n) and carriage return (\r) characters. The fix requires changing line 80 so that the logged value for endpoint contains only a single line—i.e., replacing \r and \n with empty strings. We do this inline before logging. Only code inside backend/app/api/plugins/rpi_cam/routers/camera_interaction/utils.py needs to be updated, on line 80 of the function.


Suggested changeset 1
backend/app/api/plugins/rpi_cam/routers/camera_interaction/utils.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/backend/app/api/plugins/rpi_cam/routers/camera_interaction/utils.py b/backend/app/api/plugins/rpi_cam/routers/camera_interaction/utils.py
--- a/backend/app/api/plugins/rpi_cam/routers/camera_interaction/utils.py
+++ b/backend/app/api/plugins/rpi_cam/routers/camera_interaction/utils.py
@@ -77,7 +77,8 @@
         except RequestError as e:
             # Network-level errors (DNS, connection refused, timeouts).
             logger = logging.getLogger(__name__)
-            logger.warning("Network error contacting camera %s%s: %s", camera.url, endpoint, e)
+            safe_endpoint = endpoint.replace("\r", "").replace("\n", "")
+            logger.warning("Network error contacting camera %s%s: %s", camera.url, safe_endpoint, e)
             raise HTTPException(
                 status_code=503,
                 detail={
EOF
@@ -77,7 +77,8 @@
except RequestError as e:
# Network-level errors (DNS, connection refused, timeouts).
logger = logging.getLogger(__name__)
logger.warning("Network error contacting camera %s%s: %s", camera.url, endpoint, e)
safe_endpoint = endpoint.replace("\r", "").replace("\n", "")
logger.warning("Network error contacting camera %s%s: %s", camera.url, safe_endpoint, e)
raise HTTPException(
status_code=503,
detail={
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants