Repository navigation
docs: record userinfo, check-config decisions - #704
Conversation
Concurrent misses of user info keep their own fetches, and check-config keeps creating the app, as its checks need it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideDocumentation records two decisions: concurrent userinfo cache misses remain independent, and Sequence diagram for independent userinfo cache missessequenceDiagram
participant RequestA
participant RequestB
participant Userinfo
participant Issuer
par concurrent request A
RequestA->>Userinfo: _get_userinfo
Userinfo->>Issuer: GET /userinfo
Issuer-->>Userinfo: user info
Userinfo-->>RequestA: user info
and concurrent request B
RequestB->>Userinfo: _get_userinfo
Userinfo->>Issuer: GET /userinfo
Issuer-->>Userinfo: user info
Userinfo-->>RequestB: user info
end
Sequence diagram for check-config application-backed validationsequenceDiagram
participant CLI as check-config
participant App
participant StartupChecks
CLI->>App: create_app
CLI->>StartupChecks: register_openapi
StartupChecks->>App: register_openapi
CLI->>StartupChecks: register_access_control
StartupChecks->>App: register_access_control
CLI->>StartupChecks: check_service_info
StartupChecks->>App: check_service_info
Note over CLI,App: App is validated but never served
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 #704 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 66 66
Lines 8588 8588
=========================================
Hits 8588 8588
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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="docs/cli.md" line_range="56-58" />
<code_context>
Loads and validates the configuration and runs the startup checks of the app and, if
`jobs` is set, of its workers. It runs `Foca.create_app()` without serving the app and
-without writing to the database, so it's fit as a CI or Helm test step. Checks that your
+without writing to the database, so it's fit as a CI or Helm test step. It does create
+the app, as the checks need it: specifications are checked by registering them with the
+app, and the checks of access control and the service info work on it. Checks that your
app's functions run on startup (e.g., [fields of the service info computed at
runtime](configuration/service-info.md)) run too, and what they need must be available.
</code_context>
<issue_to_address>
**Config check writes to plugin store**
When `check-config` runs for a gateway app with a plugin-store backend and no `db` section, `disable_startup_writes()` leaves `db` as `None`, so `Foca.create_app()` treats the missing database config as permission to run `host.setup_store()`, which creates indexes and caps expiry. `setup_store()` logs and swallows database errors, so `check-config` can mutate the store or exit successfully after setup fails.
Make the no-startup-writes switch disable plugin-store setup independently of whether `db` is configured, or document the exception.
</issue_to_address>Linked issues
#702 chore: userinfo coalescing, check-config app use · 3 of 3 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Decide whether concurrent user-info cache misses for one token should share a fetch. | ✅ Met | The decision is to keep separate fetches, and docs/authentication.md records that concurrent cache misses fetch independently. |
| 2 | Decide whether check-config should create the web app for its checks. | ✅ Met | The decision is to keep creating the app, and docs/cli.md explains that checks run against it without serving it. |
| 3 | If behavior changes, include tests and documentation. | ✅ Met | The PR keeps the existing behavior and documents both decisions; no behavior change requiring tests is made. |
Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: docs/cli.md:58
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes #702
Light lane: docs only. Both points are decided in favour of the current behaviour, with the docs now saying so.
Coalescing user info: no
Concurrent cache misses for one token keep fetching separately.
userinfo_cache_ttl: 0andvalidate_userinfo, every request must fetch anyway, so sharing would not apply there. No report of load on an issuer prompted this.401, so followers need their own fallback fetch, adding up to anothertimeoutto their wait. That is new locking and failure paths in_get_userinfo, which has just got its ordering guarantees right.Can be reopened if an issuer's rate limits become a problem in a deployment.
check-configand the web app: stayscheck-configkeeps callingcreate_app()with the startup switches off. The checks work on the app:register_openapi()registers specifications with the Connexion app,register_access_control()adds to it,check_service_info()takes the Flask app, and CORS and opt-in headers are set on it. Running them without an app would mean a second code path that can drift from what startup really does, which is what the command is there to check. The app is never served.Verification
mkdocs build --strict: passed. No code changed.Open questions
None.
🤖 Generated with Claude Code
Summary by Sourcery
Document the accepted user-info caching and
check-configbehavior decisions.Enhancements:
check-configcreates the application to run startup checks, including the gateway plugin-store exception.Documentation:
check-configapplication setup.