Skip to content

assignment --force list still restores and reuses saved Blackboard session #47

Description

@JKay15

Summary

On current upstream head 58d4e0c63979fa6d7056e39df94a407e64bad14d, assignment --force list still restores ~/Library/Caches/org.sshwy.pku3b/ua.json and reuses that Blackboard session if it is valid. The command therefore ignores the fresh-session part of --force.

Reproduction

Environment used for the reproduced run:

  • macOS
  • current upstream binary built from 58d4e0c63979fa6d7056e39df94a407e64bad14d
  • existing cfg.toml for a valid account
  • temporary HOME containing only that config and a valid Blackboard cookie jar copied to the legacy shared path ~/Library/Caches/org.sshwy.pku3b/ua.json

Reproduction steps:

  1. Create a fresh temporary HOME.
  2. Symlink the existing cfg.toml into ~/Library/Application Support/org.sshwy.pku3b/cfg.toml under that temporary home.
  3. Create ~/Library/Caches/org.sshwy.pku3b/ under that temporary home.
  4. Copy a valid Blackboard session cookie jar into ~/Library/Caches/org.sshwy.pku3b/ua.json.
  5. Run:
env HOME=/tmp/pku3b-upstream-force-reuse.XXXXXX NO_COLOR=1 RUST_LOG=info /private/tmp/pku3b-upstream-58d4e0c-node1/target/release/pku3b assignment --force list

Observed result

The command exits 0, prints the normal assignment listing, and logs:

  • [INFO pku3b::api::builder] Cache TTL: None
  • [INFO pku3b::api::builder] Download Artifact TTL: None
  • [INFO pku3b::api::blackboard] reuse saved login session

That shows --force disabled the TTL caches but still restored and reused the saved Blackboard session.

Expected result

assignment --force list should not restore or reuse a saved Blackboard login session. It should start from a fresh Blackboard session path for that run.

Why this appears to be happening

The current upstream flow still wires the shared cookie-restore path in the force case:

  • src/utils.rs:26-27 uses one shared Blackboard cookie path: projectdir().cache_dir().join("ua.json")
  • src/cli/mod.rs:138-146 always sets cookie_restore_path(Some(utils::default_user_agent_data_path()))
  • src/cli/mod.rs:150-154 calls build_client(!force), so force disables TTL caching but does not disable Blackboard cookie restore/save
  • src/api/blackboard.rs:6-21 reuses any restored session whose Blackboard homepage preflight succeeds and logs reuse saved login session
  • src/http.rs:48-65 saves and loads the cookie jar directly on that shared path

Distinction from nearby issues

This is different from the other open Blackboard session bugs:

  • not the cache-path failure in #44, because the cache path is valid here
  • not the cross-account reuse in #45, because the configured account is unchanged here
  • not the stale-session reauthentication failure in #46, because the saved session is valid and the command succeeds by reusing it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions