Skip to content

docs: align the 0.18 guide on opt-in roles - #535

Merged
uniqueg merged 2 commits into
devfrom
docs/migration-opt-in-unmapped
Oct 26, 2026
Merged

uniqueg merged 2 commits into
devfrom
docs/migration-opt-in-unmapped

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Summary

Aligns the "Opt-in roles" section of docs/migration-0.18.md with #533: opt-in roles that no group is mapped to yet are allowed, with a startup warning (and the advice to check it, as a misspelled opt-in role is only warned of); still refused on startup: opt-in roles that are resource_roles or start with a subject prefix, an invalid or clashing opt_in_header, and configured rules granting opt-in roles.

Closes #534

Light lane: docs only; reviewed the diff myself against foca/models/config.py and the docs changed by #533.

Verification

  • mkdocs build --strict: passes.

🤖 Generated with Claude Code

Summary by Sourcery

Documentation:

  • Align the 0.18 migration guide with the current opt-in role validation and startup-warning behavior.

Since #533, opt-in roles that no group is mapped to are allowed, with a
startup warning, instead of failing validation.

Closes #534

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg uniqueg added this to the v0.18.0 milestone Oct 26, 2026
@sourcery-ai

sourcery-ai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the 0.18 migration guide to match current opt-in role validation: unmapped roles are permitted with startup warnings, while unsafe role definitions, invalid headers, and policy grants remain rejected.

File-Level Changes

Change Details Files
Clarify migration behavior for opt-in role validation and startup warnings.
  • Document that unmapped opt-in roles are allowed but produce a startup warning because users cannot yet opt into them.
  • Emphasize checking warnings after deployment to catch misspelled opt-in roles, which remain warning-only.
  • Update the rejected-configuration list to include resource roles and roles using subject prefixes while retaining invalid or conflicting headers and policy grants.
docs/migration-0.18.md

Assessment against linked issues

Issue Objective Addressed Explanation
#534 Update the 0.18 migration guide to say that unmapped opt-in roles are allowed and produce a startup warning, while advising readers to check for misspelled roles. ✅
#534 Accurately list the opt-in-role configurations that still prevent startup, including resource roles, subject prefixes, invalid or clashing headers, and policy rules granting opt-in roles. ✅

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

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #535   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           55        55           
  Lines         6667      6667           
=========================================
  Hits          6667      6667           
Flag Coverage Δ
test_unit 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 26, 2026 23:27

@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="docs/migration-0.18.md" line_range="213-214" />
<code_context>
-  it to another opt-in role), as the role would then apply without asking
-  for it.
+  opt-in role is a `resource_roles` role or starts with a prefix of
+  subjects, if `opt_in_header` is no valid header name or equals
+  `security.auth.on_behalf_of_header`, or if a configured rule of
+  `policies` grants an opt-in role (e.g., `[g, "user:alice", admin]`,
+  also resource-scoped `g2` rules and rules granting it to another opt-in
</code_context>
<issue_to_address>
**Unused header clash falsely rejected**

When `opt_in_roles` is empty and `opt_in_header` matches `security.auth.on_behalf_of_header`, readers are told this configuration fails validation, but `SecurityConfig.validate_access_control()` checks the header clash only when `opt_in_roles` is nonempty; with no opt-in roles, the app starts successfully and the guide overstates the validation behavior.

Clarify that the header clash is rejected only when opt-in roles are configured.
</issue_to_address>

Sourcery assessment

Approved.


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

Comment thread docs/migration-0.18.md Resolved
Address review: the clash with the on-behalf-of header is only checked
with opt-in roles set.

Part of #534

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg merged commit d6b9860 into dev Oct 26, 2026
30 checks passed
@uniqueg
uniqueg deleted the docs/migration-opt-in-unmapped branch October 26, 2026 23:40
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.

docs: align the 0.18 guide on unmapped opt-in roles

1 participant