Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

WIP #18522

Closed
wants to merge 2 commits into from
Closed

WIP #18522

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
12 changes: 10 additions & 2 deletions _scripts/cirrus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@

echo -e "Starting cirrus experimenter."

CHANNEL_FILE="cirrus.env.development"

if [[ "${NIMBUS_CIRRUS_CHANNEL}" == "release" ]]; then
CHANNEL_FILE="cirrus.env.release"
elif [[ "${NIMBUS_CIRRUS_CHANNEL}" == "stage" ]]; then
CHANNEL_FILE="cirrus.env.stage"
fi

docker run --rm --name cirrus \
--net fxa \
--mount type=bind,source=$(pwd)/_scripts/configs/cirrus.env.sample,target=/cirrus/.env \
--mount type=bind,source=$(pwd)/_scripts/configs/cirrus.fml.yml,target=/cirrus/feature_manifest/fml.yml \
--mount type=bind,source="$(pwd)/_scripts/configs/${CHANNEL_FILE},target=/cirrus/.env" \
--mount type=bind,source="$(pwd)/_scripts/configs/cirrus.fml.yml,target=/cirrus/feature_manifest/frontend-experiments.fml.yml" \
--memory=1024m \
-p 8001:8001 \
mozilla/cirrus:sha-1275f51cb
11 changes: 11 additions & 0 deletions _scripts/configs/cirrus.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CIRRUS_REMOTE_SETTING_URL=https://firefox.settings.services.allizom.org/v1/buckets/main/collections/nimbus-web-experiments/records
CIRRUS_REMOTE_SETTING_PREVIEW_URL=https://firefox.settings.services.allizom.org/v1/buckets/main/collections/nimbus-web-preview/records
CIRRUS_REMOTE_SETTING_REFRESH_RATE_IN_SECONDS=10
CIRRUS_APP_ID=accounts.cirrus
CIRRUS_APP_NAME=accounts_cirrus
CIRRUS_CHANNEL=development
CIRRUS_FML_PATH=/cirrus/feature_manifest/frontend-experiments.fml.yml
CIRRUS_SENTRY_DSN=
CIRRUS_INSTANCE_NAME=cirrus_pod_app_v1
CIRRUS_ENV_NAME=fxa_development
CIRRUS_GLEAN_MAX_EVENTS_BUFFER=10
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ CIRRUS_REMOTE_SETTING_REFRESH_RATE_IN_SECONDS=10
CIRRUS_APP_ID=accounts.cirrus
CIRRUS_APP_NAME=accounts_cirrus
CIRRUS_CHANNEL=release
CIRRUS_FML_PATH=/cirrus/feature_manifest/sample.yml
# CIRRUS_SENTRY_DSN=dsn_url
CIRRUS_FML_PATH=/cirrus/feature_manifest/frontend-experiments.fml.yml
CIRRUS_SENTRY_DSN=
CIRRUS_INSTANCE_NAME=cirrus_pod_app_v1
CIRRUS_ENV_NAME=test_app_stage
CIRRUS_ENV_NAME=fxa_release
CIRRUS_GLEAN_MAX_EVENTS_BUFFER=10
11 changes: 11 additions & 0 deletions _scripts/configs/cirrus.env.stage
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CIRRUS_REMOTE_SETTING_URL=https://firefox.settings.services.allizom.org/v1/buckets/main/collections/nimbus-web-experiments/records
CIRRUS_REMOTE_SETTING_PREVIEW_URL=https://firefox.settings.services.allizom.org/v1/buckets/main/collections/nimbus-web-preview/records
CIRRUS_REMOTE_SETTING_REFRESH_RATE_IN_SECONDS=10
CIRRUS_APP_ID=accounts.cirrus
CIRRUS_APP_NAME=accounts_cirrus
CIRRUS_CHANNEL=stage
CIRRUS_FML_PATH=/cirrus/feature_manifest/frontend-experiments.fml.yml
CIRRUS_SENTRY_DSN=
CIRRUS_INSTANCE_NAME=cirrus_pod_app_v1
CIRRUS_ENV_NAME=fxa_stage
CIRRUS_GLEAN_MAX_EVENTS_BUFFER=10
11 changes: 7 additions & 4 deletions _scripts/configs/cirrus.fml.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
about:
description: Nimbus Feature Manifest for Python Testing
description: Nimbus Feature Manifest for FxA Frontend Experimentation
channels:
- beta
- development
- stage
- release
features:
example-feature:
Expand All @@ -16,10 +17,12 @@ features:
type: Option<String>
default: null
defaults:
- channel: beta
- channel: development
value: { "enabled": false }
- channel: stage
value: { "enabled": true }
- channel: release
value: { "something": "wicked" }
value: { "something": "nice" }

