Skip to content

[C4GT Community]: Implement Real-time Block Connection Validation Engine for Visual Editor #796

@kashyapanish6373-cyber

Description

@kashyapanish6373-cyber

Ticket Contents

Description

Music Blocks is a visual programming environment tailored for music and mathematics, used by thousands of students and educators globally. Currently, the new Visual Block Editor prototype lacks a robust connection validation system. Users can snap incompatible blocks together, leading to runtime errors and a confusing educational experience.

This project aims to develop a real-time connection validation engine that prevents invalid block sequences before they are snapped together. By enforcing parent-child relationship rules and providing immediate visual feedback, this feature will significantly enhance the user experience, making the learning curve smoother and more intuitive for our primary audience (children aged 8-14).

Goals

Goals

  • [Goal 1] Develop a recursive validation engine to evaluate block compatibility (e.g., Pitch blocks inside Note blocks).
  • [Goal 2] Implement real-time drag-and-drop UI feedback (e.g., highlighting valid drop zones in green, invalid in red).
  • [Goal 3] Enforce parent-child connection rules across all core music block categories (Action, Math, Pitch, Rhythm).
  • [Goal 4] Write comprehensive unit tests for the validation logic with >80% code coverage.
  • [Goal 5] Integrate the validation engine smoothly with the existing React-based Visual Block Editor prototype.
  • [Midpoint Milestone] By 1.5 months, the core validation logic must be written and unit-tested for the primary block types (Start, Note, Pitch, Rhythm), even if the UI integration is still in progress.

Installation / Set-up Steps:

  1. Fork and clone the Music Blocks repository.
  2. Run yarn install or npm install to fetch dependencies.
  3. Run npm run start to launch the local development server.
  4. Refer to docs/CONTRIBUTING.md for detailed guidelines.

Expected Outcome from Contributor

A fully functional block connection validation system integrated into the visual editor. When a user drags a block, the system should instantly determine if the target connection is valid based on predefined rules. The UI should reflect this with clear, accessible visual cues. Invalid connections should physically reject the drop action, snapping the block back to its original position. The PR must include unit tests and documentation on how to add connection rules for future blocks.

Expected Outcome from Mentor

Mentors are expected to provide clear documentation on the block connection rules (what blocks can go where), review pull requests promptly, guide the contributor on React/Redux best practices within the Music Blocks architecture, and assist with debugging complex drag-and-drop state issues.

Acceptance Criteria

  • Blocks of incompatible types cannot be snapped together.
  • Hovering an incompatible block over a drop zone displays a visual error indicator (e.g., red outline/overlay).
  • Hovering a compatible block displays a success indicator.
  • The validation engine handles deeply nested blocks efficiently without lagging the UI.
  • Unit tests for all validation rules pass successfully.
  • Code is well-documented and adheres to Sugar Labs ESLint configurations.

Implementation Details

  • Technologies: JavaScript (ES6+), React, Redux, Jest (for testing).
  • Architecture: Create a centralized ValidationService or utility module that consumes a schema of block rules. The drag-and-drop handlers should query this service onDragUpdate to toggle UI states, and onDragEnd to allow/reject the final placement.

Mockups/Wireframes

Currently, no explicit wireframes exist for this specific logic, but contributors should follow the visual design language of the existing Music Blocks prototype. Block snapping UI should mimic standard block-based programming interfaces like Scratch or Blockly, emphasizing clear color-coded feedback during the drag state.

Product Name

Music Blocks

Organisation Name

C4GT

Domain

EdTech / Open Source Education

Tech Skills Needed

JavaScript, React

Mentorship Status

Mentor Required

Mentor(s)

https://github.com/kashyapanish6373-cyber

Complexity

Medium

Contribution Type

UI / UX design, Others, Code contribution

Issue Type

Paid ticket, Unpaid ticket, Bounty ticket

Monetary Incentive

NA (or specify if Sugar Labs/C4GT provides a stipend)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions