Skip to content

fix(querying): swap startWith and endsWith operators - #10753

Merged
sushantdhiman merged 1 commit into
masterfrom
fix/op-start-swap
Apr 12, 2019
Merged

sushantdhiman merged 1 commit into
masterfrom
fix/op-start-swap

Conversation

@SimonSchick

Copy link
Copy Markdown
Contributor

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

Fixes #10743

@gabegorelick

Copy link
Copy Markdown
Contributor

I agree that the current behavior of startsWith and endsWith is very wrong, but either no one is using it, or people are using it and working around that they do the opposite of what they should. If it's the latter, this change will break consumers of Sequelize. If it's the former, then arguably these aliases should just be removed.

@SimonSchick

Copy link
Copy Markdown
Contributor Author

@gabegorelick I disagree here, it's obviously unintended behavior eg. a bug, most people that use this functionality probably haven't even noticed this isn't working as intended.
By the same logic any bug that has unintended side effects should be considered a feature.

I will leave final judgement to @sushantdhiman

@gabegorelick

Copy link
Copy Markdown
Contributor

most people that use this functionality probably haven't even noticed this isn't working as intended.

I guess I hadn't considered this, because that's a very scary thought.

By the same logic any bug that has unintended side effects should be considered a feature.

I don't wish to rehash common debates around semantic versioning here, so let me just give an example.

Let's say that 0.00001% of the time, Model.findOne actually returned an array of model instances. I would agree that this is a bug that could be fixed in a minor version since. But what happens if that rate was 100%? Clearly, Model.findOne would still be wrong in such a case. But undeniably, users would have lots of code that depended on the output. Is it OK to break them? Probably not.

It's not cut and dry, so I don't object to merging this, but we should at least understand the implications and be prepared for people to complain when their code stops working. Again, that probably won't happen in this case since no one's complained about startsWith being incorrect. So that's more reason to merge this.

@gabegorelick

Copy link
Copy Markdown
Contributor

Sequelize also tends to "move fast and breaks things", which is arguably a good stance to take when most consumers are applications that will be pinned to a specific version anyway.

Anyway, sorry to turn this into a larger thing. I'm fine merging this.

@codecov

codecov Bot commented Apr 12, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #10753 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #10753   +/-   ##
=======================================
  Coverage   96.33%   96.33%           
=======================================
  Files          93       93           
  Lines        8993     8993           
=======================================
  Hits         8663     8663           
  Misses        330      330
Impacted Files Coverage Δ
lib/dialects/abstract/query-generator.js 97.57% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 504034c...13529be. Read the comment docs.

@sushantdhiman sushantdhiman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This was an incorrect implementation that can be fixed in same semver

@sushantdhiman
sushantdhiman merged commit e33462a into master Apr 12, 2019
@sushantdhiman
sushantdhiman deleted the fix/op-start-swap branch April 12, 2019 04:50
@sushantdhiman

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 5.3.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

startsWith and endsWith operators are reversed

3 participants