- Add IssueSystemToken() method in internal/db/accounts.go that wraps revoke-old, track-new, and upsert-system_tokens in a single SQLite transaction - Update handleTokenIssue in internal/server/server.go to use the new atomic method instead of three separate DB calls - Update IssueServiceToken in internal/grpcserver/tokenservice.go with the same fix - Add TestIssueSystemTokenAtomic test covering first issue and rotation Security: token issuance now uses a single transaction to prevent inconsistent state (e.g., old token revoked but new token not tracked) if a crash occurs between operations. Follows the same pattern as RenewToken which was already correctly transactional. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
39 KiB
39 KiB