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

feat(27255): allow local modification for remote feature flags #29696

Merged
merged 55 commits into from
Feb 21, 2025
Merged
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
d4f2f3f
feat(27255): allow local modification for remote feature flags
DDDDDanica Jan 14, 2025
887ed35
Update LavaMoat policies
metamaskbot Jan 14, 2025
4cef487
feat(27255): move the file to git ignore and add instructions to Read…
DDDDDanica Jan 16, 2025
5e3788b
feat(29629): Add _flags to webpack build only when in development; an…
DDDDDanica Jan 16, 2025
5c703f2
feat(29629): adapted to right pattern in transform function
DDDDDanica Jan 16, 2025
35fe1f0
feat(29629): relocate `getManifestFlags` to `shared/lib/manifestFlags`
DDDDDanica Jan 16, 2025
473a3bd
feat(29629): enrich `getRemoteFeatureFlags` return type
DDDDDanica Jan 16, 2025
caa4b4f
feat(29629): shallow merge states in `getRemoteFeatureFlags`
DDDDDanica Jan 16, 2025
0bff314
Update LavaMoat policies
metamaskbot Jan 16, 2025
d4e79a7
feat(29629): fix e2e test due to shallow merging
DDDDDanica Jan 17, 2025
8e88e7f
feat(29629): Update readme
DDDDDanica Jan 17, 2025
b1a52ae
feat(29629): Remove unused [] param in getWebpackConfig test
DDDDDanica Jan 17, 2025
b2b5862
feat(29629): Remove unnecessary --test flag in non-default options te…
DDDDDanica Jan 17, 2025
a5ea54f
feat(29629): Remove comment in json file to avoid copy error; read .m…
DDDDDanica Jan 17, 2025
5308bed
feat(29629): Move getRemoteFeatureFlags selector to a separate ts file
DDDDDanica Jan 19, 2025
2cc1560
feat(29629): Rename remote-feature-flags.ts file name
DDDDDanica Jan 19, 2025
248ec01
feat(29629): Refactor getRemoteFeatureFlags to use safe merge from lo…
DDDDDanica Jan 19, 2025
40f3c07
feat(29629): Rename gitnore comment
DDDDDanica Jan 19, 2025
3a16019
feat(29629): Remove asyn reading for loadManifestFlags in normal build
DDDDDanica Jan 19, 2025
77ad1e5
feat(29629): Fix unit test of file not exist
DDDDDanica Jan 19, 2025
b09f6a5
feat(29629): Fix lint
DDDDDanica Jan 20, 2025
9487c17
Merge branch 'main' into feature/remote-feature-flags-manifest-adaption
DDDDDanica Jan 26, 2025
51b6de6
fix(3742): fix lint
DDDDDanica Jan 26, 2025
f3c8e38
feat(27255): import json file from `.metamaskrc` instead of using rea…
DDDDDanica Jan 31, 2025
2c5ab32
feat(27255): fix lint
DDDDDanica Jan 31, 2025
945c42a
feat(27255): removed console log in build console
DDDDDanica Jan 31, 2025
f170665
Merge branch 'main' into feature/remote-feature-flags-manifest-adaption
DDDDDanica Feb 3, 2025
8be5eb3
feat(27255): update README.md
DDDDDanica Feb 3, 2025
f2cee6a
feat(27255): add the * wildcard to ignored filed name
DDDDDanica Feb 3, 2025
3a53d83
feat(27255): fix lint and try to fix "TypeError: Cannot destructure p…
DDDDDanica Feb 3, 2025
a721328
Merge branch 'main' into feature/remote-feature-flags-manifest-adaption
DDDDDanica Feb 11, 2025
ff643b6
Simplify remoteFeatureFlag type in manifestFlags.ts file
DDDDDanica Feb 11, 2025
af74af6
Modify plugins.ManifestPlugin.test.ts to use mock utility from node:test
DDDDDanica Feb 11, 2025
7c3ff23
Add silently ignores non-ENOENT filesystem unit test
DDDDDanica Feb 11, 2025
ab7448d
Make manifest.overrides.json more general
DDDDDanica Feb 12, 2025
581831c
Fix lint; revert to `fs.readFile`
DDDDDanica Feb 12, 2025
b120921
Merge branch 'main' into feature/remote-feature-flags-manifest-adaption
HowardBraham Feb 12, 2025
e950aa3
Fix failed unit tests
DDDDDanica Feb 13, 2025
b801c6c
Merge branch 'main' into feature/remote-feature-flags-manifest-adaption
DDDDDanica Feb 13, 2025
84bc8f1
Add more unit tests for overwrite manifest case
DDDDDanica Feb 13, 2025
86211f3
Merge remote-tracking branch 'origin/feature/remote-feature-flags-man…
DDDDDanica Feb 13, 2025
b768704
Changed copy of develop options from designer
DDDDDanica Feb 19, 2025
1003d35
Merge branch 'main' into feature/remote-feature-flags-manifest-adaption
DDDDDanica Feb 19, 2025
4248edf
Update snapshot
DDDDDanica Feb 19, 2025
a199f6f
refactor to prevent manifest transforms from modifying original object
DDDDDanica Feb 19, 2025
6e112e8
fix lint for return in the function
DDDDDanica Feb 19, 2025
1071e2b
change develop options context
DDDDDanica Feb 20, 2025
dcb78e3
fix snpapshot
DDDDDanica Feb 20, 2025
96fe46d
Fix lint
DDDDDanica Feb 20, 2025
9f92cc9
Improve word and lint fix for developer options
DDDDDanica Feb 20, 2025
49542c0
Rollback manifestClone copy method
DDDDDanica Feb 20, 2025
0380cf0
Revert addTabsPermission
DDDDDanica Feb 20, 2025
d8fb679
Restore mock after each test
DDDDDanica Feb 20, 2025
5ad5fdb
Update snapshot
DDDDDanica Feb 20, 2025
1e89e33
Update readme
DDDDDanica Feb 20, 2025
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
Next Next commit
feat(27255): allow local modification for remote feature flags
DDDDDanica committed Jan 16, 2025
commit d4f2f3f29df1443a68497479e23e2d0f459aa628
12 changes: 12 additions & 0 deletions app/scripts/lib/manifestFlags.ts
Original file line number Diff line number Diff line change
@@ -60,6 +60,18 @@ export type ManifestFlags = {
*/
forceEnable?: boolean;
};
/**
* Feature flags to control business logic behavior
*/
remoteFeatureFlags?: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Include the type of remoteFeatureFlags in manifest as optional value. We include testFlagForThreshold that's created for testing purpose in remote feature flag API .

