Skip to content

Fix #280: merge regen with --diff-algorithm=minimal, writing the proof only on a clean merge - #300

Merged
namin merged 5 commits into
midspiral:mainfrom
Sequela02:regen-merge-cleanup
Nov 14, 2026
Merged

namin merged 5 commits into
midspiral:mainfrom
Sequela02:regen-merge-cleanup

Conversation

@Sequela02

Copy link
Copy Markdown
Contributor

This replaces #296 so the change lands in one merge, as discussed there. It keeps the commit from #296 (6b7278c) and adds two on top.

Fixes #280.

018a054 writes the merge only when it is clean. git merge-file -p prints the result instead of writing it into the .dfy, so regen no longer saves and restores the proof around the merge or before the old-Git retry. On a conflict, Git's output goes to .dfy.merged. The other arguments are fixed, so exit 129 alone means a Git before 2.44, and the LC_ALL override and the stderr regex are gone. I kept the error messages from #296 instead of the dafnyCheckDiff format I suggested, because that format prints "git exited undefined" when git can't start and "git exited null" when it is killed.

The tests use a sh fake git, like the fake dafny, and cover the old-Git fallback, a non-conflict exit and a missing git. The existing conflict test covers real conflicts. A .gitattributes keeps the fixture's LF line endings. Against #296 this is 37 lines added and 136 removed.

d69e4b4 makes the large-proof test fail instead of skip when CI is set, so a CI image with old Git can't turn the regression off. Drop it if you'd rather keep the skip.

I ran npm run typecheck, npm run typecheck:examples and tools/test-fixtures.sh in WSL with Git 2.43 and Dafny 4.11. They pass, with the large-proof test skipped. One test, "Dafny's string lastIndexOf computes JavaScript's result", fails in my environment on main and on #296 as well, so I ran the script without that file. With Git 2.56 on Windows, the #280 fixture merges byte for byte through dafnyRegen. I haven't run the large-proof test with Git 2.44 or later on Linux; CI covers it.

namin and others added 5 commits November 12, 2026 22:11
git merge-file -p prints the merge instead of writing it into the
proof, so regen no longer saves and restores the .dfy around the merge
or before the old-Git retry. With fixed arguments, exit 129 can only
mean the option was rejected, so the locale override and stderr match
go. The tests use a sh fake git and cover the old-Git fallback, a
non-conflict exit and a missing git; the existing conflict test covers
real conflicts. The fixture's .gitattributes keeps its LF line endings.
On Git before 2.44 the test skips, so a CI image with old Git would turn the regression off without a failure.

@namin namin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@namin
namin merged commit 406d361 into midspiral:main Nov 14, 2026
41 checks passed
@Sequela02
Sequela02 deleted the regen-merge-cleanup branch November 14, 2026 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lsc regen reports a conflict for a one-line generated change after a large proof block

2 participants