Skip to content

feat(plugins): resolve per-request pipelines - #498

Merged
uniqueg merged 23 commits into
devfrom
feat/plugin-pipelines
Oct 25, 2026
Merged

uniqueg merged 23 commits into
devfrom
feat/plugin-pipelines

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Summary

Lets clients choose a pipeline and backends per request, within limits that admins set. This is the second PR of the v0.18.0 plugin stack (#485), on top of the engine (#486).

  • Client tags:
    • gateway.pipeline holds a preset name or an inline JSON pipeline.
    • gateway.backends holds an allow or deny list of backends, as JSON.
    • Any other gateway.* tag from a client is rejected with 400 (reserved-tag), as are tags that are not a mapping.
    • For APIs other than TES, start() requires tags= to be passed explicitly.
  • Admin limits:
    • plugins.client_pipelines sets enabled, allowed (presets and/or inline), roles, max_steps, max_alternatives and the frame (prepend/append).
    • plugins.presets defines named pipelines.
    • Per plugin, available.<id>.client_selectable and roles decide what clients may choose.
    • Presets enforce plugin roles but may include plugins that are not client_selectable, since admins write them.
  • Client pipelines replace plugins.pipeline. Steps that must always run belong in prepend. The docs and the config docstrings say so with a warning.
  • Parsing limits:
    • Both tags are capped at 8 KiB, checked before parsing (the pipeline cap is configurable as client_pipelines.max_size).
    • Client pipelines must be I-JSON: no NaN or Infinity, integers within ±(2^53−1), no unpaired surrogates, at most 32 levels of nesting.
  • Uniform errors: unknown, not installed, disabled, non-selectable and role-restricted plugins all get the same message. Unknown presets and presets that need a role share one message too. Clashes with frame step IDs get a generic message, so clients can't probe the configuration.
  • Startup checks: unknown plugins in presets or in the frame stop the app. So do preset step IDs that clash with frame steps that are kept.

Closes #487

Verification

Run locally:

  • ruff check and ruff format --check: pass.
  • mypy: pass.
  • pytest without MongoDB: pass, with 100% coverage of foca/plugins.
  • mkdocs build --strict: pass.
  • pre-commit run --all-files: pass.
  • Push hook (semgrep, ast-grep): pass.

The MongoDB tests did not run locally. CI: 27 checks pass, including the MongoDB tests; 2 are skipped as intended.

The tests include a seeded, table-driven test over 300 random client pipelines built from allowed and forbidden plugins. No forbidden plugin gets through.

Review: two rounds of adversarial and quality review on frozen snapshots of the branch. Round 1 found:

  • presets bypassing plugin roles;
  • non-mapping tags skipping the reserved-tag check;
  • unbounded backends tags;
  • non-I-JSON numbers;
  • a lost InvalidVia export;
  • dead fields;
  • duplicated constants;
  • missing startup tests.

Round 2 found surrogate encoding errors returning 500, leaks of frame step IDs, false clashes with dropped frame steps, and unbounded nesting. All of these are fixed.

Declined review findings

  • Refusing empty client pipelines: declined. Clients may run only the frame. That is the decided design: admin constraints live in prepend/append.
  • Commit hygiene (merge commits from the stack): declined. The PR is squash-merged.

🤖 Generated with Claude Code

Summary by Sourcery

Enable safely constrained, per-request selection of plugin pipelines and backends while preserving administrator-defined policy frames.

New Features:

  • Allow clients to select named or inline pipelines and filter or reorder candidate backends per request through reserved tags.
  • Add configurable presets, client-selection permissions, role restrictions, pipeline frames, and limits for administrator control.

Bug Fixes:

  • Reject invalid, unsafe, oversized, non-I-JSON, or unauthorized client selections with consistent problem types and prevent reserved-tag misuse.

Enhancements:

  • Validate presets and pipeline frames at startup, enforce plugin availability and role policies, and apply backend selection after routing without adding non-candidate backends.

Documentation:

  • Document per-request pipeline and backend selection, configuration options, replacement of the default pipeline, and gateway problem types.

Tests:

  • Add comprehensive validation, authorization, backend-selection, startup-check, fuzzed pipeline, and security-boundary coverage.

Chores:

  • Expose selection parsing and errors through the plugins public API and decouple URL utilities from Flask imports when used by plugins.

uniqueg and others added 22 commits October 25, 2026 00:24
Add `foca.plugins`, a framework-neutral engine for gateway plugins:

- plain request model (`InboundRequest`, `Backend`, `OutboundRequest`,
  `BackendResponse`, `Principal`, case-insensitive `Headers`) and an
  explicit `Context` per hook call; no Flask, Werkzeug or Connexion
  types, so plugins run unchanged after the move to Connexion 3
- `Plugin` base with `on_request`, `on_route`, `on_forward` and
  `on_response` hooks, `NotApplicable`, `Rejected` and `PluginError`
- allowlisted loading of entry points (group `foca.plugins`) with
  distribution and version pins, `RECORD` digests, `enabled: false`
  kill switch and a startup error with a migration hint for legacy
  `middlewares` keys
- steps with ordered alternatives, copy-and-commit per alternative,
  failure semantics, timeouts via a bounded thread pool, forwarding
  attempts with "not accepted" / "outcome unknown" outcomes, a total
  `forward_timeout`, `Via` headers, loop detection (508) and no routing
  to the gateway's own public URL
- `foca.plugins.adapter`, the only module using Connexion 2 / Flask
- config section `plugins`, docs pages, and an ast-grep rule that keeps
  framework imports out of `foca/plugins` except the adapter

Co-Authored-By: Claude Opus 5.5 <[email protected]>
What proTES needs to adopt the engine:

- `Foca(gateway=GatewayApp(api, validate, sanitize,
  validate_outbound))` declares a gateway app; `create_app()` loads its
  plugins once to fail fast, and `foca.plugins.runtime.get_host()`
  gives controllers and Celery tasks the host of their process,
  created on first use after forks (no Flask app context needed)
- legacy `middlewares` keys are refused before the app's strict
  `custom` model is validated
- errors of the app's `sanitize` (e.g. 413) stop the request
  unchanged; `validate` failures stay invalid output
- `validate_outbound` per attempt (reason `invalid_outbound`)
- `NotAccepted`/`OutcomeUnknown` exceptions with reason codes for the
  app's client, and `Attempt.report()`
- adapter: `request_id()` from a safe `X-Request-ID` or a new one;
  `Principal.groups` are the mapped roles of access control
- string short form of steps (`- <plugin id>`)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Let clients choose the pipeline and the backends of a request in two
reserved tags, under the configurable prefix `plugins.tags.prefix`
(default `gateway.`):

- `gateway.pipeline`: a preset name (`plugins.presets`) or a pipeline
  as JSON, validated and authorized before any plugin runs (limits,
  roles, `client_selectable`, uniform "plugin not available" errors)
  and framed by `client_pipelines.prepend`/`append` (`if_missing_phase`
  for a default route step)
- `gateway.backends`: `{"type": "order" | "allow" | "forbid",
  "backends": [...]}`, applied to the routed candidates; items that are
  no candidates are discarded and recorded
- any other client tag under the prefix is refused with 400

Presets and frames are resolved on startup; presets that need a
disabled plugin are unavailable. Gateway errors move to
`foca.plugins.errors`. `foca.utils.urls` imports Flask only in
`get_public_url()`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review fixes:

- outbound `Via` headers are the inbound request's with this gateway's
  entry appended (RFC 9110, section 7.6.3), whatever plugins or the
  app's builder set, so that loops through several gateways are
  detected (A -> B -> A)
- each call gets its own deep copy of the step's parameters, and the
  caller's claims as a read-only deep copy, so that a hook cannot
  change them for later calls, requests or provenance
- hooks raising `SystemExit` and other `BaseException`s fail like
  others; `KeyboardInterrupt` and `GeneratorExit` propagate

Refs #486

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`foca.security.access_control.get_current_claims()` returns a copy of
the claims of the current request's token, next to
`get_current_subject()` and `get_current_groups()`; the plugin adapter
uses it instead of a private helper.

Refs #486

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Apps that configure `plugins` without `Foca(gateway=...)` get a startup
warning, as the section is validated but not used. The docs say that
there is no runtime API for operators, summarize the steps for gateway
app authors, and note that plugins are instantiated once more per
process after the startup check.

Refs #486

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`foca.plugins.engine` keeps the host, runs and attempts; the rest moves
along its seams, with the public imports from `foca.plugins` and
`foca.plugins.engine` unchanged:

- `errors`: gateway errors with problem details
- `outcomes`: `NotAccepted`, `OutcomeUnknown`, `sanitize_error()` and
  the engine's internal errors
- `records`: resolved pipelines, hook call and attempt records
- `executor`: the bounded thread pool of hook calls
- `checks`: outbound requests, `Via` names and hook output checks

Refs #486

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review fixes of #486; the engine split is redone on this branch's engine module.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Address the second review round of the plugin engine:

- Claims of the caller are a FrozenMapping, which plugins can keep in
  their state: unlike MappingProxyType, it can be deep-copied and
  pickled. The engine copies state and candidates inside the guarded
  block, so a failing copy fails that alternative only, not the request.
- The engine sets Via before the app's outbound check; inbound Via
  headers longer than 1024 characters are refused (400, InvalidVia).
  Docs say that the inbound Via is passed through verbatim.
- The default gateway_id is the host and port of the public URL,
  without user information, and only if it matches the gateway_id
  pattern.
- setup() of plugins may run more than once per process (docstring and
  author docs); tests import internals from their new modules.

Refs #486

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	foca/plugins/__init__.py
#	foca/plugins/engine.py
CodeQL flagged reflected XSS in a view that only exists for its URL
rule. Return a constant instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Principal.token is set only if a token was validated (claims).
- Repeated header fields of inbound requests are combined (e.g., Via).
- Problem responses keep the custom title of a plugin's rejection;
  problem_response() takes a request-specific title.
- Annotations reject NaN and infinite numbers.
- Plugins loaded before a load or pipeline error are closed.
- Gateway names bracket IPv6 addresses (pattern GATEWAY_ID_PATTERN),
  and the outbound Via header, with this gateway's entry, stays within
  1024 characters.
- One gateway app per process: configure() refuses other settings
  while a host is in use; reset() closes it; the host is closed at
  exit.
- Docs: app callbacks run outside plugin deadlines and must be fast;
  rejections in the response phase count as errors.

Refs #486

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	foca/plugins/config.py
#	foca/plugins/engine.py
Guard against names in foca.plugins.__all__ that do not resolve (e.g.,
a missing import), as noticed by proTES.

Refs #486

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A merge dropped InvalidVia from the imports of foca.plugins, though it
is still in __all__; the test of the exported names catches this now.

Refs #487

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Address the pre-review of per-request pipelines and backends:

- Tags that are not a map give 400 (reserved-tag) instead of being
  ignored, which skipped the check of reserved tags. Apps of APIs other
  than TES must pass tags= to start() (TypeError otherwise); the default
  is a typed sentinel. (start() takes no pipeline= argument any more
  since the per-request pipelines landed; callers pass tags.)
- Whether choices are enabled is checked in one place, when the tags
  are read, and before their values are parsed.
- The backends tag is at most 8 KiB before it is parsed, and lists at
  least one backend.
- Presets need the roles of their plugins (not client_selectable, as
  admins write them); unknown presets get the same message.
- Preset steps with the identifier of a frame step and
  client_pipelines.allowed: [] are refused at startup; the message for
  preset names without presets allowed says so.
- PRESET_PATTERN is defined once (config), the item length limit is
  not repeated in its message, the unused ClientSelection.backends_raw
  and the PROBLEM_TYPE_BASE re-export of the engine are removed.
- Tests: random client pipelines from allowed and forbidden plugins
  never let a forbidden one through; unknown plugins in prepend fail
  at startup; WES tags; limits of the backends tag.

foca/utils/urls.py keeps its lazy Flask import: get_public_url() needs
the request context, while the other URL helpers serve the
framework-free foca.plugins, which must import without Flask.

Refs #487

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A preset or client pipeline (even an empty one) runs instead of
plugins.pipeline; only the frame runs for every request, so policies
belong in client_pipelines.prepend. Also name the available keys
client_selectable and roles, the preset role rule, the limits of the
backends tag, and the problem types invalid-via and gateway-error.

Refs #487

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Client pipelines with NaN, Infinity, non-finite numbers (1e999) or
integers beyond 2^53 - 1 are refused (400): RFC 8785 hashes of the
resolved pipeline cannot represent them, so provenance would fail
after the backend accepted, or pipelines would collide.

Refs #487

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Address the second review round of client pipelines:

- Tag values with unpaired surrogates are refused with 400 instead of
  failing with a UnicodeEncodeError; client pipelines must be valid
  Unicode (strings and keys) and are nested 32 levels deep at most.
- Identifiers of client pipelines and presets clash only with the
  frame steps that are kept: appended defaults (if_missing_phase) that
  are left out no longer block the same identifiers; presets are
  checked against them at startup. Errors say to set an explicit id,
  and the client's error no longer names the gateway's steps.
- A _has_role() helper replaces three role checks; InvalidSelection
  sits next to InvalidVia; STEP_ID_PATTERN has its docstring back.
- Docs no longer say that discarded backends are recorded (#488 adds
  that).

Refs #487

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

sourcery-ai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

This PR enables clients to select bounded, role-authorized presets or inline pipelines and narrow or reorder routed backends per request, while admins retain control through plugin allowlists, frames, presets, limits, reserved-tag validation, uniform errors, and startup checks.

Sequence diagram for per-request pipeline and backend selection

sequenceDiagram
    actor Client
    participant Host as PluginHost
    participant Selection as selection
    participant Run as PipelineRun

    Client->>Host: start(inbound, principal, tags)
    Host->>Selection: parse_client_tags(tags, prefix, limits)
    Selection-->>Host: ClientSelection
    Host->>Host: resolve(pipeline, principal)
    alt inline pipeline
        Host->>Selection: parse_client_pipeline(value)
        Selection-->>Host: validated steps
    end
    Host->>Run: PipelineRun(pipeline, selection)
    Run->>Run: route(candidates)
    Run->>Selection: apply_backend_selection(routed, backends)
    Selection-->>Run: filtered or reordered candidates
    Run-->>Client: execute selected pipeline and backends
Loading

File-Level Changes

Change Details Files
Add configuration and documentation for client-selected pipelines, presets, backend selection, reserved tags, and administrative safety limits.
  • Introduce client pipeline and backend settings, named presets, reserved tag prefix, plugin selectability, and role controls.
  • Document replacement of the default pipeline, framing via prepend/append, backend selection semantics, limits, and problem types.
  • Validate preset/frame references, plugin availability, step identifiers, and startup configuration consistency.
docs/configuration/plugins.md
docs/plugins.md
docs/reference.md
foca/plugins/config.py
Implement per-request parsing, authorization, resolution, framing, and backend filtering in the plugin engine.
  • Parse and validate reserved tags, including bounded UTF-8 JSON and I-JSON pipeline constraints.
  • Resolve presets or inline pipelines with uniform authorization failures and role-aware plugin checks.
  • Frame client choices with mandatory admin steps and apply backend allow, deny, or ordering after routing.
  • Require explicit tags for non-TES APIs and expose selection/provenance state on pipeline runs.
foca/plugins/selection.py
foca/plugins/engine.py
foca/plugins/errors.py
foca/plugins/outcomes.py
Preserve public exports and utility behavior while decoupling plugin selection from Flask request context.
  • Export the new selection error and restore the InvalidVia/public plugin API exports.
  • Move the Flask request import into the request-dependent URL helper so selection code works without Flask context.
foca/plugins/__init__.py
foca/utils/urls.py
Add comprehensive coverage for selection behavior, limits, authorization, startup checks, and adversarial inputs.
  • Test presets, inline pipelines, frames, backend filtering, reserved tags, API-specific tag handling, and uniform errors.
  • Cover disabled, unavailable, role-restricted, and non-selectable plugins, frame clashes, I-JSON constraints, Unicode, nesting, and size limits.
  • Use seeded randomized pipelines to verify forbidden plugins cannot be selected.
tests/plugins/fakes.py
tests/plugins/test_plugin_basics.py
tests/plugins/test_plugin_selection.py

Assessment against linked issues

Issue Objective Addressed Explanation
#487 Allow clients to select a per-request pipeline or preset through reserved tags, with admin framing, configuration limits, and authorization checks that prevent use of unavailable or unauthorized plugins. ✅
#487 Allow clients to order, allow, or forbid backends through a reserved tag, applying the choice after routing while retaining only eligible request candidates. ✅
#487 Expose the resolved client selection and pipeline for downstream provenance, and document and test the per-request selection behavior. ✅

Possibly linked issues


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

@codecov

codecov Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##               dev      #498    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           43        44     +1     
  Lines         4458      4749   +291     
==========================================
+ Hits          4458      4749   +291     
Flag Coverage Δ
test_unit 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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
uniqueg marked this pull request as ready for review October 25, 2026 02:57

@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 5 issues

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

## Individual Comments

### Comment 1
<location path="foca/plugins/selection.py" line_range="398-399" />
<code_context>
+    """
+    keys: dict[str, Backend] = {}
+    for backend in candidates:
+        keys.setdefault(backend.id, backend)
+        keys.setdefault(_key(backend.url), backend)
+    listed: list[Backend] = []
+    discarded: list[str] = []
</code_context>
<issue_to_address>
**Backend choices target the wrong candidate**

When a candidate's ID equals another candidate's URL or normalized URL, `apply_backend_selection` stores IDs and normalized URLs in one dictionary and checks the raw item in that shared namespace first, so an allow or forbid choice by URL can resolve to the wrong backend and fail to enforce the requested selection.

Resolve backend IDs and normalized URLs in separate namespaces.

Also at `foca/plugins/selection.py:403`.
</issue_to_address>

### Comment 2
<location path="foca/plugins/selection.py" line_range="173-174" />
<code_context>
+            f"Tags under {prefix!r} are reserved for the gateway: {reserved[0]}",
+            slug="reserved-tag",
+        )
+    pipeline = tags.get(f"{prefix}{PIPELINE_TAG}")
+    raw = tags.get(f"{prefix}{BACKENDS_TAG}")
+    if pipeline is not None and not pipelines_enabled:
+        raise InvalidSelection("Choosing pipelines per request is disabled")
</code_context>
<issue_to_address>
**Null choice tags bypass rejection**

When a caller supplies `gateway.pipeline: null` or `gateway.backends: null`, `parse_client_tags` treats the reserved tag as absent, skips parsing and validation (including disabled-choice checks), and uses the default pipeline or unrestricted server candidate set instead of returning a 400 response.

Reject reserved choice tags that are present with a `None` value.

Also at `foca/plugins/selection.py:175-177`.
</issue_to_address>

### Comment 3
<location path="foca/plugins/selection.py" line_range="334" />
<code_context>
+        InvalidSelection: The value is not a valid pipeline.
+    """
+    try:
+        data = json.loads(value, parse_constant=_reject_constant)
+        if not isinstance(data, list):
+            raise TypeError("not a list")
</code_context>
<issue_to_address>
**Duplicate keys bypass I-JSON validation**

When an inline pipeline contains duplicate object member names, `json.loads` collapses duplicate keys before `check_i_json` runs, so `parse_client_pipeline` accepts ambiguous input that violates the I-JSON contract and uses whichever duplicate value the parser retains.

Reject duplicate object member names during JSON decoding before they are collapsed.
</issue_to_address>

### Comment 4
<location path="foca/plugins/config.py" line_range="518-521" />
<code_context>
                             " 'plugins.available'"
                         )
+        frame = self.client_pipelines
+        reserved = {
+            step.id
+            for step in (*frame.prepend, *frame.append)
+            if step.if_missing_phase is None
+        }
+        for name, steps in self.presets.items():
</code_context>
<issue_to_address>
**Dropped frame steps block startup**

When a frame step's plugins are all disabled and the step uses `on_failure: skip`, while a preset uses its ID, `_check_references` reserves IDs from the raw frame configuration even when a frame step has no enabled plugin and `on_failure: skip`; the engine drops such steps during resolution, but the config validator still rejects a preset reusing their IDs, so the application fails to start for a non-clashing configuration.

Check preset/frame ID clashes against the resolved steps that are actually retained, rather than reserving IDs from dropped frame steps.
</issue_to_address>

### Comment 5
<location path="foca/plugins/config.py" line_range="320" />
<code_context>
+    )
+    max_steps: PositiveInt = 8
+    max_alternatives: PositiveInt = 3
+    max_size: PositiveInt = 8192
+    roles: list[str] = []
+    prepend: list[StepConfig] = []
</code_context>
<issue_to_address>
**Default pipeline size exceeds stated cap**

When the default configuration is used and a pipeline tag is larger than 2 KiB but no larger than 8 KiB, `max_size` defaults to 8192, so `parse_client_tags` accepts pipeline tag values larger than the stated 2 KiB limit.

