Skip to content

Commit

Permalink
refactor(flags): remove ENABLE_EXPORT_NEURONS_REPORT feature flag (#6372
Browse files Browse the repository at this point in the history
)

# Motivation

The feature has been enabled by default in production for over a month.
We can clean up the code related to the feature flag since there is no
need to hide it in the future.

# Changes

-  Removed all references to `ENABLE_EXPORT_NEURONS_REPORT`
-  Removed tests that check the behavior of turning off the feature.

# Tests

-  Tests should pass as before.

# Todos

- [ ] Add entry to changelog (if necessary).
Not necessary
  • Loading branch information
yhabib authored Feb 10, 2025
1 parent 8621bcb commit d2c683f
Show file tree
Hide file tree
Showing 12 changed files with 5 additions and 48 deletions.
1 change: 0 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
"ENABLE_CKTESTBTC": false,
"DISABLE_IMPORT_TOKEN_VALIDATION_FOR_TESTING": false,
"ENABLE_PERIODIC_FOLLOWING_CONFIRMATION": true,
"ENABLE_EXPORT_NEURONS_REPORT": true,
"ENABLE_USD_VALUES": true,
"ENABLE_USD_VALUES_FOR_NEURONS": true,
"ENABLE_PORTFOLIO_PAGE": true,
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/lib/components/header/AccountMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import Logout from "$lib/components/header/Logout.svelte";
import ManageInternetIdentityButton from "$lib/components/header/ManageInternetIdentityButton.svelte";
import { authSignedInStore } from "$lib/derived/auth.derived";
import { ENABLE_EXPORT_NEURONS_REPORT } from "$lib/stores/feature-flags.store";
import { i18n } from "$lib/stores/i18n";
import { IconUser, Popover } from "@dfinity/gix-components";
Expand Down Expand Up @@ -41,9 +40,7 @@

<LinkToCanisters on:nnsLink={closeMenu} />

