docs: update Task 3 design for removed dead-code scenario
Update the per-user-profile plan document to reflect the corrected Task 3 design: remove the now-unreachable TestClaimLegacyOwner_NoOpOnGenuinelyFreshInstall test from the code example, update the ClaimLegacyOwner implementation example to remove the dead-code branch and false doc comment about fresh installs, and fix the commit message to match the corrected design. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -693,7 +693,6 @@ package store
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
@@ -704,8 +703,7 @@ import (
|
||||
// new user identified by oidcSub. Safe to call on every startup: once the
|
||||
// users table is non-empty, it's a no-op, so leaving
|
||||
// GENIUSRUN_LEGACY_OWNER_OIDC_SUB set after the first successful run causes
|
||||
// no harm. Also a no-op on a genuinely fresh install (no legacy profile row
|
||||
// to claim at all).
|
||||
// no harm.
|
||||
func (db *DB) ClaimLegacyOwner(ctx context.Context, oidcSub string) error {
|
||||
var userCount int
|
||||
if err := db.QueryRowContext(ctx, `SELECT COUNT(*) FROM users`).Scan(&userCount); err != nil {
|
||||
@@ -717,9 +715,6 @@ func (db *DB) ClaimLegacyOwner(ctx context.Context, oidcSub string) error {
|
||||
|
||||
var displayName string
|
||||
err := db.QueryRowContext(ctx, `SELECT name FROM profile WHERE user_id IS NULL LIMIT 1`).Scan(&displayName)
|
||||
if err == sql.ErrNoRows {
|
||||
return nil // fresh install, no pre-existing singleton profile to claim
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("find legacy profile: %w", err)
|
||||
}
|
||||
@@ -763,8 +758,7 @@ git commit -m "$(cat <<'EOF'
|
||||
store: add ClaimLegacyOwner one-time upgrade bootstrap
|
||||
|
||||
Binds pre-multi-tenancy singleton rows to one named OIDC subject, given at
|
||||
startup via an env var (wired in Task 11). No-ops once any user exists or
|
||||
on a genuinely fresh install.
|
||||
startup via an env var (wired in Task 11). No-ops once any user exists.
|
||||
EOF
|
||||
)"
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user