Why: Account disable could be followed by late Backend business writes, API key creation could implicitly create users, account bootstrap locks could invert, and directory cursors were process-local or leaked out-of-scope changes. Evidence: Local go test ./... and isolated PostgreSQL package suites passed on the staged candidate; exact committed-head SELF replay and stage 6 human review remain pending. Impact: Adds final account transactions and external-effect checks across HTTP, Host, Bus and run manager; tightens API key issuance and persists versioned cursor signing. Delegated RDM rename still needs the separately proposed real-operator contract, so A1 and stage 6 are not complete. Refs: Documents U3 r1, approved A1-A4 amendment fb3a821, pending delegated-projection amendment 5783940, Dev feature/iam-u3-account-directory-recovery.
16 lines
492 B
Go
16 lines
492 B
Go
package store
|
|
|
|
import "testing"
|
|
|
|
func TestZeroTokenBudgetLookupDoesNotWrite(t *testing.T) {
|
|
st := openTestStore(t)
|
|
status, err := st.AccountTokens("viewer", 0, 100)
|
|
if err != nil || status.Total != 0 || status.Over {
|
|
t.Fatalf("empty budget lookup: %+v %v", status, err)
|
|
}
|
|
var rows int
|
|
if err := st.DB().QueryRow(`SELECT COUNT(*) FROM llm_usage_daily WHERE owner='viewer'`).Scan(&rows); err != nil || rows != 0 {
|
|
t.Fatalf("read-only budget lookup wrote %d rows: %v", rows, err)
|
|
}
|
|
}
|