Skip to content

feat(chart): add plugin values - #348

Merged
uniqueg merged 7 commits into
devfrom
feat/chart-plugins
Oct 31, 2026
Merged

uniqueg merged 7 commits into
devfrom
feat/chart-plugins

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Summary

Chart values for the plugins of FOCA 0.18's plugin engine (#335, part of step 10 of #321):

  • plugins.available, plugins.pipeline, plugins.presets, plugins.clientPipelines, plugins.clientBackends, plugins.tags and plugins.provenance (camelCase), rendered into the plugins section of the app config with its snake_case keys. Plugin config, step params, plugin identifiers and preset names are kept as they are; empty values are left out (the app's defaults apply: ordered failover).
  • Other settings (defaults, gateway_id) go through config.plugins, which merges. Rendering fails if a setting is set both in plugins and in config.plugins, and on the old config.custom.middlewares / config.middlewares (the error names the key).
  • values.schema.json mirrors FOCA's PluginsConfig (extra keys refused; FOCA's patterns for plugin, step and preset identifiers; allowed non-empty). Steps take the long form (alternatives) only; documented.
  • Docs: chart README (Configuration), docs/plugins.md, docs/upgrading.md (Plugins).
  • Docker Compose (config.dev.yaml) and the smoke config (tests/smoke/config.yaml) with an explicit pipeline (ordered failover).
  • Tests: rendered section validated with FOCA's PluginsConfig; each empty value left out; partial values merge with config.plugins; conflicts and middlewares refused; invalid values with their error paths; a check that every key of the schema maps (via protes.pluginKeys) to a key of FOCA's model and vice versa; docs and Compose examples validate with FOCA.

Verification

Local (Python 3.13 venv, FOCA 0.18.0, Helm 3.18.5; CI uses 3.22.1):

  • pre-commit run --all-files: passed (ruff, semgrep, gitleaks, actionlint, ast-grep, mypy)
  • coverage run -m pytest: 1171 passed, 1 skipped; coverage 100%
  • helm lint deployment --strict with test-values.yaml, plus optional-values.yaml, plus MongoDB auth off: passed
  • mkdocs build --strict: passed
  • Smoke test (Compose): not run locally (needs Docker); runs in CI.

CI: all checks passed on b8ee811 (Lint, Test (mongomock), Test (MongoDB 7.0), Chart, Docs, Smoke test, Scan image, Release readiness, CI passed, CodeQL, Read the Docs). One intermediate Lint failure (mypy annotation in a new test) fixed in b8ee811.

Sourcery: one thread (boundary test for 128-character plugin identifiers), fixed and resolved.

Declined review findings

  • Move the step schema to top-level $defs (quality): test_schema_of_library requires $defs to equal the library chart's, so app-specific definitions stay under properties.plugins.definitions.
  • Derive the expected rendered config from the input values in the tests (quality): explicit expected values are deliberate; deriving them would reuse the conversion under test.
  • Drop the explicit pipeline from the Compose overlays (quality): feat(chart): add plugin values #335 asks for an explicit pipeline; it is also a validated example.
  • Separate chart section in the upgrade notes, restructure _plugin_examples (quality, low): the chart note sits with the custom.middlewares bullet it concerns; the helper is small and tested.
  • Accept FOCA's short step forms in the schema (adversarial, low): stricter than the app, not unsafe; documented as long form only, which keeps the schema and conversion simple.
  • Refuse non-built-in identifiers under the reserved foca. prefix in the schema (adversarial round 2, low): it would copy FOCA's list of built-in plugins into the chart, which drifts with FOCA; the app refuses them at startup with a clear message.

Round 2 (adversarial + quality) found no high or medium findings; one low (values.yaml wording on built-in plugins) fixed.

Open questions

None.

Closes #335

🤖 Generated with Claude Code

Work in progress: chart values, schema, helpers, docs and tests for
the plugins of FOCA's plugin engine.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The PR introduces schema-validated Helm values for FOCA’s plugin engine, converts them into the app’s snake_case plugin config with clear conflict and legacy checks, and updates documentation, Compose examples, and comprehensive model- and rendering-based tests.

Sequence diagram for plugin configuration rendering

sequenceDiagram
    participant Helm
    participant Validation
    participant Renderer
    participant AppConfig
    participant FOCA
    Helm->>Validation: protes.validate
    Validation->>Validation: protes.checkPlugins
    alt conflict or legacy middlewares
        Validation-->>Helm: fail with setting key
    else valid values
        Validation->>Renderer: protes.plugins
        Renderer->>Renderer: protes.snakeKeys
        Renderer->>AppConfig: render plugins with snake_case keys
        AppConfig->>FOCA: validate PluginsConfig
    end
Loading

Flow diagram for Helm plugin values rendering

flowchart LR
    Values[Helm values.plugins] --> Validate[protes.validate]
    Validate --> Check[protes.checkPlugins]
    Check -->|valid| Convert[protes.plugins]
    Convert --> Keys[protes.snakeKeys]
    Keys --> Config[App config.plugins]
    Config --> FOCA[FOCA PluginsConfig]
Loading

File-Level Changes

