Repository navigation
feat(chart): add plugin values - #348
Conversation
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]>
Reviewer's GuideThe 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 renderingsequenceDiagram
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
Flow diagram for Helm plugin values renderingflowchart 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]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
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
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.tagsandplugins.provenance(camelCase), rendered into thepluginssection of the app config with its snake_case keys. Pluginconfig, stepparams, plugin identifiers and preset names are kept as they are; empty values are left out (the app's defaults apply: ordered failover).defaults,gateway_id) go throughconfig.plugins, which merges. Rendering fails if a setting is set both inpluginsand inconfig.plugins, and on the oldconfig.custom.middlewares/config.middlewares(the error names the key).values.schema.jsonmirrors FOCA'sPluginsConfig(extra keys refused; FOCA's patterns for plugin, step and preset identifiers;allowednon-empty). Steps take the long form (alternatives) only; documented.docs/plugins.md,docs/upgrading.md(Plugins).config.dev.yaml) and the smoke config (tests/smoke/config.yaml) with an explicit pipeline (ordered failover).PluginsConfig; each empty value left out; partial values merge withconfig.plugins; conflicts and middlewares refused; invalid values with their error paths; a check that every key of the schema maps (viaprotes.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 --strictwithtest-values.yaml, plusoptional-values.yaml, plus MongoDB auth off: passedmkdocs build --strict: passedCI: 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
$defs(quality):test_schema_of_libraryrequires$defsto equal the library chart's, so app-specific definitions stay underproperties.plugins.definitions._plugin_examples(quality, low): the chart note sits with thecustom.middlewaresbullet it concerns; the helper is small and tested.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