Skip to content

Refactor cdm.js to improve maintainability and fix critical bugs#150

Merged
atheurer merged 2 commits intomasterfrom
cdm-cleanup
Feb 17, 2026
Merged

Refactor cdm.js to improve maintainability and fix critical bugs#150
atheurer merged 2 commits intomasterfrom
cdm-cleanup

Conversation

@atheurer
Copy link
Contributor

Summary

  • Extract utility functions to reduce code duplication (deep cloning, type checking, error responses)
  • Refactor 19 get* wrapper functions using a factory pattern
  • Consolidate array flattening logic and generalize instance discovery
  • Fix 5 critical runtime bugs including variable name typos and incorrect property access
  • Apply prettier formatting for consistency

Changes

  • Net reduction of 37 lines (226 insertions, 263 deletions)
  • All exports preserved - maintains backward compatibility
  • Improved code readability and maintainability

Test plan

  • Verify all existing functionality works as expected
  • Test get* wrapper functions
  • Validate instance discovery logic
  • Confirm no runtime errors in previously buggy code paths

🤖 Generated with Claude Code

atheurer and others added 2 commits February 12, 2026 14:44
Reduces code duplication by extracting utility functions for deep cloning,
type checking, and error responses. Refactors 19 get* wrapper functions to
use a factory pattern, consolidates array flattening logic, and generalizes
instance discovery. Fixes 5 critical runtime bugs including variable name
typos and incorrect property access. Net reduction of 85 lines while
preserving all exports and maintaining backward compatibility.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Contributor

@k-rister k-rister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks pretty good to me except for deepClone...

Copy link
Contributor

@k-rister k-rister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I get it :). Using strings to derefence the objects while copying things.

@atheurer atheurer merged commit 938b940 into master Feb 17, 2026
29 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Crucible Tracking Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants