Commit Graph
100 Commits
Author SHA1 Message Date
Lars a5aad0da7e debug: add logging to execute_unified_prompt_stream function
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 18s
Deploy Development / deploy (push) Successful in 51s
Build Test / lint-backend (push) Successful in 0s
2026-04-18 08:34:35 +02:00
Lars ce5b96f373 debug: add module load and function entry logging
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 49s
Build Test / lint-backend (push) Successful in 0s
2026-04-18 08:32:31 +02:00
Lars 11fac3d123 debug: use print and logger.warning for auth debug
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 56s
Build Test / lint-backend (push) Successful in 1s
2026-04-18 08:28:31 +02:00
Lars f0ad900565 debug: add logging to require_auth_flexible
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 14s
Deploy Development / deploy (push) Successful in 59s
Build Test / lint-backend (push) Successful in 1s
2026-04-18 08:24:32 +02:00
Lars 36478863a2 fix: restore prompts.py with correct ASCII quotes (Edit tool introduced smart quotes)
Build Test / pytest-backend (push) Successful in 5s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 52s
Build Test / lint-backend (push) Successful in 0s
2026-04-18 08:22:37 +02:00
Lars ec667a75b6 fix: remove test endpoint with syntax error
Build Test / pytest-backend (push) Failing after 0s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 52s
Build Test / lint-backend (push) Successful in 0s
2026-04-18 08:20:56 +02:00
Lars f864f9894d debug: add POST test endpoint
Build Test / pytest-backend (push) Failing after 1s
Build Test / build-frontend (push) Successful in 21s
Deploy Development / deploy (push) Successful in 56s
Build Test / lint-backend (push) Successful in 0s
2026-04-18 08:16:51 +02:00
Lars 73104a1a4c cleanup: Remove debug logging and test endpoint
Build Test / pytest-backend (push) Successful in 8s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 1m2s
Build Test / lint-backend (push) Successful in 0s
2026-04-18 08:04:00 +02:00
LarsandClaude Sonnet 4.5 d66e68a5df fix: SSE auth with ssetoken query parameter - WORKING
Build Test / pytest-backend (push) Waiting to run
Build Test / build-frontend (push) Waiting to run
Build Test / lint-backend (push) Waiting to run
Deploy Development / deploy (push) Has been cancelled
Root Cause:
- FastAPI cannot use same parameter name in endpoint and dependency
- Query param 'token' conflicted between endpoint and require_auth_flexible
- FastAPI cached dependency signatures at startup

Solution:
- Renamed to 'ssetoken' in require_auth_flexible (backend/auth.py)
- Updated frontend to use ssetoken (frontend/src/utils/api.js)
- Removed debug logging
- Added test endpoint /test-ssetoken

Testing:
✅ Header auth: X-Auth-Token works
✅ Query auth: ?ssetoken=XXX works
✅ SSE streaming: Ready for testing

Note: Required full rebuild, not just restart

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-18 08:03:36 +02:00
LarsandClaude Sonnet 4.5 d2b4f74cd2 fix: Query parameter conflict in require_auth_flexible
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 56s
Build Test / lint-backend (push) Successful in 0s
Root Cause Analysis:
- FastAPI cannot distinguish between endpoint Query params and Dependency Query params
- When endpoint has Query(...), dependency Query(default=None, name='token') is ignored
- Token went to endpoint, not to require_auth_flexible

Solution:
- Renamed internal parameter to auth_token with alias='token'
- Now FastAPI correctly routes ?token=XXX to the dependency
- Uses Query(default=None, alias='token') to maintain API compatibility

Testing:
- Header auth: Works (X-Auth-Token)
- Query auth: Now works (?token=XXX)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-18 07:53:18 +02:00
Lars 1a826973a9 debug: Add logging to require_auth_flexible
Build Test / pytest-backend (push) Successful in 5s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 50s
Build Test / lint-backend (push) Successful in 0s
2026-04-18 07:38:15 +02:00
LarsandClaude Sonnet 4.5 d13e7cda26 fix: execute-stream nutzt require_auth_flexible
Build Test / pytest-backend (push) Successful in 5s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 54s
Build Test / lint-backend (push) Successful in 0s
Backend:
- Ersetzt manuelle Token-Validierung durch Depends(require_auth_flexible)
- Nutzt get_session() mit expires_at Check + profiles JOIN
- Token-Parameter nicht mehr nötig (require_auth_flexible holt ihn)

Root Cause (Live-Logs):
- Request kam an mit Token: 401 Unauthorized
- Manuelle Auth: SELECT profile_id FROM sessions WHERE token = %s
- Fehlte: expires_at Check + profiles JOIN
- require_auth_flexible nutzt vollständige get_session() Logik

Fixes:
- "Connection to server lost" - Token-Validierung funktioniert jetzt

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-18 07:24:49 +02:00
LarsandClaude Sonnet 4.5 ec85d5f5f6 fix: Token-Abfrage in executeUnifiedPromptStream
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 18s
Deploy Development / deploy (push) Successful in 56s
Build Test / lint-backend (push) Successful in 1s
Frontend:
- api.js Zeile 487: localStorage.getItem('token') → getToken()
- Token heißt 'bodytrack_token', nicht 'token'
- SSE-Requests bekamen undefined token → 401 Unauthorized

Root Cause:
- Admin verwendet executeUnifiedPrompt (normaler Request mit Header-Auth)
- Analyse verwendet executeUnifiedPromptStream (SSE mit Token im URL)
- SSE bekam keinen Token wegen falschem localStorage key

Fixes:
- "Connection to server lost" in Analyse-Seite

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-18 07:13:47 +02:00
LarsandClaude Sonnet 4.5 1139b00743 fix: execute-stream POST → GET für EventSource
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 54s
Build Test / lint-backend (push) Successful in 0s
Backend:
- prompts.py: @router.post → @router.get für /execute-stream
- EventSource unterstützt nur GET-Requests
- modules/timeframes nutzen Defaults (SSE kann keine komplexen Params)

Fixes:
- "Connection to server lost" bei Analyse-Ausführung

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-18 07:07:16 +02:00
LarsandClaude Sonnet 4.5 e9712cef23 fix: BASE_URL typo + nginx timeout für Workflows
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 18s
Deploy Development / deploy (push) Successful in 54s
Build Test / lint-backend (push) Successful in 0s
Frontend:
- api.js Zeile 499: BASE_URL → BASE (executePromptStreaming)
- nginx.conf: proxy_read_timeout 300s für lange Workflow-Ausführungen

Fixes:
- "BASE_URL is not defined" Fehler in Analyse-Seite
- 504 Gateway Timeout bei Workflow-Ausführung (>60s)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-18 07:03:48 +02:00
Lars 1220ee54fb feat: Enhance activity session handling and schema retrieval
Build Test / pytest-backend (push) Successful in 9s
Build Test / build-frontend (push) Successful in 15s
Deploy Development / deploy (push) Successful in 59s
Build Test / lint-backend (push) Successful in 1s
- Updated `get_activity_session_logical_unit` to support optional parameters for form training context, allowing for more flexible schema resolution.
- Introduced a new endpoint `/attribute-schema` to fetch activity attribute schemas without an existing session, improving manual data entry capabilities.
- Enhanced the `getActivitySession` API method to accept query parameters for training category and type, facilitating dynamic schema retrieval.
- Updated the frontend `ActivityPage` to utilize the new schema fetching logic, ensuring a smoother user experience when managing activity sessions and metrics.
2026-04-17 21:48:37 +02:00
Lars 92e334dcd2 feat: Enhance Admin Activity Attribute Profiles UI and styling
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 55s
Build Test / lint-backend (push) Successful in 1s
- Introduced a new layout for the Admin Activity Attribute Profiles page, improving the user interface with a dedicated class for styling.
- Added new CSS styles for input fields, labels, and layout structures to enhance the visual presentation and usability of the attribute profiles.
- Updated the form structure to include clearer labels and organization for input fields, ensuring better accessibility and user experience.
- Improved responsiveness of the layout for mobile devices, ensuring a consistent experience across different screen sizes.
2026-04-17 20:57:31 +02:00
Lars bc8e9fb7fa feat: Enhance training parameters handling and documentation
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 48s
Build Test / lint-backend (push) Successful in 0s
- Introduced new fields for descriptions in training parameters, improving clarity for AI context in `training_sessions_recent_json`.
- Added a glossary placeholder `{{training_parameters_glossary_md}}` to provide a Markdown table of active training parameters, including names and descriptions.
- Updated the `placeholder_resolver.py` and `activity_metrics.py` to support the new glossary functionality.
- Enhanced the `AdminActivityAttributeProfilesPage` to allow input for descriptions in both German and English, ensuring better context for metrics.
- Revised tests to validate the inclusion of description fields in parameter schema merges and metrics handling.
2026-04-17 20:42:11 +02:00
Lars c3be745efa feat: Enhance activity metrics documentation and registry updates
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 48s
Build Test / lint-backend (push) Successful in 0s
- Added details for Issue #53 regarding the audit of activity placeholders between Layer 1 and Layer 2a in `CLAUDE.md` and `README.md`.
- Updated the `ACTIVITY_SESSION_METRICS_EAV_AGENT_GUIDE.md` to reflect the new registry checks and dynamic session metrics handling.
- Revised the `placeholder_resolver.py` and `activity_metrics.py` to clarify the registration of activity metrics and session insights, ensuring consistency in the handling of dynamic keys and metrics.
- Improved descriptions and semantic contracts in `activity_session_insights.py` to better outline the structure and limitations of session data.
2026-04-17 20:28:58 +02:00
Lars 680ecd1c06 feat: Update activity metrics handling to prioritize legacy columns over EAV
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 50s
Build Test / lint-backend (push) Successful in 0s
- Enhanced the `merge_column_backed_and_eav_metrics` function to ensure that when both legacy columns and EAV values are present, the legacy column takes precedence.
- Revised documentation in `ACTIVITY_PRODUCTION_ARCHITECTURE_AND_PHASES.md` and `ACTIVITY_SCALAR_KANON_TABLE.md` to reflect the new reading logic and clarify the handling of metrics.
- Updated the `activity_data_canon.py` to specify the new merge behavior, ensuring consistency in data retrieval.
- Added unit tests to validate the new logic, confirming that legacy columns are preferred when available.
2026-04-17 15:49:38 +02:00
Lars 38797d687d feat: Enhance export functionality and documentation for activity metrics
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 54s
Build Test / lint-backend (push) Successful in 0s
- Implemented JSON and CSV export features in `routers/exportdata.py`, including enriched session metrics for activity data.
- Updated `CLAUDE.md` to reflect new export capabilities and added details about the inclusion of `session_metrics_json` in the `activity.csv` file.
- Revised `ACTIVITY_PRODUCTION_ARCHITECTURE_AND_PHASES.md` to document the integration of export features and their relationship with session metrics.
- Improved the overall structure and clarity of the documentation to support the new export functionalities.
2026-04-17 13:09:49 +02:00
Lars fa3e66fb31 feat: Update activity documentation and enhance API responses with session metrics
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 18s
Deploy Development / deploy (push) Successful in 51s
Build Test / lint-backend (push) Successful in 0s
- Added new updates for Phase A and Phase B in `CLAUDE.md`, detailing the completion of Phase A and the introduction of enriched session metrics in the API response for `GET /api/activity`.
- Enhanced the README to include references to new documentation files for scalar canon and composite metrics implementation.
- Updated `ACTIVITY_PRODUCTION_ARCHITECTURE_AND_PHASES.md` to reflect the current status of phases and added navigation rules for data access.
- Improved `ACTIVITY_SESSION_METRICS_EAV_AGENT_GUIDE.md` with links to new implementation concepts for composite metrics.
- Refactored the activity router to integrate enriched session metrics into the activity list responses, ensuring a more comprehensive data presentation.
2026-04-17 12:55:12 +02:00
Lars cc0f57758a feat: Implement sorting and categorization for activity profile schema rows
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 47s
Build Test / lint-backend (push) Successful in 0s
- Introduced a new sorting mechanism for activity profile schema rows based on defined categories and UI groups, enhancing the organization of displayed metrics.
- Added constants for training parameter categories and their German labels to improve clarity in the UI.
- Refactored the `SessionMetricsFields` component to utilize the new sorting logic, replacing the previous mapping approach for better maintainability and user experience.
- Ensured that orphan metrics are sorted correctly for consistent display alongside the main metrics.
2026-04-16 13:46:29 +02:00
Lars 2a6c437a08 feat: Introduce activity schema headline binding for improved metrics handling
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 48s
Build Test / lint-backend (push) Successful in 1s
- Added a new function `activitySchemaHeadlineBinding` to streamline the binding of profile parameters to their corresponding headline columns, enhancing clarity in the metrics display logic.
- Refactored the `SessionMetricsFields` component to utilize the new binding function, simplifying the filtering of schema entries and improving maintainability.
- Updated the logic in `ActivityPage` to leverage the binding function for determining the appropriate column for metrics, ensuring consistent data handling across the application.
2026-04-16 13:15:41 +02:00
Lars c9d71c0179 fix: Refine EAV writing logic in session metrics upsert function
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 47s
Build Test / lint-backend (push) Successful in 0s
- Updated the `upsert_session_metrics_from_csv_mapped` function to ensure EAV writes are only skipped when the `source_field` is populated, preventing duplicate storage.
- Enhanced unit tests to cover scenarios where the `source_field` is set but the corresponding column is empty, ensuring correct EAV behavior.
- Adjusted test cases to reflect changes in the handling of `hr_avg` and other metrics, improving overall test coverage and accuracy.
2026-04-16 13:01:32 +02:00
Lars 9d5e16455c refactor: Update session metrics handling to improve EAV logic and filtering
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 55s
Build Test / lint-backend (push) Successful in 0s
- Revised the `upsert_session_metrics_from_csv_mapped` function to clarify EAV writing conditions, ensuring only relevant parameters are processed.
- Enhanced the `merge_column_backed_and_eav_metrics` function to exclude EAV rows for parameters not present in the schema, improving data integrity.
- Updated unit tests to reflect changes in EAV handling and ensure correct functionality when parameters are mapped or not mapped in the profile schema.
- Improved frontend logic to prevent duplicate display of metrics already handled in the entry form, enhancing user experience.
2026-04-16 12:53:14 +02:00
Lars 2a26e4fecf refactor: Remove source field handling from activity session metrics logic
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 54s
Build Test / lint-backend (push) Successful in 0s
- Eliminated checks for `source_field` in the `replace_activity_session_metrics` function to streamline EAV row replacement, ensuring consistency with existing logic.
- Updated frontend logic to simplify the filtering of metrics during payload construction, enhancing maintainability.
- Removed outdated unit tests related to `source_field` handling, reflecting the updated logic in the codebase.
2026-04-16 12:35:55 +02:00
Lars 94bb4a8199 feat: Update activity session metrics handling to skip source field inserts
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 55s
Build Test / lint-backend (push) Successful in 0s
- Modified the `replace_activity_session_metrics` function to skip EAV inserts for parameters with a defined `source_field`, aligning with the existing logic in `upsert_session_metrics_from_csv_mapped`.
- Enhanced the frontend logic to filter out metrics associated with `source_field` during payload construction, improving data integrity and user experience.
- Added unit tests to validate the new behavior, ensuring that metrics with `source_field` are correctly excluded from inserts.
2026-04-16 12:29:01 +02:00
Lars fd7a2dac6d feat: Improve session metrics upsert logic and add unit tests for source field handling
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 53s
Build Test / lint-backend (push) Successful in 0s
- Enhanced the `upsert_session_metrics_from_csv_mapped` function to skip EAV writes when a `source_field` is provided, ensuring canonical handling of activity logs.
- Updated the docstring to clarify the behavior regarding `source_field` and EAV logic.
- Added unit tests to validate the new behavior, ensuring correct functionality when `source_field` is set or not set during CSV imports.
2026-04-16 12:22:44 +02:00
Lars 8d0a6dd487 feat: Refactor activity data handling to use dynamic registry fields
Build Test / pytest-backend (push) Successful in 5s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 54s
Build Test / lint-backend (push) Successful in 0s
- Replaced hardcoded keys in `activity_data_canon.py` with a dynamic retrieval method from the module registry, ensuring that `ACTIVITY_MODULE_REGISTRY_FIELD_KEYS` reflects the current configuration.
- Updated `activity_persistence_orchestrator.py` to utilize the new dynamic field retrieval function, enhancing consistency across the data layer.
- Modified `activity_session_metrics.py` to reference the dynamic field keys, improving maintainability and reducing redundancy in the codebase.
2026-04-16 12:14:39 +02:00
Lars 06f83e2ffc revert: Wiederherstellung Codezustand von ca8cee9 (ohne Branch-Historie zu überschreiben)
Build Test / pytest-backend (push) Successful in 5s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 53s
Build Test / lint-backend (push) Successful in 0s
Reverts cd29c7d..026c51b per git revert. Alle zwischenliegenden Commits bleiben in Gitea sichtbar; der Arbeitsbaum entspricht wieder dem Stand von ca8cee9.

