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

Remove CHIP only feature flag, attempt 2 #1825

Merged
merged 5 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { HealthPlanPackageType } from '../../domain-models'
import { toDomain } from '../../../../app-web/src/common-code/proto/healthPlanFormDataProto'
import { sharedTestPrismaClient } from '../../testHelpers/storeHelpers'
import { insertHealthPlanPackage } from './insertHealthPlanPackage'
import {
insertHealthPlanPackage,
InsertHealthPlanPackageArgsType,
} from './insertHealthPlanPackage'
import { isStoreError } from '../storeError'

describe('insertHealthPlanPackage', () => {
Expand All @@ -13,14 +16,14 @@ describe('insertHealthPlanPackage', () => {

const client = await sharedTestPrismaClient()

const args = {
const args: InsertHealthPlanPackageArgsType = {
stateCode: 'FL',
populationCovered: 'MEDICAID',
programIDs: ['smmc'],
riskBasedContract: false,
submissionType: 'CONTRACT_ONLY' as const,
submissionType: 'CONTRACT_ONLY',
submissionDescription: 'concurrency state code test',
contractType: 'BASE' as const,
populationCovered: 'MEDICAID' as const,
contractType: 'BASE',
}

const resultPromises = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { PopulationCoveredType } from '../../gen/gqlServer'

export type InsertHealthPlanPackageArgsType = {
stateCode: string
populationCovered?: PopulationCoveredType
populationCovered: PopulationCoveredType
programIDs: string[]
riskBasedContract?: boolean
submissionType: SubmissionType
Expand Down
3 changes: 1 addition & 2 deletions services/app-api/src/resolvers/configureResolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ export function configureResolvers(
submitHealthPlanPackage: submitHealthPlanPackageResolver(
store,
emailer,
emailParameterStore,
launchDarkly
emailParameterStore
),
unlockHealthPlanPackage: unlockHealthPlanPackageResolver(
store,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ describe.each(flagValueTestParameters)(
})

const input: CreateHealthPlanPackageInput = {
populationCovered: 'MEDICAID',
programIDs: [
'5c10fe9f-bec9-416f-a20c-718b152ad633',
'037af66b-81eb-4472-8b80-01edf17d12d9',
Expand Down Expand Up @@ -74,6 +75,7 @@ describe.each(flagValueTestParameters)(
ldService: mockLDService,
})
const input: CreateHealthPlanPackageInput = {
populationCovered: 'MEDICAID',
programIDs: ['xyz123'],
riskBasedContract: false,
submissionType: 'CONTRACT_ONLY',
Expand All @@ -100,6 +102,7 @@ describe.each(flagValueTestParameters)(
})

const input: CreateHealthPlanPackageInput = {
populationCovered: 'MEDICAID',
programIDs: ['xyz123'],
riskBasedContract: false,
submissionType: 'CONTRACT_ONLY',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
getTestStateAnalystsEmails,
} from '../../testHelpers/parameterStoreHelpers'
import * as awsSESHelpers from '../../testHelpers/awsSESHelpers'
import { testLDService } from '../../testHelpers/launchDarklyHelpers'
import { testCMSUser, testStateUser } from '../../testHelpers/userHelpers'

describe('submitHealthPlanPackage', () => {
Expand Down Expand Up @@ -903,10 +902,7 @@ describe('submitHealthPlanPackage', () => {

describe('Feature flagged population coverage question test', () => {
it('errors when population coverage question is undefined', async () => {
const mockLDService = testLDService({ 'chip-only-form': true })
const server = await constructTestPostgresServer({
ldService: mockLDService,
})
const server = await constructTestPostgresServer()

// setup
const initialPkg = await createAndUpdateTestHealthPlanPackage(server, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
hasAnyValidRateData,
isContractAndRates,
removeRatesData,
hasValidPopulationCoverage,
removeInvalidProvisionsAndAuthorities,
isValidAndCurrentLockedHealthPlanFormData,
hasValidSupportingDocumentCategories,
Expand All @@ -29,9 +28,7 @@ import {
} from '../attributeHelper'
import { toDomain } from '../../../../app-web/src/common-code/proto/healthPlanFormDataProto'
import { EmailParameterStore } from '../../parameterStore'
import { LDService } from '../../launchDarkly/launchDarkly'
import { GraphQLError } from 'graphql'
import { FeatureFlagSettings } from 'app-web/src/common-code/featureFlags'

import type {
UnlockedHealthPlanFormDataType,
Expand Down Expand Up @@ -70,29 +67,17 @@ export function isSubmissionError(err: unknown): err is SubmissionError {
// This strategy (returning a different type from validation) is taken from the
// "parse, don't validate" article: https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/
function submit(
draft: UnlockedHealthPlanFormDataType,
featureFlags?: FeatureFlagSettings
draft: UnlockedHealthPlanFormDataType
): LockedHealthPlanFormDataType | SubmissionError {
const maybeStateSubmission: Record<string, unknown> = {
...draft,
status: 'SUBMITTED',
submittedAt: new Date(),
}

// move this check into isValidContract when feature flag is removed
const validPopulationCovered = featureFlags?.['chip-only-form']
? hasValidPopulationCoverage(
maybeStateSubmission as LockedHealthPlanFormDataType
)
: true

if (
isValidAndCurrentLockedHealthPlanFormData(maybeStateSubmission) &&
validPopulationCovered
)
if (isValidAndCurrentLockedHealthPlanFormData(maybeStateSubmission))
return maybeStateSubmission
else if (
!validPopulationCovered ||
!hasValidContract(maybeStateSubmission as LockedHealthPlanFormDataType)
) {
return {
Expand Down Expand Up @@ -139,20 +124,14 @@ function submit(
export function submitHealthPlanPackageResolver(
store: Store,
emailer: Emailer,
emailParameterStore: EmailParameterStore,
launchDarkly: LDService
emailParameterStore: EmailParameterStore
): MutationResolvers['submitHealthPlanPackage'] {
return async (_parent, { input }, context) => {
const { user, span } = context
const { submittedReason, pkgID } = input
setResolverDetailsOnActiveSpan('submitHealthPlanPackage', user, span)
span?.setAttribute('mcreview.package_id', pkgID)

const chipOnlyFormFlag = await launchDarkly.getFeatureFlag(
context,
'chip-only-form'
)

// This resolver is only callable by state users
if (!isStateUser(user)) {
logError(
Expand Down Expand Up @@ -284,9 +263,7 @@ export function submitHealthPlanPackageResolver(
}

// attempt to parse into a StateSubmission
const submissionResult = submit(draftResult, {
'chip-only-form': chipOnlyFormFlag,
})
const submissionResult = submit(draftResult)

if (isSubmissionError(submissionResult)) {
const errMessage = submissionResult.message
Expand Down
3 changes: 2 additions & 1 deletion services/app-api/src/testHelpers/gqlHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ const createTestHealthPlanPackage = async (
const programIDs = programs.map((program) => program.id)
const input: CreateHealthPlanPackageInput = {
programIDs: programIDs,
populationCovered: 'MEDICAID',
riskBasedContract: false,
submissionType: 'CONTRACT_ONLY' as const,
submissionType: 'CONTRACT_ONLY',
submissionDescription: 'A created submission',
contractType: 'BASE',
}
Expand Down
2 changes: 1 addition & 1 deletion services/app-graphql/src/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ type Mutation {

input CreateHealthPlanPackageInput {
"Population that the contract covers"
populationCovered: PopulationCoveredType
populationCovered: PopulationCoveredType!
"An array of managed care program IDs this package covers"
programIDs: [ID!]!
"Whether or not this contract is risk based"
Expand Down
7 changes: 0 additions & 7 deletions services/app-web/src/common-code/featureFlags/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ const featureFlags = {
flag: 'packages-with-shared-rates',
defaultValue: false,
},
/**
* Enables Chip-only form changes
*/
CHIP_ONLY_FORM: {
flag: 'chip-only-form',
defaultValue: false,
},
/**
* Enables supporting documents to be associated with a specific rate certification on the Rate Details page
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function newHealthPlanFormData(): UnlockedHealthPlanFormDataType {
stateNumber: 5,
id: 'test-abc-123',
stateCode: 'MN',
populationCovered: 'MEDICAID',
programIDs: [mockMNState().programs[0].id],
submissionType: 'CONTRACT_AND_RATES',
riskBasedContract: true,
Expand All @@ -68,6 +69,7 @@ function basicHealthPlanFormData(): UnlockedHealthPlanFormDataType {
stateNumber: 5,
id: 'test-abc-123',
stateCode: 'MN',
populationCovered: 'MEDICAID',
programIDs: [mockMNState().programs[0].id],
submissionType: 'CONTRACT_AND_RATES',
riskBasedContract: true,
Expand All @@ -94,6 +96,7 @@ function contractOnly(): UnlockedHealthPlanFormDataType {
stateNumber: 5,
id: 'test-abc-123',
stateCode: 'MN',
populationCovered: 'MEDICAID',
programIDs: [mockMNState().programs[0].id],
submissionType: 'CONTRACT_ONLY',
riskBasedContract: false,
Expand All @@ -120,6 +123,7 @@ function contractAmendedOnly(): UnlockedHealthPlanFormDataType {
stateNumber: 5,
id: 'test-abc-123',
stateCode: 'MN',
populationCovered: 'MEDICAID',
programIDs: [mockMNState().programs[0].id],
submissionType: 'CONTRACT_ONLY',
riskBasedContract: false,
Expand Down Expand Up @@ -167,6 +171,7 @@ function unlockedWithContacts(): UnlockedHealthPlanFormDataType {
stateNumber: 5,
id: 'test-abc-123',
stateCode: 'MN',
populationCovered: 'MEDICAID',
programIDs: [mockMNState().programs[0].id],
submissionType: 'CONTRACT_AND_RATES',
riskBasedContract: true,
Expand Down Expand Up @@ -254,6 +259,7 @@ function unlockedWithDocuments(): UnlockedHealthPlanFormDataType {
stateNumber: 5,
id: 'test-abc-123',
stateCode: 'MN',
populationCovered: 'MEDICAID',
programIDs: [mockMNState().programs[0].id],
submissionType: 'CONTRACT_AND_RATES',
riskBasedContract: true,
Expand Down Expand Up @@ -364,6 +370,7 @@ function unlockedWithFullRates(): UnlockedHealthPlanFormDataType {
stateNumber: 5,
id: 'test-abc-123',
stateCode: 'MN',
populationCovered: 'MEDICAID',
programIDs: [mockMNState().programs[0].id],
submissionType: 'CONTRACT_AND_RATES',
riskBasedContract: true,
Expand Down Expand Up @@ -409,7 +416,7 @@ function unlockedWithFullRates(): UnlockedHealthPlanFormDataType {
documentCategories: ['RATES'],
},
],
supportingDocuments: [],
supportingDocuments: [],
actuaryContacts: [
{
name: 'foo bar',
Expand Down Expand Up @@ -468,6 +475,7 @@ function unlockedWithFullContracts(): UnlockedHealthPlanFormDataType {
stateNumber: 5,
id: 'test-abc-123',
stateCode: 'MN',
populationCovered: 'MEDICAID',
programIDs: [mockMNState().programs[0].id],
submissionType: 'CONTRACT_AND_RATES',
riskBasedContract: true,
Expand Down Expand Up @@ -540,7 +548,7 @@ function unlockedWithFullContracts(): UnlockedHealthPlanFormDataType {
documentCategories: ['RATES'],
},
],
supportingDocuments: [],
supportingDocuments: [],
actuaryContacts: [
{
name: 'foo bar',
Expand Down Expand Up @@ -599,6 +607,7 @@ function unlockedWithALittleBitOfEverything(): UnlockedHealthPlanFormDataType {
status: 'DRAFT',
stateCode: 'MN',
stateNumber: 5,
populationCovered: 'MEDICAID',
programIDs: [
mockMNState().programs[0].id,
mockMNState().programs[1].id,
Expand Down Expand Up @@ -735,6 +744,7 @@ function basicLockedHealthPlanFormData(): LockedHealthPlanFormDataType {
stateNumber: 5,
id: 'test-abc-123',
stateCode: 'MN',
populationCovered: 'MEDICAID',
programIDs: [mockMNState().programs[0].id],
submissionType: 'CONTRACT_ONLY',
riskBasedContract: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ const hasValidContract = (sub: LockedHealthPlanFormDataType): boolean =>
sub.managedCareEntities.length !== 0 &&
sub.federalAuthorities.length !== 0 &&
sub.riskBasedContract !== undefined &&
hasValidModifiedProvisions(sub)
hasValidModifiedProvisions(sub) &&
hasValidPopulationCoverage(sub)

const hasValidPopulationCoverage = (
sub: LockedHealthPlanFormDataType
Expand Down Expand Up @@ -305,7 +306,7 @@ const generateRateName = (
return rateName
}

// This logic is no longer needed once SUPPORTING_DOCS_BY_RATE flag is on in production
// This logic is no longer needed once SUPPORTING_DOCS_BY_RATE flag is on in production
const convertRateSupportingDocs = (
documents: SubmissionDocument[]
): SubmissionDocument[] => {
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { screen } from '@testing-library/react'
import {
ldUseClientSpy,
renderWithProviders,
} from '../../../testHelpers/jestHelpers'
import { renderWithProviders } from '../../../testHelpers/jestHelpers'
import { SubmissionTypeSummarySection } from './SubmissionTypeSummarySection'
import {
mockContractAndRatesDraft,
Expand Down Expand Up @@ -69,7 +66,6 @@ describe('SubmissionTypeSummarySection', () => {
})

it('renders expected fields for draft package on review and submit', () => {
ldUseClientSpy({ 'chip-only-form': true })
renderWithProviders(
<SubmissionTypeSummarySection
submission={draftSubmission}
Expand Down Expand Up @@ -104,7 +100,6 @@ describe('SubmissionTypeSummarySection', () => {
})

it('renders missing field message for population coverage question when expected', () => {
ldUseClientSpy({ 'chip-only-form': true })
renderWithProviders(
<SubmissionTypeSummarySection
submission={
Expand Down
Loading
Loading