types:
objects: {}
Expand Down
18 changes: 0 additions & 18 deletions packages/fxa-graphql-api/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,4 @@ module.exports = {
},
coverageDirectory: './coverage',
testEnvironment: 'node',
moduleNameMapper: {
'@fxa/accounts/recovery-phone':
'<rootDir>/../../../libs/accounts/recovery-phone/src/index.ts',
'@fxa/shared/mozlog': '<rootDir>/../../../libs/shared/mozlog/src/index',
'@fxa/shared/l10n': '<rootDir>/../../../libs/shared/l10n/src/index.ts',
'@fxa/shared/notifier':
'<rootDir>/../../../libs/shared/notifier/src/index.ts',
'@fxa/shared/metrics/statsd':
'<rootDir>/../../../libs/shared/metrics/statsd/src/index.ts',
'@fxa/shared/log': '<rootDir>/../../../libs/shared/log/src/index.ts',
'@fxa/shared/db/mysql/account': [
'<rootDir>/../../../libs/shared/db/mysql/account/src/index.ts',
],
'@fxa/shared/db/mysql/core':
'<rootDir>/../../../libs/shared/db/mysql/core/src/index.ts',
'@fxa/shared/error': '<rootDir>/../../../libs/shared/error/src/index.ts',
'@fxa/shared/otp': '<rootDir>/../../../libs/shared/otp/src/index.ts',
},
};
1 change: 1 addition & 0 deletions packages/fxa-graphql-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
},
"nx": {
"tags": [
"scope:server",
"scope:gql",
"type:core"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { PassportStrategy } from '@nestjs/passport';
import { deriveHawkCredentials } from 'fxa-auth-client';
import { SessionToken } from 'fxa-shared/db/models/auth/session-token';
import { ExtendedError } from 'fxa-shared/nestjs/error';
import { Token } from 'graphql';
import { Strategy } from 'passport-http-bearer';

export interface SessionTokenResult {
Expand Down
68 changes: 0 additions & 68 deletions packages/fxa-graphql-api/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,74 +267,6 @@ const conf = convict({
},
},
},
recoveryPhone: {
enabled: {
default: false,
doc: 'Enable recovery phone feature',
env: 'RECOVERY_PHONE__ENABLED',
format: Boolean,
},
allowedRegions: {
default: ['CA', 'US'],
doc: 'Allowed regions for recovery phone',
env: 'RECOVERY_PHONE__ALLOWED_REGIONS',
format: Array,
},
otp: {
kind: {
default: 'recovery-phone-code',
doc: 'An identifier for the type of otp codes being sent out',
env: 'RECOVERY_PHONE__OTP__KIND',
format: String,
},
digits: {
default: 6,
doc: 'The number of digits in an otp code',
env: 'RECOVERY_PHONE__OTP__DIGITS',
format: Number,
},
},
maxRegistrationsPerNumber: {
default: 5,
doc: 'Max number of uids that can be associated to the same phone number.',
env: 'RECOVERY_PHONE__MAX_UID_PER_NUMBER',
format: Number,
},
redis: {},
sms: {
from: {
default: ['15005550006'],
doc: 'The twilio number messages are sent from.',
env: 'RECOVERY_PHONE__SMS__FROM',
format: Array,
},
maxMessageSegmentLength: {
default: 160,
doc: 'Max allowed sms message segment length',
env: 'RECOVERY_PHONE__SMS__MAX_MESSAGE_SEGMENT_LENGTH',
format: Number,
},
validNumberPrefixes: {
default: ['+1'], // USA and Canada
doc: 'Allowed phone number prefixes. Controls the locales that a message can be sent to.',
env: 'RECOVERY_PHONE__SMS__VALID_NUMBER_PREFIXES',
format: Array,
},
},
},
twilio: {
accountSid: {
default: 'AC00000000000000000000000000000000',
doc: 'Twilio Account ID',
env: 'RECOVERY_PHONE__TWILIO__ACCOUNT_SID',
format: String,
},
authToken: {
default: '00000000000000000000000000000000',
doc: 'Twilio Auth Token, required to access api',
env: 'RECOVERY_PHONE__TWILIO__AUTH_TOKEN',
},
},
});

// handle configuration files. you can specify a CSV list of configuration
Expand Down
21 changes: 6 additions & 15 deletions packages/fxa-graphql-api/src/gql/account.resolver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { AuthClientService } from '../backend/auth-client.service';
import { ProfileClientService } from '../backend/profile-client.service';
import { AccountResolver } from './account.resolver';
import { NotifierService, NotifierSnsService } from '@fxa/shared/notifier';
import { RecoveryPhoneService } from '@fxa/accounts/recovery-phone';
import { GraphQLResolveInfo } from 'graphql';

let USER_1: any;
Expand All @@ -33,7 +32,6 @@ describe('#integration - AccountResolver', () => {
let logger: any;
let knex: Knex;
let authClient: any;
let recoveryPhoneService: any;
let profileClient: any;
let notifierSnsService: any;
let notifierService: any;
Expand All @@ -57,9 +55,6 @@ describe('#integration - AccountResolver', () => {
notifierService = {
send: jest.fn(),
};
recoveryPhoneService = {
hasConfirmed: jest.fn(),
};
const MockMozLogger: Provider = {
provide: MozLoggerService,
useValue: logger,
Expand Down Expand Up @@ -99,10 +94,6 @@ describe('#integration - AccountResolver', () => {
provide: ConfigService,
useValue: { get: jest.fn().mockReturnValue({ url: 'test' }) },
},
{
provide: RecoveryPhoneService,
useValue: recoveryPhoneService,
},
],
}).compile();

Expand Down Expand Up @@ -203,13 +194,15 @@ describe('#integration - AccountResolver', () => {
const linkedAccounts = resolver.linkedAccounts(user!);
expect(linkedAccounts).toEqual([]);
});

it('resolves recovery phone number', async () => {
authClient.recoveryPhoneGet = jest.fn().mockResolvedValue({
exists: true,
phoneNumber: '+11234567890',
});
authClient.recoveryPhoneAvailable = jest
.fn()
.mockResolvedValue({ available: true });
recoveryPhoneService.hasConfirmed = jest
.fn()
.mockResolvedValue({ exists: true, phoneNumber: '+11234567890' });

const user = await Account.findByUid(USER_1.uid);
// Make the private method public for testing in favor of mocking 'info',
Expand All @@ -229,9 +222,6 @@ describe('#integration - AccountResolver', () => {
{} as unknown as GraphQLResolveInfo
);

expect(recoveryPhoneService.hasConfirmed).toHaveBeenCalledWith(
user!.uid
);
expect(authClient.recoveryPhoneAvailable).toHaveBeenCalledWith(
'token',
headers
Expand Down Expand Up @@ -916,6 +906,7 @@ describe('#integration - AccountResolver', () => {
expect(authClient.passwordChangeStartWithAuthPW).toBeCalledWith(
'foo@moz.com',
'3456789abcdef12',
'sessionToken',
{},
headers
);
Expand Down
3 changes: 0 additions & 3 deletions packages/fxa-graphql-api/src/gql/account.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ import { FinishSetupInput } from './dto/input/finish-setup';
import { EmailBounceStatusPayload } from './dto/payload/email-bounce';
import { NotifierService } from '@fxa/shared/notifier';
import { MozLoggerService } from '@fxa/shared/mozlog';
import { RecoveryPhoneService } from '@fxa/accounts/recovery-phone';
import { RecoveryPhone } from './model/recoveryPhone';

function snakeToCamel(str: string) {
Expand All @@ -113,7 +112,6 @@ export function snakeToCamelObject(obj: { [key: string]: any }) {
export class AccountResolver {
constructor(
@Inject(AuthClientService) private authAPI: AuthClient,
private recoveryPhoneService: RecoveryPhoneService,
private notifier: NotifierService,
private profileAPI: ProfileClientService,
private log: MozLoggerService
Expand Down Expand Up @@ -883,7 +881,6 @@ export class AccountResolver {
sessionToken,
headers
);

if (includeAvailability) {
// This queries the auth-server endpoint instead of directly due to
// this endpoint needing maxmind
Expand Down
21 changes: 0 additions & 21 deletions packages/fxa-graphql-api/src/gql/gql.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@ import { ClientInfoResolver } from './clientInfo.resolver';
import { LegalResolver } from './legal.resolver';
import { SessionResolver } from './session.resolver';
import { SubscriptionResolver } from './subscription.resolver';
import {
RecoveryPhoneManager,
RecoveryPhoneService,
SmsManager,
TwilioFactory,
TwilioConfigProvider,
SmsConfigProvider,
RecoveryPhoneRedisProvider,
RecoveryPhoneConfigProvider,
} from '@fxa/accounts/recovery-phone';
import {
OtpConfigProvider,
OtpManagerProvider,
Expand Down Expand Up @@ -95,17 +85,6 @@ export const GraphQLConfigFactory = async (
useClass: MozLoggerService,
},
AccountDatabaseNestFactory,
RecoveryPhoneConfigProvider,
RecoveryPhoneService,
RecoveryPhoneRedisProvider,
RecoveryPhoneManager,
SmsConfigProvider,
SmsManager,
TwilioFactory,
TwilioConfigProvider,
OtpConfigProvider,
OtpRedisStorageProvider,
OtpManagerProvider,
MySQLConfigProvider,
],
})
Expand Down
19 changes: 0 additions & 19 deletions packages/fxa-graphql-api/test/jest-e2e.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,4 @@ module.exports = {
transform: {
'^.+\\.(t|j)s$': ['ts-jest', { isolatedModules: true }],
},
moduleNameMapper: {
'@fxa/accounts/recovery-phone':
'<rootDir>/../../../libs/accounts/recovery-phone/src/index.ts',
'@fxa/shared/mozlog': '<rootDir>/../../../libs/shared/mozlog/src/index',
'@fxa/shared/l10n': '<rootDir>/../../../libs/shared/l10n/src/index.ts',
'@fxa/shared/notifier':
'<rootDir>/../../../libs/shared/notifier/src/index.ts',
'@fxa/shared/metrics/statsd':
'<rootDir>/../../../libs/shared/metrics/statsd/src/index.ts',
'@fxa/shared/log': '<rootDir>/../../../libs/shared/log/src/index.ts',
'@fxa/shared/db/mysql/account': [
'<rootDir>/../../../libs/shared/db/mysql/account/src/index.ts',
],
'@fxa/shared/db/mysql/core':
'<rootDir>/../../../libs/shared/db/mysql/core/src/index.ts',
'@fxa/shared/error': '<rootDir>/../../../libs/shared/error/src/index.ts',
'@fxa/shared/otp': '<rootDir>/../../../libs/shared/otp/src/index.ts',
'@fxa/shared/sentry': '<rootDir>/../../../libs/shared/sentry/src/index',
},
};
3 changes: 1 addition & 2 deletions packages/fxa-graphql-api/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"@fxa/shared/notifier": ["libs/shared/notifier/src/index"],
"@fxa/shared/sentry": ["libs/shared/sentry/src/index"],
"@fxa/shared/otp": ["libs/shared/otp/src/index"],
"@fxa/shared/error": ["libs/shared/error/src/index"],
"@fxa/accounts/recovery-phone": ["libs/accounts/recovery-phone/src/index"]
"@fxa/shared/error": ["libs/shared/error/src/index"]
}
}
}