Set the default `max_size` to 2048 bytes.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 5 findings to address first, and per-request pipeline choice is enabled by default, and a client-supplied pipeline—including an empty one—replaces the configured default; policies not placed in prepend can therefore be skipped by authenticated callers. Reverting stops future choices, but cannot undo processing or forwarding effects that already occurred.

Blocking findings: foca/plugins/selection.py:399, foca/plugins/selection.py:174, foca/plugins/selection.py:334, foca/plugins/config.py:521, foca/plugins/config.py:320


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

Comment thread foca/plugins/selection.py Resolved
Comment thread foca/plugins/selection.py Resolved
Comment thread foca/plugins/selection.py Resolved
Comment thread foca/plugins/config.py Resolved
Comment thread foca/plugins/config.py Resolved
- Backend selections match items with :// against candidate URLs and
  other items against identifiers only, so that an identifier that
  equals another candidate's URL cannot select the wrong backend.
- Choice tags that are present count whatever their value: null and
  other non-strings get 400, also when the choice is disabled.
- Objects of client pipelines must not have duplicate keys (I-JSON).
- Clashes of preset steps with the frame are checked by the engine
  only, against the frame steps that are kept (no steps dropped for
  lack of enabled plugins, no left-out appended defaults).

Refs #487

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg merged commit 6914279 into dev Oct 25, 2026
30 checks passed
@uniqueg
uniqueg deleted the feat/plugin-pipelines branch October 25, 2026 03:25
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(plugins): resolve per-request pipelines

1 participant