Skip to content

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

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

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

Conversation

@atheurer

Copy link
Copy Markdown
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>

@k-rister k-rister left a comment

Copy link
Copy Markdown
Contributor

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...

Comment thread queries/cdmq/cdm.js

@k-rister k-rister left a comment

Copy link
Copy Markdown
Contributor

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
@k-rister
k-rister deleted the cdm-cleanup branch May 21, 2026 20:01
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