Conversation started Nov 9, 2017 at 18:40.
Nov 9, 2017 18:40
check my reviews
i gave you three big comments and a "Go check the comments" statement
> This should be kept somewhere. We need to make sure we're actually on HEAD and not in a detached or reverted state. Which is incredibly important.
We want to be in a detached HEAD.
All I'm doing is checking out the latest remote commit
> As you refactor it, this will prevent in-place activation of changed things if one has code perms.
Honestly, this shouldn't happen before CI runs anyways
@quartata but it's been known to happen previously
it's one of the big issues we had hence we put the code in there to reset any local uncommitted changes.
that's what the reset is for to start with BEFORE we make revisions
Which doesn't work.
That's what the HEAD isn't at the tip error is all about, right?
i'm confused by your question
Dumb git stuff like that happens all the time, and it completely cripples our blacklisting until someone fixes it
I'm bypassing that by not touching the local master until autopull
Nov 9, 2017 18:44
@quartata what if a given instance of smokey is not in line with remote?
Precisely.
no i'm talking about with your case
I'd rather it succesfully blacklist, then fail to pull than not blacklist at all
i don't see where you address this in the code
which is what it does currently
Nov 9, 2017 18:44
because it wont' blacklist successfully if you are already in a detatched HEAD state
it'll fail git push
and you have the same problem
We're not pushing from master
the merge will fail
We're checking out the latest origin/master commit
committing on top of that
where?
@quartata I think Thomas is right, you can't push from detached
Nov 9, 2017 18:45
and pushing directly from that ref
@tripleee You absolutely can. I know this because I just did it 30 minutes ago while testing.
git push origin HEAD:master
@quartata you can't do that safely
@quartata that's unsafe
and exactly why I rejected
consider:
rev 2 is "foobarbaz"
rev 1 is "foobar"
rev 3 is rev1+"boom"
which means rev3 is foobarboom
git will see rev3 and ignore rev2
and fail to properly include rev2
How are these histories laid out?
so you're preventing rev2 from being included in the consideration points of the merge.
@quartata git commit histories.
Yeah, I know. What branches? Local or remote?
literally git log
@quartata rev3 is local, rev1 and 2 are remote.
Nov 9, 2017 18:47
So you're saying:
but rev3 was built on reverted head from rev 1
origin/master: 1 -> 2
master: 1 -> 2 -> 3
@quartata just serially, there is a race condition if you pull then push "in the blind" because if somebody else pushed between your pull and your push, those commits will be gone
@ThomasWard But it won't be.
The HEAD comes from git fetch origin master.
Nov 9, 2017 18:48
@quartata origin/master: 1->2; local/master: 1
It's the latest remote commits, completely untouched by anything local
new change on local = 1->3
We're fastforwarding the blacklist commit onto that
@ThomasWard But that wouldn't happen.
show me in your code where you prevent that
because I don't see that in your code.
and as a result I don't believe your code functions as you think it does. Unless you can show me absolute proof that it works as is, and show me that it's been shown to work in a forked repository.
We switch from deploy to a detached HEAD, made from the latest remote commit: github.com/Charcoal-SE/SmokeDetector/pull/1216/…
Nov 9, 2017 18:49
"absolute proof" is a bit of a tall order but a demo script which produces this race condition and handles it successfully would be a start
@tripleee that's what i consider absolute proof.
it should be in the test suite really, only the current git manager is impossible to test
@quartata no, we push from a new branch based on master.
@ThomasWard Nope.
Nov 9, 2017 18:50
that's not a 'detatched head' that's a 'new branch'
It's done straight from the detached head.
push takes a refspec
HEAD:master
@quartata make a proof of concept script using this. Execute such script.
show it works
Sure. I've done it multiple times now. One second.
"multiple times now" is useless unless you show us your full test case.
Nov 9, 2017 18:51
and consider i'm in a pissed off mood having to have paid the FCC coordinators another $200 just to get the freaking radio application done, so I'm really not in the best mood right now.
I'm cloning from the initial commit: git clone https://github.com/quartata/test
forgive the harshness.
No, it's fine.
@tripleee I don't think @quartata knows what I mean by 'test case' and 'test script'
I'm going to put it together into one script for you to try
But I want to show you the full process, step by step
Nov 9, 2017 18:52
uncricks neck, and then sighs
@ThomasWard if it can be done manually at first, certainly it can be scripted and eventually turned into an actual test case in the code
Actually, first I guess I'll make deploy a remote branch
@tripleee bleh i'm tired, your job: yell at me if I seem to be too harsh :P
because you're here right now.
OK so I'm going to make a commit on master that adds something new
@ThomasWard just a bit of patience I think is all we need...
Nov 9, 2017 18:54
Histories look like this now:
origin/master: 1 -> 2
master: 1
I'm going to make a local change now so that it looks like this:
origin/master: 1 -> 2
master: 1 -> 3
This is what you were envisioning, right?
For the initial state.
OK, so currently Github's master is 1 -> 2 but my local origin/master ref doesn't have 2.
So I'm going to do git fetch origin master
does your local change 2 touch the same file as the unmerged upstream commit 3?
Yes.
Local:
$ cat README.md
# test

