refuse register when remote root has state and local path is dirty #15
No reviewers
Labels
No labels
agent
blocked
agent
new
agent
review
agent
working
complexity
high
complexity
low
priority
high
priority
low
priority
medium
risk
high
risk
low
risk
medium
type
bug
type
chore
type
feature
type
security
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
tfks/dropbear!15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "bug/init-refuse-existing-remote-root"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs: #8
Summary
dropbear register(formerlyinit) now refuses to register aroot_idwhose bucket prefix already contains objects and whose local path holds any user content (anything other than.dropbear/). Closes the "second origin device" footgun called out in #8 without breaking the legitimate "all devices retired, re-adopt on a fresh dir" flow that #13 enabled.Rule
roots/<rootID>/.dropbear/)INIT_REMOTE_ROOT_EXISTS).dropbear/EnsureRootNotInitialized, from #13).dropbear/.dropbear/Probe errors now distinguish
ErrUnauthorized→ exit 9 andErrTransient→ exit 10, instead of collapsing to exit 1.Changes
cmd/dropbear/register.go—remoteRootHasStateprobe,localPathHasUserContentcheck, newINIT_REMOTE_ROOT_EXISTSrefusal, error-class → exit-code mapping for probe failures.cmd/dropbear/register_test.go— refuses with dirty local + remote registry; allows with empty local + remote registry; existingWithoutRegistrycase still covers #13's invariant.internal/config/{diagnostic,exitcode}.go— newDiagInitRemoteRootExistsmapped toStateUninitialized.internal/objectstore/keys.go— conflict resolution against #13'sRootPrefix; no behavior change.wiki/runbooks/install-daemon.md— rule documented next to the manual-registerinstructions.Follow-up
Filed separately: let
registerread--remote-*from a pre-existing.dropbear/root.tomlso users can copy a config from another device and re-register without re-typing the bucket/endpoint.Test plan
go test ./cmd/dropbear/... ./internal/deviceregistry/... ./internal/config/...— 184 passjust check— format/vet clean (lint crash was a transient golangci-lint/toolchain hiccup, runs clean on the user's side)