Skip to content

Fix 701 - #702

Merged
w568w merged 3 commits into
mainfrom
fix-701
Sep 2, 2026
Merged

Fix 701#702
w568w merged 3 commits into
mainfrom
fix-701

Conversation

@w568w

@w568w w568w commented Sep 2, 2026

Copy link
Copy Markdown
Member

This PR:

  • Adds a transaction-based cookie management to fix the concurrent in-flight requests issue.
  • Fixes the parsing error where the postgraduate timetable's teacher field can be null.

Fixes #701.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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 + TransactionalCookieJar and integrate them into Dio cookie interception to avoid stale Set-Cookie overwrites 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) is null, and introduce a shared FallbackException for 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.

Comment thread lib/widget/libraries/error_page_widget.dart
Comment thread lib/repository/fdu/neo_login_tool.dart
@w568w

w568w commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

@copilot Are you stupid?

@w568w

w568w commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

User confirmed that it works.

@w568w
w568w merged commit 54d217a into main Sep 2, 2026
2 checks passed
@w568w
w568w deleted the fix-701 branch September 2, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 会话过期后并发请求可能覆盖新登录 Cookie,导致课程表加载失败

2 participants