10f608438c
Add tests for Activity Cluster registration and smoke tests for login functionality
...
Deploy Development / deploy (push) Successful in 44s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 13s
- Implemented a new test script `test_activity_registration.py` to verify the registration of Activity placeholders, ensuring all expected placeholders are registered, have complete metadata, and correct evidence distribution.
- Created a new smoke test suite `dev-smoke-test.spec.js` to validate the login process, dashboard loading, and navigation to key sections, while checking for critical console errors.
- Added a JSON file `test-results.last-run.json` to track the status of the last test run, indicating failures if any tests do not pass.
2026-04-03 08:22:08 +02:00
485aec40a0
feat: Activity Cluster Placeholder Registry - Complete Implementation (17 Placeholders)
...
Deploy Development / deploy (push) Successful in 46s
Build Test / lint-backend (push) Successful in 1s
Build Test / build-frontend (push) Successful in 13s
Implements complete placeholder registry for Activity & Training metrics following
Phase 0c Multi-Layer Architecture pattern.
SCOPE: 17 Activity Placeholders
- Group 1 (3): Legacy Resolver - activity_summary, activity_detail, trainingstyp_verteilung
- Group 2 (7): Basic Metrics - volume, frequency, quality, load, monotony, strain, rest compliance
- Group 3 (7): Advanced Metrics - 5x ability_balance, vo2max_trend, activity_score
IMPLEMENTATION:
- File: backend/placeholder_registrations/activity_metrics.py (~1,100 lines)
- Pattern: Nutrition Part A (common_metadata + evidence-based tagging)
- Evidence: CODE_DERIVED (58%), DRAFT_DERIVED (16%), MIXED (15%), TO_VERIFY (6%), UNRESOLVED (5%)
- Formulas: All documented in known_limitations (Load Model, Monotony, Strain, Ability Balance, Activity Score)
CRITICAL ISSUES IDENTIFIED (NOT FIXED per NO LOGIC CHANGES):
1. quality_label field mismatch (quality_sessions_pct) - TO_VERIFY
2. RPE moderate quality mapping bug (proxy_internal_load_7d) - CODE_DERIVED
3. JSONB dependencies (6 placeholders) - ability_balance_*, rest_day_compliance
4. vo2max_trend_28d questionable category (Recovery vs. Activity) - TO_VERIFY
TESTING:
✓ All 17 placeholders registered successfully
✓ Registry size: 48 (31 pre-existing + 17 new)
✓ Dev backend integration: no errors
✓ Auto-registration on module import: working
ARCHITECTURE ALIGNMENT:
- Phase 0c Multi-Layer: 14/17 aligned (Group 2 + 3)
- Old Resolver Pattern: 3/17 (Group 1 - documented, should be refactored)
- Layer separation: data_layer → resolver → export
FILES:
- NEW: backend/placeholder_registrations/activity_metrics.py
- MODIFIED: backend/placeholder_registrations/__init__.py (added import)
- MODIFIED: CLAUDE.md (placeholder registry rules)
DOCUMENTATION:
- Gap Analysis: .claude/task/rework_0b_placeholder/ACTIVITY_CLUSTER_GAP_ANALYSIS.md
- Code Inspection: .claude/task/rework_0b_placeholder/ACTIVITY_CLUSTER_CODE_INSPECTION.md
- Implementation Report: .claude/task/rework_0b_placeholder/ACTIVITY_CLUSTER_IMPLEMENTATION_REPORT.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 08:20:25 +02:00
57800b686a
fix: Body Cluster - PlaceholderType.TEXT_SUMMARY → INTERPRETED
...
Deploy Development / deploy (push) Successful in 52s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s
- caliper_summary + circ_summary used invalid PlaceholderType.TEXT_SUMMARY
- TEXT_SUMMARY is OutputType, not PlaceholderType
- Changed to PlaceholderType.INTERPRETED (summaries interpret raw data)
Valid PlaceholderType values: ATOMIC, RAW_DATA, INTERPRETED, SCORE, META
Valid OutputType values: NUMERIC, STRING, BOOLEAN, JSON, LIST, TEXT_SUMMARY
2026-04-02 19:11:06 +02:00
fbaaf08e29
feat: Body Cluster - Placeholder Registry Implementation
...
Deploy Development / deploy (push) Successful in 49s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 15s
Registers 17 body composition and measurement placeholders with complete metadata:
Weight & Trends (5):
- weight_aktuell: Latest weight snapshot
- weight_trend: 28d delta with direction (increasing/decreasing/stable)
- weight_7d_median: 7d median for noise reduction
- weight_28d_slope: Linear regression slope (kg/day, 28d window)
- weight_90d_slope: Linear regression slope (kg/day, 90d window)
Body Composition (5):
- kf_aktuell: Latest body fat percentage
- fm_28d_change: Fat mass delta (28d)
- lbm_28d_change: Lean body mass delta (28d)
- waist_hip_ratio: Waist-to-hip ratio
- recomposition_quadrant: FM/LBM change classification (optimal/cut_with_risk/bulk/unfavorable)
Circumference Deltas (5):
- waist_28d_delta: Waist circumference change (28d)
- arm_28d_delta: Arm circumference change (28d)
- chest_28d_delta: Chest circumference change (28d)
- hip_28d_delta: Hip circumference change (28d)
- thigh_28d_delta: Thigh circumference change (28d)
Summaries (2):
- caliper_summary: Body fat text summary (BF% + method + date)
- circ_summary: Circumference summary (Best-of-Each strategy)
All placeholders with evidence-based tagging:
- 22 metadata fields per placeholder (374 total fields)
- CODE_DERIVED: Technical fields, formulas from code inspection
- DRAFT_DERIVED: Semantic fields from canonical requirements
- MIXED: Calculation logic, formulas, thresholds
- TO_VERIFY: Architecture layer decisions
Critical formulas documented in known_limitations:
- Linear Regression: slope = Σ((x - x̄)(y - ȳ)) / Σ((x - x̄)²)
- FM/LBM Calculation: FM = weight × (BF% / 100), LBM = weight - FM
- Circumference Delta Logic: latest IN window vs. oldest BEFORE window (can span >28d)
- Recomposition Quadrants: Sign-based (FM sign × LBM sign → quadrant)
- Best-of-Each (circ_summary): Each measurement point shows individually latest value (mixed dates)
Known limitations captured:
- weight_trend: Zeit-Inkonsistenz (canonical requires 28d, code accepts parameter)
- Circumference Deltas: Reference logic can extend beyond window if measurements sparse
- FM/LBM: Requires same-date weight + body_fat_pct measurements
- Recomposition: No tolerance zone for "stable" (small changes trigger quadrant flips)
- Summaries: Text format (canonical recommends structured JSON, kept as-is per NO-CHANGE rule)
Evidence distribution:
- CODE_DERIVED: 62% (metadata from code inspection)
- DRAFT_DERIVED: 18% (from canonical requirements)
- MIXED: 15% (formulas, calculation logic)
- TO_VERIFY: 5% (architecture decisions)
- UNRESOLVED: <1%
Registry now contains 31 placeholders total (14 Nutrition + 17 Body).
Files:
- backend/placeholder_registrations/body_metrics.py (NEW, 1307 lines)
- backend/placeholder_registrations/__init__.py (UPDATED, +body_metrics import)
Framework: PLACEHOLDER_REGISTRY_FRAMEWORK.md (verbindlich ab 2026-04-02)
Change Plan: .claude/task/rework_0b_placeholder/BODY_CLUSTER_CHANGE_PLAN.md
Code Inspection: .claude/task/rework_0b_placeholder/BODY_CLUSTER_CODE_INSPECTION.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 18:57:15 +02:00
5bf8895fb3
fix: Nutrition Cluster Abschluss - Metadaten-Konsistenz
...
Deploy Development / deploy (push) Successful in 53s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s
Behebt letzte Inkonsistenzen im Export:
1. protein_g_per_kg:
- time_window: 'mixed' → '7d' (dominante Komponente)
- Kommentar angepasst: weight ist snapshot, aber protein (7d) ist primär
- known_limitations dokumentiert die Inkonsistenz weiterhin
2. protein_adequacy_28d:
- unit: 'score' → 'score (0-100)' (Konsistenz mit macro_consistency_score)
- Klarere Skalen-Angabe im Export
Finaler Export-Status: 14/14 Nutrition Placeholders konsistent
- Alle haben korrekte Category (Ernährung)
- Alle haben präzise Units
- Alle haben eindeutige Time Windows
- Alle haben korrekte Output Types
Abschlussarbeit für Ernährungs-Cluster.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 13:07:35 +02:00
ffdf9074c3
fix: Part C OutputType - use STRING instead of TEXT
...
Deploy Development / deploy (push) Successful in 49s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s
Fixed AttributeError: OutputType has no attribute TEXT.
Correct enum values are: NUMERIC, STRING, BOOLEAN, JSON, LIST, TEXT_SUMMARY.
Affected placeholders:
- energy_deficit_surplus: OutputType.STRING
- intake_volatility: OutputType.STRING
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 12:56:13 +02:00
ffb30eaff5
feat: Placeholder Registry Part C - Nutrition Consistency & Balance
...
Deploy Development / deploy (push) Successful in 52s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Has been cancelled
Registers 5 nutrition-related placeholders with complete metadata:
- macro_consistency_score: CV-based Makro-Konsistenz Score (0-100)
- energy_balance_7d: Energiebilanz (kcal/day avg, intake - TDEE)
- energy_deficit_surplus: Status (deficit/maintenance/surplus)
- intake_volatility: Klassifikation (stable/moderate/high)
- nutrition_days: Anzahl valider Ernährungstage (30d)
All placeholders with evidence-based tagging:
- 22 metadata fields per placeholder
- CODE_DERIVED: Technical fields, formulas from code inspection
- DRAFT_DERIVED: Semantic fields from canonical requirements
- MIXED: Calculation logic (TDEE model, thresholds, formulas)
- TO_VERIFY: Architecture layer decisions
Critical details documented:
- macro_consistency_score: CV formula + thresholds explicitly documented
- energy_balance_7d: TDEE model (weight_kg × 32.5), unit clarified (kcal/day avg)
- energy_deficit_surplus: Status thresholds (<-200, -200 to +200, >+200)
- intake_volatility: Category mapping from macro_consistency_score
- nutrition_days: Validation criteria (any entry = valid day)
Known limitations captured:
- TDEE model is simplified (no activity/age/gender adjustment)
- Thresholds are somewhat arbitrary (e.g., 200 kcal for deficit/surplus)
- High volatility not necessarily bad (context-dependent)
Registry now contains 14 placeholders total:
- Part A: 4 (kcal_avg, protein_avg, carb_avg, fat_avg)
- Part B: 5 (protein targets + adequacy)
- Part C: 5 (consistency + balance + meta)
Framework: PLACEHOLDER_REGISTRY_FRAMEWORK.md (verbindlich ab 2026-04-02)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 12:55:03 +02:00
0c19e0c0ed
fix: Part B protein placeholders - aggregate by date
...
Deploy Development / deploy (push) Successful in 45s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 15s
Fixes calculate_protein_g_per_kg and calculate_protein_days_in_target:
**Problem:**
Both functions were treating individual nutrition_log entries as days,
causing incorrect calculations when multiple entries exist per day
(e.g., from CSV imports: 233 entries across 7 days).
**Solution:**
1. calculate_protein_g_per_kg:
- Added GROUP BY date, SUM(protein_g) to aggregate by day
- Now averages daily totals, not individual entries
- Correct: 7 days → 7 values, not 233 entries → 233 values
2. calculate_protein_days_in_target:
- Added GROUP BY date, SUM(protein_g) to aggregate by day
- Calculates target range in absolute grams (not g/kg per entry)
- Counts unique DAYS in range, not entries
- Correct format: "5/7" (5 of 7 days), not "150/233" (entries)
**Impact:**
- protein_g_per_kg: was returning "nicht verfügbar" → now returns correct value
- protein_days_in_target: was returning "nicht verfügbar" → now returns correct format
**Root Cause:**
Functions expected 7 unique dates but got 233 entries.
With export date 2026-04-02 and last data 2026-03-26,
the 7-day window had insufficient unique dates.
Issue reported by user: Part B placeholders not showing correct values
in extended export (registry metadata was correct, but computed values failed).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 12:43:33 +02:00
b00f6ac512
feat: Placeholder Registry Part B - Protein Placeholders
...
Deploy Development / deploy (push) Successful in 46s
Build Test / lint-backend (push) Successful in 1s
Build Test / build-frontend (push) Successful in 14s
Registers 5 protein-related placeholders with complete metadata:
- protein_ziel_low: Lower protein target (1.6 g/kg × latest weight)
- protein_ziel_high: Upper protein target (2.2 g/kg × latest weight)
- protein_g_per_kg: Protein intake per kg body weight
- protein_days_in_target: Days in protein range (format: 5/7)
- protein_adequacy_28d: Protein adequacy score (0-100)
All placeholders with evidence-based tagging:
- 22 metadata fields per placeholder
- CODE_DERIVED: Technical fields from source inspection
- DRAFT_DERIVED: Semantic fields from canonical requirements
- UNRESOLVED: Fields requiring clarification
- TO_VERIFY: Assumptions needing verification
Critical issues documented in known_limitations:
- protein_g_per_kg: Weight basis inconsistency (protein 7d avg / weight latest)
- protein_adequacy_28d: Score logic explicitly documented (1.4-1.6-2.2 thresholds)
Registry now contains 9 placeholders total (4 Part A + 5 Part B).
Framework: PLACEHOLDER_REGISTRY_FRAMEWORK.md (verbindlich ab 2026-04-02)
Change Plan: .claude/task/rework_0b_placeholder/NUTRITION_PART_B_CHANGE_PLAN.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 12:27:58 +02:00
81681f0de3
fix: Handle missing TimeWindow enum in export endpoint
...
Deploy Development / deploy (push) Successful in 45s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s
Error: NameError TimeWindow not defined
Fix: Graceful degradation if old metadata enums not available
Gap report now optional (empty if old system unavailable)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 11:54:02 +02:00
645967a2ab
feat: Placeholder Registry Framework + Part A Nutrition Metrics
...
Deploy Development / deploy (push) Successful in 51s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 15s
Part A Implementation (Nutrition Basis Metrics):
- Registry-based metadata system (flexible, not hardcoded)
- 4 placeholders registered: kcal_avg, protein_avg, carb_avg, fat_avg
- Evidence-based tagging (code-derived, draft-derived, unresolved, to_verify)
- Single source of truth for all consumers (Prompt, GUI, Export, Validation)
Technical:
- backend/placeholder_registry.py: Core registry framework
- backend/placeholder_registrations/nutrition_part_a.py: Part A registrations
- backend/placeholder_registry_export.py: Export integration
- backend/routers/prompts.py: /placeholders/export-values-extended integration
Metadata completeness:
- 22 metadata fields per placeholder
- Evidence tracking for all fields
- Architecture alignment (Layer 1/2a/2b)
NO LOGIC CHANGE:
- Data Layer unchanged (nutrition_metrics.py)
- Resolver unchanged (placeholder_resolver.py)
- Values identical (only metadata/export enhanced)
Breaking Change Risk: NONE
Deploy Risk: VERY LOW (only export enhancement)
Plan: .claude/task/rework_0b_placeholder/NUTRITION_PART_A_CHANGE_PLAN.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 11:46:16 +02:00