A third of my pull requests never merged
Between August 2022 and December 2024 I opened 133 pull requests against elastic/kibana, the public repository behind Kibana, the browser interface to Elasticsearch. I worked on Rule Management inside the Security Solution, the part of the product a security team uses to manage its detection rules. A detection rule is a saved query plus a schedule. Kibana runs it against the customer's logs every few minutes and writes an alert whenever it matches.
89 of those pull requests merged. 44 closed without merging. That is almost exactly a third, and phrased that way it sounds like a third of my time was wasted.
I went back and read all 44. Two of them look like abandonment in the ordinary sense, and both are one-line changes that opened and closed on the same day. Everything else has a reason, and in most cases the reason is written down in the thread where anyone can still read it.
The interesting part is what the other 42 were for. On a repository the size of Kibana, a pull request does more than propose a change. It is how you get a shared build job to run against your branch, and it is a durable place to write something down that other people will find later. Both of those uses produce branches that were never going to merge, and they land in the same statistic as a failed proposal.
The 44, sorted by reason
Every one of them falls into exactly one of these.
| Reason | Count |
|---|---|
| Branch that existed only to run a build job | 10 |
| Explicit do-not-merge, testing or draft branch | 4 |
| Test triage write-up or a re-run of a skipped test, closed on purpose | 4 |
| Superseded by a later pull request | 13 |
| Spike or proof of concept that answered its question | 6 |
| Closed because the decision or the premise changed | 5 |
| No reason recorded anywhere | 2 |
Eighteen of those, the first three rows, were opened with no intention of merging at all. Another six were spikes, meaning short exploratory branches written to answer a question rather than to ship. Thirteen are the same change re-landed on a cleaner branch, so that work did merge, just under a different number.
A branch is how you ask for CI
Kibana has a flaky test suite runner, a build job that takes one test suite and runs it a hundred or three hundred times to establish whether a failure is real or noise. The way I used it, you pointed it at a pull request branch.
That produces artefacts that look strange from outside. #161864 has a diff of zero lines. So do two of its siblings. The branch exists because the runner needs somewhere to point, and the pull request exists because that is how a branch becomes visible to a build job and to the colleague you are going to send the results to.
Others carry a diff that exists only to provoke something. #170713 and #170714 are the same one-line change opened twice, once against main and once against the 8.11 release branch, because I wanted to compare one test's behaviour across two versions and there was no way to ask that except by running it in both places.
#174296 changes a single page title and says "DO NOT MERGE" in its own title. It carries the label that tells CI to spin up a test deployment from the branch, and the one-word change is there so the branch has something to deploy. I wanted to confirm that a hosted Elasticsearch project, the managed offering rather than a cluster you run yourself, could be created from a branch at all.
#199056 duplicates an already-open pull request's diff, opened to trigger a cloud redeploy and closed an hour later.
None of these are code review. They are a build system being driven through the only interface it exposes.
A branch is also a place to write something down
This one took me longer to notice about my own behaviour.
#169246 is titled as a flaky test runner pull request for two Cypress suites. Cypress tests drive a real browser against a running Kibana, and they are where flakiness lives. The diff is thirty lines. The body is the actual output: five linked failure issues, each annotated with whether the failure was a real flake or an artefact of the runner, and which team owned it from then on. I closed it six days later with a comment that states the whole category plainly.
This PR doesn't need merging but contains important information about triaging of failing tests belonging to @elastic/security-detection-engine. Closing.
The deliverable was the write-up. The branch was the envelope.
#169847 is the clearest case. It is a two-line diff against a Cypress test that had been reported as flaky. I ran the suite 500 times across three configurations, including one unmodified control run, and could not reproduce the failure once. So I closed the pull request and the tracking issue together, with a note saying I would reopen both if the failure came back. The output of that work is the sentence "we ran it 500 times and it did not fail", plus the decision to change nothing. No merged commit carries that.
Thirteen times I wrote the same change twice
This is the largest category and from a distance the one that most looks like failure. In ten of the thirteen there is a closing comment naming the replacement.
The expensive one is #144461. It extended Kibana's bulk edit API so that when you edit 400 rules at once and the edit is meaningless for some of them, say adding a tag a rule already has, the response reports those as skipped with a reason instead of claiming updated and writing the record back unchanged.
Getting there meant refactoring bulkEdit inside the shared alerting framework, code owned by another team. The existing code pushed the tag onto the rule and returned nothing, so by the time the response was assembled there was nothing left to compare. Splitting it into functions that take a rule and return one makes the comparison possible. Here is the shape of it, invented and cut down to the one edit type rather than the real code, which handles a dozen and is much longer. Rule is the stored detection rule document.
function applyTagEdit(rule: Rule, tag: string): Rule {
if (rule.tags.includes(tag)) {
return rule;
}
return { ...rule, tags: [...rule.tags, tag] };
}
const editedRule = applyTagEdit(rule, tag);
// The same object back means the rule already had the tag, so nothing was written.
const outcome = editedRule === rule ? 'skipped' : 'updated';
The real version ran to +2,318 lines across 30 files. It sat open for 40 days and collected 147 comments, the second highest comment count of anything I opened there. Then I closed it.
Closing in favour of #147345 after ResponseOps refactored
rules_client.
Mid-review, the framework team had split the single large rules_client.ts into per-method files. My refactor of a function inside that file no longer applied to a file that existed. #147345 is the same change re-landed against rules_client/methods/bulk_edit.ts. It is +2,313 lines, five lines smaller than the original, and it merged eight days after opening, because the review had already happened on the other branch.
Nobody made a mistake there. Two teams were editing the same file in one large shared repository and one of them landed first. Nothing from those 147 comments was lost, which is the reason the second branch closed in eight days instead of forty.
The other pattern in this group is a first attempt that turns out to be much larger than the problem. #189187 extended an endpoint's contract by hand-writing +2,374 lines of OpenAPI, the YAML format that describes an HTTP endpoint's request and response shapes. #189790 does the same job in +395 lines by defining the schema once in Zod, a TypeScript validation library, and generating the YAML from it. A week before I closed it, I would have called the first one nearly done.
The stale bot closed the ones I would not have guessed
Twenty of the 44 were not closed by a person at all. A bot that sweeps up branches with no recent activity got them years later, after they had sat open between 713 and 1,224 days.
I expected that set to be my orphans, real proposals I had opened, argued for, half finished, and then lost to a change of priorities. Some of it I assumed I would be embarrassed by.
It is close to the opposite. The twenty are almost exactly the zero-line CI branches, the do-not-merge branches and the spikes. The reason is obvious in hindsight. Nobody bothers to close a branch that was never going to merge. It has no owner and costs nothing to leave open, so it sits there until something automated notices.
The pull requests that closed within days or weeks are the ones somebody closed deliberately, me or a teammate, and nearly all of those carry a comment explaining why. How long a branch stayed open tells you nothing about whether the work mattered. It tells you whether anyone had a reason to come back and shut it down.
What I would change
Two of the 44 have no reason recorded anywhere. One is a backport, a change already merged to main and being re-applied to a release branch, opened and closed the same day, where the change reached that branch by some route I can no longer reconstruct. The other is a one-line fix to a count badge with only CI comments on it. If I could change one thing about how I worked in that repository, it would be to leave a sentence on those two. It costs nothing at the moment of closing and it is unrecoverable three years later.
The rest of it I would do the same way. The merge rate was never the measure. What made the closed branches worth opening is that the thread is public and permanent, so the flaky-test triage, the 500 clean runs, and the reason a 40-day review had to start over are all still readable by someone who was not there.
I left that team in December 2024, so the tooling and the code have moved since. The numbers above come from the pull requests themselves, and anyone can check them.