Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
It changes core authentication/cookie concurrency behavior (high risk) and introduces an architectural coupling concern around exception placement that should be validated in a human review.
Pull request overview
This PR addresses Fudan authentication/session race conditions by introducing transaction-based cookie updates and epoch-aware cookie saving, preventing stale in-flight responses from overwriting newly refreshed login cookies. It also hardens postgraduate timetable parsing by handling null teacher fields and improves error surfacing when both primary/fallback operations fail.
Changes:
- Add
SessionCookieCoordinator+TransactionalCookieJarand integrate them into Dio cookie interception to avoid staleSet-Cookieoverwrites during concurrent re-login flows. - Refactor Neo authentication to run login inside an isolated cookie transaction and add a “retry without login” path when the session advanced mid-flight.
- Fix PG timetable parsing when
JSXM(teacher) isnull, and introduce a sharedFallbackExceptionfor dual-attempt failures.
File summaries
| File | Description |
|---|---|
| lib/util/io/cookie_manager_fix.dart | Adds epoch-coordinated cookie handling and integrates it into TolerantCookieManager. |
| lib/repository/cookie/independent_cookie_jar.dart | Introduces cookie storage keys and transactional cookie snapshots for isolated login updates. |
| lib/repository/cookie/persistent_cookie_jar.dart | Persists cookie changes via replaceCookie and maintains debounce-based saving. |
| lib/repository/fdu/neo_login_tool.dart | Uses transactional login cookies for Neo auth and adds epoch-based retry behavior for concurrent requests. |
| lib/widget/libraries/error_page_widget.dart | Adds FallbackException and renders combined primary/fallback failure messages/details. |
| lib/widget/dialogs/login_dialog.dart | Switches to throwing FallbackException on dual login-method failures. |
| lib/repository/fdu/postgraduate_timetable_repository.dart | Wraps primary/secondary timetable endpoint failures into FallbackException. |
| lib/model/time_table.dart | Handles nullable PG teacher field by emitting an empty teacherNames list. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@copilot Are you stupid? |
|
User confirmed that it works. |
This PR:
null.Fixes #701.