Change Details Files
Adds Helm chart values for configuring FOCA’s plugin engine and renders them into the application’s plugins configuration.
  • Introduces camelCase chart values for available plugins, pipelines, presets, client selection, tags, and provenance.
  • Recursively converts chart keys to the app’s snake_case keys while preserving plugin config, step params, plugin identifiers, and preset names.
  • Omits empty values so FOCA defaults remain effective, while allowing other plugin settings to merge through config.plugins.
  • Adds validation for duplicate plugin settings and legacy middleware configuration, with targeted Helm rendering errors.
deployment/templates/_helpers.tpl
deployment/values.yaml
deployment/values.schema.json
Mirrors FOCA’s plugin configuration contract in the chart schema and verifies conversion coverage.
  • Adds strict schemas, identifier patterns, long-form pipeline step definitions, and non-empty constraints for allowed values.
  • Tests rendered configurations against FOCA’s PluginsConfig and checks schema/conversion keys against FOCA’s model.
  • Covers empty, partial, conflicting, legacy, and invalid plugin values with expected error paths.
deployment/values.schema.json
tests/test_chart.py
Documents and demonstrates plugin configuration across the chart and Compose-based workflows.
  • Documents chart values, key conversion, defaults, installation requirements, and migration behavior.
  • Adds explicit ordered-failover pipelines to development and smoke-test Compose overlays.
  • Validates documentation and Compose plugin examples with FOCA’s configuration model.
deployment/README.md
docs/plugins.md
docs/upgrading.md
config.dev.yaml
tests/smoke/config.yaml
deployment/ci/optional-values.yaml
tests/test_config_examples.py

Possibly linked issues

  • feat(chart): add plugin values #335: The PR directly implements the issue’s plugin chart values, config rendering, schema, README, tests, and explicit Compose/smoke pipelines.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@read-the-docs-community

read-the-docs-community Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 proTES | 🛠️ Build #35540497 | 📁 Comparing b8ee811 against latest (d28342f)

  🔍 Preview build  

3 files changed
± deployment/index.html
± plugins/index.html
± upgrading/index.html

@codecov

codecov Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d28342f) to head (b8ee811).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #348   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           23        23           
  Lines         2136      2136           
=========================================
  Hits          2136      2136           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

uniqueg and others added 4 commits October 31, 2026 04:53
Convert only the settings under plugins.available and plugins.presets,
not the identifiers of plugins and the names of presets, which are
chosen by operators. Fix the README references and note the chart's
plugin values in the upgrade notes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Check that the chart's schema of plugins has FOCA's keys in camelCase
and that each is converted, that each empty value is left out, and the
path of each schema error. Split the chart README on plugins into a
list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Check the identifiers of plugins and steps, the names of presets and
the allowed kinds of client pipelines with FOCA's patterns and limits,
so that invalid values fail when rendering, not when the app starts.
Name the middlewares key that was found in the error, and document
that steps take the long form.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg marked this pull request as ready for review October 31, 2026 05:03

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="tests/test_chart.py" line_range="1378" />
<code_context>
+        ),
+        ({"gatewayId": "x"}, "at '/plugins'"),
+        ({"available": {"Tes.X": {}}}, "invalid propertyName 'Tes.X'"),
+        ({"available": {"x" * 129: {}}}, "invalid propertyName 'xxx"),
+        (
+            {"presets": {"Fast": [{"alternatives": [{"plugin": "x"}]}]}},
</code_context>
<issue_to_address>
**Valid long plugin names pass unchecked**

When the schema's plugin-name limit is lowered to 20 characters, `test_plugins_invalid` only checks that the error contains the prefix `invalid propertyName 'xxx`; a schema limit of 20 characters would still reject the 129-character input with that prefix, while excluding valid longer identifiers. The test passes despite the chart enforcing the wrong limit.

Also assert that a valid identifier above the tested fixture length renders successfully, while the 129-character identifier is rejected.
</issue_to_address>

Linked issues

#335 feat(chart): add plugin values · 5 of 5 met

# Requirement Status Notes
1 Configure the listed plugin settings through chart values and render them into the app's config ✅ Met The chart defines the plugin values and renders them under config.plugins; the tests validate the rendered section with FOCA's PluginsConfig.
2 Add the plugin values schema and document their use in the chart README ✅ Met The schema covers the plugin settings, and the README describes the chart values and configuration.
3 Set an explicit pipeline in the Docker Compose and smoke-test configurations ✅ Met config.dev.yaml, mounted by docker-compose.yaml, and tests/smoke/config.yaml both set the ordered pipeline explicitly.
4 Refer to the chart values in docs/plugins.md ✅ Met The new Helm chart and Docker Compose section documents the chart values and the explicit Compose pipelines.
5 Pass the chart tests, Helm lint, chart README check, and smoke test ✅ Met The PR reports these checks passed in CI; the added tests cover rendering, schema validation, and the smoke configuration.

Sourcery assessment

Needs a human reviewer. 1 finding to address first, and if client pipeline or backend selection is configured incorrectly, clients could be allowed to choose an unintended plugin or TES target, and tasks already routed that way would not be undone by reverting the chart change. The chart defaults leave these client-selection options disabled, but the new values expose controls that can affect routing and access.

Blocking findings: tests/test_chart.py:1378


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread tests/test_chart.py Resolved

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sourcery assessment

Approved.

@uniqueg
uniqueg merged commit 22c1001 into dev Oct 31, 2026
19 checks passed
@uniqueg
uniqueg deleted the feat/chart-plugins branch October 31, 2026 05:34
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.

feat(chart): add plugin values

1 participant