Skip to content

Big refactor#25

Merged
PaulHax merged 35 commits intomainfrom
big-refactor
Jul 22, 2025
Merged

Big refactor#25
PaulHax merged 35 commits intomainfrom
big-refactor

Conversation

@PaulHax
Copy link
Collaborator

@PaulHax PaulHax commented Jul 22, 2025

No description provided.

PaulHax added 30 commits July 19, 2025 11:48
- Rename EnhancedExperiment to Experiment and EnhancedScenario to Scenario for cleaner naming
- Remove numeric suffix logic from scenario IDs since scenes provide unique identification
- Fix timestamp generation to use actual datetime instead of branching on test env
- Update method name from add_enhanced_experiment to add_experiment
- Fix scenario key truncation to preserve full scenario IDs like "June2025-MF1-eval"
- Changed key format from underscore-separated to colon-separated to avoid parsing ambiguity
- Updated JavaScript getSelectedKey() to match new format
- Made run_variant required with default value "default"
- Simplified conflict detection to use full keys including run_variant
- Updated tests to expect new key format

Example: pipeline_random:llama3.3-70b:affiliation-0.5:default
- Rename handleRunSpecificScenarioChange to handleRunScnarioChange for consistency
- Update handleRunScnarioChange and handleRunSceneChange to use updatePinnedRunState
- Enhance updateParameterForRun to use updateAppParameters directly for validation
- Remove complex validateKDMAsForScenarioChange function (validation now handled by updateAppParameters)
- Remove unused setParametersForRun function
- Store available options in run state for UI dropdowns
- Add KDMAUtils module with normalize, sort, compare, and format functions
- Replace duplicate KDMA handling logic across state.js and app.js
- Centralize KDMA value normalization (Math.round * 10 / 10)
- Centralize KDMA display formatting (toFixed(1))
- Centralize KDMA array sorting and comparison logic
- Document purpose of dual KDMA validation checks
- Maintain all existing functionality while improving maintainability
…ation

- Remove pinCurrentRun and replace with addColumn/copyColumn pattern
- Eliminate semi-global appState.selectedScene/Scenario/etc properties
- Pass parameters directly to createRunConfig instead of using appState
- Calculate context-specific KDMAs using updateAppParameters per run
- Simplify startup logic to auto-pin first valid configuration directly
- Preserve timing_s data in all column creation paths to fix probe time NA issue

Benefits:
- Cleaner architecture with no temporary global state manipulation
- Context-specific KDMA filtering for each run configuration
- More predictable column creation with explicit parameters
- Eliminated redundant state management code
- Remove unused import updateCurrentData from state.js
- Remove unused showNotification function
- Remove CURRENT_RUN_ID constant and related current run logic
- Clean up parameter initialization to use only pinned run logic
- Simplify conditional checks for run ID validation
- Add updateComparisonDisplay() call after restoring pinned runs from URL
- Replace pinRunFromConfig with addColumn for proper availableOptions initialization
- Enhance createRunConfigFromParams to fetch all available options (scenarios, scenes, ADMs, LLMs)
- Remove unnecessary defensive checks for availableOptions in dropdown functions
- Optimize URL updates during batch restoration to avoid redundant calls

The UI now properly displays restored columns with all dropdown options populated correctly.
- Add original_index field to InputOutputItem to track position in source file
- Unify experiment creation flow to always use original indices
- Fix timing data access to use source_index instead of loop index
- Remove special casing between uniform and mixed KDMA experiments
- Ensure KDMA slider changes now update both data and probe times correctly

Fixes issue where changing KDMA slider always returned same data because
all experiments had source_index=0 instead of correct indices pointing
to different positions in shared input_output.json files.
- Update canRemoveSpecificKDMA to use run.availableOptions.kdmas.validCombinations
- Fix getMaxKDMAsForRun to work with new manifest format (v2.0)
- Use KDMAUtils.arraysEqual for proper KDMA comparison
- Remove unused functions: canRemoveKDMAsForRun, checkExperimentExistsForScenario, getKDMAPermutations
- KDMA delete buttons now enable when removing a KDMA results in a valid combination
- Simplify getValidKDMAsForRun using optional chaining and cleaner structure
- Remove unused functions that relied on old manifest format:
  - extractParametersFromConfig
  - matchesConstraints
  - getValidOptionsForConstraints
- These functions are obsolete since we now use availableOptions.kdmas.validCombinations
- Add canAddKDMAToRun function to verify current KDMAs can be extended
- Check if valid combinations exist that include current KDMA values with additional KDMAs
- Fix Add KDMA button to only enable when current KDMA values can form larger valid combinations
- Update tooltip to show more accurate disabled reason
- Ensures proper behavior for multi-KDMA scenarios like pipeline_baseline merit/affiliation combinations
- Set slider min/max/step dynamically based on valid KDMA values from availableOptions
- Remove unnecessary snapping logic since HTML5 range input handles constraints
- Calculate step as minimum difference between consecutive valid values
- Prevents invalid selections like 0.5 when only discrete values (0,1) are valid
- Cleaner implementation using native browser validation
- Remove unnecessary typeof object checks for KDMA combinations
- Remove null checks where objects are guaranteed to exist
- Fix LLM null handling in transformManifestForUpdateParameters using optional chaining
- Ensure consistent map key generation for null LLM values
Replace complex experiment searching logic with simple call to
updateAppParameters() which already calculates available run_variant
options. Show disabled dropdown for 0-1 variants to maintain UI consistency.

Fixes issue where run variants like "rerun", "greedy_w_cache" weren't
showing in dropdown for pipeline_baseline and other ADMs.
Clean up console output by removing verbose debug logging while
preserving error and warning messages for troubleshooting.

Removed debug logs for:
- Parameter validation progress
- KDMA values processing
- Experiment/scenario processing details
- Transform completion summaries

Kept important error/warning logs for production debugging.
- Remove unused buildExperimentKey function and manifest variable
- Extract generic dropdown creation into createDropdownForRun()
- Consolidate parameter change handlers with handleSimpleParameterChange()
- Create updateKDMAsForRun() helper for KDMA updates
- Simplify formatValue with mapping objects and extracted expandable content logic
- Reduce code duplication while maintaining all functionality
- Add runVariants to availableOptions for consistency
- Enhance createDropdownForRun with disableWhenFewOptions and customDisplayText
- Replace complex createRunVariantDropdownForRun with simple call to generic function
- Reduce code duplication by 28 lines while maintaining all functionality
- Preserve special "(default)" display text and disabled state for few options
PaulHax added 2 commits July 21, 2025 22:37
- Add getValidKDMATypesForRun() to filter KDMA types by valid combinations
- Update createSingleKDMAControlForRun() to use validation logic
- Auto-disable KDMA type dropdown when only one option available
- Prevents users from seeing unselectable KDMA type options
- Fixes confusion when dropdown shows invalid choices that can't be picked
- Extract magic numbers to named constants (800ms, 0.001 tolerance, etc.)
- Consolidate similar parameter change handlers using factory pattern
- Break down complex formatValue function into focused helpers
- Improve KDMAUtils with better deep equality and constants
- Encapsulate global state in structured GlobalState object
- Add strict dropdown selection helper for tests
- Remove unused code and improve organization
- Fix test to work with disabled dropdowns when only one option available

All functionality preserved, 46/47 tests passing
PaulHax added 2 commits July 22, 2025 10:50
Backend changes:
- Update parse_alignment_target_id() to handle multi-KDMA format like "ADEPT-June2025-affiliation_merit-1.0_0.0"
- Support parsing multiple KDMA names and values separated by underscores
- Maintain backward compatibility with single KDMA format

Frontend changes:
- Add smart KDMA addition: when all valid combinations require multiple KDMAs, add complete combination at once
- Enable KDMA deletion when unaligned (empty) option is available
- Smart KDMA removal: clicking delete clears all KDMAs when partial removal would be invalid
- Add getMinimumRequiredKDMAs() helper to detect when complete combinations are needed

This fixes the issue where multi-KDMA experiments couldn't add KDMAs due to validation rejecting incomplete combinations.
Remove special case handling for KDMA parameter options since KDMAs have
higher priority than ADMs in the parameter hierarchy. The priority-based
cascading system already handles this correctly.
URL parameters now include the manifest creation date and are ignored if
they don't match the current manifest, preventing stale bookmarks from
applying outdated parameters to newer data.
@PaulHax PaulHax merged commit 702ae05 into main Jul 22, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant