Keep service auth PostgreSQL-owned in ConfigMap mode - #1267
Conversation
📝 WalkthroughWalkthrough
ChangesService authentication hydration
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant ConfigMapWatcher
participant Postgres
participant RuntimeValidation
ConfigMapWatcher->>ConfigMapWatcher: Load ConfigMap and resolve other secrets
ConfigMapWatcher->>Postgres: Read persisted service_auth on first load
ConfigMapWatcher->>ConfigMapWatcher: Reuse cached service_auth on reload
ConfigMapWatcher->>RuntimeValidation: Validate hydrated configuration
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/service/core/config/configmap_loader.py`:
- Around line 298-301: Update _load_and_apply() around the Postgres
get_service_configs() hydration path to catch connector read exceptions, record
the failure, and return LoadResult.TRANSIENT_FAILURE so cold starts can retry.
Preserve validation-failure handling for invalid persisted authentication data,
and add a unit test configuring get_service_configs.side_effect to verify the
transient result and recorded failure.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: a8239961-7bb0-47ed-849e-9d7da714be89
📒 Files selected for processing (2)
src/service/core/config/configmap_loader.pysrc/service/core/config/tests/test_configmap_loader_unit.py
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1267 +/- ##
==========================================
+ Coverage 67.00% 67.04% +0.04%
==========================================
Files 203 203
Lines 26109 26156 +47
Branches 3952 3963 +11
==========================================
+ Hits 17494 17536 +42
- Misses 7854 7856 +2
- Partials 761 764 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
cypres
left a comment
There was a problem hiding this comment.
Why is "JWT signing identity" PostgreSQL-owned ?
Sounds like something we should move to a Kubernetes secret if it's secret, and config map if not secret
Description
Issue - None
ConfigMap mode currently drops
service_authfrom the in-memory snapshot when the field is omitted from the ConfigMap. Every subsequentServiceConfigconstruction then invokes the default factory and generates a new RSA signing identity. Tokens minted by one request can therefore fail validation against JWKS returned by the next request, which prevents backend listeners and workers from authenticating.This change keeps the JWT signing identity PostgreSQL-owned while leaving ConfigMap data authoritative for all other managed configuration:
service.service_authis discarded before secret resolution and cannot override the persisted identity;The change does not generate or persist new signing keys and does not hydrate any other ConfigMap-managed field from PostgreSQL.
Validation
bazel test //src/service/core/config/tests:test_configmap_loader_unit --test_output=errors(93 tests passed; target also ran mypy)Local testcontainer-backed integration targets could not start because this machine has no Docker socket; they run in the supported GitHub CI environment instead.
Checklist
Summary by CodeRabbit
Bug Fixes
Documentation