Made-with: Cursor
2026-04-16 11:59:23 +02:00
Lars 026c51b6b5 feat: Add CSV import support for additional training parameters
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 48s
Build Test / lint-backend (push) Successful in 0s
- Introduced `resolve_activity_attribute_schema_for_csv_import` to enhance the handling of training parameters during CSV imports, allowing for the inclusion of active parameters not present in the category/type profile.
- Updated `apply_activity_mapped_column_aliases` and `upsert_session_metrics_from_csv_mapped` to utilize the new CSV import function, ensuring comprehensive mapping and insertion of metrics.
- Added unit tests to validate the new functionality and ensure correct behavior when handling mapped training parameters during CSV imports.
2026-04-16 11:32:16 +02:00
Lars 7d6fdab812 feat: Enhance activity import functionality with additional metrics
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 58s
Build Test / lint-backend (push) Successful in 0s
- Updated the `_import_activity` function to include new metrics: duration_min, kcal_active, kcal_resting, hr_avg, hr_max, and distance_km during CSV imports.
- Modified the `insert_activity_csv_minimal` function to accept and store these additional metrics in the activity log.
- Enhanced the `run_activity_post_write_hooks_import` function to utilize the new metrics for auto-evaluation after activity imports.
- Updated the activity import router to pass the new metrics from the CSV file to the database functions, ensuring comprehensive data handling.
- Improved frontend handling of activity entry forms to accommodate the new metrics, enhancing user experience during activity log edits.
2026-04-16 11:04:43 +02:00
Lars 5cda485458 feat: Refactor activity data handling and improve CSV import logic
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 53s
Build Test / lint-backend (push) Successful in 0s
- Updated `ACTIVITY_PRODUCTION_ARCHITECTURE_AND_PHASES.md` to clarify the derivation of `ACTIVITY_MODULE_REGISTRY_FIELD_KEYS` from `csv_parser.module_registry`.
- Enhanced `activity_data_canon.py` to eliminate hardcoded key lists, ensuring all registry fields are derived dynamically.
- Refactored the `_import_activity` function to remove redundant parameters and streamline the import process.
- Improved the `insert_activity_csv_minimal` function to handle metrics exclusively through `update_activity_columns`, preventing hardcoded values.
- Updated frontend components to manage editable activity log fields more effectively, ensuring proper handling of metrics during CSV imports.
- Added unit tests to validate the new logic and ensure consistency in activity session metrics handling.
2026-04-16 10:35:08 +02:00
Lars cd29c7d433 feat: Enhance activity session metrics handling and CSV import logic
Build Test / pytest-backend (push) Successful in 9s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 51s
Build Test / lint-backend (push) Successful in 0s
- Updated the `ACTIVITY_SESSION_METRICS_EAV_AGENT_GUIDE` with new details on CSV import processes and EAV handling, improving documentation clarity.
- Refactored the `_import_activity` function to utilize `apply_activity_mapped_column_aliases`, ensuring proper mapping of training parameters and reducing redundancy.
- Introduced validation for numeric bounds in the `activity_csv_registry_updates_from_mapped` function, enhancing data integrity during CSV imports.
- Added new utility functions to manage column aliasing and streamline the upsert process for session metrics, preventing duplicate entries.
- Implemented unit tests to validate the new aliasing logic and ensure correct behavior during session metrics updates.
2026-04-16 07:25:39 +02:00
Lars ca8cee990b feat: Enhance activity metrics handling and documentation
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 1m1s
Build Test / lint-backend (push) Successful in 0s
- Updated the README to include new activity production architecture and phases, improving clarity on the development roadmap.
- Enhanced the `ACTIVITY_SESSION_METRICS_EAV_AGENT_GUIDE` with details on the target architecture and phase plan for production readiness.
- Introduced a new function `merge_column_backed_and_eav_metrics` to streamline the merging of metrics from column-backed and EAV sources, ensuring data integrity and reducing duplication.
- Refactored session metrics handling to eliminate deprecated synchronization methods, improving the overall efficiency of data processing.
- Added unit tests for the new merging logic, ensuring robust validation of metrics handling.
2026-04-15 16:59:11 +02:00
Lars 58ddde6b1e feat: Add time input fields for activity log and enhance time handling
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 15s
Deploy Development / deploy (push) Successful in 46s
Build Test / lint-backend (push) Successful in 1s
- Introduced start_time and end_time fields in the activity log entry form, allowing users to input specific times for activities.
- Implemented utility functions to format and validate time inputs from the API and user input, ensuring proper handling of time data.
- Updated the activity display to show formatted start and end times, improving clarity for users reviewing their activity logs.
2026-04-15 11:39:39 +02:00
Lars 08eae86ddc feat: Refactor activity import logic and enhance CSV handling
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 56s
Build Test / lint-backend (push) Successful in 0s
- Replaced the deprecated `resolve_activity_log_column_patch_from_csv` function with `activity_csv_registry_updates_from_mapped` to streamline updates from CSV mappings.
- Updated the `_import_activity` function to utilize the new registry updates, improving data integrity during activity imports.
- Enhanced the activity module registry by adding German labels for various fields, improving localization support.
- Refactored the session metrics handling to ensure only relevant fields are processed, enhancing the overall robustness of CSV imports.
2026-04-15 10:35:48 +02:00
Lars 9d47c4ef84 feat: Update session metrics handling for CSV-mapped values
Build Test / pytest-backend (push) Successful in 5s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 54s
Build Test / lint-backend (push) Successful in 0s
- Enhanced the docstring for `upsert_session_metrics_from_csv_mapped` to clarify the handling of schema parameters and EAV logic.
- Modified the condition for skipping updates based on `source_field` to ensure only patchable columns are processed, improving data integrity during session metrics upsert operations.
2026-04-15 10:28:13 +02:00
Lars e4e8c70cd2 feat: Enhance CSV header normalization and mapping for activity data
Build Test / pytest-backend (push) Successful in 5s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 49s
Build Test / lint-backend (push) Successful in 0s
- Introduced a new utility function `canonical_csv_header_label` to standardize CSV header labels, improving consistency in field mapping.
- Updated the `_lookup_db_field` function to support prefix matching for longer manual keys, enhancing the accuracy of field resolution.
- Added tests to validate handling of non-breaking space characters in CSV headers and ensure correct mapping to normalized keys, improving robustness of CSV parsing.
2026-04-15 10:04:32 +02:00
Lars c570e67a09 feat: Enhance activity session metrics handling and frontend display
Build Test / pytest-backend (push) Successful in 8s
Build Test / build-frontend (push) Successful in 20s
Deploy Development / deploy (push) Successful in 48s
Build Test / lint-backend (push) Successful in 0s
- Updated the `ACTIVITY_LOG_PATCHABLE_COLUMNS` and `ACTIVITY_LOG_PATCH_FORBIDDEN` sets to improve validation of CSV imports, ensuring only allowed fields are patched.
- Refactored the `_coerce_raw_value_for_parameter` function to handle string inputs for integer and float types, enhancing data coercion accuracy.
- Modified the `SessionMetricsFields` component to display orphan metrics that do not match the current schema, improving user visibility of imported data discrepancies.
- Enhanced the frontend to handle and display additional metrics, ensuring a more comprehensive representation of session data.
2026-04-15 08:55:43 +02:00
Lars 574af61349 feat: Enhance CSV import and validation for activity module
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 47s
Build Test / lint-backend (push) Successful in 0s
- Updated the CSV import logic to merge active training parameters with static fields for the activity module, improving field mapping accuracy.
- Enhanced validation functions to incorporate dynamic field definitions based on active training parameters, ensuring better data integrity during imports.
- Refactored related functions to streamline the process of handling CSV templates and field mappings, improving maintainability and clarity.
- Added new utility functions for resolving activity log column patches and upserting session metrics from CSV, enhancing the overall import functionality.
2026-04-15 08:12:58 +02:00
Lars 934b915357 First Version EAV Importer. feat: Enhance activity detail retrieval with EAV metrics and refactor activity import logic
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 53s
Build Test / lint-backend (push) Successful in 0s
- Updated the `get_activity_detail` function to include session metrics in the activity detail output, allowing for enriched data representation.
- Refactored the activity import logic to streamline the process of inserting and updating activity records, utilizing new helper functions for better maintainability.
- Improved the handling of duplicate activity entries by implementing a more robust identification mechanism.
- Enhanced the metadata for activity detail registration to reflect the inclusion of EAV metrics and updated source tables.
2026-04-15 07:25:39 +02:00
Lars c6e8371d5a feat: Implement session deduplication in activity listing
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 49s
Build Test / lint-backend (push) Successful in 0s
- Added a new query parameter `collapseDuplicateSessions` to the activity listing endpoint to enable deduplication of sessions based on date, type, start time, duration, and calories.
- Enhanced backend logic to handle deduplication and return the most recent entry for duplicate sessions.
- Updated frontend to support the new deduplication feature, improving the clarity of displayed activity data.
- Modified API utility to include the new parameter in requests for activity data.
2026-04-14 16:19:34 +02:00
Lars f718785145 feat: Add monthly activity fetching and improve activity listing
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 47s
Build Test / lint-backend (push) Successful in 0s
- Introduced a new query parameter for the activity listing endpoint to fetch entries by calendar month (format: YYYY-MM), excluding days and offset.
- Implemented backend validation for the month parameter to ensure correct format and range.
- Enhanced the frontend to support month selection, allowing users to load activities for specific months and dynamically update the displayed entries.
- Improved the user interface to show the selected month and the range of loaded months, enhancing user experience.
2026-04-14 14:34:10 +02:00
Lars 9fdb02ff8b feat: Refactor activity session metrics handling and enhance activity listing
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 51s
Build Test / lint-backend (push) Successful in 0s
- Updated the `replace_activity_session_metrics` function to improve validation logic and error handling for required fields.
- Enhanced the activity listing query to order results by date, start time, and ID, ensuring consistent output.
- Modified the frontend to handle null values in metrics payload and improved the display of activity statistics, including total entries in profile and sample size.
2026-04-14 14:25:17 +02:00
Lars 1f51c32521 feat: Enhance activity listing and statistics retrieval with pagination and quality filter options
Build Test / pytest-backend (push) Successful in 5s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 48s
Build Test / lint-backend (push) Successful in 0s
- Added pagination support to the activity listing endpoint with `limit` and `offset` parameters.
- Introduced a `skip_quality_filter` option to allow retrieval of all entries without applying the quality filter.
- Updated the frontend to implement dynamic loading of activity entries and statistics without the quality filter.
- Improved user experience with a "Load More" button for fetching additional entries on the ActivityPage.
2026-04-14 14:11:01 +02:00
Lars 766b64cd64 feat: Expand ActivityEntry model and enhance activity log handling
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 53s
Build Test / lint-backend (push) Successful in 0s
- Added new fields to the ActivityEntry model for improved tracking: hr_min, pace_min_per_km, cadence, avg_power, elevation_gain, temperature_celsius, humidity_percent, avg_hr_percent, and kcal_per_km.
- Updated the create_activity function to accommodate the new fields in the activity log.
- Modified session metrics handling to ensure accurate data retrieval and merging based on the updated schema.
2026-04-14 12:59:47 +02:00
Lars 3296dfca28 feat: Enhance activity log handling and session metrics synchronization
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 18s
Deploy Development / deploy (push) Successful in 53s
Build Test / lint-backend (push) Successful in 0s
- Added a new function to synchronize session metrics with activity log entries, ensuring data consistency.
- Updated the create and update activity endpoints to call the synchronization function after inserting or modifying activity logs.
- Introduced a set of allowed keys for activity log payloads to streamline data handling in the frontend.
- Improved data coercion logic for various data types in the frontend to ensure accurate data submission.
2026-04-14 12:53:35 +02:00
Lars db9952525a feat: Add endpoints for activity statistics and uncategorized activities
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 48s
Build Test / lint-backend (push) Successful in 0s
- Implemented a new endpoint to retrieve activity statistics for the last 30 entries, including total calories and duration by activity type.
- Added an endpoint to list activities without assigned training types, grouped by activity type.
- Removed deprecated versions of the statistics and uncategorized activities endpoints for cleaner code.
2026-04-14 12:32:38 +02:00
Lars 196b6c5cf1 feat: Add update functionality for training category and type parameters
Build Test / pytest-backend (push) Successful in 8s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 50s
Build Test / lint-backend (push) Successful in 0s
- Introduced new endpoints for updating training category and type parameters in the backend.
- Added corresponding update functions in the frontend API utility.
- Enhanced the Admin Activity Attribute Profiles page to support editing and saving changes for category and type parameters.
- Implemented state management for editing parameters and improved error handling during updates.
2026-04-14 12:26:52 +02:00
Lars cf7379b2f6 feat: Implement Activity Attribute Profiles and session metrics editing
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 55s
Build Test / lint-backend (push) Successful in 1s
- Added new Admin UI for managing Activity Attribute Profiles.
- Enhanced ActivityPage to support dynamic loading and editing of session metrics.
- Updated API utility functions to handle new endpoints for training parameters and metrics.
- Improved form handling for session metrics, including validation and error management.
- Updated documentation to reflect new features and changes in session metrics handling.
2026-04-14 11:56:16 +02:00
Lars 48508c164e feat: Add Activity Session Metrics functionality
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 59s
Build Test / lint-backend (push) Successful in 0s
- Introduced Activity Session Metrics for enhanced tracking of session data.
- Updated backend to support new API endpoints for managing session metrics.
- Added new Pydantic models for activity metrics and replaced metrics functionality.
- Enhanced data layer to include session metrics in recent training session data.
- Updated documentation to reflect changes in session metrics handling.
2026-04-14 11:49:14 +02:00
Lars 1b01f5e6d0 feat: Enhance goal progress tracking and display
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 55s
Build Test / lint-backend (push) Successful in 0s
- Added a function to calculate goal progress percentage based on start, target, and current values.
- Updated GoalsPage to display progress in a user-friendly format, including visual progress bars.
- Implemented error handling for goal progress updates in the backend to ensure robustness.
2026-04-14 10:43:49 +02:00
Lars df8e732709 fix: Use correct field 'label' instead of 'name' for node display
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 56s
Build Test / lint-backend (push) Successful in 0s
- Frontend saves node name as 'label' (workflowSerializer.js:19)
- Changed WorkflowNode.name to WorkflowNode.label
- Changed node.name to node.label in workflow_executor.py
- Priority: node.label > prompt_slug > node_type-id
- Verified against frontend serialization code
2026-04-13 18:09:12 +02:00
Lars d5325acee6 fix: Use node.name in node_label calculation (minimal change)
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 56s
Build Test / lint-backend (push) Successful in 0s
- Add name field to WorkflowNode model
- Extend node_label priority: node.name > prompt_slug > node_type-id
- No new fields in NodeExecutionState (uses existing debug_prompt_slug)
- Simpler approach than previous attempt to avoid 504 timeout
2026-04-13 18:03:02 +02:00
Lars b7062d32bf Revert "feat: Show node.name from workflow editor in debug panel"
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 55s
Build Test / lint-backend (push) Successful in 0s
This reverts commit 5fa2ea2e6b.
2026-04-13 15:54:22 +02:00
Lars 5fa2ea2e6b feat: Show node.name from workflow editor in debug panel
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 54s
Build Test / lint-backend (push) Successful in 1s
- Add name field to WorkflowNode model
- Add node_name field to NodeExecutionState
- Set node_name in execute_workflow from node.name
- Display priority: node_name > debug_prompt_slug > node_label > node_id

