Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the Aegis Stack project generator/templates to support an auth[oauth] modifier for optional GitHub/Google OAuth social login, while also updating the Insights UI/collector and strengthening DB enum-like fields via CHECK constraints.
Changes:
- Add an OAuth modifier to
auth[...]parsing + template context, plus generated OAuth routes/middleware/settings/deps and template tests/docs. - Add CHECK-constraint support to the dynamic migration generator and apply it to Insights/Auth models.
- Refactor parts of the Insights modal UI (charts, event chips/filtering) and improve PyPI per-version “human vs bot” breakdown.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/core/test_template_generator.py | Adds coverage for include_oauth behavior in template context. |
| tests/core/test_auth_service_parser.py | Adds parser tests for oauth modifier (ordering/case/duplicates/errors). |
| docs/services/auth/index.md | Documents auth[oauth] usage, routes, and env vars. |
| copier.yml | Adds include_oauth Copier question gated by include_auth. |
| aegis/templates/copier-aegis-project/{{ project_slug }}/tests/services/test_oauth_user_service.py.jinja | Adds service-level tests for OAuth user upsert/linking behavior. |
| aegis/templates/copier-aegis-project/{{ project_slug }}/tests/api/test_oauth_endpoints.py.jinja | Adds endpoint guard tests (503 when unconfigured, 401 when unauthenticated). |
| aegis/templates/copier-aegis-project/{{ project_slug }}/pyproject.toml.jinja | Adds conditional deps for OAuth (authlib, itsdangerous). |
| aegis/templates/copier-aegis-project/{{ project_slug }}/app/services/insights/models.py.jinja | Adds CHECK constraints + adjusts InsightEvent.origin typing. |
| aegis/templates/copier-aegis-project/{{ project_slug }}/app/services/insights/collectors/pypi.py | Improves per-version breakdown by grouping on installer and computing human totals. |
| aegis/templates/copier-aegis-project/{{ project_slug }}/app/services/auth/user_service.py.jinja | Adds RegistrationClosed + upsert_from_oauth service method. |
| aegis/templates/copier-aegis-project/{{ project_slug }}/app/services/auth/deps.py.jinja | Adds token extraction from either Bearer or session cookie when OAuth enabled. |
| aegis/templates/copier-aegis-project/{{ project_slug }}/app/services/auth/deps.py | Removes the non-templated deps file (replaced by .jinja). |
| aegis/templates/copier-aegis-project/{{ project_slug }}/app/models/user.py.jinja | Adds CHECK constraint for OAuth provider and keeps provider as StrEnum. |
| aegis/templates/copier-aegis-project/{{ project_slug }}/app/core/security.py.jinja | Adds session-cookie helpers and SESSION_COOKIE_NAME for browser OAuth flows. |
| aegis/templates/copier-aegis-project/{{ project_slug }}/app/core/log.py | Suppresses noisy Stripe SDK INFO logs. |
| aegis/templates/copier-aegis-project/{{ project_slug }}/app/core/config.py.jinja | Adds OAuth-related settings + (currently) a DEBUG_OAUTH debug variable. |
| aegis/templates/copier-aegis-project/{{ project_slug }}/app/components/frontend/dashboard/modals/modal_sections.py | Adds reusable chart palette/tooltips/line-card + date-range chips. |
| aegis/templates/copier-aegis-project/{{ project_slug }}/app/components/frontend/dashboard/modals/insights_modal.py | Refactors Insights modal (hero/goals, charts, event chips dropdown/filtering, tables). |
| aegis/templates/copier-aegis-project/{{ project_slug }}/app/components/backend/middleware/session.py.jinja | Adds SessionMiddleware registration for OAuth flows (conditional). |
| aegis/templates/copier-aegis-project/{{ project_slug }}/app/components/backend/api/routing.py.jinja | Conditionally mounts the OAuth router under /api/v1. |
| aegis/templates/copier-aegis-project/{{ project_slug }}/app/components/backend/api/auth/oauth.py.jinja | Adds OAuth start/callback + connection list/unlink routes. |
| aegis/templates/copier-aegis-project/{{ project_slug }}/README.md.jinja | Adds project-level OAuth setup docs + updates service list description. |
| aegis/core/template_generator.py | Adds include_oauth to template context from parsed auth config. |
| aegis/core/post_gen_tasks.py | Removes OAuth files/tests when include_oauth isn’t enabled. |
| aegis/core/migration_generator.py | Adds CheckConstraintSpec support and renders sa.CheckConstraint(...) in migrations. |
| aegis/core/copier_manager.py | Threads include_oauth into Copier data. |
| aegis/core/auth_service_parser.py | Adds oauth modifier parsing and better unknown/duplicate errors. |
| aegis/constants.py | Adds AnswerKeys.AUTH_OAUTH. |
527e663 to
b036dfb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.