* fix(init): refuse --force when remote has Dolt history bd init --force in a repo whose origin has refs/dolt/data silently skipped the bootstrap-from-remote path and then wired origin as a Dolt remote anyway. The next write auto-pushed an orphan history, failing with "no common ancestor". Recovery options were all destructive. This change: - Adds --reinit-local (named-intent replacement for --force) and --discard-remote (explicit cross-boundary authorization). - Routes --force to --reinit-local with a DeprecationWarning. --force continues to work for ≥2 releases. - Refuses bd init --force / --reinit-local when origin has refs/dolt/data, unless --discard-remote is also passed. Exit code 10 (ExitRemoteDivergenceRefused). - Adds stable numeric exit codes for init refusals (10/11/12). - Adds bd init-safety documenting the full flag surface and the destroy-token format. - Adds an internal race-safety re-check: if remote state changes during the TTY confirmation window, abort rather than overwrite. - Retrofits the existing destroy-token echo at init.go:231 to not print a copy-pasteable destructive invocation, matching the new error-text-no-echo ADR invariant. Adds: - cmd/bd/init_safety.go — CheckRemoteSafety chokepoint (pure fn). - cmd/bd/init_safety_test.go — guard matrix (13 cases) + subprocess regression test with a synthetic refs/dolt/data fixture. - docs/adr/0002-init-safety-invariants.md — ADR encoding the five invariants (single-source identity, scope-bound --force, central chokepoint, error-text-no-echo, race-safety). - docs/RECOVERY.md — named recovery playbooks per refusal exit code. - .github/CODEOWNERS — review ownership for init*.go pointing at the ADR so future flags must extend the guard matrix. Historical pattern (git log for cmd/bd/init.go): 8+ prior commits patched individual surfaces of this class without encoding the invariant. The guard matrix test is the structural hedge — adding a new flag or data source is a signal to extend the table, not to add another `&& !someFlag` at the call site. (bd-q83) * fix(init): satisfy lint for origin safety helpers (bd-main-nwo) --------- Co-authored-by: matt wilkie <maphew@gmail.com>
14 lines
722 B
Text
14 lines
722 B
Text
# CODEOWNERS — review ownership
|
|
#
|
|
# Changes under cmd/bd/init*.go interact with init-safety invariants
|
|
# documented in docs/adr/0002-init-safety-invariants.md. Reviewers MUST
|
|
# confirm new flags / data sources extend CheckRemoteSafety's guard
|
|
# matrix (cmd/bd/init_safety_test.go) before approving. Silent guard
|
|
# accretion is how we ended up with 8+ paper-over commits before ADR 0002
|
|
# — the matrix + review gate is the structural hedge.
|
|
|
|
# Init-safety critical path
|
|
cmd/bd/init.go @gastownhall/beads-maintainers
|
|
cmd/bd/init_*.go @gastownhall/beads-maintainers
|
|
cmd/bd/init_safety*.go @gastownhall/beads-maintainers
|
|
docs/adr/0002-init-safety-invariants.md @gastownhall/beads-maintainers
|