Skip to content

Commit

Permalink
Remove Data Column From Personal Information Log (#16300)
Browse files Browse the repository at this point in the history
* remove data column from personal info log

* remove missing data error test

* rubocop formatting

* reorder personal info log data keys in spec

* add personal_information_log.rb to CODEOWNERS

* update CODEOWNERS for lib/common/client/middleware

* add personal_information_log.rb model to CODEOWNERS
  • Loading branch information
stevenjcumming authored Apr 16, 2024
1 parent 3345419 commit 74f39cf
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ app/models/persistent_attachment.rb @department-of-veterans-affairs/benefits-no
app/models/persistent_attachments/dependency_claim.rb @department-of-veterans-affairs/benefits-dependents-management @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/models/persistent_attachments/lgy_claim.rb @department-of-veterans-affairs/benefits-non-disability @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/models/persistent_attachments/pension_burial.rb @department-of-veterans-affairs/benefits-non-disability @department-of-veterans-affairs/pensions @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/models/personal_information_log.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/models/power_of_attorney.rb @department-of-veterans-affairs/Benefits-Team-1 @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/models/preneeds @department-of-veterans-affairs/mbs-core-team @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/models/prescription_preference.rb @department-of-veterans-affairs/vfs-mhv-medications @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
Expand Down Expand Up @@ -1291,7 +1292,7 @@ spec/lib/claim_status_tool @department-of-veterans-affairs/benefits-management-t
spec/lib/common/client/concerns/mhv_fhir_session_client_spec.rb @department-of-veterans-affairs/vfs-mhv-medical-records @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/lib/common/client/concerns/mhv_jwt_session_client_spec.rb @department-of-veterans-affairs/vfs-mhv-medical-records @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/lib/common/client/concerns/mhv_locked_session_client_spec.rb @department-of-veterans-affairs/vfs-mhv-medical-records @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/lib/common/client/middleware/response @department-of-veterans-affairs/backend-review-group
spec/lib/common/client/middleware @department-of-veterans-affairs/backend-review-group
spec/lib/debt_management_center @department-of-veterans-affairs/vsa-debt-resolution @department-of-veterans-affairs/backend-review-group
spec/lib/decision_review @department-of-veterans-affairs/Benefits-Team-1 @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/lib/disability_compensation @department-of-veterans-affairs/Disability-Experience @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
Expand Down Expand Up @@ -1460,6 +1461,7 @@ spec/models/mhv_opt_in_flag_spec.rb @department-of-veterans-affairs/vfs-mhv-secu
spec/models/mpi_data_spec.rb @department-of-veterans-affairs/octo-identity
spec/models/onsite_notification_spec.rb @department-of-veterans-affairs/vfs-authenticated-experience-backend @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/models/persistent_attachments @department-of-veterans-affairs/benefits-non-disability @department-of-veterans-affairs/pensions @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/models/personal_information_log_spec.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/models/preneeds @department-of-veterans-affairs/mbs-core-team @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/models/prescription_spec.rb @department-of-veterans-affairs/vfs-mhv-medications @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/models/prescription_details_spec.rb @department-of-veterans-affairs/vfs-mhv-medications @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
Expand Down
2 changes: 1 addition & 1 deletion app/models/personal_information_log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class PersonalInformationLog < ApplicationRecord
scope :last_week, -> { where('created_at >= :date', date: 1.week.ago) }

has_kms_key
has_encrypted :data, migrating: true, type: :json, key: :kms_key, **lockbox_options
has_encrypted :data, type: :json, key: :kms_key, **lockbox_options

validates :error_class, presence: true
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class DropDataInPersonalInformationLog < ActiveRecord::Migration[7.1]
def change
safety_assured { remove_column :personal_information_logs, :data, :jsonb }
end
end
1 change: 0 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/lib/common/client/middleware/logging_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

it 'creates a new personal information log record' do
expect { client.get('success') }.to change(PersonalInformationLog, :count).by(1)
expect(PersonalInformationLog.last.data.keys).to eq(%w[url method request_body response_body])
expect(PersonalInformationLog.last.data.keys).to eq(%w[method url request_body response_body])
end

it 'correctly records (no) request body on a GET request' do
Expand Down
4 changes: 2 additions & 2 deletions spec/models/personal_information_log_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
context 'when data is missing' do
let(:pi_log) { build(:personal_information_log, data: nil) }

it 'raises PG::NotNullViolation error' do
expect { pi_log.save }.to raise_error(ActiveRecord::NotNullViolation)
it 'does not raise error' do
expect { pi_log.save }.not_to raise_error
end
end

Expand Down

0 comments on commit 74f39cf

Please sign in to comment.