Skip to content

feat(auth): insert user_owned provision record on self-hosted registration#26

Merged
raghavyuva merged 1 commit into
mainfrom
feat/byos-lifecycle
Apr 18, 2026
Merged

feat(auth): insert user_owned provision record on self-hosted registration#26
raghavyuva merged 1 commit into
mainfrom
feat/byos-lifecycle

Conversation

@raghavyuva

Copy link
Copy Markdown
Collaborator

Summary

  • Added createUserOwnedProvisionRecord(userId, organizationId, sshKeyId) to src/auth/user-setup.ts
  • Called inside loadSSHCredentials after createMachineBillingEntry (only runs when config.selfHosted is true)
  • Inserts a user_provision_details row with type='user_owned' and step='COMPLETED' so the Go API's IsServerUserOwned check returns true for BYOS machines

Why

IsServerUserOwned in the Go API queries user_provision_details to determine if a machine is user-owned. Without this row, all BYOS lifecycle operations (pause, resume, restart, status) fell through to the provisioned-machine Redis queue path and timed out with 504.

Behaviour

  • Non-fatal: if the insert fails, the error is logged and registration continues unchanged
  • Only fires for self-hosted instances (config.selfHosted = true)
  • No schema changes (the user_provision_details table already exists with all required columns)

Test plan

  • Register a new self-hosted user
  • Confirm user_provision_details row exists with type='user_owned' and step='COMPLETED' for that user's machine
  • Confirm BYOS lifecycle API routes (status, pause, resume, restart) work without 504

Related

Companion PR: nixopus/nixopus — feat/byos-lifecycle (Go API lifecycle routing + SSH/DB operations)

@raghavyuva raghavyuva merged commit 38c0443 into main Apr 18, 2026
@raghavyuva raghavyuva deleted the feat/byos-lifecycle branch April 18, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant