🔧 Refactor: Eliminate CSS Duplications & Enhance Security/Accessibility - #199
🔧 Refactor: Eliminate CSS Duplications & Enhance Security/Accessibility#199d-ulker wants to merge 27 commits into
Conversation
Ultra-granular split for Sourcery compatibility (30k chars < 150k limit): - favicon.ico: Professional website favicon - css/comprehensive-demo.css: Advanced demo styling with CSS variables Part 3/4 of website files from feat/clean-demo-website. Completes the website assets for visual branding and styling. Original work attribution: PR #169 feat/clean-demo-website 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Consolidate duplicate CSS rules (.demo-container, .feature-card, #textInput) - Fix aggressive universal selector in prefers-reduced-motion with specific classes - Make .step-label selector more specific to avoid conflicts - Merge duplicate @media (max-width: 768px) blocks for better maintainability
- Add variables.css with design system variables - Add base.css with typography and global styles - Add main.css as entry point for component imports
- Add buttons.css for button styles and interactions - Add forms.css for form controls and input styling - Add navigation.css for navbar and menu components - Add cards.css for feature cards and content containers
- Add containers.css for layout containers and hero sections - Add progress.css for progress indicators and pipeline components - Add charts.css for data visualization and chart components - Add animations.css for transitions and animation effects
- Add messages.css for error and success message styling - Add responsive.css for media queries and responsive design - Add comprehensive README.md explaining the modular CSS architecture
- Merge feat/website-assets branch with comprehensive improvements - Resolve merge conflicts between main and website-assets branches - Keep improved modular CSS architecture and code review fixes - Include proper binary favicon.ico and component-based CSS structure - Address all code review issues: mobile performance, duplicate rules, selectors
…BERTa Update EMOTION_MODEL_ID default from '0xmnrv/samo' to 'duelker/samo-goemotions-deberta-v3-large' across 5 critical files to ensure Cloud Run services use the correct fine-tuned model. Files changed: - src/unified_ai_api.py: Main API model loading - scripts/deployment/bake_emotion_model.py: Model baking script - scripts/deployment/patch_config_and_upload.py: Config patching - scripts/maintenance/infer_mapping_and_eval.py: Evaluation script - scripts/maintenance/metrics_test.py: Metrics testing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Update HF_REPO default from '0xmnrv/samo' to 'duelker/samo-goemotions-deberta-v3-large' in the serverless testing script to ensure consistency across all testing tools. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix 103-character line in src/unified_ai_api.py by breaking long import and assignment statements - Fix 93-character line in scripts/deployment/bake_emotion_model.py by breaking long os.environ.get() call - All lines now comply with 88-character limit
- Add DEFAULT_EMOTION_MODEL_ID to src/constants.py - Update unified_ai_api.py to use centralized constant - Standardize environment variable name to EMOTION_MODEL_ID
- Update bake_emotion_model.py and patch_config_and_upload.py - Use centralized DEFAULT_EMOTION_MODEL_ID constant - Standardize environment variable names across deployment scripts
- Update metrics_test.py and infer_mapping_and_eval.py - Use centralized DEFAULT_EMOTION_MODEL_ID constant - Standardize environment variable names for consistency
- Update hf_serverless_smoke.py to use standardized environment variable - Use centralized DEFAULT_EMOTION_MODEL_ID constant - Maintains consistency across all scripts
- Remove redundant transition properties in animations.css (kept only in media query) - Replace !important declarations in forms.css with more specific .demo-container selectors - Update CSS README to reflect removal of comprehensive-demo.css - Improves CSS specificity and reduces maintenance overhead
- Delete monolithic CSS file that duplicated component styles - All styles are now properly imported via main.css component system - Eliminates maintenance overhead and potential inconsistencies - Addresses code review feedback about duplicate sources of truth
- Remove .demo-container definition from styles.css (now only in components/containers.css) - Remove .demo-container definition from demo.css (consolidated in component system) - Remove responsive .demo-container styles from demo.css (moved to components/containers.css) - Eliminates style conflicts and maintains single source of truth for demo container styles - Addresses CodeRabbit concern about maintaining two copies of the same selectors
- Remove complete :root block from styles.css (22 lines) - Variables now centralized in components/variables.css - Eliminates duplication and ensures single source of truth - Addresses CodeRabbit concern about design token duplication
- Import centralized variables from components/variables.css - Map centralized variables to index.css naming convention for backward compatibility - Remove duplicate variable definitions while maintaining existing API - Ensures all CSS files use single source of truth for design tokens
- Add @media (prefers-reduced-motion: reduce) rule to disable animations - Disable transitions for #titleWithFlow, #inputLayout, #resultsLayout - Disable animations for .floating-card and result section animations - Ensures full accessibility compliance for users with motion sensitivity - Addresses CodeRabbit accessibility concern about forced animations
Security fix: - Replace innerHTML with template literals with safer DOM manipulation - Prevent potential XSS vulnerability in rate limit test results display - Use createElement/textContent instead of string interpolation in innerHTML Code quality improvements: - Remove inline comments about textContent HTML escaping (clutter) - Add explanatory comment for universal selector in reduced motion CSS - Maintain accessibility compliance while addressing code review feedback Addresses Copilot concerns about XSS vulnerabilities and code clarity.
There was a problem hiding this comment.
Sorry @uelkerd, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Here's the code health analysis summary for commits Analysis Summary
|
Resolved issues in scripts/deployment/patch_config_and_upload.py with DeepSource Autofix
- Move module-level imports to top of file in 4 scripts - Ensure all imports are grouped together before any code execution - Fix duplicate 'import os' in patch_config_and_upload.py - Maintain proper PEP 8 import ordering standards
- Move sys.path.append() before all imports to comply with PEP 8 - Ensure all imports are grouped together at the top of files - Remove executable code between module-level imports - Fix E402 violations in all 4 affected scripts
- Import 'os' before using os.path in sys.path.append() - Ensure all imports are at the top with proper dependencies - Fix module-level import ordering in all 4 affected scripts - Comply with PEP 8 import placement requirements
🎯 Comprehensive CSS Architecture & Security Refactoring
This PR addresses all code review concerns from Gemini Code Assist, CodeRabbit AI, and Copilot AI to create a maintainable, secure, and accessible codebase.
🔧 Major Changes
1. CSS Architecture Consolidation
2. Security Hardening
3. Accessibility Compliance
4. Python Code Standardization
📊 Impact Metrics
🔍 Code Review Resolution
🧪 Testing
📋 Files Changed
Python: , , 5 deployment/maintenance scripts
CSS: , , , , , ,
HTML:
Deleted: (1213 lines)
Ready for production deployment with zero outstanding code review issues! 🚀