originbind

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package originbind owns one invariant: a workspace is bound to one origin.

Both surfaces that can change which origin owns a workspace live behind it — `gadak init` and PUT onboarding/connect/ — so the decision cannot exist on one path and not the other. That split is exactly how GDK-247 happened: the CLI path was closed and the unauthenticated HTTP path was not.

It is not part of internal/workspace, which mounts profiles under /w/ and imports internal/server: the server calls this, so that would cycle.

Index

Constants

View Source
const ErrCodeReplaceRefused = "standalone_data_present"

ErrCodeReplaceRefused is the --json / HTTP "error" value when a connected init or onboarding connect refuses to take over a standalone workspace that holds data. The string is a CLI --json contract; do not change it.

Variables

This section is empty.

Functions

func ClearStandalone

func ClearStandalone(next *config.Config)

ClearStandalone is the single owner of "origin is now a Jira site, so this workspace is no longer standalone". Reached only after RefuseReplace (or an explicit replace opt-in). Empty standalone workspaces take this path too: once connected, Kind must be cleared.

func LocalData

func LocalData(cfg *config.Config) (n int, persist string, err error)

LocalData reports how many locally originated issues this standalone workspace holds, and the origin persist path (via origin.PersistPath — never rebuilt from string pieces).

"Holds data" is max(mirror issues, origin issues):

  • mirror: SELECT COUNT(*) FROM issues, only if gadak.db already exists (store.Open would create it)
  • origin: Search on the in-process origin, only if the persist file already exists (origin.Client would create it)

init --standalone creates a persist file with a project fixture and no issues, so that empty-origin case is n==0 and the common "I tried it, now I want to connect" path is not blocked.

func RefuseReplace

func RefuseReplace(cfg *config.Config, replace bool) error

RefuseReplace stops a connected init / onboarding connect from silently changing which origin owns a standalone workspace that holds locally originated issues. An empty standalone workspace (tried it, nothing filed) is not a hazard and is allowed through.

JSON rendering stays at the CLI call site — this returns an error only.

Types

type ReplaceRefusedError

type ReplaceRefusedError struct {
	Issues  int
	Persist string
}

ReplaceRefusedError is returned when RefuseReplace blocks a connect. Error() is the human sentence previously printed by gadak init.

func (*ReplaceRefusedError) Error

func (e *ReplaceRefusedError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL