unison icon indicating copy to clipboard operation
unison copied to clipboard

`rewrite` commands cause ucm to spin and consume resources

Open rlmark opened this issue 2 months ago • 1 comments

A rewrite rule for a simple tuple -> proper record type conversion causes the UCM to hang and ultimately get killed by some process manager.

The rule:

findPagination : (Nat, Nat)
                 -> Rewrites
                   ( RewriteSignature (Nat, Nat) Pagination,
                     RewriteTerm (Nat, Nat) Pagination,
                     RewriteCase (Nat, Nat) Pagination)
findPagination limitOffsetTup =
  @rewrites
    signature (Nat, Nat) ==> api.articles.Pagination
    term limitOffsetTup ==> Pagination (at1 limitOffsetTup) (at2 limitOffsetTup)
    case limitOffsetTup ==> Pagination (at1 limitOffsetTup) (at2 limitOffsetTup)

in the project:

scratch/main> clone @rlmark/realworld/replace

sfind works, but includes transitive dependencies (which might be tantamount to the entirety of my project):

realworld/replace> sfind findPagination
realworld/replace> edit 1-300

A subsequent rewrite command then hangs for 10+ minutes:

realworld/replace> rewrite findPagination

Ultimately being killed:

/opt/homebrew/bin/ucm: line 5: 16232 Killed: 9               UCM_WEB_UI="/opt/homebrew/Cellar/unison-language/0.5.49/share/unison-language/ui" /opt/homebrew/opt/unison-language/libexec/unison "$@"

Environment (please complete the following information):

  • ucm --version release/0.5.49'
  • OS/Architecture: macOS 26.0.1 Tahoe - M1 chip

Additional context While the rewrite command is not the most commonly used command, this was for a video highlighting a special thing you can do in Unison.

rlmark avatar Oct 17 '25 17:10 rlmark

Eep! Thanks for the report.

aryairani avatar Oct 22 '25 17:10 aryairani