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

Fixes #100 - False positive in hash diff #129

Merged
merged 1 commit into from
May 6, 2021

Conversation

groyoh
Copy link
Contributor

@groyoh groyoh commented May 5, 2021

When a key in the actual results in a noop and its key index in the expected is less than its index in the actual, the diff would display a delete for this key along with a noop. For instance, in the diff below we have - profile_background_tile: false, and profile_background_tile: false.

Differing hashes.

Expected: { created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, geo_enabled: false, verified: true, media_count: 51044, statuses_count: 273860, contributors_enabled: false, profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png", profile_background_color: "FFF1E0", profile_background_tile: false, profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg", listed_count: 37009, profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592" }
  Actual: { listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, statuses_count: 273860, media_count: 51044, contributors_enabled: false, is_translator: false, is_translation_enabled: false, profile_background_color: "FFF1E0", profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png", profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592", profile_background_tile: false }

Diff:

  {
    listed_count: 37009,
    created_at: "Tue Jan 13 19:28:24 +0000 2009",
    favourites_count: 38,
-   geo_enabled: false,
-   verified: true,
+   utc_offset: nil,
    statuses_count: 273860,
    media_count: 51044,
    contributors_enabled: false,
+   is_translator: false,
+   is_translation_enabled: false,
    profile_background_color: "FFF1E0",
    profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png",
-   profile_background_tile: false,
-   profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",
    profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592",
    profile_background_tile: false
  }

When a key in the `actual` results in a noop and its key index in the `expected`
is less than its index in the `actual`, the diff would display a `delete` for
this key along with a noop. For instance, in the diff below we have
`-   profile_background_tile: false,` and `    profile_background_tile: false`.

```
Differing hashes.

Expected: { created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, geo_enabled: false, verified: true, media_count: 51044, statuses_count: 273860, contributors_enabled: false, profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png", profile_background_color: "FFF1E0", profile_background_tile: false, profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg", listed_count: 37009, profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592" }
  Actual: { listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, statuses_count: 273860, media_count: 51044, contributors_enabled: false, is_translator: false, is_translation_enabled: false, profile_background_color: "FFF1E0", profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png", profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592", profile_background_tile: false }

Diff:

  {
    listed_count: 37009,
    created_at: "Tue Jan 13 19:28:24 +0000 2009",
    favourites_count: 38,
-   geo_enabled: false,
-   verified: true,
+   utc_offset: nil,
    statuses_count: 273860,
    media_count: 51044,
    contributors_enabled: false,
+   is_translator: false,
+   is_translation_enabled: false,
    profile_background_color: "FFF1E0",
    profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png",
-   profile_background_tile: false,
-   profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",
    profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592",
    profile_background_tile: false
  }
```
@groyoh groyoh changed the title Fixes #100 Fixes #100 - False positive in hash diff May 5, 2021
@mcmire
Copy link
Collaborator

mcmire commented May 6, 2021

Oof, you're totally right. Can't believe I missed this. Thanks for the fix!

@mcmire mcmire merged commit 5872288 into splitwise:master May 6, 2021
@mcmire
Copy link
Collaborator

mcmire commented May 8, 2021

This fix has been included in v0.7.0!

@groyoh
Copy link
Contributor Author

groyoh commented May 8, 2021 via email

@groyoh groyoh deleted the bugfix/hash_differ branch May 8, 2021 07:35
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

Successfully merging this pull request may close these issues.

2 participants