experimenter/cirrus
dependabot[bot] 0667abb95c
chore(deps): Bump ruff from 0.1.0 to 0.2.0 in /cirrus/server (#10221)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.1.0 to 0.2.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/astral-sh/ruff/releases">ruff's
releases</a>.</em></p>
<blockquote>
<h2>v0.2.0</h2>
<p>Check out the <a href="https://astral.sh/blog/ruff-v0.2.0">blog
post</a> for a migration guide and overview of the changes!</p>
<h2>Changes</h2>
<h3>Breaking changes</h3>
<ul>
<li>The <code>NURSERY</code> selector cannot be used anymore</li>
<li>Legacy selection of nursery rules by exact codes is no longer
allowed without preview enabled</li>
</ul>
<p>See also, the &quot;Remapped rules&quot; section which may result in
disabled rules.</p>
<h3>Deprecations</h3>
<p>The following rules are now deprecated:</p>
<ul>
<li><a
href="https://docs.astral.sh/ruff/rules/missing-type-self/"><code>missing-type-self</code></a>
(<code>ANN101</code>)</li>
<li><a
href="https://docs.astral.sh/ruff/rules/missing-type-cls/"><code>missing-type-cls</code></a>
(<code>ANN102</code>)</li>
</ul>
<p>The following command line options are now deprecated:</p>
<ul>
<li><code>--show-source</code>; use <code>--output-format full</code>
instead</li>
<li><code>--no-show-source</code>; use <code>--output-format
concise</code> instead</li>
<li><code>--output-format text</code>; use <code>full</code> or
<code>concise</code> instead</li>
</ul>
<p>The following settings have moved and the previous name is
deprecated:</p>
<ul>
<li><code>ruff.allowed-confusables</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_allowed-confusables"><code>ruff.lint.allowed-confusables</code></a></li>
<li><code>ruff.dummy-variable-rgx</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_dummy-variable-rgx"><code>ruff.lint.dummy-variable-rgx</code></a></li>
<li><code>ruff.explicit-preview-rules</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_explicit-preview-rules"><code>ruff.lint.explicit-preview-rules</code></a></li>
<li><code>ruff.extend-fixable</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_extend-fixable"><code>ruff.lint.extend-fixable</code></a></li>
<li><code>ruff.extend-ignore</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_extend-ignore"><code>ruff.lint.extend-ignore</code></a></li>
<li><code>ruff.extend-per-file-ignores</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_extend-per-file-ignores"><code>ruff.lint.extend-per-file-ignores</code></a></li>
<li><code>ruff.extend-safe-fixes</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_extend-safe-fixes"><code>ruff.lint.extend-safe-fixes</code></a></li>
<li><code>ruff.extend-select</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_extend-select"><code>ruff.lint.extend-select</code></a></li>
<li><code>ruff.extend-unfixable</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_extend-unfixable"><code>ruff.lint.extend-unfixable</code></a></li>
<li><code>ruff.extend-unsafe-fixes</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_extend-unsafe-fixes"><code>ruff.lint.extend-unsafe-fixes</code></a></li>
<li><code>ruff.external</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_external"><code>ruff.lint.external</code></a></li>
<li><code>ruff.fixable</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_fixable"><code>ruff.lint.fixable</code></a></li>
<li><code>ruff.flake8-annotations</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-annotations"><code>ruff.lint.flake8-annotations</code></a></li>
<li><code>ruff.flake8-bandit</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-bandit"><code>ruff.lint.flake8-bandit</code></a></li>
<li><code>ruff.flake8-bugbear</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-bugbear"><code>ruff.lint.flake8-bugbear</code></a></li>
<li><code>ruff.flake8-builtins</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-builtins"><code>ruff.lint.flake8-builtins</code></a></li>
<li><code>ruff.flake8-comprehensions</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-comprehensions"><code>ruff.lint.flake8-comprehensions</code></a></li>
<li><code>ruff.flake8-copyright</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-copyright"><code>ruff.lint.flake8-copyright</code></a></li>
<li><code>ruff.flake8-errmsg</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-errmsg"><code>ruff.lint.flake8-errmsg</code></a></li>
<li><code>ruff.flake8-gettext</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-gettext"><code>ruff.lint.flake8-gettext</code></a></li>
<li><code>ruff.flake8-implicit-str-concat</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-implicit-str-concat"><code>ruff.lint.flake8-implicit-str-concat</code></a></li>
<li><code>ruff.flake8-import-conventions</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-import-conventions"><code>ruff.lint.flake8-import-conventions</code></a></li>
<li><code>ruff.flake8-pytest-style</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-pytest-style"><code>ruff.lint.flake8-pytest-style</code></a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md">ruff's
changelog</a>.</em></p>
<blockquote>
<h2>0.2.0</h2>
<h3>Breaking changes</h3>
<ul>
<li>The <code>NURSERY</code> selector cannot be used anymore</li>
<li>Legacy selection of nursery rules by exact codes is no longer
allowed without preview enabled</li>
</ul>
<p>See also, the &quot;Remapped rules&quot; section which may result in
disabled rules.</p>
<h3>Deprecations</h3>
<p>The following rules are now deprecated:</p>
<ul>
<li><a
href="https://docs.astral.sh/ruff/rules/missing-type-self/"><code>missing-type-self</code></a>
(<code>ANN101</code>)</li>
<li><a
href="https://docs.astral.sh/ruff/rules/missing-type-cls/"><code>missing-type-cls</code></a>
(<code>ANN102</code>)</li>
</ul>
<p>The following command line options are now deprecated:</p>
<ul>
<li><code>--show-source</code>; use <code>--output-format full</code>
instead</li>
<li><code>--no-show-source</code>; use <code>--output-format
concise</code> instead</li>
<li><code>--output-format text</code>; use <code>full</code> or
<code>concise</code> instead</li>
</ul>
<p>The following settings have moved and the previous name is
deprecated:</p>
<ul>
<li><code>ruff.allowed-confusables</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_allowed-confusables"><code>ruff.lint.allowed-confusables</code></a></li>
<li><code>ruff.dummy-variable-rgx</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_dummy-variable-rgx"><code>ruff.lint.dummy-variable-rgx</code></a></li>
<li><code>ruff.explicit-preview-rules</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_explicit-preview-rules"><code>ruff.lint.explicit-preview-rules</code></a></li>
<li><code>ruff.extend-fixable</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_extend-fixable"><code>ruff.lint.extend-fixable</code></a></li>
<li><code>ruff.extend-ignore</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_extend-ignore"><code>ruff.lint.extend-ignore</code></a></li>
<li><code>ruff.extend-per-file-ignores</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_extend-per-file-ignores"><code>ruff.lint.extend-per-file-ignores</code></a></li>
<li><code>ruff.extend-safe-fixes</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_extend-safe-fixes"><code>ruff.lint.extend-safe-fixes</code></a></li>
<li><code>ruff.extend-select</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_extend-select"><code>ruff.lint.extend-select</code></a></li>
<li><code>ruff.extend-unfixable</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_extend-unfixable"><code>ruff.lint.extend-unfixable</code></a></li>
<li><code>ruff.extend-unsafe-fixes</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_extend-unsafe-fixes"><code>ruff.lint.extend-unsafe-fixes</code></a></li>
<li><code>ruff.external</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_external"><code>ruff.lint.external</code></a></li>
<li><code>ruff.fixable</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_fixable"><code>ruff.lint.fixable</code></a></li>
<li><code>ruff.flake8-annotations</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-annotations"><code>ruff.lint.flake8-annotations</code></a></li>
<li><code>ruff.flake8-bandit</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-bandit"><code>ruff.lint.flake8-bandit</code></a></li>
<li><code>ruff.flake8-bugbear</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-bugbear"><code>ruff.lint.flake8-bugbear</code></a></li>
<li><code>ruff.flake8-builtins</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-builtins"><code>ruff.lint.flake8-builtins</code></a></li>
<li><code>ruff.flake8-comprehensions</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-comprehensions"><code>ruff.lint.flake8-comprehensions</code></a></li>
<li><code>ruff.flake8-copyright</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-copyright"><code>ruff.lint.flake8-copyright</code></a></li>
<li><code>ruff.flake8-errmsg</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-errmsg"><code>ruff.lint.flake8-errmsg</code></a></li>
<li><code>ruff.flake8-gettext</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-gettext"><code>ruff.lint.flake8-gettext</code></a></li>
<li><code>ruff.flake8-implicit-str-concat</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-implicit-str-concat"><code>ruff.lint.flake8-implicit-str-concat</code></a></li>
<li><code>ruff.flake8-import-conventions</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-import-conventions"><code>ruff.lint.flake8-import-conventions</code></a></li>
<li><code>ruff.flake8-pytest-style</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-pytest-style"><code>ruff.lint.flake8-pytest-style</code></a></li>
<li><code>ruff.flake8-quotes</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-quotes"><code>ruff.lint.flake8-quotes</code></a></li>
<li><code>ruff.flake8-self</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-self"><code>ruff.lint.flake8-self</code></a></li>
<li><code>ruff.flake8-tidy-imports</code> → <a
href="https://docs.astral.sh//ruff/settings/#lint_flake8-tidy-imports"><code>ruff.lint.flake8-tidy-imports</code></a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="1fadefa67b"><code>1fadefa</code></a>
Bump version to 0.2.0 (<a
href="https://redirect.github.com/astral-sh/ruff/issues/9762">#9762</a>)</li>
<li><a
href="06ad687efd"><code>06ad687</code></a>
Deduplicate deprecation warnings for v0.2.0 release (<a
href="https://redirect.github.com/astral-sh/ruff/issues/9764">#9764</a>)</li>
<li><a
href="148b64ead3"><code>148b64e</code></a>
Fix issue where output format mode would not change to <code>full</code>
if preview mode...</li>
<li><a
href="99eddbd2a0"><code>99eddbd</code></a>
Remove stale preview documentation from stabilized rule behaviors (<a
href="https://redirect.github.com/astral-sh/ruff/issues/9759">#9759</a>)</li>
<li><a
href="836d2eaa01"><code>836d2ea</code></a>
Restore RUF011 documentation (<a
href="https://redirect.github.com/astral-sh/ruff/issues/9758">#9758</a>)</li>
<li><a
href="994514d686"><code>994514d</code></a>
Redirect <code>PHG001</code> to <code>S307</code> and
<code>PGH002</code> to <code>G010</code> (<a
href="https://redirect.github.com/astral-sh/ruff/issues/9756">#9756</a>)</li>
<li><a
href="a578414246"><code>a578414</code></a>
Redirect <code>TRY200</code> to <code>B904</code> (<a
href="https://redirect.github.com/astral-sh/ruff/issues/9755">#9755</a>)</li>
<li><a
href="0d752e56cd"><code>0d752e5</code></a>
Add tests for redirected rules (<a
href="https://redirect.github.com/astral-sh/ruff/issues/9754">#9754</a>)</li>
<li><a
href="46c0937bfa"><code>46c0937</code></a>
Use fake rules for testing deprecation and removal infrastructure (<a
href="https://redirect.github.com/astral-sh/ruff/issues/9752">#9752</a>)</li>
<li><a
href="e5008ca714"><code>e5008ca</code></a>
Fix bug where selection included deprecated rules during preview (<a
href="https://redirect.github.com/astral-sh/ruff/issues/9746">#9746</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/astral-sh/ruff/compare/v0.1.0...v0.2.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ruff&package-manager=pip&previous-version=0.1.0&new-version=0.2.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
Dependabot will merge this PR once it's up-to-date and CI passes on it,
as requested by @jaredlockhart.

[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-05 20:51:01 +00:00
..
server chore(deps): Bump ruff from 0.1.0 to 0.2.0 in /cirrus/server (#10221) 2024-02-05 20:51:01 +00:00
README.md feat(cirrus): Update cirrus docs test for random key (#10195) 2024-02-01 22:47:02 +00:00

README.md

Cirrus

Cirrus is a feature configuration server that allows clients to obtain a set of features based on their provided client_id and context information. This document provides information on setting up the Cirrus environment, including required environment variables and commands for running and testing Cirrus.

Environment Setup

To set up the Cirrus environment, follow these steps:

  1. Create a .env file inside the cirrus/server directory.

  2. Copy the contents of .env.example into .env by running the following command:

    cp .env.example .env
    
  3. Open the .env file and modify the values of the following environment variables:

    CIRRUS_REMOTE_SETTING_URL=https://firefox.settings.services.mozilla.com/v1/buckets/main/collections/nimbus-web-experiments/records
    CIRRUS_REMOTE_SETTING_REFRESH_RATE_IN_SECONDS=10
    CIRRUS_APP_ID=test_app_id
    CIRRUS_APP_NAME=test_app_name
    CIRRUS_CHANNEL=developer
    CIRRUS_FML_PATH=./feature_manifest/sample.fml.yaml
    CIRRUS_SENTRY_DSN=dsn_url
    CIRRUS_INSTANCE_NAME=cirrus_pod_app_v1
    CIRRUS_ENV_NAME=test_app_stage
    CIRRUS_GLEAN_MAX_EVENTS_BUFFER=10
    
    

    Here's what each variable represents:

    • CIRRUS_REMOTE_SETTING_URL: The URL of the remote settings where the experiments data is stored. In this case, it points to the collection of nimbus web experiments.
    • CIRRUS_REMOTE_SETTING_REFRESH_RATE_IN_SECONDS: The refresh rate in seconds for fetching the experiments recipes from the remote settings. Set it to 10 to retrieve the latest data every 10 seconds.
    • CIRRUS_APP_ID: Replace test_app_id with the actual ID of your application for example firefox-desktop.
    • CIRRUS_APP_NAME: Replace test_app_name with the desired name for your application for example firefox_desktop.
    • CIRRUS_CHANNEL: Replace developer with the channel like beta, release etc.
    • CIRRUS_FML_PATH: The file path to the feature manifest file. Set it to ./feature_manifest/sample.fml.yaml or specify the correct path to your feature manifest file.
    • CIRRUS_SENTRY_DSN: Replace dsn_url with the appropriate DSN value.
    • CIRRUS_INSTANCE_NAME: Replace with the instance name.
    • CIRRUS_ENV_NAME: Replace with the concatenation of project and environment name
    • CIRRUS_GLEAN_MAX_EVENTS_BUFFER: This value represents the max events buffer size for glean. You can set the value from range 1 to 500, by default Cirrus sets it to 10.

    Adjust the values of these variables according to your specific configuration requirements.

By following these steps, you will create the .env file and configure the necessary environment variables for the Cirrus application.

Commands

The following are the available commands for working with Cirrus:

  • cirrus_build: Builds the Cirrus container.

    • Usage: make cirrus_build
  • cirrus_up: Starts the Cirrus container.

    • Usage: make cirrus_up
  • cirrus_down:cirrus_down: Stops the Cirrus container.

    • Usage: make cirrus_down
  • cirrus_test: Runs tests for the Cirrus application.

    • Usage: make cirrus_test
  • cirrus_check: Performs various checks on the Cirrus application including Ruff linting, Black code formatting check, Pyright static type checking, pytest tests, and documentation generation..

    • Usage: make cirrus_check
  • cirrus_code_format: Formats the code in the Cirrus application.

    • Usage: make cirrus_code_format
  • cirrus_typecheck_createstub: Performs static type checking and creates stub files.

    • Usage: make cirrus_typecheck_createstub
  • cirrus_generate_docs: Generates documentation for the Cirrus application such as openapi schema.

    • Usage: make cirrus_generate_docs

OpenAPI Schema

OpenAPI schema for the Cirrus API

Cirrus Server to get Feature configuration API structure

Api Doc

Cirrus Api Doc for the Cirrus API

Endpoint

POST /v1/features/

  • When making a POST request, please make sure to set headers content type as JSON
      headers: {
              "Content-Type": "application/json",
        }
    

Input

The input should be a JSON object with the following properties:

  • client_id (string): Used for bucketing calculation.
  • context (object): Used for context. It can have any key-value pair.
    • any-key (anytype).
    • language (string): Optional field
    • region (string): Optional field

Note: Make sure to provide a key-value pair when making a call, setting the context value as {} will be considered as False value. For testing you can set value such as

 context: { key: "example-key" }

Example input:

{
  "client_id": "4a1d71ab-29a2-4c5f-9e1d-9d9df2e6e449",
  "context": {
    "key1": "value1",
    "key2": {
      "key2.1": "value2",
      "key2.2": "value3"
    }
  }
}
  • To target clients based on languages you can use key as language and it supports list of languages

Example input:

{
  "client_id": "4a1d71ab-29a2-4c5f-9e1d-9d9df2e6e449",
  "context": {
    "language": "en"
  }
}
  • To target clients based on country you can use key as region and it supports list of countries

Example input:

{
  "client_id": "4a1d71ab-29a2-4c5f-9e1d-9d9df2e6e449",
  "context": {
    "region": "US"
  }
}
  • To target client based on both language and country

Example input:

{
  "client_id": "4a1d71ab-29a2-4c5f-9e1d-9d9df2e6e449",
  "context": {
    "language": "en",
    "region": "US"
  }
}
  • You can make your custom field to target too. Prepare what fields you want to be be able to target on, and then work backwards to construct it and populate a targeting context that will satisfy that. Example input:
{
  "client_id": "4a1d71ab-29a2-4c5f-9e1d-9d9df2e6e449",
  "context": {
    "random_key": "random_value",
  }
}

Output

The output will be a JSON object with the following properties:

  • features (object): An object that contains the set of features. Each feature is represented as a sub-object with its own set of variables.

Example output:

{
  "Feature1": {
    "Variable1.1": "valueA",
    "Variable1.2": "valueB"
  },
  "Feature2": {
    "Variable2.1": "valueC",
    "Variable2.2": "valueD"
  },
  "FeatureN": {
    "VariableN.1": "valueX",
    "VariableN.2": "valueY"
  }
}

Notes

  • This API only accepts POST requests.
  • All parameters should be supplied in the body as JSON.