Commit graph

2 commits

Author SHA1 Message Date
Claude
693dd9dace
Add comprehensive unit tests for activity_utils.py v2.0 features
- Created 58 unit tests covering all 8 utility functions
- Tests cover template rendering, metadata conditions, conditional content,
  navigation, weighted random, progressive hints, and context creation
- Fixed operator precedence bug: _not_contains and _not_exists must be
  checked before _contains and _exists to prevent false matches
- All tests passing (58/58)
2025-11-10 16:55:12 +00:00
Claude
2b19fc5b9d
Implement OpenCompletion Activity YAML v2.0 features for immersive activities
Add comprehensive v2.0 features to enhance activity creation:

Features Implemented:
- Template variables: {{metadata.key}}, {{current_attempt}}, etc.
- Conditional content blocks: show_if conditions for dynamic content
- Advanced metadata conditions: gte, lt, contains, regex, exists operators
- Conditional navigation: if/elif/else branching based on metadata
- Progressive hints system: Auto-display hints based on attempt number
- Weighted random selection: Probabilistic outcomes with custom weights
- Dynamic question text: Questions with template variables
- Built-in attempt counters: Access to current_attempt, max_attempts, attempts_remaining

Files Modified:
- activity.py: Integrated all v2.0 features into activity execution
- activity_utils.py: New utility module for templates and conditions
- activity_yaml_validator.py: Updated validator for v2.0 schema
- CLAUDE.md: Added session persistence and Twitch Plays model docs
- research/SPEC.yaml: Comprehensive v2.0 feature documentation

Added:
- research/activity-test-v2-features.yaml: Test activity demonstrating all features

All changes validated and tested. Zero errors in validator.
2025-11-10 15:13:02 +00:00