Delete replaced profile generations and retry failed deletes (CLS-1267) #318
Loading…
Reference in a new issue
No description provided.
Delete branch "stephen/cls-1267-retired-generations"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
CLS-1267 item 2, the cleanup half (the lock and refresh fence are #316). Replacing a profile (PAT login,
auth refresh --token, Fjord login) published a new generation under a new random key and never deleted the previous generation's secret. A later logout only knows the current generation, so the old PAT, bearer or refresh token stayed in storage with no way to find it again.Schema (additive).
HostProfilesgainsretired: Vec<Profile>(#[serde(default, skip_serializing_if = "Vec::is_empty")]). Oldhosts.tomlfiles load unchanged and an empty list is never written; tests cover both.Behaviour
retiredin the same publication as the new generation, so its identity is durable before any delete is attempted.auth login, Fjord login,auth refresh(both kinds) and logout on that host. Logout drains before unpublishing, so a failure leaves the profile selectable and logging out again retries.profile_session::logoutshares the newsecret_keyshelper.Known limits (self-review rounds, left as is)
delete_tokencannot confirm deletion from a keychain that is unreachable on Linux (PlatformFailure warns and succeeds, as in #314) or disabled withFJ_NO_KEYCHAIN=1, so those are dropped from the list as deleted.drain_withseam and by an unreadable token store, not by a failing keychain; the refresh and Fjord-login call sites are covered by existing integration tests but not by a new failing-delete test.Tests: old file round-trip, list round-trip, replacement deletes the old secret, failed delete stays listed and is retried, retry on the next store and on logout, abandoned PAT and Fjord generations kept when the store is unreadable then drained, one failed delete does not stop the generation's other secrets. Touches
profiles.rs,fjord_profiles.rs,profile_session.rs(logout only), a newprofile_retired.rs,profile_maintenance.rsandinvocation_profiles.rs; fj-cl confirmed it is not editing these.CI note: the first push failed clippy (an unused import and a fold) because this host's newer toolchain stops at an unrelated lint; fixed, and clippy is clean here with that lint allowed. A fourth self-review round (past the 3-round budget, needed for the CI fix) added only the hosts-with-profiles restriction above and repeated the keychain limits.
Automated Codex review (read-only) of head
510fdd76bb.No new correctness or security findings. Required formatting checks passed; builds and tests were not run.
src/config/profile_retired.rs:37,85: The confirmed-deletion and durable-retry invariants retain the accepted limitations documented under “Known limits” in the PR body, including unconfirmed keychain deletes, unrecorded cleanup on failed first login, and failure-test coverage gaps. No new evidence makes these blocking. Address them in follow-up work.BLOCKING: 0
Reviewed head
510fdd76bbat 2026-11-11T17:40:07Z by codex exec (read-only sandbox).Automated Codex review (read-only) of head
59e25105e7.No new blocking correctness or security findings found.
src/config/profile_retired.rs:88: The invariant is that unfinished credential deletion retains a durable identity. The PR body already defers unconfirmed keychain deletion and failed staged cleanup on a host without profiles. Those paths can leave secrets without a retry descriptor. No new evidence makes these blocking here. Follow-up: preserve cleanup identities independently of selectable profiles and retain entries when deletion cannot be confirmed.BLOCKING: 0
Reviewed head
59e25105e7at 2026-11-11T17:46:38Z by codex exec (read-only sandbox).Automated Codex review (read-only) of head
60b6771f52.No new correctness or security problems found in the changed paths.
src/config/profile_retired.rs:85: Invariant: retain credential identities until deletion is confirmed. The PR body’s accepted “Known limits” remain: unavailable or disabled keychains can leave deletion unconfirmed, and failed staged cleanup during a first named login can leave an untracked secret. These are disclosed deferrals, with no new evidence here of normal-operation impact. Follow-up: preserve unresolved cleanup identities independently of active profiles and distinguish confirmed deletion from unavailable storage.BLOCKING: 0
Reviewed head
60b6771f52at 2026-11-12T00:04:38Z by codex exec (read-only sandbox).