User sees 'Qualitätseinschätzung' instead of 'node_abc123'
2026-04-13 15:43:42 +02:00
Lars f97d15288d fix: Show debug_prompt_slug instead of node_id
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 47s
Build Test / lint-backend (push) Successful in 0s
Priority: debug_prompt_slug > node_label > node_type-shortid > node_id
2026-04-13 15:36:50 +02:00
Lars 736dc58d81 feat: Show debug info in WorkflowResultViewer
Build Test / pytest-backend (push) Successful in 8s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 59s
Build Test / lint-backend (push) Successful in 1s
Display per node:
- debug_prompt (prompt sent to AI)
- debug_raw_response (raw AI response)
- analysis_core (parsed results)
- normalized_signals (decision signals with status)
- Failed nodes: red border + red background

NO other changes - executeWorkflow still used
2026-04-13 15:31:37 +02:00
Lars 0a27533262 feat: Highlight failed nodes in WorkflowDebugPanel
Build Test / build-frontend (push) Waiting to run
Build Test / pytest-backend (push) Has been cancelled
Build Test / lint-backend (push) Waiting to run
Deploy Development / deploy (push) Successful in 54s
- Failed nodes now have:
  - Red border (2px instead of 1px)
  - Light red background (#D85A3010)
  - Red shadow/glow effect

Makes it immediately obvious which nodes had errors.
2026-04-13 12:58:25 +02:00
Lars 7388776b29 fix: Add human-readable labels to workflow nodes in debug output
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 53s
Build Test / lint-backend (push) Successful in 0s
- workflow_executor.py: Store prompt_slug or generated label in debug_prompt_slug for all nodes
  - This makes it easy to identify nodes in the debug panel
  - Example: 'wf_nutrition_basis' instead of 'node_5'

- Helps identify which node is which when debugging workflows
2026-04-13 12:52:29 +02:00
Lars a515a5d563 feat: Add WorkflowDebugPanel component to display per-node debug information
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 56s
Build Test / lint-backend (push) Successful in 0s
- Created WorkflowDebugPanel.jsx: Collapsible panel showing debug info for each workflow node
  - Shows prompt sent to AI
  - Shows raw AI response
  - Shows parsed results
  - Shows normalized signals
  - Color-coded status (executed/failed/skipped)
  - Expandable/collapsible per node

- Updated Analysis.jsx:
  - Added WorkflowDebugPanel import
  - Store node_states in newResult for debugging
  - Display WorkflowDebugPanel below InsightCard (both locations)

This makes it easy to debug workflow issues by seeing exactly what happened at each node.
2026-04-13 12:41:12 +02:00
Lars 12d4d7c63b feat: Add comprehensive debug information for workflow nodes
Build Test / pytest-backend (push) Successful in 8s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 55s
Build Test / lint-backend (push) Successful in 0s
Backend changes:
- workflow_models.py: Add debug_prompt, debug_raw_response, debug_node_type, debug_prompt_slug, metadata fields to NodeExecutionState
- workflow_executor.py: Capture and store debug info for analysis, logic, and join nodes when enable_debug=True
  - Analysis nodes: store full prompt + raw AI response
  - Logic nodes: store expression + evaluation result
  - Join nodes: store strategy + path statistics

Frontend changes:
- Analysis.jsx: Enable debug mode by default (debug=true) for all workflow executions

This allows developers to see exactly what prompt was sent to the AI, what response was received, and how each node was processed - essential for debugging workflow issues.
2026-04-13 12:38:55 +02:00
Lars 3664f53c51 fix: Use NodeStatus.EXECUTED instead of COMPLETED
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 15s
Deploy Development / deploy (push) Successful in 53s
Build Test / lint-backend (push) Successful in 0s
NodeStatus enum has EXECUTED, not COMPLETED. Fixed in workflow_executor.py progress callback.
2026-04-13 11:49:31 +02:00
Lars fb2e0803c0 fix: SSE streaming - WorkflowNode label attribute and ai_insights column name
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 52s
Build Test / lint-backend (push) Successful in 0s
- workflow_executor.py: Generate node_label from prompt_slug or node.type (WorkflowNode has no label attribute)
- prompts.py: Fix INSERT statement - use 'created' column instead of 'created_at'

SSE endpoint now works correctly for workflow execution streaming.
2026-04-13 11:47:31 +02:00
Lars bb01283727 fix: Correct except/finally indentation in SSE endpoint
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 46s
Build Test / lint-backend (push) Successful in 0s
2026-04-13 11:41:56 +02:00
Lars bc60b9f5c9 fix: Correct indentation in SSE execute_workflow_async function
Build Test / pytest-backend (push) Failing after 1s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 49s
Build Test / lint-backend (push) Successful in 0s
2026-04-13 11:27:44 +02:00
Lars fbeabcde97 fix: IndentationError in prompts.py SSE endpoint
Build Test / pytest-backend (push) Failing after 1s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 52s
Build Test / lint-backend (push) Successful in 1s
2026-04-13 11:25:34 +02:00
LarsandClaude Sonnet 4.5 ba474b0a57 feat: Implement Server-Sent Events (SSE) for long-running workflows
Build Test / pytest-backend (push) Failing after 1s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 54s
Build Test / lint-backend (push) Successful in 0s
Backend:
- workflow_executor.py: Add progress_callback parameter, emit events for execution_started, node_complete, execution_complete, execution_failed
- prompt_executor.py: Thread progress_callback through execute chain
- routers/prompts.py: New /execute-stream endpoint with asyncio Queue for SSE

Frontend:
- utils/api.js: New executeUnifiedPromptStream() function with EventSource
- pages/Analysis.jsx: Use SSE with live progress display (X/Y Nodes)

Fixes:
- No more gateway timeouts for complex workflows (10+ nodes)
- Live progress feedback for users
- Unlimited workflow complexity

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-13 11:23:16 +02:00
LarsandClaude Opus 4.6 790e6df8ef fix: Make debug parameter work as Query parameter in /api/prompts/execute
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 49s
Build Test / lint-backend (push) Successful in 1s
Bug: debug=true in URL was ignored because FastAPI expected it in
request body (POST without Query() expects body params by default).

Result: node_states were never returned, even with ?debug=true

Fix: Changed debug and save to Query parameters:
- debug: bool = Query(False, ...)
- save: bool = Query(False, ...)

Now ?debug=true in URL correctly enables debug output with node_states.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 09:14:30 +02:00
LarsandClaude Opus 4.6 057df0afc8 fix: Support UI-format edge routing with sourceHandle
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 24s
Deploy Development / deploy (push) Successful in 52s
Build Test / lint-backend (push) Successful in 0s
Logic-Nodes evaluated correctly but activated_edges was empty because
_get_edges_by_label() only checked e.label, which is null in UI format.

UI format uses:
- sourceHandle: "true" / "false" (instead of label: "then" / "else")
- targetHandle: "in" / "path_1" / etc.

Changes:
1. Added source_handle/target_handle fields to WorkflowEdge model
   - With aliases sourceHandle/targetHandle for camelCase JSON
2. Updated _get_edges_by_label() to check both formats:
   - Legacy: e.label == "then" / "else"
   - UI: e.source_handle == "true" / "false"

Now Logic-Nodes correctly activate outgoing edges → Join-Node receives
completed paths → End-Node executes → Workflow completes!

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 09:07:50 +02:00
LarsandClaude Opus 4.6 ba04e0c0b6 fix: Add extra='forbid' to Condition for proper Union resolution
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 15s
Deploy Development / deploy (push) Successful in 55s
Build Test / lint-backend (push) Successful in 0s
Critical fix: Without extra='forbid', Pydantic accepted UI format
{operator: "and", operands: [...]} as valid Condition by ignoring
unknown fields, resulting in Condition(expression=None).

With extra='forbid':
- Condition rejects unknown fields → fails
- Union tries next type → LogicExpression → success

Test Results (9/9 passed):
- Simple comparisons (eq, neq, gt, lt, in) ✅
- AND/OR combinations ✅
- Deep nesting (3+ levels) ✅
- NOT operator ✅
- All operators (eq, neq, in, not_in, gt, lt, gte, lte, and, or, not) ✅
- Legacy format (Condition wrapper) ✅
- Complex real-world scenarios ✅

Added comprehensive test suite in:
- test_condition_parsing.py (9 test cases)
- test_condition_union.py (Union resolution verification)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 09:01:53 +02:00
LarsandClaude Opus 4.6 f5ce1ec941 refactor: Proper type-safe condition handling with Union types
Build Test / pytest-backend (push) Successful in 5s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 52s
Build Test / lint-backend (push) Successful in 0s
Previous fix used Any type, breaking type safety and only handling
simple cases. This is the correct implementation:

Changes:
1. LogicExpression.operands: List[Any] → List['LogicExpression']
   - Enables recursive/nested expressions
   - Proper type checking for all operator combinations

2. WorkflowNode.condition: Any → Union[LogicExpression, Condition]
   - Type-safe deserialization
   - Supports both UI format (direct LogicExpression) and legacy (Condition wrapper)
   - Pydantic automatically tries LogicExpression first, then Condition

3. Executor: Simplified with isinstance() checks
   - Clean type detection without dict manipulation
   - Fallback for edge cases

This now correctly handles:
- Simple conditions: {operator: "eq", ref: "...", value: "..."}
- Combined: {operator: "and", operands: [...]}
- Nested: {operator: "or", operands: [{operator: "and", ...}, ...]}
- All operators: eq, neq, in, not_in, gt, lt, gte, lte, contains, and, or, not
- Legacy format: {expression: {...}, then_path: "...", else_path: "..."}

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 08:45:55 +02:00
LarsandClaude Opus 4.6 2deb6510f8 fix: Support UI-format LogicExpression in Logic-Node condition field
Build Test / pytest-backend (push) Successful in 13s
Build Test / build-frontend (push) Successful in 15s
Deploy Development / deploy (push) Successful in 48s
Build Test / lint-backend (push) Successful in 0s
Root cause: UI saves LogicExpression directly as condition:
  {operands: [...], operator: "and"}

But Pydantic model expected Condition with wrapped expression:
  {expression: {operands: [...], operator: "and"}}

Result: Pydantic deserialized it as Condition with expression=None
→ Logic-Nodes failed with "'NoneType' object has no attribute 'operator'"

Fix:
1. Changed WorkflowNode.condition type from Condition to Any
2. Executor now handles both dict and Pydantic model formats
3. Detects UI format (operator+operands) vs legacy format (expression wrapper)
4. Converts dict to LogicExpression before evaluation

Fixes: Logic-Node execution failures in Training-Tiefenanalyse workflow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 08:40:43 +02:00
LarsandClaude Opus 4.6 0eac40abf6 fix: Add None-check for Logic-Node condition/expression
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 51s
Build Test / lint-backend (push) Successful in 0s
Previous fix handled hasattr() but didn't check for None values.
Now explicitly checks that operator/expression is not None before using it.

Error was: "'NoneType' object has no attribute 'operator'"

Clearer error message: "condition is None or missing"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 08:32:54 +02:00
LarsandClaude Opus 4.6 e915d3fb13 fix: Support both Logic-Node condition serialization formats
Build Test / pytest-backend (push) Successful in 5s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 54s
Build Test / lint-backend (push) Successful in 0s
Logic-Nodes were timing out because UI saves condition as:
  {operands: [...], operator: "and"}

But Backend expected:
  {expression: {operands: [...], operator: "and"}}

This caused node.condition.expression to be None, triggering:
- Logic-Node failures
- Join-Node wait_all timeout
- 504 Gateway Timeout

Fix: Accept both formats by checking for operator/operands attributes
directly on condition, falling back to condition.expression.

Fixes: 504 Gateway Timeout in Training-Tiefenanalyse workflow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 08:26:43 +02:00
Lars 60f6cf3c6d fix: Add null check for logic node expression to prevent AttributeError
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 58s
Build Test / lint-backend (push) Successful in 0s
Problem: Logic nodes without logic_expression defined caused AttributeError
"'NoneType' object has no attribute 'operator'" when evaluating condition.

Solution: Check both node.condition AND node.condition.expression before
calling evaluate_logic_expression(). Return clear FAILED state with error
message instead of crashing.

Impact: Workflows with incomplete logic node definitions now fail gracefully
with clear error message instead of cryptic AttributeError.
2026-04-13 08:16:06 +02:00
Lars e09cbc112e fix: Preserve case in question IDs during parsing
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 55s
Build Test / lint-backend (push) Successful in 0s
Problem: Parser converted question IDs to lowercase ('qAnalyst' → 'qanalyst'),
causing normalization to fail because id_catalog lookup is case-sensitive.

Impact: All workflow question signals were lost - normalized_signals stayed empty,
so template placeholders like {{node_2.signal_qAnalyst}} remained unresolved.

Solution: Removed .lower() call in parse_decision_questions() to preserve
original case from AI response.

Root cause: Line 162 in result_container_parser.py
Fixes: Question augmentation signals not appearing in workflow end nodes
2026-04-12 14:04:14 +02:00
Lars f6b3182a80 fix: Add wrapper in prompts.py execute endpoint for workflow signature mismatch
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 48s
Build Test / lint-backend (push) Successful in 0s
Problem: Workflows executed via /api/prompts/execute (not /api/workflows/execute)
were passing call_openrouter directly to execute_prompt_with_data, which then
passes it to workflow_executor. workflow_executor expects (prompt, model) signature
but call_openrouter has (prompt, max_tokens=4096) signature.

Previous fix in workflows.py was correct but unused - workflows use prompts.py endpoint.

Solution: Added workflow_llm_call() wrapper in execute_unified_prompt() endpoint
that matches expected (prompt, model) -> str signature.

Related: cb3aa48 (workflows.py fix for different endpoint)
2026-04-12 13:44:08 +02:00
Lars cb3aa48999 fix: Add wrapper function for workflow LLM calls to prevent max_tokens signature mismatch
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 49s
Build Test / lint-backend (push) Successful in 0s
Problem: workflow_executor calls openrouter_call_func(prompt, model) but
call_openrouter expects (prompt, max_tokens=4096). This caused the model string
'anthropic/claude-sonnet-4' to be passed as max_tokens, resulting in OpenRouter
requesting 64000 tokens and failing with 402 credit errors.

Solution: Added workflow_llm_call() wrapper in workflows.py that matches the
expected (prompt, model) -> str signature and calls call_openrouter correctly.

Fixes: All workflows failing with 402 'insufficient credits' errors
2026-04-12 13:37:31 +02:00
LarsandClaude Opus 4.6 77f1ed14c5 fix: Cursor-Problem beim Frage-ID Editieren
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 54s
Build Test / lint-backend (push) Successful in 0s
Problem: Cursor springt nach jedem Tastendruck aus dem ID-Feld

Ursache: key={q.id} in QuestionEditor map
- Wenn ID geändert wird, ändert sich der React Key
- React unmountet alte Component und mountet neue
- Focus geht verloren

Lösung: key={idx} verwenden
- Stabiler Key während Editing
- Komponente bleibt gemountet
- Cursor bleibt im Feld

UX: Jetzt kann man IDs flüssig editieren ohne Unterbrechung

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-12 12:29:52 +02:00
Lars 08c9cccdcc feat: Add expandable collapsible component for improved content display
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 53s
Build Test / lint-backend (push) Successful in 0s
- Introduced `ExpandableCollapsible` component to manage the visibility of lengthy content, allowing users to toggle between expanded and collapsed views.
- Updated `renderTestOutput` to utilize the new component for displaying test results, JSON outputs, and object representations, enhancing user experience by reducing clutter.
- Enhanced `Markdown` component to support fenced code blocks, improving the rendering of code snippets with language labels and better styling.

These changes improve the readability and organization of content within the application, providing users with a more interactive and manageable interface.
2026-04-12 11:10:39 +02:00
Lars 4b6e1bed11 feat: Enhance OpenRouter API interaction and error handling
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 54s
Build Test / lint-backend (push) Successful in 0s
- Increased the maximum token limit in the `call_openrouter` function from 1500 to 4096 to allow for more extensive responses.
- Implemented robust error handling for API requests, including timeout and request errors, with detailed HTTP exceptions for better debugging.
- Improved JSON response handling to ensure valid data is returned, with specific error messages for missing content in the response.
- Enhanced the overall reliability of the OpenRouter API integration, providing clearer feedback for users in case of issues.

These changes improve the user experience by ensuring more comprehensive responses and clearer error reporting during API interactions.
2026-04-12 11:03:07 +02:00
Lars 90a27846ca feat: Improve float parsing logic for enhanced accuracy in numeric conversions
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 56s
Build Test / lint-backend (push) Successful in 0s
- Updated the `_parse_float_auto` function in `type_converter.py` to better handle various decimal and thousand separators, particularly for cases with long decimal parts from sources like Apple Health.
- Enhanced the logic for splitting and processing numeric strings to ensure correct interpretation of values, including edge cases with multiple separators.
- Added handling for cases where numeric strings may contain both commas and periods, improving overall robustness in float parsing.

These changes enhance the accuracy of numeric conversions, ensuring more reliable data processing across the application.
2026-04-12 07:28:24 +02:00
Lars d7cefdd9e9 feat: Update Gitea issues index and enhance data layer metrics
Build Test / pytest-backend (push) Successful in 9s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 1m3s
Build Test / lint-backend (push) Successful in 0s
- Updated the Gitea issues index to reflect the latest state as of 2026-04-11, adding issue #76 to the list.
- Refined data handling in `activity_metrics.py`, `body_metrics.py`, `nutrition_metrics.py`, and `scores.py` to ensure consistent float conversions for calculations, improving accuracy in metric evaluations.
- Enhanced the calculation logic for various metrics to handle potential None values more robustly, ensuring smoother data processing and improved reliability across the application.

These changes improve the clarity of the Gitea issues documentation and enhance the overall accuracy and reliability of health and fitness metrics.
2026-04-11 22:14:45 +02:00
Lars 4868e44882 feat: Refine placeholder resolution with enhanced modifiers support
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 55s
Build Test / lint-backend (push) Successful in 0s
- Updated `resolve_placeholders` in `prompt_executor.py` to support combined modifiers for placeholders, allowing for more flexible output formats.
- Enhanced `build_ai_placeholder_caption` in `placeholder_registry.py` to clarify the generation of AI context captions, focusing on descriptions and explanations.
- Introduced new helper functions in `placeholder_resolver.py` to streamline the retrieval of descriptions and explanations for placeholders.
- Modified tests to cover new functionality, ensuring accurate behavior for combined modifiers and improved placeholder resolution.

These changes enhance the usability and clarity of placeholder outputs, providing users with richer contextual information.
2026-04-11 21:58:29 +02:00
Lars a9a414b956 feat: Enhance placeholder caption generation and formatting
Build Test / pytest-backend (push) Successful in 8s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 54s
Build Test / lint-backend (push) Successful in 0s
- Updated `build_ai_placeholder_caption` in `placeholder_registry.py` to improve the generation of AI context captions by prioritizing descriptions and avoiding redundancy.
- Introduced `format_value_with_d_modifier` in `placeholder_resolver.py` to format values with contextual information, enhancing the clarity of exported placeholder values.
- Modified `export_placeholder_values` in `prompts.py` to utilize the new formatting function, ensuring that exported data includes both raw values and contextual descriptions.
- Added tests for the new formatting function and updated existing tests to ensure accurate caption generation.

These changes improve the contextual relevance of placeholder data and enhance the user experience when interacting with exported values.
2026-04-11 21:47:08 +02:00
Lars baeddd7c13 feat: Enhance placeholder system with AI context support
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 48s
Build Test / lint-backend (push) Successful in 0s
- Introduced `build_ai_placeholder_caption` function in `placeholder_registry.py` to generate AI context captions based on placeholder metadata.
- Updated `resolve_placeholders` in `placeholder_resolver.py` to support modifiers for AI context, allowing for enhanced descriptions when placeholders are resolved.
- Modified `get_placeholder_catalog` to include AI captions in the output, improving the metadata available for placeholders.
- Adjusted `export_placeholder_values` to include AI captions in the exported data, enhancing the information provided to users.

These changes improve the flexibility and functionality of the placeholder system, enabling richer context generation for dynamic content.
2026-04-11 21:36:29 +02:00
Lars 41bf593d4c feat: Refactor sleep metrics calculations and improve error handling
Build Test / pytest-backend (push) Successful in 3s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 54s
Build Test / lint-backend (push) Successful in 0s
- Updated `get_sleep_avg_duration` and `get_sleep_avg_quality` functions in `placeholder_resolver.py` to provide clearer error messages when data is unavailable.
- Enhanced sleep quality calculations in `recovery_metrics.py` to handle cases with insufficient data more robustly.
- Improved data handling in various metrics files (`activity_metrics.py`, `body_metrics.py`, `nutrition_metrics.py`, `recovery_metrics.py`, and `scores.py`) to ensure consistent float conversions for calculations.
- Added utility functions in `recovery_metrics.py` for parsing and normalizing sleep segment data, enhancing the accuracy of sleep quality assessments.

These changes improve the reliability and clarity of sleep-related metrics and enhance overall data handling across the application.
2026-04-11 21:27:49 +02:00
Lars 04e23d8115 feat: Enhance placeholder resolution and error handling
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 55s
Build Test / lint-backend (push) Successful in 0s
- Updated `extract_value_raw` to improve JSON parsing and handle unavailable data more effectively.
- Introduced new functions in `placeholder_resolver.py` for standardized responses when data is unavailable, enhancing clarity for users and AI.
- Modified various data retrieval functions to utilize the new response format, providing detailed reasons for unavailability.
- Improved availability checks in `export_placeholder_values_extended` to account for new response formats.

These changes enhance the robustness of the placeholder system and improve user experience by providing clearer error messages and data handling.
2026-04-11 21:22:27 +02:00
Lars 052ba195cc feat: Update placeholder metadata and nutrition metrics
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 15s
Deploy Development / deploy (push) Successful in 54s
Build Test / lint-backend (push) Successful in 1s
- Adjusted the total number of placeholders from 116 to 114 across various documentation and code files to reflect the current state of the system.
- Enhanced TDEE calculation logic in `nutrition_metrics.py` to prioritize Mifflin–St Jeor BMR with PAL when demographic data is available, with a fallback to a weight-based estimate.
- Updated placeholder registrations to ensure consistency with the new metadata structure and improved data handling.
- Revised documentation to clarify the authoritative source of placeholder metadata and the implications of the changes on existing functionalities.

These updates improve the accuracy and consistency of the placeholder system and enhance the nutritional assessment capabilities within the application.
2026-04-11 21:11:05 +02:00
Lars 2ea5f905c4 feat: Add new profile and time period placeholders in placeholder_resolver.py
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 50s
Build Test / lint-backend (push) Successful in 1s
- Introduced functions to retrieve profile name, age, height, and gender for better placeholder resolution.
- Added functions for displaying current date and time period labels (last 7, 30, and 90 days).
- Updated PLACEHOLDER_MAP to utilize new functions for improved readability and maintainability.
- Enhanced placeholder registrations in __init__.py to include new modules for sleep, vital metrics, and profile time periods.

These changes enhance the flexibility and functionality of the placeholder system, allowing for more dynamic content generation.
2026-04-11 21:08:34 +02:00
Lars e9e094c6a4 feat: Enhance nutrition and activity metrics with new data layers
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 48s
Build Test / lint-backend (push) Successful in 0s
- Added new functions for BMI and goal weight/body fat percentage retrieval in `body_metrics.py`.
- Introduced training frequency and inter-session gap calculations in `activity_metrics.py`.
- Updated placeholder registrations to include new metrics for nutrition and activity.
- Improved data handling in `placeholder_resolver.py` for better integration of new metrics.
- Enhanced documentation across modules to reflect the new functionalities.

These updates improve the accuracy and comprehensiveness of health and fitness assessments within the application.
2026-04-11 20:46:17 +02:00
Lars 61a5bb39ae feat: Update nutrition metrics and energy balance calculations
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 59s
Build Test / lint-backend (push) Successful in 0s
- Introduced a single TDEE calculation based on current weight, replacing the fixed 2500 kcal value.
- Updated `get_energy_balance_data` to use daily totals for intake calculations and improved energy balance logic.
- Enhanced `get_nutrition_average_data` to calculate averages over calendar days instead of raw log entries.
- Adjusted placeholder resolution to ensure consistent metadata usage across requests.
- Fixed issues in the charts router to reflect the new energy balance logic and TDEE calculations.

These changes improve the accuracy of nutritional assessments and streamline data handling in the application.
2026-04-11 19:04:27 +02:00
LarsandClaude Opus 4.6 549c31431e feat: Validierungs-Panel mit Details und Click-to-Jump
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 17s
Deploy Development / deploy (push) Successful in 54s
Build Test / lint-backend (push) Successful in 0s
Issue #1 + #3: Validierung zeigt keine Details / Fehler-Lokalisierung

NEU: ValidationPanel Component
- Zeigt alle Fehler und Warnungen mit vollständigen Details
- Gruppiert nach Severity (Fehler/Warnungen)
- Aufklappbar pro Gruppe (collapsible)
- Click-to-Jump: Fehler mit nodeId sind klickbar
- Klick selektiert betroffene Node → Config-Panel öffnet sich
- Schließbar, öffnet sich automatisch bei neuen Fehler/Warnungen

Features:
- Fixed position (bottom-right, über Canvas)
- Farb-Kodierung: Rot (Errors) / Gelb (Warnings)
- Hover-Effekt auf klickbare Items
- Type-Labels (structure, isolation, etc.)
- Scrollbar bei vielen Fehler/Warnungen
- X-Button zum Schließen

UX-Verbesserungen:
- Kein Raten mehr: Zeigt WAS der Fehler ist
- Kein Suchen mehr: Klick springt direkt zur Node
- Übersichtlich auch bei vielen Fehler/Warnungen
- Funktioniert in großen Workflows

Technisch:
- handleValidationNodeClick: setSelectedNodeId
- Auto-show bei errors.length > 0 || warnings.length > 0
- State: showValidationPanel (closable)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 15:27:14 +02:00
LarsandClaude Opus 4.6 3fa01dd686 feat: Warnung bei ungespeicherten Workflow-Änderungen
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 52s
Build Test / lint-backend (push) Successful in 1s
Issue #0: Ungespeicherte Änderungen gehen verloren beim "Zurück"-Klick

Implementiert:
- hasUnsavedChanges State tracking
- Warnung beim "Zurück"-Button (navigate zu /admin/prompts)
- Warnung beim "Neu"-Button (nur wenn unsaved changes)
- Browser beforeunload Event (warnt bei Browser-Back/Refresh)

Tracking für alle Änderungen:
- onNodesChange/onEdgesChange (Node-Bewegung, Löschen via Delete-Taste)
- onConnect (neue Edges)
- handleAddNode (Node hinzufügen)
- handleNodeUpdate (Node-Daten ändern)
- handleDeleteNode (Node löschen via Button)
- workflowName onChange (Titel ändern)

Flag wird cleared:
- Nach erfolgreichem Save (Update/Create)
- Nach erfolgreichem Load
- Bei "Neu" (nach User-Bestätigung)

UX:
- Klare Warnung: "Du hast ungespeicherte Änderungen"
- Kein Datenverlust mehr durch versehentliches Zurück
- Browser warnt auch bei Refresh/Close

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 15:21:31 +02:00
LarsandClaude Opus 4.6 c9357d4c0e feat: Import Dialog mit 3 Buttons (Ja/Nein/Abbrechen)
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 15s
Deploy Development / deploy (push) Successful in 56s
Build Test / lint-backend (push) Successful in 0s
Ersetzt zwei aufeinanderfolgende confirm()-Dialoge durch einen
Custom Dialog mit drei klaren Optionen:

- "Ja, überschreiben" → bestehende Prompts aktualisieren
- "Nein, nur neue" → existierende überspringen
- "Abbrechen" → Import komplett abbrechen

UX-Verbesserung:
- Alle Optionen auf einen Blick sichtbar
- Kein Raten mehr was "OK" oder "Abbrechen" bedeutet
- Klare Beschreibungstexte unter jedem Button
- Vollbildschirm-Modal mit Overlay

Technisch:
- importDialogData State für Dialog-Daten
- handleImportChoice verarbeitet yes/no/cancel
- Custom Modal-JSX statt Browser confirm()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 14:57:48 +02:00
LarsandClaude Opus 4.6 f3a61091c7 fix: Import confirmation UX - two-step process
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 16s
Deploy Development / deploy (push) Successful in 54s
Build Test / lint-backend (push) Successful in 0s
Admin-Prompts Import hatte unklare Abbrechen-Logik:
- Nutzer erwartete: Abbrechen = Import komplett abbrechen
- Vorher: Abbrechen = overwrite=false, Import lief weiter

Lösung: Zwei-Schritt-Bestätigung
1. "X Prompts importieren?" → Abbrechen = kompletter Abbruch
2. "Existierende überschreiben?" → Abbrechen = nur neue importieren

UX: Klare Trennung zwischen "Import abbrechen" und "Modus wählen"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 14:54:53 +02:00
LarsandClaude Opus 4.6 10d24bbef7 fix(workflow): Duplicate - JSON-encode JSONB fields
Build Test / pytest-backend (push) Successful in 4s
Build Test / build-frontend (push) Successful in 15s
Deploy Development / deploy (push) Successful in 52s
Build Test / lint-backend (push) Successful in 0s
**Error:**
```
psycopg2.ProgrammingError: can't adapt type 'dict'
```

**Root Cause:**
- duplicate_prompt passed Python dicts directly to SQL INSERT
- JSONB fields from r2d() are already deserialized by psycopg2
- PostgreSQL expects JSON strings for JSONB columns

**Fix:**
- Added json.dumps() for all JSONB fields before INSERT:
  - stages, output_schema, question_augmentations, graph_data
- Same pattern as import function

Files changed:
- backend/routers/prompts.py: JSON-encode JSONB in duplicate_prompt

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 14:46:13 +02:00