Skip to content

Bound lyric harmonization timestamps and window count to prevent browser hangs #28

Closed

Description

@cchacs

Audited main at 69b3db6.

chordr/screen.js filters individual token start/duration values for finiteness, but _harmonizeMelody adds them and iterates every window until that endpoint. A valid numeric token {start: 1e308, duration: 1e308, midi: 60} overflows the endpoint to Infinity and never completes. Large finite timestamps also cause impractically many synchronous iterations on the browser main thread.

Reproduced through window.chordr.generateAccompanimentFromLyrics with a mocked schema_version 1 playback response containing that token; a Node child process exceeded a two-second timeout. Existing 100 JS and 18 Python tests pass.

Please validate the summed endpoint and supported song horizon, bound work independently of timestamps, and return a graceful unavailable/invalid result. Add regression coverage for overflow and very large finite timestamps.

Activity

  1. pullfrog commented on Oct 11, 2026

    @pullfrog
    Contributor
  2. pullfrog commented on Oct 11, 2026

    @pullfrog
    Contributor

    Built and opened PR #31: "Bound lyric harmonization timestamps and window count to prevent browser hangs (#28)" — #31

    _harmonizeMelody (chordr/screen.js:1116) now validates the summed endpoint t.start + t.duration for finiteness and against a supported 15-minute song horizon (sharing routes.py's MAX_AUDIO_DURATION_SECONDS), returns the existing graceful null for out-of-bound melodies, and hard-caps the window loop (MAX_HARMONY_WINDOWS) independently of timestamps — so the issue's repro {start: 1e308, duration: 1e308, midi: 60} no longer overflows to an infinite main-thread loop, and large finite spans no longer iterate billions of windows.

    Coverage: 3 new tests (overflow with a real token alongside; very large finite span beyond the horizon; an in-horizon ≥890s boundary still harmonizes). JS suite 110/110 (was 107), Python 20/20, node --check clean. Reverting the fix to the old reduce-based endpoint makes the overflow test hang (killed by external 12s timeout), proving the regression pins it. Docs/version kept in sync: README null-conditions, CHANGELOG ### Fixed, plugin.json 0.6.1→0.6.2, CLAUDE.md prose + count.

    Task list (7/7 completed)
    • Create feature branch pullfrog/28-bound-lyric-harmonization
    • Fix _harmonizeMelody: validate summed endpoint, horizon, cap windows in chordr/screen.js
    • Add regression tests for overflow and very large finite timestamps
    • Update docs: README null-conditions, CHANGELOG Fixed entry, plugin.json 0.6.2, CLAUDE.md
    • Run JS test suite and node --check
    • Self-review diff via reviewfrog
    • Commit, push, open PR, report progress

    Pullfrog  | View workflow run | via Pullfrog | Using big-pickle (free) | 𝕏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions