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

Fix check for outdated Rust library #17861

Merged
merged 2 commits into from
Oct 29, 2024

Conversation

erikjohnston
Copy link
Member

This failed when install with poetry, so let's properly try and detect what's going on.

This failed when install with poetry, so let's properly try and detect
what's going on.
@erikjohnston erikjohnston marked this pull request as ready for review October 22, 2024 14:57
@erikjohnston erikjohnston requested a review from a team as a code owner October 22, 2024 14:57
@@ -0,0 +1 @@
Fix detection when the built Rust library was outdated when using source installations.
Copy link
Contributor

Choose a reason for hiding this comment

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

This failed when install with poetry, so let's properly try and detect what's going on.

What's the testing strategy for this?

  1. Create a new directory
  2. poetry new synapse-pr-17861-test
  3. cd synapse-pr-17861-test
  4. poetry add synapse (but install from this branch)
  5. ...

Copy link
Member Author

Choose a reason for hiding this comment

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

This is for source check outs, so run poetry install -E "all test" in a checkout of this branch. Then python -c "import synapse" should work, while if you edit a rust source file it should then fail.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good ✅

Test what happens before this change:

  1. git clone [email protected]:element-hq/synapse.git synapse-pr-17861-test
  2. cd synapse-pr-17861-test
  3. poetry install --extras all
  4. poetry run python -c "import synapse" (works as expected)
  5. Make an edit to one of the rust files like rust/src/http.rs
  6. poetry run python -c "import synapse" (works when it shouldn't ❌)

Test how this PR fixes things:

  1. git checkout erikj/fix_outdated_rust_detection
  2. Actually complains about dirty Rust source files (worked as expected)
    $ poetry run python -c "import synapse"
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/eric/Downloads/synapse-pr-17861-test2/synapse/__init__.py", line 107, in <module>
        check_rust_lib_up_to_date()
      File "/home/eric/Downloads/synapse-pr-17861-test2/synapse/util/rust.py", line 51, in check_rust_lib_up_to_date
        raise Exception("Rust module outdated. Please rebuild using `poetry install`")
    Exception: Rust module outdated. Please rebuild using `poetry install`
  3. Re-install as instructed to rebuild rust: poetry install --extras all
  4. poetry run python -c "import synapse" (works as expected ✅)

@erikjohnston erikjohnston merged commit d427403 into develop Oct 29, 2024
39 checks passed
@erikjohnston erikjohnston deleted the erikj/fix_outdated_rust_detection branch October 29, 2024 17:06
@erikjohnston
Copy link
Member Author

Thank you!

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