{#if $ENABLE_EXPORT_NEURONS_REPORT}
<LinkToReporting on:nnsLink={closeMenu} />
{/if}
<LinkToReporting on:nnsLink={closeMenu} />

<Logout on:nnsLogoutTriggered={toggle} />
</div>
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/lib/constants/environment.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export interface FeatureFlags<T> {
ENABLE_CKTESTBTC: T;
DISABLE_IMPORT_TOKEN_VALIDATION_FOR_TESTING: T;
ENABLE_PERIODIC_FOLLOWING_CONFIRMATION: T;
ENABLE_EXPORT_NEURONS_REPORT: T;
ENABLE_USD_VALUES: T;
ENABLE_USD_VALUES_FOR_NEURONS: T;
ENABLE_PORTFOLIO_PAGE: T;
Expand All @@ -28,7 +27,6 @@ export const defaultFeatureFlagValues: FeatureFlags<boolean> = {
ENABLE_CKTESTBTC: false,
DISABLE_IMPORT_TOKEN_VALIDATION_FOR_TESTING: false,
ENABLE_PERIODIC_FOLLOWING_CONFIRMATION: false,
ENABLE_EXPORT_NEURONS_REPORT: false,
ENABLE_USD_VALUES: false,
ENABLE_USD_VALUES_FOR_NEURONS: false,
ENABLE_PORTFOLIO_PAGE: false,
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/lib/stores/feature-flags.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export const EDITABLE_FEATURE_FLAGS: Array<FeatureKey> = [
"ENABLE_CKTESTBTC",
"DISABLE_IMPORT_TOKEN_VALIDATION_FOR_TESTING",
"ENABLE_PERIODIC_FOLLOWING_CONFIRMATION",
"ENABLE_EXPORT_NEURONS_REPORT",
"ENABLE_USD_VALUES",
"ENABLE_USD_VALUES_FOR_NEURONS",
"ENABLE_PORTFOLIO_PAGE",
Expand Down Expand Up @@ -155,7 +154,6 @@ export const {
ENABLE_CKTESTBTC,
DISABLE_IMPORT_TOKEN_VALIDATION_FOR_TESTING,
ENABLE_PERIODIC_FOLLOWING_CONFIRMATION,
ENABLE_EXPORT_NEURONS_REPORT,
ENABLE_USD_VALUES,
ENABLE_USD_VALUES_FOR_NEURONS,
ENABLE_PORTFOLIO_PAGE,
Expand Down
6 changes: 0 additions & 6 deletions frontend/src/routes/(app)/(nns)/reporting/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
import Content from "$lib/components/layout/Content.svelte";
import Layout from "$lib/components/layout/Layout.svelte";
import { AppPath } from "$lib/constants/routes.constants";
import { ENABLE_EXPORT_NEURONS_REPORT } from "$lib/stores/feature-flags.store";
import { referrerPathStore } from "$lib/stores/routes.store";
import { onMount } from "svelte";
onMount(async () => {
if ($ENABLE_EXPORT_NEURONS_REPORT !== true) await goto(AppPath.Accounts);
});
const back = async () => {
if ($referrerPathStore.length > 0) {
Expand Down
14 changes: 0 additions & 14 deletions frontend/src/tests/lib/components/header/AccountMenu.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import AccountMenu from "$lib/components/header/AccountMenu.svelte";
import { overrideFeatureFlagsStore } from "$lib/stores/feature-flags.store";
import {
mockLinkClickEvent,
resetNavigationCallbacks,
Expand Down Expand Up @@ -130,18 +129,7 @@ describe("AccountMenu", () => {
vi.spyOn(console, "error").mockImplementation(() => {});
});

it("should not show the LinkToReporting button if feature flag is off(by default", async () => {
const { accountMenuPo } = renderComponent();
await accountMenuPo.openMenu();

expect(await accountMenuPo.getLinkToReportingPo().isPresent()).toBe(
false
);
});

it("should display Reporting button link", async () => {
overrideFeatureFlagsStore.setFlag("ENABLE_EXPORT_NEURONS_REPORT", true);

const { accountMenuPo } = renderComponent();
await accountMenuPo.openMenu();

Expand All @@ -151,8 +139,6 @@ describe("AccountMenu", () => {
});

it("should close popover on click on reporting", async () => {
overrideFeatureFlagsStore.setFlag("ENABLE_EXPORT_NEURONS_REPORT", true);

const { accountMenuPo, linkToReportingPo } = renderComponent();
await accountMenuPo.openMenu();

Expand Down
14 changes: 0 additions & 14 deletions frontend/src/tests/routes/app/reporting/layout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { goto } from "$app/navigation";
import { OWN_CANISTER_ID_TEXT } from "$lib/constants/canister-ids.constants";
import { AppPath } from "$lib/constants/routes.constants";
import { pageStore } from "$lib/derived/page.derived";
import { overrideFeatureFlagsStore } from "$lib/stores/feature-flags.store";
import { referrerPathStore } from "$lib/stores/routes.store";
import { page } from "$mocks/$app/stores";
import Layout from "$routes/(app)/(nns)/reporting/+layout.svelte";
Expand All @@ -26,19 +25,6 @@ describe("Layout", () => {
return render(Layout);
};

beforeEach(() => {
overrideFeatureFlagsStore.setFlag("ENABLE_EXPORT_NEURONS_REPORT", true);
});

it("should redirect to /accounts if feature flag is off", async () => {
overrideFeatureFlagsStore.setFlag("ENABLE_EXPORT_NEURONS_REPORT", false);

renderReporting();

expect(goto).toHaveBeenCalledWith(AppPath.Accounts);
expect(goto).toHaveBeenCalledTimes(1);
});

it("should stay in the page if feature flag is on", () => {
renderReporting();

Expand Down
1 change: 0 additions & 1 deletion frontend/vitest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ vi.mock("./src/lib/utils/env-vars.utils.ts", () => ({
ENABLE_CKTESTBTC: true,
DISABLE_IMPORT_TOKEN_VALIDATION_FOR_TESTING: false,
ENABLE_PERIODIC_FOLLOWING_CONFIRMATION: false,
ENABLE_EXPORT_NEURONS_REPORT: false,
ENABLE_USD_VALUES: false,
ENABLE_USD_VALUES_FOR_NEURONS: false,
ENABLE_PORTFOLIO_PAGE: false,
Expand Down
2 changes: 1 addition & 1 deletion scripts/nns-dapp/test-config-assets/app/arg.did
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
record{ 0="CKUSDC_LEDGER_CANISTER_ID"; 1="xevnm-gaaaa-aaaar-qafnq-cai" };
record{ 0="CYCLES_MINTING_CANISTER_ID"; 1="rkp4c-7iaaa-aaaaa-aaaca-cai" };
record{ 0="DFX_NETWORK"; 1="app" };
record{ 0="FEATURE_FLAGS"; 1="{\"DISABLE_IMPORT_TOKEN_VALIDATION_FOR_TESTING\":false,\"ENABLE_CKTESTBTC\":false,\"ENABLE_EXPORT_NEURONS_REPORT\":true,\"ENABLE_IMPORT_TOKEN_BY_URL\":true,\"ENABLE_PERIODIC_FOLLOWING_CONFIRMATION\":true,\"ENABLE_PORTFOLIO_PAGE\":true,\"ENABLE_USD_VALUES\":true,\"ENABLE_USD_VALUES_FOR_NEURONS\":true}" };
record{ 0="FEATURE_FLAGS"; 1="{\"DISABLE_IMPORT_TOKEN_VALIDATION_FOR_TESTING\":false,\"ENABLE_CKTESTBTC\":false,\"ENABLE_IMPORT_TOKEN_BY_URL\":true,\"ENABLE_PERIODIC_FOLLOWING_CONFIRMATION\":true,\"ENABLE_PORTFOLIO_PAGE\":true,\"ENABLE_USD_VALUES\":true,\"ENABLE_USD_VALUES_FOR_NEURONS\":true}" };
record{ 0="FETCH_ROOT_KEY"; 1="false" };
record{ 0="GOVERNANCE_CANISTER_ID"; 1="rrkah-fqaaa-aaaaa-aaaaq-cai" };
record{ 0="HOST"; 1="https://icp-api.io" };
Expand Down
2 changes: 1 addition & 1 deletion scripts/nns-dapp/test-config-assets/app/env
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ VITE_LEDGER_CANISTER_ID=ryjl3-tyaaa-aaaaa-aaaba-cai
VITE_INDEX_CANISTER_ID=qhbym-qaaaa-aaaaa-aaafq-cai
VITE_OWN_CANISTER_ID=xnjld-hqaaa-aaaal-qb56q-cai
VITE_FETCH_ROOT_KEY=false
VITE_FEATURE_FLAGS="{\"DISABLE_IMPORT_TOKEN_VALIDATION_FOR_TESTING\":false,\"ENABLE_CKTESTBTC\":false,\"ENABLE_EXPORT_NEURONS_REPORT\":true,\"ENABLE_IMPORT_TOKEN_BY_URL\":true,\"ENABLE_PERIODIC_FOLLOWING_CONFIRMATION\":true,\"ENABLE_PORTFOLIO_PAGE\":true,\"ENABLE_USD_VALUES\":true,\"ENABLE_USD_VALUES_FOR_NEURONS\":true}"
VITE_FEATURE_FLAGS="{\"DISABLE_IMPORT_TOKEN_VALIDATION_FOR_TESTING\":false,\"ENABLE_CKTESTBTC\":false,\"ENABLE_IMPORT_TOKEN_BY_URL\":true,\"ENABLE_PERIODIC_FOLLOWING_CONFIRMATION\":true,\"ENABLE_PORTFOLIO_PAGE\":true,\"ENABLE_USD_VALUES\":true,\"ENABLE_USD_VALUES_FOR_NEURONS\":true}"
VITE_HOST=https://icp-api.io
VITE_IDENTITY_SERVICE_URL=https://identity.internetcomputer.org/
VITE_ICP_SWAP_URL=https://uvevg-iyaaa-aaaak-ac27q-cai.raw.ic0.app/
Expand Down
2 changes: 1 addition & 1 deletion scripts/nns-dapp/test-config-assets/mainnet/arg.did
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
record{ 0="CKUSDC_LEDGER_CANISTER_ID"; 1="xevnm-gaaaa-aaaar-qafnq-cai" };
record{ 0="CYCLES_MINTING_CANISTER_ID"; 1="rkp4c-7iaaa-aaaaa-aaaca-cai" };
record{ 0="DFX_NETWORK"; 1="mainnet" };
record{ 0="FEATURE_FLAGS"; 1="{\"DISABLE_IMPORT_TOKEN_VALIDATION_FOR_TESTING\":false,\"ENABLE_CKTESTBTC\":false,\"ENABLE_EXPORT_NEURONS_REPORT\":true,\"ENABLE_IMPORT_TOKEN_BY_URL\":true,\"ENABLE_PERIODIC_FOLLOWING_CONFIRMATION\":true,\"ENABLE_PORTFOLIO_PAGE\":true,\"ENABLE_USD_VALUES\":true,\"ENABLE_USD_VALUES_FOR_NEURONS\":true}" };
record{ 0="FEATURE_FLAGS"; 1="{\"DISABLE_IMPORT_TOKEN_VALIDATION_FOR_TESTING\":false,\"ENABLE_CKTESTBTC\":false,\"ENABLE_IMPORT_TOKEN_BY_URL\":true,\"ENABLE_PERIODIC_FOLLOWING_CONFIRMATION\":true,\"ENABLE_PORTFOLIO_PAGE\":true,\"ENABLE_USD_VALUES\":true,\"ENABLE_USD_VALUES_FOR_NEURONS\":true}" };
record{ 0="FETCH_ROOT_KEY"; 1="false" };
record{ 0="GOVERNANCE_CANISTER_ID"; 1="rrkah-fqaaa-aaaaa-aaaaq-cai" };
record{ 0="HOST"; 1="https://icp-api.io" };
Expand Down
2 changes: 1 addition & 1 deletion scripts/nns-dapp/test-config-assets/mainnet/env
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ VITE_LEDGER_CANISTER_ID=ryjl3-tyaaa-aaaaa-aaaba-cai
VITE_INDEX_CANISTER_ID=qhbym-qaaaa-aaaaa-aaafq-cai
VITE_OWN_CANISTER_ID=qoctq-giaaa-aaaaa-aaaea-cai
VITE_FETCH_ROOT_KEY=false
VITE_FEATURE_FLAGS="{\"DISABLE_IMPORT_TOKEN_VALIDATION_FOR_TESTING\":false,\"ENABLE_CKTESTBTC\":false,\"ENABLE_EXPORT_NEURONS_REPORT\":true,\"ENABLE_IMPORT_TOKEN_BY_URL\":true,\"ENABLE_PERIODIC_FOLLOWING_CONFIRMATION\":true,\"ENABLE_PORTFOLIO_PAGE\":true,\"ENABLE_USD_VALUES\":true,\"ENABLE_USD_VALUES_FOR_NEURONS\":true}"
VITE_FEATURE_FLAGS="{\"DISABLE_IMPORT_TOKEN_VALIDATION_FOR_TESTING\":false,\"ENABLE_CKTESTBTC\":false,\"ENABLE_IMPORT_TOKEN_BY_URL\":true,\"ENABLE_PERIODIC_FOLLOWING_CONFIRMATION\":true,\"ENABLE_PORTFOLIO_PAGE\":true,\"ENABLE_USD_VALUES\":true,\"ENABLE_USD_VALUES_FOR_NEURONS\":true}"
VITE_HOST=https://icp-api.io
VITE_IDENTITY_SERVICE_URL=https://identity.internetcomputer.org/
VITE_ICP_SWAP_URL=https://uvevg-iyaaa-aaaak-ac27q-cai.raw.ic0.app/
Expand Down

0 comments on commit d2c683f

Please sign in to comment.