opm-simulators icon indicating copy to clipboard operation
opm-simulators copied to clipboard

Check out a given PR/commit in the past for debugging a divergence

Open hakonhagland opened this issue 9 months ago • 4 comments

I was currently helping someone with debugging a divergence in the behavior of flow for a given test case. We would like to see if it could have been introduced in a given PR that was merged some months ago and I found the commit of the PR in opm-simulators. How do I find the the corresponding commits in opm-common and opm-grid? Then I could do something like

for repo in opm-common opm-grid opm-simulators
do
    git clone [email protected]:OPM/"${repo}".git
done
cd opm-common
git checkout master
git checkout -b debugging 64ee498c7351ba4ae
cd ..
cd opm-grid
git checkout master
git checkout -b debugging e416147260b2b4ac35bd58
cd ..
cd opm-simulators
git checkout master
git checkout -b debugging 2bbf48c39c01a6cff117d0c89
cd ..

where 64ee498c7351ba4ae and e416147260b2b4ac35bd58 are the commits in opm-common and opm-grid that corresponds to 2bbf48c39c01a6cff117d0c89 in opm-simulators. Then I would recompile flow from that state.

hakonhagland avatar Mar 12 '25 07:03 hakonhagland

there is no "corresponding" commit, the different histories are entirely independent. best you have to go by is date.

akva2 avatar Mar 12 '25 07:03 akva2

You can do git bisect based on merge commits even for opm similar to here. But you need to checkout corresponding versions of the upstream modules by corresponding date and compile them, too.

I am not saying that it is easy/fast, though.

blattms avatar Mar 12 '25 13:03 blattms

Another idea for the future could be to create a new repository, e.g. opm-history that contains three files opm-simulators.txt, opm-grid.txt and opm-common.txt. Each file could for example be in the format:

<date1> <sha1_1> <sha1_2> <sha1_3>
<date2> <sha2_1> <sha2_2> <sha2_3>
....

where sha1_1 is the sha of a commit in opm-simulators and sha1_2 and sha1_3 are the corresponding commit SHAs for opm-grid and opm-common. The three files could for example be updated automatically by a GitHub action workflow in each of the 3 repositories that will be triggered on each push to master.

This could give us a recorded timeline of “which commits existed for all three repos at each merge event,” which should make future “time travel” for debugging purposes easier.

hakonhagland avatar Mar 12 '25 18:03 hakonhagland

In principle it sounds like a good idea, but I would do a internet review to see if there isn't an existing system for this already before brewing our own hacks.

akva2 avatar Mar 14 '25 09:03 akva2