Skip to content

Commit

Permalink
Merge branch 'master' into rcassity-ci-v2-logs
Browse files Browse the repository at this point in the history
  • Loading branch information
RachalCassity authored Nov 6, 2024
2 parents 7a932c2 + 2c54e40 commit bfd15e0
Show file tree
Hide file tree
Showing 282 changed files with 7,841 additions and 2,188 deletions.
87 changes: 41 additions & 46 deletions .github/CODEOWNERS

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions .github/workflows/backend-pr-approver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Backend PR Approver
on:
workflow_run:
workflows:
- "Backend PR Labeler"
types: [completed]
jobs:
say-hi:
runs-on: ubuntu-latest
steps:
- name: Say Hi
run: |
echo "Hi"
15 changes: 15 additions & 0 deletions .github/workflows/backend-pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Backend PR Labeler
on:
pull_request:
types: [opened, reopened, review_requested, review_request_removed, ready_for_review, converted_to_draft, labeled, unlabeled]
workflow_run:
workflows:
- "Code Checks"
types: [completed]
jobs:
check-pr-status:
runs-on: ubuntu-latest
steps:
- name: Say Hi
run: |
echo "Hi"
4 changes: 2 additions & 2 deletions .github/workflows/check_codeowners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Respond to PR if check CODEOWNERS exists for new files fails
if: ${{ failure() }}
uses: thollander/actions-comment-pull-request@e2c37e53a7d2227b61585343765f73a9ca57eda9 # v3.0.0
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
message: 'Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: ${{ env.offending_file }}'
GITHUB_TOKEN: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }}
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
- name: Respond to PR if check CODEOWNERS exists for deleted files fails
if: ${{ failure() }}
uses: thollander/actions-comment-pull-request@e2c37e53a7d2227b61585343765f73a9ca57eda9 # v3.0.0
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
message: 'Error: A file (or its parent directories) was deleted but its reference still exists in CODEOWNERS. Please update the .github/CODEOWNERS file and delete the entry for the Offending file: ${{ env.offending_file }}'
GITHUB_TOKEN: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }}
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/deploy_delay_notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":scared_and_sweating_smiley: GitHub Action Runner Workflow failed! :scared_and_sweating_smiley:\n" +
"<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} Run #${{ github.run_number }}>\n\n" +
"*Development Summary:*\n${{ env.dev_summary }}\n\n" +
"*Staging Summary:*\n${{ env.staging_summary }}"
"text": ">:scared_and_sweating_smiley: GitHub Action Runner Workflow failed! :scared_and_sweating_smiley:\n \
<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} Run #${{ github.run_number }}>\n\n \
*Development Summary:*\n${{ env.dev_summary }}\n\n \
*Staging Summary:*\n${{ env.staging_summary }}"
}
},
{ "type": "divider" }
Expand All @@ -169,9 +169,9 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":scared_and_sweating_smiley: GitHub Action Runner Workflow failed! :scared_and_sweating_smiley:\n\n" +
"Unknown error occured. See logs:\n" +
"<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} Run #${{ github.run_number }}>"
"text": ">:scared_and_sweating_smiley: GitHub Action Runner Workflow failed! :scared_and_sweating_smiley:\n\n \
Unknown error occured. See logs:\n \
<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} Run #${{ github.run_number }}>"
}
},
{ "type": "divider" }
Expand Down
1 change: 1 addition & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ Lint/MissingSuper:
- 'lib/search_typeahead/service.rb'
- 'lib/token_validation/v2/client.rb'
- 'lib/va_profile/address_validation/service.rb'
- 'lib/va_profile/v3/address_validation/service.rb'
- 'lib/va_profile/service.rb'
- 'lib/vbs/requests/list_statements.rb'
- 'lib/vic/id_card_attribute_error.rb'
Expand Down
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ GEM
activemodel (= 7.1.4.1)
activesupport (= 7.1.4.1)
timeout (>= 0.4.0)
activerecord-import (1.7.0)
activerecord-import (1.8.1)
activerecord (>= 4.2)
activerecord-postgis-adapter (9.0.2)
activerecord (~> 7.1.0)
Expand Down Expand Up @@ -731,7 +731,7 @@ GEM
parallel (1.26.3)
parallel_tests (4.7.2)
parallel
parser (3.3.5.0)
parser (3.3.5.1)
ast (~> 2.4.1)
racc
patience_diff (1.2.0)
Expand Down Expand Up @@ -931,7 +931,7 @@ GEM
actionpack (>= 5.2, < 8.0)
railties (>= 5.2, < 8.0)
rtesseract (3.1.3)
rubocop (1.67.0)
rubocop (1.68.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand Down Expand Up @@ -1031,9 +1031,9 @@ GEM
ffi
ssrf_filter (1.1.2)
staccato (0.5.3)
statsd-instrument (3.9.4)
statsd-instrument (3.9.6)
stringio (3.1.1)
strong_migrations (2.0.1)
strong_migrations (2.0.2)
activerecord (>= 6.1)
super_diff (0.13.0)
attr_extras (>= 6.2.4)
Expand All @@ -1047,7 +1047,7 @@ GEM
thread_safe (0.3.6-java)
tilt (2.3.0)
timecop (0.9.10)
timeout (0.4.1)
timeout (0.4.2)
trailblazer-option (0.1.2)
ttfunk (1.7.0)
typhoeus (1.4.1)
Expand Down Expand Up @@ -1087,7 +1087,7 @@ GEM
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.8.2)
webrick (1.9.0)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-driver (0.7.6-java)
Expand Down
8 changes: 5 additions & 3 deletions app/controllers/concerns/form_attachment_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def validate_file_upload_class!
end
rescue => e
log_message_to_sentry(
'form attachment error 1',
'form attachment error 1 - validate class',
:info,
phase: 'FAC_validate',
klass: filtered_params[:file_data].class.name,
Expand All @@ -55,8 +55,10 @@ def save_attachment_to_cloud!
form_attachment.set_file_data!(filtered_params[:file_data], filtered_params[:password])
rescue => e
log_message_to_sentry(
'form attachment error 2',
'form attachment error 2 - save to cloud',
:info,
has_pass: filtered_params[:password].present?,
ext: File.extname(filtered_params[:file_data]).last(5),
phase: 'FAC_cloud',
exception: e.message
)
Expand All @@ -67,7 +69,7 @@ def save_attachment_to_db!
form_attachment.save!
rescue => e
log_message_to_sentry(
'form attachment error 3',
'form attachment error 3 - save to db',
:info,
phase: 'FAC_db',
errors: form_attachment.errors,
Expand Down
26 changes: 0 additions & 26 deletions app/controllers/v0/backend_statuses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,12 @@ module V0
class BackendStatusesController < ApplicationController
service_tag 'maintenance-windows'
skip_before_action :authenticate
before_action :validate_service, only: [:show]

def index
options = { params: { maintenance_windows: } }
render json: BackendStatusesSerializer.new(backend_statuses, options)
end

# TO-DO: After transition of Post-911 GI Bill to 24/7 availability, confirm show action
# and related logic can be completely removed
#
# GET /v0/backend_statuses/:service
def show
render json: BackendStatusSerializer.new(backend_status)
end

private

# NOTE: Data is from PagerDuty
Expand All @@ -32,22 +23,5 @@ def backend_statuses
def maintenance_windows
@maintenance_windows ||= MaintenanceWindow.end_after(Time.zone.now)
end

# NOTE: Data is GI bill scheduled downtime
def backend_status
@backend_status ||= BackendStatus.new(name: backend_service)
end

def backend_service
params[:service]
end

def validate_service
raise Common::Exceptions::RecordNotFound, backend_service unless recognized_service?
end

def recognized_service?
BackendServices.all.include?(backend_service)
end
end
end
15 changes: 10 additions & 5 deletions app/controllers/v0/caregivers_assistance_claims_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def create
end
rescue => e
unless e.is_a?(Common::Exceptions::ValidationErrors) || e.is_a?(::Form1010cg::Service::InvalidVeteranStatus)
Rails.logger.debug('CaregiverAssistanceClaim: error submitting claim',
Rails.logger.error('CaregiverAssistanceClaim: error submitting claim',
{ saved_claim_guid: @claim.guid, error: e })
end
raise e
Expand All @@ -42,10 +42,15 @@ def create
# If we were unable to submit the user's claim digitally, we allow them to the download
# the 10-10CG PDF, pre-filled with their data, for them to mail in.
def download_pdf
# Brakeman will raise a warning if we use a claim's method or attribute in the source file name.
# Use an arbitrary uuid for the source file name and don't use the return value of claim#to_pdf
# as the source_file_path (to prevent changes in the the filename creating a vunerability in the future).
source_file_path = PdfFill::Filler.fill_form(@claim, SecureRandom.uuid, sign: false)
source_file_path = if Flipper.enabled?(:caregiver1010)
@claim.to_pdf(SecureRandom.uuid,
sign: false)
else
PdfFill::Filler.fill_form(
@claim, SecureRandom.uuid, sign: false
)
end

client_file_name = file_name_for_pdf(@claim.veteran_data)
file_contents = File.read(source_file_path)

Expand Down
16 changes: 14 additions & 2 deletions app/controllers/v0/profile/address_validation_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

require 'va_profile/models/validation_address'
require 'va_profile/address_validation/service'
require 'va_profile/models/v3/validation_address'
require 'va_profile/v3/address_validation/service'

module V0
module Profile
Expand All @@ -11,7 +13,12 @@ class AddressValidationController < ApplicationController
skip_before_action :authenticate, only: [:create]

def create
address = VAProfile::Models::ValidationAddress.new(address_params)
address = if Flipper.enabled?(:va_v3_contact_information_service, @current_user)
VAProfile::Models::V3::ValidationAddress.new(address_params)
else
VAProfile::Models::ValidationAddress.new(address_params)
end

raise Common::Exceptions::ValidationErrors, address unless address.valid?

Rails.logger.warn('AddressValidationController#create request completed', sso_logging_info)
Expand All @@ -29,6 +36,7 @@ def address_params
:address_pou,
:address_type,
:city,
:country_name,
:country_code_iso3,
:international_postal_code,
:province,
Expand All @@ -39,7 +47,11 @@ def address_params
end

def service
@service ||= VAProfile::AddressValidation::Service.new
@service ||= if Flipper.enabled?(:va_v3_contact_information_service, @current_user)
VAProfile::V3::AddressValidation::Service.new
else
VAProfile::AddressValidation::Service.new
end
end
end
end
Expand Down
9 changes: 9 additions & 0 deletions app/controllers/v0/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,14 @@ def show
def icn
render json: { icn: current_user.icn }, status: :ok
end

def credential_emails
emails = current_user.user_account.user_verifications.each_with_object({}) do |verification, credentials|
credentials[verification.credential_type.to_sym] =
verification.user_credential_email.credential_email
end

render json: emails
end
end
end
4 changes: 2 additions & 2 deletions app/controllers/v1/nod_callbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class NodCallbacksController < ApplicationController
'SC' => 'supplemental-claims'
}.freeze

VALID_FUNCTION_TYPES = %w[form evidence].freeze
VALID_FUNCTION_TYPES = %w[form evidence secondary_form].freeze

def create
return render json: nil, status: :not_found unless enabled?
Expand Down Expand Up @@ -95,7 +95,7 @@ def authenticity_error
end

def bearer_token_secret
Settings.dig(:nod_vanotify_status_callback, :bearer_token)
Settings.nod_vanotify_status_callback.bearer_token
end

def enabled?
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/v1/pension_ipf_callbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def authenticity_error
end

def bearer_token_secret
Settings.dig(:pension_ipf_vanotify_status_callback, :bearer_token)
Settings.pension_ipf_vanotify_status_callback.bearer_token
end

def log_params(payload)
Expand Down
19 changes: 0 additions & 19 deletions app/controllers/v1/post911_gi_bill_statuses_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require 'formatters/date_formatter'
require 'lighthouse/benefits_education/outside_working_hours'
require 'lighthouse/benefits_education/service'

module V1
Expand All @@ -10,9 +9,6 @@ class Post911GIBillStatusesController < ApplicationController
include SentryLogging
service_tag 'gibill-statement'

# TO-DO: Remove this action after transition of LTS to 24/7 availability
before_action :service_available?, only: :show

STATSD_GI_BILL_TOTAL_KEY = 'api.lighthouse.gi_bill_status.total'
STATSD_GI_BILL_FAIL_KEY = 'api.lighthouse.gi_bill_status.fail'

Expand All @@ -36,16 +32,6 @@ def handle_error(e)
render json: { errors: e.errors }, status: status || :internal_server_error
end

# TO-DO: Remove this method after transition of LTS to 24/7 availability
def service_available?
unless Flipper.enabled?(:sob_updated_design) || BenefitsEducation::Service.within_scheduled_uptime?
StatsD.increment(STATSD_GI_BILL_FAIL_KEY, tags: ['error:scheduled_downtime'])
headers['Retry-After'] = BenefitsEducation::Service.retry_after_time
# 503 response
raise BenefitsEducation::OutsideWorkingHours
end
end

def log_vet_not_found(user, timestamp)
PersonalInformationLog.create(
data: { timestamp:, user: user_json(user) },
Expand All @@ -69,11 +55,6 @@ def user_json(user)
}.to_json
end

# TO-DO: Remove this method after transition of LTS to 24/7 availability
def skip_sentry_exception_types
super + [BenefitsEducation::OutsideWorkingHours]
end

def service
BenefitsEducation::Service.new(@current_user&.icn)
end
Expand Down
Loading

0 comments on commit bfd15e0

Please sign in to comment.