Skip to content

feat(config)!: config overlays, relative paths - #294

Merged
uniqueg merged 51 commits into
devfrom
feat/config-overlays
Oct 19, 2026
Merged

uniqueg merged 51 commits into
devfrom
feat/config-overlays

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Summary

Tenth PR of the v0.14.0 production-readiness series. Builds on #293 (← #292 ← … ← #274); please merge those first. Until then, this diff includes their commits; the change of this PR is the last commit.

Implements the refined proposals in #247 and #209.

Changes

  • Several config files (feat: Adding DEV, PROD, TEST environment variables #247):
    • Foca(config_file=...) and ConfigParser accept a path or a sequence of paths, merged left to right before validation: mappings recursively; lists and other values, including null, replace earlier ones (deep_merge()).
    • Files listed in FOCA_CONFIG_OVERLAY are appended. Paths are separated by os.pathsep and relative to the working directory, like other environment paths. A missing overlay file raises a FileNotFoundError naming the variable.
    • Validation runs once on the merged result; the merged files are logged at INFO. Empty files are fine; files that are not YAML mappings raise a clear error.
    • No environments: section and no mode enum: apps that need a mode set it in custom via an overlay.
  • Relative paths (Using FOCA without Docker #209):
    • Relative paths in the config (api.specs[].path, security.access_control.api_specs, security.access_control.model) resolve against the directory of the first config file, so apps work from any working directory. Before, they resolved against the working directory, and access_control.api_specs not at all.
    • Without a config file (config built in code), the working directory is used, as before.
    • Implemented via Config.model_validate(data, context={"base_dir": ...}) and ValidationInfo in the validators.
    • Overlays use the same base directory, so a path means the same in every file.
    • Foca.config_dir exposes the directory for resolving paths in custom; Foca.config_files lists all merged files.
  • Docs:
    • README: how relative paths are resolved, and a new "Environment-specific configuration" section (base + overlay, FOCA_CONFIG_OVERLAY);
    • the template mentions both.

Closes #247
Closes #209

Breaking changes

Relative paths in config files resolve against the directory of the (first) config file instead of the working directory. Downstream:

  • proTES (pro_tes/config.yaml, specs as api/...): already relative to the config file, so no change needed.
  • cloud-registry (cloud_registry/config.yaml, specs as cloud_registry/api/...): change the spec paths to api/....

#209 was labelled blocked on #188 (Connexion 3); it no longer depends on it, so the label can be removed.

Verification

  • Merge semantics (deep_merge): nested mappings, list and scalar replacement, null, mappings replacing other values and vice versa; inputs are not mutated.
  • Config files:
    • several files passed in code (path and string);
    • FOCA_CONFIG_OVERLAY with one relative path (resolved against the working directory) and with two paths;
    • an overlay without a config file;
    • a missing overlay file (clear error);
    • a non-mapping file;
    • an empty overlay.
  • Relative paths:
    • an app created from a different working directory finds its OpenAPI spec and Casbin model via relative paths in its config, and the routes are registered;
    • without a config file, paths resolve against the working directory.
  • Local runs on Python 3.13 and 3.10: 540 passed, with the two live-MongoDB suites run against mongomock via a local, uncommitted pytest plugin. foca has 100% line coverage, and ruff check, ruff format --check and mypy foca are clean.

CI: all checks pass (lint/type-check/build, unit tests on Python 3.10–3.14 with MongoDB 7.0/8.0, petstore integration tests, Codecov patch and project).

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Enable layered configuration files with predictable overrides and make configured resource paths independent of the application's working directory.

New Features:

  • Support merging multiple configuration files and environment-selected overlays with recursive mapping merges and replacement semantics for lists and scalar values.
  • Resolve configured file paths relative to the first configuration file and expose the configuration directory and merged file list to applications.

Enhancements:

  • Validate the merged configuration once and provide clearer handling for empty or invalid YAML configuration files.
  • Extend path resolution to access-control API specifications and models while preserving working-directory resolution for in-code configurations.

Documentation:

  • Document configuration overlays, environment-specific settings, and relative path resolution in the README and configuration template.

Tests:

  • Add coverage for configuration merge semantics, overlays, invalid and empty files, and path resolution from different working directories.

uniqueg and others added 29 commits October 18, 2026 02:31
Bearer token validation fetched the OpenID Connect discovery document
from whatever issuer a token named, and validated the token against
that issuer's keys and user info endpoint. Tokens minted by any OpenID
Connect provider could therefore be accepted, and the service could be
made to send requests to arbitrary URLs.

- accept only tokens of the trusted issuers listed in the new
  `security.auth.issuers` setting; reject all others before any
  network request; reject all tokens if no issuers are configured
- check that the discovery document was issued for the token's issuer
  and pass the issuer to `jwt.decode`
- always verify the signature locally; the user info endpoint is only
  an additional check (`validate_userinfo`), done after verification,
  whose `sub` must match the token's
- require `exp`, `iat`, `iss` and the identity claim
- return the verified claims; `add_key_to_claims` works again
- fetch documents with timeouts and without following redirects;
  cache discovery documents and JWK sets (`timeout`, `cache_ttl`),
  refetching JWK sets on unknown key IDs at most every 30 seconds
- log warnings on app creation if no issuers are configured, audience
  validation is disabled or expired tokens are accepted

BREAKING CHANGE: `security.auth.issuers` must list the trusted token
issuers; otherwise, all tokens are rejected. `validation_methods`,
`validation_checks` and `claim_issuer` are removed; use
`validate_userinfo: True` to additionally validate tokens via the user
info endpoint. Signatures are always verified locally.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Also drop the unreachable error handling for decoding the token header,
which can always be decoded once the token itself was decoded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
There were two ways of enforcing access control: config-driven
enforcement (`access_control.enforce`, `enforce_access_control`) based
on validated token claims, and the `check_permissions` decorator based
on flask-authz, which took subjects from request headers. The latter
only worked because `validate_token` copied all token claims into the
request headers (replacing the original headers), and used client-set
headers where no token was validated.

- remove `check_permissions`, the flask-authz dependency and the
  `owner_headers`/`user_headers` settings; use `enforce_access_control`
  to enforce policies on single controllers
- stop copying token claims into request headers; use
  `get_current_subject()`, `get_current_groups()` or `token_info`
- read validated token info from Connexion's request context directly
  instead of treating any `AttributeError` as "no claims"
- depend on pycasbin, the maintained successor of the casbin package
  (previously pulled in via flask-authz)

BREAKING CHANGE: `check_permissions` and the `owner_headers` and
`user_headers` settings are removed (configs using them fail
validation), and token claims are no longer available as request
headers. Use `access_control.enforce` or the `enforce_access_control`
decorator, and `get_current_subject()`/`get_current_groups()`.

Closes #276

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Connexion raises `BadRequestProblem` for requests failing schema
validation (e.g., request bodies with unknown properties or values not
matching a pattern). The exception is not in FOCA's default exception
mapping, so such requests were answered with 500 instead of 400.

Add `BadRequestProblem` to the default mapping.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rules were serialized to comma-separated lines and split again when
loaded, so values containing commas (e.g., identity claims passed to
`add_resource_role`) turned into extra fields, and malformed rules could
break enforcement for all requests. Stored documents were copied onto
rules as a whole, the permissions API accepted and stored arbitrary
rule objects, and actions in the reference model matched as substrings.

- validate rules on every write path (adapter, permissions API,
  resource role helpers): policy type defined in the model, matching
  number of values, values non-empty strings of at most 1024 characters
  without commas or line breaks and not starting with `#`, and `act`
  values valid regular expressions
- load rules from `ptype` and `v0` to `v5` only, passed as lists; skip
  invalid stored rules with a warning
- deny requests with subjects that are not valid rule values (403)
- respond with 400 to invalid rules in the permissions API; disallow
  additional properties in its `Permission` and `Rule` schemas, drop
  the unused `rule_section`, and return only rule fields
- anchor action patterns in the reference model and petstore example
- add `api_swagger_ui` and `api_serve_spec` (default: off) to serve
  the Swagger UI and spec of the permissions API

BREAKING CHANGE: action patterns of the reference model must match the
whole HTTP method. The permissions API rejects rules with unknown
policy types, extra keys or a wrong number of values, and no longer
serves its Swagger UI and spec unless `api_swagger_ui` and
`api_serve_spec` are set.

Closes #277

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Discovery documents and JWK sets were only cached after successful
fetches, so while an identity provider was unavailable, every request
fetched them again, amplifying load on the provider during an outage.

Do not fetch a discovery document or JWK set again within
`JWKS_REFETCH_COOLDOWN` seconds after a failed attempt. User info
requests depend on the token and are not throttled.

Also test that tokens without key ID are verified with all signing
keys, not only the first one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Explain that without `audience`, tokens that trusted issuers issued for
other services are accepted, and recommend setting it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The permissions API looked up its collection in four places, stored
rules via the Casbin adapter on POST but directly on PUT, failed on
stored rules without identifier or policy type, and turned every error
into 500. Generated rule identifiers were not guaranteed to be unique,
and `save_policy` duplicated stored rules.

- store rules via the adapter on POST and PUT (upsert by identifier),
  so that both store the same fields
- return stored rules without identifier (omitting it) and skip rules
  without policy type when reading; let the global error handler deal
  with errors instead of wrapping them as 500
- add `access_control.id_charset` and `id_length` for generated rule
  identifiers; reject other identifiers in `PUT /permissions/{id}`
- ensure a unique index on rule identifiers and retry with a new
  identifier on collisions
- make `save_policy` replace the stored rules instead of adding them
- make `CasbinRule` a dataclass with `to_dict()` (was `dict()`) and
  `from_values()`; drop the debug `print()`; raise `ValueError` instead
  of asserting a collection is given

BREAKING CHANGE: `PUT /permissions/{id}` rejects identifiers that do not
match `access_control.id_charset` and `id_length` (default: 6 letters or
digits). Stored rules with duplicate identifiers make the first write
fail, as the unique index cannot be created. `CasbinRule.dict()` is
renamed to `to_dict()`, and `Adapter.save_policy()` replaces all stored
rules.

Closes #278
Closes #142

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The section on header properties was removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Writing through `Adapter.save_policy_line` (e.g., via
`Enforcer.add_policy`) only checked rule values, so rules with policy
types not defined in the model, a wrong number of values or invalid
action patterns were stored successfully, but skipped when loading
policies.

Let the adapter take the path to the Casbin model and validate rules
against it before storing them; FOCA passes the configured model.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	foca/security/access_control/foca_casbin_adapter/adapter.py
#	foca/security/access_control/register_access_control.py
#	tests/security/access_control/test_register_casbin_enforcer.py
With 4 characters from 2, only 16 identifiers are possible, so storing
10 rules could exhaust the retries for a unique identifier.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`GET /permissions` returned all rules as a bare list (optionally
limited via `limit`, in reverse natural order), and only subjects
allowed by the policies (e.g., admins) could see any rules.

Pagination (as per the GA4GH API pagination guide, page-based):
- `page_size` (default 100, at most 1000) and `page` (from 0) replace
  `limit`; the response is `{"results": [...], "pagination": {"page",
  "page_size", "total", "total_pages"}}`, in creation order
- out-of-range pages and page sizes are rejected with 400

Self-service (opt-in via `access_control.self_service`):
- any authenticated subject may list and get the rules that apply to
  them (subject is their prefixed identifier, one of their roles from
  group claims, or `*`); other rules are not found (404)
- subjects allowed by the policies still get all rules; write
  operations are still enforced
- operations opt in via `x-foca-self-service: true`; the resolver
  leaves enforcement to their controllers, which use the new
  `is_permitted()`

BREAKING CHANGE: `GET /permissions` returns an object with `results`
and `pagination` instead of a list, and `limit` is replaced by
`page_size` and `page`.

Closes #113
Closes #112

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`security.auth.required` (default `True`) did not enforce
authentication, which is defined per operation in the API specs. It
only decided whether FOCA registered access control, so every app with
default settings mounted the permissions API and connected to an access
control database. Inconsistent settings only logged an error.

- add `security.access_control.enabled` (default `False`); only then
  register the policy collection, Casbin adapter and permissions API
- remove `security.auth.required`
- reject access control options (`enforce`, `api_specs`,
  `api_controllers`, `self_service`) without `enabled`, and `enabled`
  without trusted token issuers (`auth.issuers`)
- log warnings about authentication settings on the first token
  validation instead of on app creation, as only then is it known that
  the app validates tokens

BREAKING CHANGE: `security.auth.required` is removed (configs using it
fail validation). Apps using the permissions API or `enforce` must set
`security.access_control.enabled: True` and `security.auth.issuers`;
apps not using access control no longer get an access control
database.

Closes #279

Co-Authored-By: Claude Opus 5.5 <[email protected]>
If stored rules share identifiers (e.g., rules stored by previous
versions), the unique index on identifiers cannot be created, so every
write failed.

Log an error with a recovery path once and store rules without
guaranteeing unique identifiers instead; document how to resolve this.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With `disable_auth: true`, `register_openapi` called `.pop("security",
None)` on every field of each Path Item Object, including path-level
`parameters` (a list), so registering such specs failed with a
`TypeError`.

Add `_iter_operations()`, yielding only Operation Objects, and use it
both for removing security requirements and for adding operation
fields. Test the specifications passed to Connexion, not only the
return type.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- map `ServiceUnavailable` to status 503 (was 502)
- look up exceptions along their method resolution order, so that
  subclasses of mapped exceptions (e.g., `class TaskNotFound(NotFound)`)
  are handled like their closest mapped base class instead of as 500
- log each handled exception once, with its problem details, instead of
  logging the problem details and the exception separately

BREAKING CHANGE: `ServiceUnavailable` returns 503 instead of 502, and
unmapped subclasses of mapped exceptions return the status of their
closest mapped base class instead of 500.

Closes #280

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`ExceptionConfig` required apps to describe the shape of their error
responses (`required_members`, `extension_members`, `status_member`,
nested `public_members`/`private_members`) and to list every werkzeug
exception, and the handler read its settings from `current_app`.

- respond with RFC 9457 problem details; `build_problem()` resolves
  them without an app: closest listed class in the exception's MRO,
  else the exception's HTTP status (`code`, `status` or `status_code`)
  with its standard reason phrase, else a listed `Exception`, else 500
- `ExceptionConfig`: `mapping` (dotted path to a dictionary mapping
  exception classes to problem details with integer `status` and string
  `title`), flat `public_members` and `logging`; the other fields and
  the default `exceptions` dictionary are removed
- `register_exception_handler(app, conf)` binds the settings instead of
  reading `current_app`
- log exceptions with their unfiltered problem details
- update examples (problem details instead of `code`/`message`),
  template and README

BREAKING CHANGE: `ExceptionConfig.exceptions`, `required_members`,
`extension_members`, `status_member` and `private_members` are removed
and `public_members` is a flat list of member names. Rename
`exceptions` to `mapping`; each mapped entry needs `status` and
`title`. `foca.errors.exceptions` no longer provides the default
`exceptions` dictionary or re-exports werkzeug exceptions.

Closes #240

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- create the unique index on rule identifiers until it succeeds (or
  fails due to duplicate stored identifiers), instead of giving up
  after any first error
- require `id_charset` and `id_length` to allow for at least one
  million identifiers, so that generating unique identifiers cannot
  run out of attempts
- remove stored rules by their policy type and values only, so that
  rules with other fields (e.g., written directly) can be revoked

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	foca/security/access_control/constants.py
`server.debug` defaulted to `True` on host `0.0.0.0`, so running an
app with default settings exposed the Werkzeug interactive debugger,
which allows executing arbitrary code.

- default `server.debug` to `False`; log a warning if debug mode is
  enabled on a host other than a loopback address
- remove `server.environment` (ignored by Flask >= 2.3) and
  `server.use_reloader` (never read)
- drop stack inspection in the app factories, used only for a debug
  log message
- make the API test config valid instead of relying on debug mode to
  ignore unresolvable operations

BREAKING CHANGE: debug mode is off by default; set `server.debug: True`
explicitly for local development. `server.environment` and
`server.use_reloader` are removed (configs using them fail validation).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`enable_cors` called `CORS(app)` without options, so any origin was
allowed for every route, and nothing could be configured.

Add `allow_origins` (default `*`), `allow_methods`, `allow_headers`,
`expose_headers`, `allow_credentials` (default `False`) and `max_age`
to `CORSConfig`, with field names following Starlette's
`CORSMiddleware` for the Connexion 3 migration, and pass them to
flask-cors. Allowing credentials for any origin fails validation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Several settings were documented but had no effect, and creating an
app mutated the parsed configuration.

- remove `access_control.api_controllers` (never applied; controllers
  are resolved via the `operationId`s of the permissions API spec) and
  the non-existent `api_route` from the docs
- remove `SpecConfig.path_out` (modified specs were never written), the
  `*.modified.yaml` fixtures and the unused `PymongoDirectionEnum`
- default `access_control.db_name` and `collection_name` in the model
  instead of setting them in `create_app()`, which left them `None`
  until then; fix the misspelled `DEFAULT_ACESS_CONTROL_...` constant
- share the setup of `create_app()` and `create_celery_app()`
- use `importlib.resources.files()` instead of a path used after its
  context exited; split custom config model paths with `rpartition`;
  rename `IndexConfig.store_enum_value` to `keys_to_list`; fix the
  `merge_yaml` and `register_openapi` docstrings
- remove the unused `examples/petstore/petstore_policies.conf`

BREAKING CHANGE: `security.access_control.api_controllers` and
`api.specs[].path_out` are removed (configs using them fail
validation). Custom permissions controllers are selected via the
`operationId`s in custom `api_specs`.

Closes #281

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Environment-specific settings required separate, complete config files
(#247), and relative file paths in configs were resolved against the
working directory, so apps only worked when started from one directory
(#209).

- accept one or several config files in `Foca`/`ConfigParser`, merged
  in order: mappings recursively, lists and other values (including
  `null`) replaced; append files listed in `FOCA_CONFIG_OVERLAY`
  (separated by `os.pathsep`, relative to the working directory), with
  a clear error for missing files; validate the merged result once and
  log the merged files
- resolve relative paths in the config (`api.specs[].path`,
  `access_control.api_specs` and `model`) against the directory of the
  first config file, or the working directory without a config file;
  expose it as `Foca.config_dir`
- document environment-specific configuration and path resolution

BREAKING CHANGE: relative paths in config files are resolved against
the directory of the (first) config file instead of the working
directory.

Closes #247
Closes #209

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

sourcery-ai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

This breaking-change PR makes configuration composable through ordered overlays and environment-selected files, resolves config-relative resources consistently, and modernizes the surrounding production-readiness surface: OIDC authentication and opt-in access control, validated/paginated permissions, RFC 9457 errors, configurable CORS, safer debug defaults, and updated examples and documentation.

Sequence diagram for merged configuration and relative resource resolution

sequenceDiagram
    participant App as Foca
    participant Parser as ConfigParser
    participant Files as ConfigFiles
    participant Config as Config
    participant Resources as ConfigResources

    App->>Parser: ConfigParser(config_file)
    Parser->>Parser: _as_paths(config_file)
    Parser->>Parser: get_overlay_files()
    loop Files in merge order
        Parser->>Files: parse_yaml(path)
        Files-->>Parser: YAML mapping
        Parser->>Parser: deep_merge(data, content)
    end
    Parser->>Config: model_validate(data, context={base_dir})
    Config->>Resources: _resolve_path(path, info)
    Resources-->>Config: Absolute resource path
    Config-->>Parser: Validated merged config
    Parser-->>App: config_files and config_dir
Loading

File-Level Changes

Change Details Files
Adds ordered configuration overlays with recursive mapping merges and replacement semantics for lists, scalars, and null values.
  • Accepts one or multiple config paths in code.
  • Appends files from FOCA_CONFIG_OVERLAY, validates the merged mapping once, and exposes merged file metadata.
  • Adds missing-file, empty-file, and non-mapping handling plus merge logging.
foca/config/config_parser.py
foca/foca.py
tests/config/test_config_parser.py
tests/test_foca.py
README.md
templates/config.yaml
Resolves configured filesystem paths relative to the first configuration file while preserving working-directory behavior for programmatic configuration.
  • Passes base_dir through Pydantic validation context.
  • Resolves OpenAPI specs, access-control specs, and Casbin models to absolute paths.
  • Exposes config_dir for custom configuration path resolution and tests cross-working-directory app creation.
foca/models/config.py
foca/config/config_parser.py
foca/foca.py
tests/test_foca.py
tests/models/test_config.py
README.md
templates/config.yaml
Reworks authentication, access-control registration, and policy handling around trusted OIDC issuers and validated Casbin rules.
  • Replaces legacy auth validation modes with issuer discovery, signature verification, caching, optional userinfo validation, and security warnings.
  • Makes access control explicitly opt-in and removes controller/header-based configuration.
  • Adds rule validation, generated unique identifiers, duplicate handling, exact action matching, and safer loading of legacy/invalid stored rules.
foca/models/config.py
foca/security/auth.py
foca/security/access_control/enforcement.py
foca/security/access_control/register_access_control.py
foca/security/access_control/foca_casbin_adapter/adapter.py
foca/security/access_control/foca_casbin_adapter/casbin_rule.py
foca/security/access_control/api/resource_role_model.conf
foca/security/access_control/api/access-control-specs.yaml
pyproject.toml
tests/security/test_auth.py
tests/security/access_control/test_enforcement.py
tests/security/access_control/foca_casbin_adapter/test_adapter.py
tests/security/access_control/foca_casbin_adapter/test_casbin_rule.py
Expands the permissions API with validated pagination, self-service visibility, configurable rule identifiers, and resource-role enforcement.
  • Returns paginated permission results and metadata with bounded page parameters.
  • Filters reads for self-service users while keeping writes policy-enforced.
  • Supports configurable identifier charset/length, unique indexes, and collision retries.
  • Adds is_permitted and updates the single-controller enforcement decorator.
foca/security/access_control/access_control_server.py
foca/security/access_control/register_access_control.py
foca/security/access_control/enforcement.py
foca/security/access_control/constants.py
foca/security/access_control/api/access-control-specs.yaml
docs/access_control/README.md
examples/petstore-access-control/README.md
tests/security/access_control/test_access_control_server.py
tests/security/access_control/test_enforcement.py
Modernizes exception responses, CORS configuration, server defaults, and OpenAPI registration behavior.
  • Maps exceptions to RFC 9457 problem details with inheritance-based lookup, status inference, filtering, and configurable logging.
  • Adds explicit CORS origins, methods, headers, credentials, exposed headers, and max-age validation.
  • Disables debug by default and warns when enabled on non-loopback hosts.
  • Iterates only over OpenAPI operation objects and stops writing modified spec files.
foca/errors/exceptions.py
foca/models/config.py
foca/security/cors.py
foca/factories/connexion_app.py
foca/api/register_openapi.py
README.md
examples/petstore/exceptions.py
examples/petstore-access-control/exceptions.py
tests/errors/test_errors.py
tests/security/test_cors.py
tests/factories/test_connexion_app.py
tests/api/test_register_openapi.py
tests/integration_tests.py

Assessment against linked issues

Issue Objective Addressed Explanation
#209 Allow users to install and run FOCA directly without Docker using only the published package and its declared dependencies, without requiring them to manually install a separate requirements list. ❌ The PR changes configuration handling, authentication, access control, and dependencies, but it does not identify or fix the package-installation/runtime error described in the issue. There is no relevant change to packaging or documentation explaining how to run FOCA without Docker.
#247 Provide standardized DEV, PROD, and TEST environment variables or modes that application code can inspect, such as through app.mode. ❌ The PR explicitly adds no mode enum or app.mode. It suggests that apps define their own environment value in custom configuration and set it through an overlay, so it does not provide the requested standardized modes.
#247 Allow environment-specific configuration values to override a shared base configuration. ✅

Possibly linked issues

  • #N/A: The PR directly implements the issue’s core access-control requirements, including validated OIDC claims, secured permissions endpoints, and resource-role helpers.

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 18, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #294   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines         1169      1216   +47     
=========================================
+ Hits          1169      1216   +47     
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 18, 2026 19:50

@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 reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. A flaw in JWT validation or Casbin enforcement could admit unauthorized requests, and any resulting data exposure cannot be undone by reverting. Also, save_policy() deletes every document in the policy collection before rewriting the in-memory rules, so stored rules skipped during loading can be permanently lost.


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

uniqueg and others added 22 commits October 18, 2026 22:17
Tokens without key ID are verified with each signing key of the
issuer. Keys of another type or algorithm than the token (e.g., an EC
key for an RS256 token) raised `InvalidAlgorithmError`, which rejected
the token instead of trying the remaining keys.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Errors are returned as RFC 9457 problem details (application/problem+json),
but the permissions API and example specifications declared
application/json with other error schemas. Declare the media type and a
problem details schema for all error responses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg merged commit c3bf628 into dev Oct 19, 2026
13 checks passed
@uniqueg
uniqueg deleted the feat/config-overlays branch October 19, 2026 00:39
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: Adding DEV, PROD, TEST environment variables Using FOCA without Docker

1 participant