claude-code: a login handed is replaced only by a grant of a newer lineage
One reason, login kept, on both paths, with a journal line; the not-handed return skips the binding's generation on purpose. Builds: ADR 0206, ADR 0209, design 39 §3 §6, design 14, H-A-138 (hq design/47-H1-answers-59 175ed320)
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
@@ -630,11 +631,20 @@ func Apply(p Paths, c Current, sealed SealedBox, write WriteManaged) (map[string
|
||||
// A login made here that the manager has not adopted yet stays whole: the grant handed is the old
|
||||
// lineage's, and writing it would spend the person's login unseen (ADR 0206, ADR 0209). The manager
|
||||
// asks claude_code_grant for it on this node's report; its successor then comes as a newer generation.
|
||||
// This return skips the binding's generation below on purpose: later binding events pull again until
|
||||
// the manager adopts the login.
|
||||
if LoginNotHanded(local, readHanded(p)) {
|
||||
return map[string]any{"applied": false, "licence": c.Licence, "reason": "login-not-adopted"}, nil
|
||||
log.Printf("login kept: the login in the credentials file was not handed to the manager yet (licence %s)", c.Licence)
|
||||
return map[string]any{"applied": false, "licence": c.Licence, "reason": LoginKept}, nil
|
||||
}
|
||||
// A login handed to the manager is replaced only by a grant of a newer lineage (its refresh token's
|
||||
// expiry later than the login's, as the manager marks it): a lease older than the login is never
|
||||
// written, so the manager's failed refresh is a finding on the manager, never a lost login here
|
||||
// (H-A-138, hq design/47-H1-answers-59 175ed320).
|
||||
if HoldsLogin(local) && !NewerLineage(local, g) {
|
||||
log.Printf("login kept: the grant offered for licence %s is not of a newer lineage than the login in the credentials file", c.Licence)
|
||||
return map[string]any{"applied": false, "licence": c.Licence, "reason": LoginKept}, nil
|
||||
}
|
||||
// A login waiting here was handed to the manager first (ADR 0206): what comes back is its successor,
|
||||
// and the refresh token in the file is the one the manager just spent.
|
||||
d := DecideApply(GrantOf(local), g, switched || HoldsLogin(local))
|
||||
if d.Apply {
|
||||
next := WithGrant(local, g)
|
||||
|
||||
Reference in New Issue
Block a user