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

data migration for journalist association fix in draftreplies table #1184

Merged
merged 2 commits into from
Nov 5, 2020

Conversation

sssoleileraaa
Copy link
Contributor

@sssoleileraaa sssoleileraaa commented Nov 5, 2020

Fixes #1185

Description

Just like we did for the replies table, apply a data migration on the draftreplies table, see #1162 for context.

Test Plan

  1. Checkout the 0.2.1 client (https://github.com/freedomofpress/securedrop-client/releases/tag/0.2.1)
  2. pip install --require-hashes -r dev-requirements.txt
  3. Send some failed replies
    • wget https://gist.githubusercontent.com/creviera/5ba70d50c12b6a6df6f98ed40ad09645/raw/5caef3339ceab1fc997ccb6b9e337bc8828ef12f/failed-reply
    • git apply failed-reply
    • Run the client and send some replies
      • Confirm that the journalist_id column of draftreplies table contains uuids for the failed draftreplies you just tried to send
  4. Now checkout this PR branch
  5. pip install --require-hashes -r requirements/dev-requirements.txt
  6. At this point, if you run the client, and view the failed replies, you will notice two things:
    • failed replies are missing the initials of the journalist in the badges
    • the client will crash after sync
  7. Apply the migration (this is done in the postinst which we will test during QA, but for now, follow the steps below)
    • first make sure alembic.ini points to the svs.sqlite db with your failed replies (edit this manually - I had to update sqlalchemy.url to sqlalchemy.url = sqlite:////home/creviera/.securedrop_client/svs.sqlite)
    • stamp the db to the previous revision: alembic stamp 7f682532afa2
    • now, apply the migration: alembic upgrade head
  8. Run the client
    • Verify failed replies now have the initials of the journalist in the badges
    • Verify the client no longer crashes after sync
    • Confirm that the journalist_id column of draftreplies table no longer contains uuids

Checklist

If these changes modify code paths involving cryptography, the opening of files in VMs or network (via the RPC service) traffic, Qubes testing in the staging environment is required. For fine tuning of the graphical user interface, testing in any environment in Qubes is required. Please check as applicable:

  • I have tested these changes in the appropriate Qubes environment
  • I do not have an appropriate Qubes OS workstation set up (the reviewer will need to test these changes)
  • These changes should not need testing in Qubes

If these changes add or remove files other than client code, the AppArmor profile may need to be updated. Please check as applicable:

  • I have updated the AppArmor profile
  • No update to the AppArmor profile is required for these changes
  • I don't know and would appreciate guidance

If these changes modify the database schema, you should include a database migration. Please check as applicable:

  • I have written a migration and upgraded a test database based on main and confirmed that the migration applies cleanly
  • I have written a migration but have not upgraded a test database based on main and would like the reviewer to do so
  • I need help writing a database migration
  • No database schema changes are needed

@sssoleileraaa sssoleileraaa changed the base branch from main to release/0.3.0 November 5, 2020 21:55
@eloquence
Copy link
Member

eloquence commented Nov 5, 2020

Environment type: non-Qubes dev env

  1. Checkout the 0.2.1 client (https://github.com/freedomofpress/securedrop-client/releases/tag/0.2.1)
  2. pip install --require-hashes -r dev-requirements.txt
  3. Send some failed replies
    • wget https://gist.githubusercontent.com/creviera/5ba70d50c12b6a6df6f98ed40ad09645/raw/5caef3339ceab1fc997ccb6b9e337bc8828ef12f/failed-reply
    • git apply failed-reply
    • Run the client and send some replies
      • Confirm that the journalist_id column of draftreplies table contains uuids for the failed draftreplies you just tried to send
  4. Now checkout this PR branch
  5. pip install --require-hashes -r requirements/dev-requirements.txt
  6. At this point, if you run the client, and view the failed replies, you will notice two things:
    • failed replies are missing the initials of the journalist in the badges
    • the client will crash after sync
  7. Now, apply the migration (this is done in the postinst which we will test during QA, but for now, follow the steps below)
    • first make sure alembic.ini points to the svs.sqlite db with your failed replies (edit this manually: I had to update the sqlalchemy.url to sqlalchemy.url = sqlite:////home/creviera/.securedrop_client/svs.sqlite)
    • now, stamp the db to the previous revision: alembic stamp 7f682532afa2
    • now, apply the migration: alembic upgrade head
  8. Run the client
    • Verify failed replies now have the initials of the journalist in the badges
    • Verify the client no longer crashes after sync
    • Confirm that the journalist_id column of draftreplies table no longer contains uuids

@conorsch
Copy link
Contributor

conorsch commented Nov 5, 2020

  1. Checkout the 0.2.1 client (https://github.com/freedomofpress/securedrop-client/releases/tag/0.2.1)
  2. pip install --require-hashes -r dev-requirements.txt
  3. Send some failed replies
    • wget https://gist.githubusercontent.com/creviera/5ba70d50c12b6a6df6f98ed40ad09645/raw/5caef3339ceab1fc997ccb6b9e337bc8828ef12f/failed-reply
    • git apply failed-reply
    • Run the client and send some replies
      • Confirm that the journalist_id column of draftreplies table contains uuids for the failed draftreplies you just tried to send
        • yes, all uuids were the same, one per failed reply
  4. Now checkout this PR branch
  5. pip install --require-hashes -r requirements/dev-requirements.txt
  6. At this point, if you run the client, and view the failed replies, you will notice two things:
    • failed replies are missing the initials of the journalist in the badges
    • the client will crash after sync
  7. Now, apply the migration (this is done in the postinst which we will test during QA, but for now, follow the steps below)
    • first make sure alembic.ini points to the svs.sqlite db with your failed replies (edit this manually: I had to update the sqlalchemy.url to sqlalchemy.url = sqlite:////home/creviera/.securedrop_client/svs.sqlite)
    • now, stamp the db to the previous revision: alembic stamp 7f682532afa2
    • now, apply the migration: alembic upgrade head
  8. Run the client
    • Verify failed replies now have the initials of the journalist in the badges
    • Verify the client no longer crashes after sync
    • Confirm that the journalist_id column of draftreplies table no longer contains uuids

@conorsch conorsch self-requested a review November 5, 2020 22:52
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.

3 participants