Conversation
This was referenced Aug 11, 2025
105e2c4 to
b9ce625
Compare
b9ce625 to
ec2caf4
Compare
… data exists - Replace exception with warning log for empty experiment data - Allow view to display with default sorting during cold start - Provides visibility via logs while maintaining functionality - Eliminates crash on first page load before experiment registration The cold start issue occurred because query() runs before views_pre_render(), so the experiment isn't registered yet on first load. This fix logs a warning for debugging while allowing the view to display content that triggers initial tracking. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
ec2caf4 to
5cbab71
Compare
- Update ExperimentRegistrationService to accept optional experiment name - Update ai_sorting.module to pass view:display format experiment names - This ensures experiments display as readable names in RL reports Fixes issue where experiments showed SHA1 hashes instead of readable names in reports. Now experiments show as "view_name:display_name" format making them much more user-friendly. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Remove unused import (Drupal\Core\Url) - Use nullable parameter syntax (?string instead of string = NULL) - Remove trailing whitespace 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #10, Fixes #12, Fixes #13
This PR implements a comprehensive overhaul of AI Sorting, transforming it from a node-only module into a universal, entity-agnostic machine learning solution with proper cold start handling, human-readable experiment names, and production-ready code quality.
Problems Solved
Changes Made
Universal Entity Support (#12)
base_fieldinstead of hardcodednid_entity,_object, and field-based entity access patternsComplete Cold Start Solution (#10)
JavaScript Modernization (#13)
ai-sorting-turns.jsandai-sorting-rewards.jsinto singleai-sorting-tracking.jsnids/nidUrlMaptoentityIds/entityUrlMapHuman-Readable Experiment Names Integration
view_id:display_idformat for clear identificationCode Quality & Cleanup
ExperimentResolver,TotalTrialsService, andAiSortingExperimentDecoratorExperimentRegistrationServiceonlyai_sorting.permissions.ymlTechnical Implementation
Universal Entity Query
Fail-Hard Error Handling
Entity-Agnostic Views Integration
Benefits
✅ Universal compatibility - Works with any Drupal entity type
✅ Proper cold start - New items get appropriate exploration scores
✅ User-friendly reporting - Readable experiment names in admin interface
✅ Reduced complexity - Single JavaScript file, streamlined codebase
✅ Better debugging - Clear error messages instead of silent failures
✅ Production ready - Clean code following Drupal standards
✅ Performance optimized - Consolidated assets, efficient database queries
✅ Future-proof architecture - Extensible design for new entity types
Use Cases Now Supported
Testing
✅ Verified with nodes, users, taxonomy terms, and media entities
✅ Cold start handling confirmed across all entity types
✅ Human-readable experiment names displaying correctly in reports
✅ JavaScript tracking working for both turns and rewards
✅ Drupal coding standards compliance verified
✅ No breaking changes for existing node-based experiments
Compatibility
Related Issues & PRs
This comprehensive overhaul transforms AI Sorting from a limited node-only tool into a universal machine learning platform that works with any Drupal content while providing the production-ready code quality and user experience expected in modern Drupal modules.
🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]