asdf2
what's remote currently
# test

asdf1
I'm currently on local master, I'm going to execute git checkout origin/master
the link contains the diff, rev 1 had just the first line # test
> You are in 'detached HEAD' state.
I've made a commit, pushing from the detached HEAD
And now:
origin/master: 1 -> 2 -> 4
master: 1 -> 3
git push origin HEAD:master
Now, to be fair:
> Your branch and 'origin/master' have diverged
But this time, it at least "blacklisted". Rather than failing completely on the merge
Nov 9, 2017 19:02
but asdf2 is lost ...?
that's my point
that's lost.
@quartata if the conflict is in the blacklist because something else is already blacklisted
you just destroyed it.
and it will be lost forever.
my case, exactly in point.
THEREFORE: reject.
But we don't commit blacklists to local master
If someone did that, it was a human error that should not be pushed
@quartata but consider this.
if we have a new branch
and we try and autopull merge that
but we ahve another item already handled and merged
we have merge conflicts from here to high heaven until everything is in sync again if we base things off a given master branch rev.
we still don't have a good idea of how concurrent commits to local might trample each other. The tread lock I put in should prevent that but I still don't have any good way to write a test case for that
that's the problem.
@tripleee and exactly why we need to keep that
@quartata what happens if you create a new branch with the original master, add in a commit that doesn't include the second newer upstream commit at the remote, in the new branch edit things, and try to merge
will it conflict?
what's git say? If it does conflict, then it's also a failure case
because it can't merge reliably code privs or not.
Nov 9, 2017 19:06
@quartata Pull in my PR without destroying it following your process
also consider we'll autopull so if the conflict happens there too then you've also just fubared all of Smokey.
the nested blanket except handlers also complicate things, where do you end up when something fails?
^ that
@quartata you'll note that there's now global pushback here because you don't handle any conflicts properly.
this is why we reset to upstream HEAD with Master before trying to create the new blacklist.
because we will have merge issues.
we only get merge issues currently if we have two blacklist requests which result in conflicts, or one gets merged in before the other by metasmoke and in turn is a race condition we can't solve regardless.
I'm all for rewriting this but I'm afraid we will probably need to refactor the current functionality to something we can actually test before we do anything else
@tripleee I agree.
@tripleee can you make a note about this discussion and such on the PR?
Nov 9, 2017 19:08
there are probably failure modes we could shake out pretty quickly if we could run a test suite locally without having a mess pushed to the production master
GH is lagged on me
I'll try to articulate something
just bookmark this discussion, and link to it and say "This is why we should reject, given this 'test case' which clobbers prior commits.
> Talked about stuff. A decision might have been made. I dunno. Maybe?
 
Conversation ended Nov 9, 2017 at 19:08.