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

Execute merge_people in plugin server #5452

Merged
merged 2 commits into from
Aug 12, 2021
Merged

Conversation

yakkomajuri
Copy link
Contributor

Changes

Fixes #5145

merge_people now delegates work to the plugin server by creating a $create_alias event.

Tests make sure that the event is created properly but tests for the merging logic are ofc in the plugin server code.

Screen.Recording.2021-08-04.at.14.50.40.mov

Checklist

  • All querysets/queries filter by Organization, by Team, and by User
  • Django backend tests
  • Jest frontend tests
  • Cypress end-to-end tests
  • Migrations are safe to run at scale (e.g. PostHog Cloud) – present proof if not obvious
  • New/changed UI is decent on smartphones (viewport width around 360px)

@timgl timgl temporarily deployed to posthog-pr-5452 August 4, 2021 19:06 Inactive
@yakkomajuri
Copy link
Contributor Author

forgot to tag you for review yesterday @macobo

@yakkomajuri yakkomajuri requested a review from macobo August 5, 2021 10:28
@macobo
Copy link
Contributor

macobo commented Aug 5, 2021

Nice work! This looks correct but haven't tested this out. I wonder if some sort of a cross plugin-server & posthog test would make sense here, wdyt?

Copy link
Contributor

@neilkakkar neilkakkar left a comment

Choose a reason for hiding this comment

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

Q: What assumptions exist around idempotency / ordering of events?

I know that right now, $set & $set_once face this, where the order matters. (And we've been thinking of finding a way around it, (for https://github.com/PostHog/plugin-server/issues/406 ? ).

I think this event definitely falls into the same category, right?

Edit: ok, create_alias already exists, so this isn't a "new" addition. This bit is not important then I guess.

cy.contains('amalia.potts@hotmail.com').click()
cy.contains('OK').click()

cy.wait(2000)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is quite optimistic on github actions settings.

Increasing the timeout just slows down tests as well.

A better solution might be to reload-and-check until the below condition is true UP TO e.g. 20s. https://docs.cypress.io/guides/core-concepts/retry-ability

See https://github.com/PostHog/posthog-js/blob/master/cypress/support/commands.js#L44-L49 for a custom command which retries until it succeeds.


Aside - we don't reset the db between tests right? In that case couldn't this start causing test-ordering related issues?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aside - we don't reset the db between tests right? In that case couldn't this start causing test-ordering related issues?

It's a good point, I would have thought so too but tests seem to have passed fine?

Can configure this to be more general

Copy link
Contributor

Choose a reason for hiding this comment

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

It might be fine as long as these users aren't directly or indirectly asserted against in other tests :)

@yakkomajuri yakkomajuri force-pushed the dedupe-merge-people branch 3 times, most recently from e3b9dd0 to 7523b0f Compare August 12, 2021 12:32
@yakkomajuri yakkomajuri merged commit 81348a0 into master Aug 12, 2021
@yakkomajuri yakkomajuri deleted the dedupe-merge-people branch August 12, 2021 13:58
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.

Move merge_people code to under plugin server
4 participants