mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 05:59:36 +08:00
`identity` binds `AUTH_DIR = SYSTEM_ROOT / "auth"` at import, so the partners fixture's `setattr(paths, "SYSTEM_ROOT", tmp)` never reached it: `save_user` wrote into the developer's own `data/system/auth/users.json` and read it back. The suite had already deposited an `alice` account there. That also made `test_a_linked_sender_gets_their_own_private_history` depend on who else happened to have an account. The first account in a store is force-promoted to admin whatever role is asked for, and an admin's scope *is* the shared pool — so on an empty store alice became admin and "her private history" and "the shared pool" resolved to one directory. It passed on a machine with existing accounts and on a full run, and failed alone and on all four Python versions in CI (v1.5.17's release commit is red for exactly this). The fixture now redirects identity's file constants too, and `alice` is saved after an admin so she is guaranteed non-admin — asserted, so the precondition cannot rot silently. Product code is unaffected: the behaviour under test was always correct. Also collapses the three copies of the api_key reduction into one. `_primary_api_key` (provider_runtime) is deleted and `LLMConfig.get_api_key` delegates, both to `keypool.primary_api_key`, which now treats an empty key as absent in either spelling so its list and scalar branches agree. Equivalence checked across every configured shape: "", None, [], [""], ["", "k"], "k", ["k"], ["k1", "k2"]. pytest 5284 passed (was 5276), pre-commit clean, ruff check + format clean at CI's pinned 0.16.0.