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

Writes to both columns during strong-migration datatype change in va_notify_notifications #19486

Closed
wants to merge 4 commits into from

Conversation

MarchandMD
Copy link
Contributor

Note: Delete the description statements, complete each step. None are optional, but can be justified as to why they cannot be completed as written. Provide known gaps to testing that may raise the risk of merging to production.

Summary

  • This work is behind a feature toggle (flipper): YES/NO

yes

  • (Summarize the changes that have been made to the platform)

before this PR:

a pending PR will add a new column called callback_metadata. That PR is the first step of the strong-migration process to change a datatype for a column. The related model VANotify::Notification is currently only writing to the metadata String-type column, which will be replaced by the callback_metadata JSONB-type column

After this PR:
The aforementioned VANotify::Notification will now write to both columns per this backend practice. Specifically, the writing to the callback_metadata will coerce the string being passed into a JSON using .to_json

  • (If bug, how to reproduce)

n/a

  • (What is the solution, why is this the solution?)

This is the solution because it's the recommended practice for updating a datatype. Also, since the callback_options[:metadata] appears originally as a String, coercing it to JSON is necessary

  • (Which team do you work for, does your team own the maintenance of this component?)

VANotify

  • (If introducing a flipper, what is the success criteria being targeted?)

n/a

Related issue(s)

  • Link to ticket created in va.gov-team repo OR screenshot of Jira ticket if your team uses Jira
  1. a pending PR
  2. https://github.com/orgs/department-of-veterans-affairs/projects/1415/views/1?pane=issue&itemId=87124754&issue=department-of-veterans-affairs%7Cvanotify-team%7C1422
  3. https://github.com/orgs/department-of-veterans-affairs/projects/1415/views/1?pane=issue&itemId=85247150&issue=department-of-veterans-affairs%7Cvanotify-team%7C1411
  • Link to previous change of the code/bug (if applicable)
  • Link to epic if not included in ticket

Testing done

  • New code is covered by unit tests
  • Describe what the old behavior was prior to the change
  • Describe the steps required to verify your changes are working as expected. Exclusively stating 'Specs run' is NOT acceptable as appropriate testing
bundle exec rspec modules/va_notify/spec

resulted in no broken specs

  • If this work is behind a flipper:
    • Tests need to be written for both the flipper on and flipper off scenarios. Docs.
    • What is the testing plan for rolling out the feature?

Screenshots

Note: Optional

What areas of the site does it impact?

(Describe what parts of the site are impacted andifcode touched other areas)

Acceptance criteria

  • I fixed|updated|added unit tests and integration tests for each feature (if applicable).
  • No error nor warning in the console.
  • Events are being sent to the appropriate logging solution
  • Documentation has been updated (link to documentation)
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs
  • Feature/bug has a monitor built into Datadog (if applicable)
  • If app impacted requires authentication, did you login to a local build and verify all authenticated routes work as expected
  • I added a screenshot of the developed feature

Requested Feedback

(OPTIONAL)What should the reviewers know in addition to the above. Is there anything specific you wish the reviewer to assist with. Do you have any concerns with this PR, why?

@MarchandMD MarchandMD closed this Nov 15, 2024
Copy link

1 Error
🚫

Modified files in db/migrate or db/schema.rb changes should be the only files checked into this PR.

File Summary

DB File(s)

  • db/schema.rb

  • modules/va_notify/db/migrate/20241114213556_add_callback_metadata_to_va_notify_notifications.rb

    App File(s)

    • modules/va_notify/lib/va_notify/service.rb

Application code must always be backwards compatible with the DB,
both before and after migrations have been run. For more info:

Generated by 🚫 Danger

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

Successfully merging this pull request may close these issues.

1 participant