/**
* A test remote featureflag for threshold
*/
testFlagForThreshold: {
name: string;
value: string;
};
};
};

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- you can't extend a type, we want this to be an interface
5 changes: 4 additions & 1 deletion development/build/manifest.js
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ const baradDurManifest = isManifestV3
? require('../../app/manifest/v3/_barad_dur.json')
: require('../../app/manifest/v2/_barad_dur.json');
const { loadBuildTypesConfig } = require('../lib/build-type');
const manifestFlags = require('../../manifest-flags.json');
Copy link
Contributor Author

@DDDDDanica DDDDDanica Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Read customized manifestFlags from manifest-flags.json so we can override the one from controller (API) - old build system


const { TASKS, ENVIRONMENT } = require('./constants');
const { createTask, composeSeries } = require('./task');
@@ -47,8 +48,10 @@ function createManifestTasks({
browserVersionMap[platform],
await getBuildModifications(buildType, platform),
customArrayMerge,
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Add customized local manifestFlags to manifest file (old build system)

_flags: manifestFlags,
},
);

modifyNameAndDescForNonProd(result);

const dir = path.join('.', 'dist', platform);
13 changes: 13 additions & 0 deletions development/webpack/utils/plugins/ManifestPlugin/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import manifestFlags from '../../../../../manifest-flags.json';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Read customized manifestFlags from manifest-flags.json so we can override the one from controller (API) - webpack build


/**
* Returns a function that will transform a manifest JSON object based on the
* given build args.
@@ -24,6 +26,17 @@ export function transformManifest(args: { lockdown: boolean; test: boolean }) {
}
}

/**
* This function sets predefined flags in the manifest's _flags property.
*
* @param browserManifest - The Chrome extension manifest object to modify
*/
function addManifestFlags(browserManifest: chrome.runtime.Manifest) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Add customized local manifestFlags to manifest file (webpack build system)

browserManifest._flags = manifestFlags;
}

transforms.push(addManifestFlags);

if (!args.lockdown) {
// remove lockdown scripts from content_scripts
transforms.push(removeLockdown);
2 changes: 1 addition & 1 deletion lavamoat/browserify/beta/policy.json
Original file line number Diff line number Diff line change
@@ -5775,4 +5775,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion lavamoat/browserify/flask/policy.json
Original file line number Diff line number Diff line change
@@ -5775,4 +5775,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion lavamoat/browserify/main/policy.json
Original file line number Diff line number Diff line change
@@ -5775,4 +5775,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion lavamoat/browserify/mmi/policy.json
Original file line number Diff line number Diff line change
@@ -5867,4 +5867,4 @@
}
}
}
}
}
Loading