Skip to content

add internal remote config patch tool #6380

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

LukasPaczos
Copy link
Contributor

Task/Issue URL: https://app.asana.com/1/137249556945/project/1208671518894266/task/1210708742763735

Description

Adds tooling to locally patch remote config. Read the details in the new README file in the diff.

Steps to test this PR

  1. Create a privacy-config/privacy-config-internal/local-patch-file/test_patch.json file with this content:
[
  {
    "op": "replace",
    "path": "/features/aiChat/state",
    "value": "disabled"
  }
]
  1. Create a privacy-config/privacy-config-internal/local.properties file with this content:
config_patches=privacy-config/privacy-config-internal/local-config-patches/test_patch.json
  1. Clean install the app.
  2. Verify Duck.ai is disabled and that Settings -> Duck.ai is gone.
  3. Update the patch file to:
[
  {
    "op": "replace",
    "path": "/version",
    "value": "2752244802866"
  },
  {
    "op": "remove",
    "path": "/features/aiChat/hash"
  }
]
  1. Relaunch the app (without clean installing it). This will download the production config and force update the feature because of the bumped version number and mismatching hash.
  2. Verify Duck.ai is enabled and that Settings -> Duck.ai is available.
  3. Update the test_patch.json to disable Duck.ai again and bump version:
[
  {
    "op": "replace",
    "path": "/features/aiChat/state",
    "value": "disabled"
  },
  {
    "op": "remove",
    "path": "/features/aiChat/hash"
  },
  {
    "op": "replace",
    "path": "/version",
    "value": "3752244802866"
  }
]
  1. Relaunch the app (without clean installing it).
  2. Verify Duck.ai is disabled and that Settings -> Duck.ai is gone.

Comment on lines +35 to +39
@ContributesMultibinding(
scope = AppScope::class,
boundType = ApiInterceptorPlugin::class,
)
class DevPrivacyConfigPatchApiInterceptor @Inject constructor(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All interceptors are currently added in default order, sorted by class name. If I assign a low priority to this interceptor without changing the others, it would run first, since it would be the only one with a defined priority. I tried giving all plugins the same priority (to preserve class name sorting as PriorityKey docs suggest) and setting this interceptor last, but the build fails due to duplicate priority keys, despite what the docs say.

I don’t want to risk changing any production behavior, so it’s fine if this interceptor doesn’t run last for now. If it ever becomes a problem, we can revisit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant