Ai research#7
Conversation
type!
I got the calendar file uncooked
|
@copilot resolve the merge conflicts in this pull request |
1 similar comment
|
@copilot resolve the merge conflicts in this pull request |
Co-authored-by: rodas-yg <207317571+rodas-yg@users.noreply.github.com>
Resolved the merge conflict in |
There was a problem hiding this comment.
Pull request overview
This PR adds a Google Calendar integration surface to the app (UI + backend OAuth callback persistence) and introduces an ML classifier artifact for “AI research” work.
Changes:
- Frontend: adds an “Integrations” card in Profile and a
/profileroute, displaying whether Google Calendar is connected and providing a connect CTA. - Backend: secures
calendar_callbackbehind authentication and persists the exchanged Google token dict onto the user profile; exposeshas_calendar_connectedin the profile serializer. - Repo ops: adds
backend/.dockerignoreand commits a serialized sklearn.joblibmodel artifact plus a standalone auth script.
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/views/Profile.vue | Adds calendar connection UI and binds to has_calendar_connected from profile data. |
| frontend/src/router/index.js | Adds /profile route for the new Profile view. |
| backend/api/views.py | Requires auth for OAuth callback and saves token dict to UserProfile. |
| backend/api/services/calendar_api.py | Relaxes oauthlib scope matching during code exchange. |
| backend/api/serializers.py | Adds has_calendar_connected computed field to profile serializer. |
| backend/test_auth.py | Adds a script that generates/prints an authorization URL (currently named like a test). |
| backend/ml_models/item_classifier.joblib | Adds a pickled sklearn pipeline artifact to the repo. |
| backend/.dockerignore | Adds ignores for common Python virtualenv/cache artifacts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Google auto-adds openid/profile scopes. We must relax oauthlib strict matching. | ||
| os.environ['OAUTHLIB_RELAX_TOKEN_SCOPE'] = '1' |
There was a problem hiding this comment.
Setting OAUTHLIB_RELAX_TOKEN_SCOPE inside exchange_code() mutates global process environment on each call. Prefer setting this once at process startup (settings/env), or at least use os.environ.setdefault(...) so you don’t unexpectedly override an operator-provided value.
| os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bigredmacro.settings") | ||
| django.setup() | ||
| from api.services.calendar_api import get_authorization_url | ||
| url, state, verifier = get_authorization_url("http://localhost:5173/calendar-callback") | ||
| print(f"URL: {url}") |
There was a problem hiding this comment.
This file is named like a test (test_auth.py) but executes Django setup and prints a URL at import time. Test runners (e.g., pytest) will collect/import it, causing side effects and potentially failing CI; move this to a scripts/ module and/or wrap execution in if __name__ == "__main__": (and consider removing from the repo if it’s only for local debugging).
| os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bigredmacro.settings") | |
| django.setup() | |
| from api.services.calendar_api import get_authorization_url | |
| url, state, verifier = get_authorization_url("http://localhost:5173/calendar-callback") | |
| print(f"URL: {url}") | |
| def main(): | |
| os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bigredmacro.settings") | |
| django.setup() | |
| from api.services.calendar_api import get_authorization_url | |
| url, state, verifier = get_authorization_url("http://localhost:5173/calendar-callback") | |
| print(f"URL: {url}") | |
| if __name__ == "__main__": | |
| main() |
| profile = UserProfile.objects(django_user_id=request.user.id).first() | ||
| if profile: | ||
| profile.google_auth_token = token_dict | ||
| profile.save() |
There was a problem hiding this comment.
The PKCE verifier is read from cache but never removed after a successful token exchange. Consider deleting pkce_{state} from cache once used to reduce replay risk and avoid stale entries accumulating until timeout.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.