Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flaky test "rebase in a sub, was conflicted" #864

Closed
geofft opened this issue Apr 11, 2022 · 2 comments
Closed

Flaky test "rebase in a sub, was conflicted" #864

geofft opened this issue Apr 11, 2022 · 2 comments

Comments

@geofft
Copy link
Contributor

geofft commented Apr 11, 2022

$ for i in {1..30}; do yarn test -g 'rebase in a sub, was conflicted' || break; done

yarn run v1.22.18
$ mocha test -g 'rebase in a sub, was conflicted'


  SubmoduleRebaseUtil
    continueSubmodules
Applying 'message'
Submodule s continuing rewrite from d07e97f43d7f6bae50a88b99c3c10ccd380d4dfa onto ffd40f6e3cfaecc64dfaea7a8d5032cc256ca1c8.
      ✓ rebase in a sub, was conflicted (551ms)


  1 passing (569ms)

Done in 2.88s.
yarn run v1.22.18
$ mocha test -g 'rebase in a sub, was conflicted'


  SubmoduleRebaseUtil
    continueSubmodules
Applying 'message'
Submodule s continuing rewrite from c91064bf09c5f0832032c0b6c323d0c5ef217254 onto d831ee3992ed646a7b591eb63212548aaa2534c9.
      1) rebase in a sub, was conflicted


  0 passing (558ms)
  1 failing

  1) SubmoduleRebaseUtil
       continueSubmodules
         rebase in a sub, was conflicted:
     Error: for repo x
    for commit M
        for path s expected Submodule { d_url: 'a', d_sha: 'qs' } but got Submodule { d_url: 'a', d_sha: 'r' }
    for open submodule s
        missing commit qs
        HEAD is r but expected qs
        In index
            unexpected change to q: File { d_contents: 'q', d_isExecutable: false }
      at Object.exports.assertEqualRepoMaps (lib/util/repo_ast_util.js:600:15)
      at Object.<anonymous> (lib/util/repo_ast_test_util.js:368:17)
      at Generator.next (<anonymous>)
      at onFulfilled (node_modules/co/index.js:65:19)



error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

This caused CI to fail on #863.

@geofft
Copy link
Contributor Author

geofft commented Apr 11, 2022

It looks like what's going on is that we're hitting this Pokémon exception handler:

} catch (e) {
// If there's nothing to commit, `NodeGit.Rebase.commit` will throw
// an error. If that's the case, we want to just ignore the
// operation and move on, as Git does.
}

The exception being ignored is of the form

  SubmoduleRebaseUtil
    continueSubmodules
Applying 'message'
Submodule s continuing rewrite from ade8295420afaf169f68655d473e02b5ca20bef5 onto 80692b65d57bfa7f3199e7e40745d02a3fd9d64d.
[Error: object not found - no match for id (ade8295420afaf169f68655d473e02b5ca20bef5)] {
  errno: -3,
  errorFunction: 'Rebase.commit'
}

I don't understand why we'd get "object not found" in this case. It's the same as the thing being rewritten from.

@geofft
Copy link
Contributor Author

geofft commented Apr 11, 2022

I get the same error bumping nodegit to 0.27, so it's not that.

I dumped the submodule's "status" out of StatusUtil.getRepoStatus, and I see

Applying 'message'
{"d_commit":{"d_sha":"20a4ca249fc8d04e807d07f4700651e86096f4d0","d_url":"/tmp/git-meta-test2022311-27614-uxptu7.41xm/a"},"d_index":{"d_sha":"8c55b375f7a10e55e30f83e1ff5d99f826597225","d_url":"/tmp/git-meta-test2022311-27614-uxptu7.41xm/a","d_relation":4},"d_workdir":{"d_status":{"d_currentBranchName":null,"d_headCommit":"8c55b375f7a10e55e30f83e1ff5d99f826597225","d_staged":{"q":1},"d_workdir":{},"d_submodules":{},"d_rebase":{"d_headName":"HEAD","d_originalHead":"20a4ca249fc8d04e807d07f4700651e86096f4d0","d_onto":"8c55b375f7a10e55e30f83e1ff5d99f826597225"},"d_sequencerState":null},"d_relation":0}}
Submodule s continuing rewrite from 20a4ca249fc8d04e807d07f4700651e86096f4d0 onto 8c55b375f7a10e55e30f83e1ff5d99f826597225.
[Error: object not found - no match for id (20a4ca249fc8d04e807d07f4700651e86096f4d0)] {
  errno: -3,
  errorFunction: 'Rebase.commit'
}

It's odd that this is the reported current comit (.d_commit.d_sha) that it's saying is not found.

geofft added a commit to geofft/git-meta that referenced this issue Apr 22, 2022
This is probably not a very fulfilling fix, but it addresses the issue
that for at least one of the test cases involving a rebase, the commit
that is recorded as the starting point of the rebase exists in the
submodule's remote but not in the non-bare submodule.

Since WriteRepoASTUtil is only used from either test code or
test-oriented utilities (generate-repos and write-repo), it seems safe
to skip the GC.

Arguably, this points to a real bug somewhere if this commit is unrooted
and therefore prone to being GC'd, but I think that bug is lives
entirely within the repo AST stuff (in generating a repo that's in the
middle of a rebase), so this probably does not paper over a problem that
could impact real git-meta users.
tsiq-shu added a commit that referenced this issue Jul 21, 2022
Fix flaky test "rebase in a sub, was conflicted" (fixes #864)
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

No branches or pull requests

1 participant