Skip to content

Commit

Permalink
Merge branch 'master' into dbex/add_ipf_started_form_spec
Browse files Browse the repository at this point in the history
  • Loading branch information
tommasina-va authored Jan 17, 2025
2 parents 6425699 + 9b91dfd commit c93bd5b
Show file tree
Hide file tree
Showing 1,106 changed files with 13,955 additions and 52,423 deletions.
54 changes: 34 additions & 20 deletions .github/CODEOWNERS

Large diffs are not rendered by default.

589 changes: 1 addition & 588 deletions .rubocop_todo.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN groupadd --gid $USER_ID nonroot \
WORKDIR /app

RUN apt-get update --fix-missing
RUN apt-get install -y poppler-utils build-essential libpq-dev git curl wget ca-certificates-java file \
RUN apt-get install -y poppler-utils build-essential libpq-dev libffi-dev libyaml-dev git curl wget ca-certificates-java file \
imagemagick pdftk tesseract-ocr \
&& apt-get clean \
&& rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/* /tmp/* /var/tmp/*
Expand Down
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ path 'modules' do
gem 'burials'
gem 'check_in'
gem 'claims_api'
gem 'covid_vaccine'
gem 'debts_api'
gem 'decision_reviews'
gem 'dhp_connected_devices'
Expand Down Expand Up @@ -154,7 +153,7 @@ gem 'sign_in_service'
gem 'slack-notify'
gem 'socksify'
gem 'staccato'
gem 'statsd-instrument'
gem 'statsd-instrument', '3.9.8' # 3.9.9 breaking change - Address Family IPv6
gem 'strong_migrations'
gem 'swagger-blocks'
# Include the IANA Time Zone Database on Windows, where Windows doesn't ship with a timezone database.
Expand Down
33 changes: 15 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ GIT

GIT
remote: https://github.com/department-of-veterans-affairs/vets-json-schema
revision: a84abd360072a0d4aaa8b1984cee2c33e1844335
revision: 75b0a0dd78b479e230867e89989bf3e8262d850c
branch: master
specs:
vets_json_schema (24.7.0)
vets_json_schema (24.7.4)
multi_json (~> 1.0)
script_utils (= 0.0.4)

Expand All @@ -99,8 +99,6 @@ PATH
check_in (0.1.0)
claims_api (0.0.1)
dry-schema
covid_vaccine (0.1.0)
sidekiq
debts_api (0.1.0)
decision_reviews (0.1.0)
rails (>= 7.1.4.1)
Expand Down Expand Up @@ -239,23 +237,23 @@ GEM
attr_extras (7.1.0)
awesome_print (1.9.2)
aws-eventstream (1.3.0)
aws-partitions (1.1031.0)
aws-sdk-core (3.214.1)
aws-partitions (1.1039.0)
aws-sdk-core (3.216.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.96.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-kms (1.97.0)
aws-sdk-core (~> 3, >= 3.216.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.177.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-s3 (1.178.0)
aws-sdk-core (~> 3, >= 3.216.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sdk-sns (1.92.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-sns (1.93.0)
aws-sdk-core (~> 3, >= 3.216.0)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.10.1)
aws-sigv4 (1.11.0)
aws-eventstream (~> 1, >= 1.0.2)
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
Expand Down Expand Up @@ -510,7 +508,7 @@ GEM
google-api-client (0.53.0)
google-apis-core (~> 0.1)
google-apis-generator (~> 0.1)
google-apis-core (0.15.1)
google-apis-core (0.16.0)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 1.9)
httpclient (>= 2.8.3, < 3.a)
Expand Down Expand Up @@ -636,9 +634,9 @@ GEM
ffi (~> 1.0)
libddwaf (1.18.0.0.0-x86_64-linux)
ffi (~> 1.0)
liquid (5.6.0)
liquid (5.6.4)
bigdecimal
strscan
strscan (>= 3.1.1)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
Expand Down Expand Up @@ -1178,7 +1176,6 @@ DEPENDENCIES
config
connect_vbms!
coverband
covid_vaccine!
csv
danger
database_cleaner
Expand Down Expand Up @@ -1325,7 +1322,7 @@ DEPENDENCIES
slack-notify
socksify
staccato
statsd-instrument
statsd-instrument (= 3.9.8)
strong_migrations
super_diff
swagger-blocks
Expand Down
8 changes: 8 additions & 0 deletions app/controllers/appeals_base_controller_v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ class AppealsBaseControllerV1 < ApplicationController

private

def log_non_module_controller(action:, form_id:)
Rails.logger.warn({
message: 'Calling decision reviews controller outside module',
action:,
form_id:
})
end

def decision_review_service
DecisionReviewV1::Service.new
end
Expand Down
10 changes: 5 additions & 5 deletions app/controllers/claims_base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ class ClaimsBaseController < ApplicationController
skip_before_action(:authenticate)
before_action :load_user, only: :create

def show
submission = CentralMailSubmission.joins(:central_mail_claim).find_by(saved_claims: { guid: params[:id] })
render json: BenefitsIntakeSubmissionSerializer.new(submission)
end

# Creates and validates an instance of the class, removing any copies of
# the form that had been previously saved by the user.
def create
Expand All @@ -39,11 +44,6 @@ def create
render json: SavedClaimSerializer.new(claim)
end

def show
submission = CentralMailSubmission.joins(:central_mail_claim).find_by(saved_claims: { guid: params[:id] })
render json: BenefitsIntakeSubmissionSerializer.new(submission)
end

private

def filtered_params
Expand Down
12 changes: 12 additions & 0 deletions app/controllers/concerns/datadog_logging.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

module DatadogLogging
extend ActiveSupport::Concern

def log_to_datadog(context, message, stack_trace)
if Flipper.enabled?(:virtual_agent_enable_datadog_logging, current_user)
error_details = { message: message, backtrace: stack_trace }
Rails.logger.error(context, error_details)
end
end
end
5 changes: 5 additions & 0 deletions app/controllers/v0/apidocs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ class ApidocsController < ApplicationController
key :name, 'medical_copays'
key :description, 'Veteran Medical Copay information for VA facilities'
end
tag do
key :name, 'Banners'
key :description, 'VAMC Situation Update Banners'
end
key :host, Settings.hostname
key :schemes, %w[https http]
key :basePath, '/'
Expand Down Expand Up @@ -120,6 +124,7 @@ class ApidocsController < ApplicationController
Swagger::Requests::Appointments,
Swagger::Requests::ContactUs::Inquiries,
Swagger::Requests::BackendStatuses,
Swagger::Requests::Banners,
Swagger::Requests::BB::HealthRecords,
Swagger::Requests::BurialClaims,
Swagger::Requests::BenefitsReferenceData,
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/v0/claim_documents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def create
# add the file after so that we have a form_id and guid for the uploader to use
@attachment.file = unlock_file(params['file'], params['password'])

if %w[21P-527EZ 21P-530 21P-530V2].include?(form_id) &&
if %w[21P-527EZ 21P-530EZ 21P-530V2].include?(form_id) &&
Flipper.enabled?(:document_upload_validation_enabled) && !stamped_pdf_valid?

raise Common::Exceptions::ValidationErrors, @attachment
Expand Down
2 changes: 0 additions & 2 deletions app/controllers/v0/contact_us/inquiries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ def create

def form_submission
params.require(:inquiry).require(:form)
rescue
raise
end

def validate!(claim)
Expand Down
18 changes: 9 additions & 9 deletions app/controllers/v0/dependents_applications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ module V0
class DependentsApplicationsController < ApplicationController
service_tag 'dependent-change'

def show
dependents = dependent_service.get_dependents
dependents[:diaries] = dependency_verification_service.read_diaries
render json: DependentsSerializer.new(dependents)
rescue => e
log_exception_to_sentry(e)
raise Common::Exceptions::BackendServiceException.new(nil, detail: e.message)
end

def create
claim = SavedClaim::DependencyClaim.new(form: dependent_params.to_json)

Expand All @@ -22,15 +31,6 @@ def create
render json: SavedClaimSerializer.new(claim)
end

def show
dependents = dependent_service.get_dependents
dependents[:diaries] = dependency_verification_service.read_diaries
render json: DependentsSerializer.new(dependents)
rescue => e
log_exception_to_sentry(e)
raise Common::Exceptions::BackendServiceException.new(nil, detail: e.message)
end

def disability_rating
res = EVSS::Dependents::RetrievedInfo.for_user(current_user)
render json: { has30_percent: res.body.dig('submitProcess', 'application', 'has30Percent') }
Expand Down
10 changes: 5 additions & 5 deletions app/controllers/v0/gi_bill_feedbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ class GIBillFeedbacksController < ApplicationController
skip_before_action(:authenticate)
before_action :load_user, only: :create

def show
gi_bill_feedback = GIBillFeedback.find(params[:id])
render json: GIBillFeedbackSerializer.new(gi_bill_feedback)
end

def create
gi_bill_feedback = GIBillFeedback.new(
params.require(:gi_bill_feedback).permit(:form).merge(
Expand All @@ -23,10 +28,5 @@ def create

render json: GIBillFeedbackSerializer.new(gi_bill_feedback)
end

def show
gi_bill_feedback = GIBillFeedback.find(params[:id])
render json: GIBillFeedbackSerializer.new(gi_bill_feedback)
end
end
end
10 changes: 5 additions & 5 deletions app/controllers/v0/health_care_applications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ def rating_info
render json: HCARatingInfoSerializer.new(hca_rating_info)
end

def show
application = HealthCareApplication.find(params[:id])
render json: HealthCareApplicationSerializer.new(application)
end

def create
health_care_application.async_compatible = params[:async_all]
health_care_application.google_analytics_client_id = params[:ga_client_id]
Expand All @@ -52,11 +57,6 @@ def create
end
end

def show
application = HealthCareApplication.find(params[:id])
render json: HealthCareApplicationSerializer.new(application)
end

def enrollment_status
loa3 = current_user&.loa3?

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/v0/map_services_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def token
result = MAP::SecurityToken::Service.new.token(application: params[:application].to_sym, icn:, cache: false)

render json: result, status: :ok
rescue Common::Client::Errors::ClientError, Common::Exceptions::GatewayTimeout
rescue Common::Client::Errors::ClientError, Common::Exceptions::GatewayTimeout, JWT::DecodeError
render json: sts_client_error, status: :bad_gateway
rescue MAP::SecurityToken::Errors::ApplicationMismatchError
render json: application_mismatch_error, status: :bad_request
Expand Down
20 changes: 10 additions & 10 deletions app/controllers/v0/onsite_notifications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ def index
render json: OnsiteNotificationSerializer.new(notifications, options)
end

def create
onsite_notification = OnsiteNotification.new(
params.require(:onsite_notification).permit(:va_profile_id, :template_id)
)

raise Common::Exceptions::ValidationErrors, onsite_notification unless onsite_notification.save

render json: OnsiteNotificationSerializer.new(onsite_notification)
end

def update
onsite_notification = OnsiteNotification.find_by(id: params[:id], va_profile_id: current_user.vet360_id)
raise Common::Exceptions::RecordNotFound, params[:id] if onsite_notification.nil?
Expand All @@ -32,16 +42,6 @@ def update
render json: OnsiteNotificationSerializer.new(onsite_notification)
end

def create
onsite_notification = OnsiteNotification.new(
params.require(:onsite_notification).permit(:va_profile_id, :template_id)
)

raise Common::Exceptions::ValidationErrors, onsite_notification unless onsite_notification.save

render json: OnsiteNotificationSerializer.new(onsite_notification)
end

private

def authenticity_error
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/v0/profile/address_validation_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def create
VAProfile::Models::ValidationAddress.new(address_params)
end

Rails.logger.info("Staging Address valid: #{address.valid?}") if Settings.vsp_environment == 'staging'

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

Rails.logger.warn('AddressValidationController#create request completed', sso_logging_info)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# frozen_string_literal: true

require 'date'
require 'datadog_logging'

module V0
module VirtualAgent
class VirtualAgentAppealController < AppealsBaseController
include DatadogLogging
service_tag 'virtual-agent'

def index
Expand Down Expand Up @@ -165,6 +167,8 @@ def get_status_type_text(appeal_status, aoj)
appeal_status_description = 'Unknown Status'
unknown_status_error = StandardError.new("Unknown status: #{appeal_status} with AOJ: #{aoj}")
log_exception_to_sentry(unknown_status_error, { appeal_status => appeal_status, aoj => aoj })
log_to_datadog(appeal_status_description, unknown_status_error.message,
unknown_status_error.backtrace)
end

if appeal_status_description.include? '{aoj_desc}'
Expand Down Expand Up @@ -192,6 +196,7 @@ def set_user_credentials
def service_exception_handler(exception)
context = 'An error occurred while attempting to retrieve the appeal(s)'
log_exception_to_sentry(exception, 'context' => context)
log_to_datadog(context, exception.message, exception.backtrace)
render nothing: true, status: :internal_server_error
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
require 'date'
require 'concurrent'
require 'lighthouse/benefits_claims/service'
require 'datadog_logging'

module V0
module VirtualAgent
class VirtualAgentClaimStatusController < ApplicationController
include DatadogLogging
include IgnoreNotFound
service_tag 'virtual-agent'
rescue_from 'EVSS::ErrorMiddleware::EVSSError', with: :service_exception_handler
Expand Down Expand Up @@ -79,12 +81,14 @@ def order_claims_lighthouse(claims)
def service_exception_handler(exception)
context = 'An error occurred while attempting to retrieve the claim(s).'
log_exception_to_sentry(exception, 'context' => context)
log_to_datadog(context, exception.message, exception.backtrace)
render nothing: true, status: :service_unavailable
end

def report_exception_handler(exception)
context = 'An error occurred while attempting to report the claim(s).'
log_exception_to_sentry(exception, 'context' => context)
log_to_datadog(context, exception.message, exception.backtrace)
end

class ServiceException < RuntimeError; end
Expand Down
Loading

0 comments on commit c93bd5b

Please sign in to comment.