cli/auth: make the two-tier mint locking contract explicit in comments · Entire

cli/auth: make the two-tier mint locking contract explicit in comments

ffc362d→main·

Soph·1w ago·1 file·+8 added/-6 removed

Review nit on #1641: CellClientFactory.mu's comment said "never held across I/O" while mintSlot.mu is deliberately held across the exchange (that's the single-flight). Say both halves explicitly so neither comment reads as contradicting the other. Comment-only change.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

Sessions

c8ee1a75c9a4View transcript

[?
Multi-cell Fan-out and Cell Routing InfrastructureClaude Code·Fable 5·1 step](/content/gh/entireio/cli/session/47b22b6e-eadc-4e6e-a6d3-01cee9413422#timeline-c8ee1a75c9a4/index.html)

Changes

1

118 unmodified lines

119
120
121
122
122
123
124
125
126
127
126
127
128
129
130
128
129
130
131
132
133
134
135

118 unmodified lines

type CellClientFactory struct {
    subject cellSubject

mu    sync.Mutex           // guards slots (map access only, never held across I/O)
    // mu guards the slots map only and is never held across I/O; the
    // hold-across-I/O locking is per-jurisdiction, on each mintSlot.mu.
    mu    sync.Mutex
    slots map[string]*mintSlot // jurisdiction -> its token slot
}

// mintSlot single-flights one jurisdiction's token: the slot mutex is held
// across the mint, so concurrent callers for the same jurisdiction wait for one
// exchange instead of duplicating it, while other jurisdictions mint in
// parallel on their own slots. A failed mint caches nothing — the next caller
// retries.
// mintSlot single-flights one jurisdiction's token. Unlike the factory-level
// mutex, the slot mutex IS deliberately held across the network exchange:
// concurrent callers for the same jurisdiction wait for one mint instead of
// duplicating it, while other jurisdictions mint in parallel on their own
// slots. A failed mint caches nothing — the next caller retries.
type mintSlot struct {
    mu    sync.Mutex
    token string

Mcmd/entire/cli/auth/cell_data_api.go+8/-6