* test(docs): red — Docs: init-safety re-clone playbook must say damaged stores go OUTSIDE data_dir and a fresh clone needs bd migrate schema (refs be-wv0d0) * feat: green — Docs: init-safety re-clone playbook must say damaged stores go OUTSIDE data_dir and a fresh clone needs bd migrate schema (refs be-wv0d0) - docs/recovery/init-safety.md: new re-clone-gotchas section covering both live gotchas from ga-vrq5pu (damaged/set-aside stores must move OUTSIDE data_dir; a fresh clone needs `bd migrate schema` for dolt-ignored clone-local tables), with cross-reference pointers from the two existing bd bootstrap mentions and a pointer (not a duplication) to bd doctor --fix's automated corrupt-manifest convention. Freshness markers bumped. - cmd/bd/init_safety_help.go: RECOVERY section of the init-safety Long help gets a brief RE-CLONE GOTCHAS addendum with both symptom signatures and the fix command. - test/docsync/init_safety_recovery_test.go: retargeted TestInitSafetyCLIReferenceCoversReCloneGotchas (written during RED) to TestInitSafetyCLIHelpCoversReCloneGotchas, asserting on cmd/bd/init_safety_help.go's Long field instead of the generated docs/cli-reference/init-safety.md. That generated page is pinned to a released bd (docs/cli-docs.pin = v1.2.2, built in a detached worktree per scripts/resolve-docs-bd.sh) and does not pick up a Long-field edit at HEAD until a maintainer bumps the pin at the next release — confirmed empirically (`git show v1.2.2:cmd/bd/init_safety_help.go` still points at the deprecated docs/RECOVERY.md path, and a full ./scripts/generate-cli-docs.sh run here produced zero diff to the committed docs/cli-reference/). CI's own drift gate (scripts/check-cli-docs-drift.sh) is blame-scoped for exactly this reason. The original RED test was asserting on an artifact this PR cannot legitimately change without fighting that pin. * fix(docs): address review feedback on init-safety re-clone playbook Three fixes per bee-ghosttrack's REQUEST-CHANGES on PR #6431: - Correct Gotcha 1's "The fix" paragraph: bd doctor --fix's corrupt-manifest repair renames the whole data_dir directory to a sibling .<ts>.corrupt.backup path, not a backup nested inside the database's own directory. Verified against cmd/bd/doctor/fix/database_integrity.go and cmd/bd/doctor/tracked_runtime.go. - Replace the hardcoded "Schema already at v64" literal with version-agnostic "Schema already at v<N>" in the doc and CLI help text, and narrow the docsync test assertion to the prefix "schema already at v" so it survives future version bumps instead of rotting again. - Drop the dead GitHub-issue-style link around ga-vrq5pu (a Gas City bead id, not a GitHub issue) — keep it as plain text. Ref: be-hobyw * review: correct re-clone gotchas and tighten their guards (PR #6431 iters 1-2) Maintainer review fixup for the adopted PR. This is a docs-only PR whose entire deliverable is factual accuracy, so every finding here is about a claim the doc makes rather than about code behaviour. === Iteration 1 === [major] Gotcha 1's "The fix" paragraph misattributed the automated repair and pointed an operator mid-crash-loop at a path that cannot run. Verified first-hand in the worktree: - internal/doltserver/manifest_recovery.go:231-235 renames <data_dir>/<db>/.dolt -> <db>/.dolt.<ts>.corrupt.backup, i.e. IN PLACE, not the whole data_dir to a sibling as the doc claimed. It also only fires behind nomsDirLooksCorrupt, whose own comment is "recovery only fires when we can prove there is nothing the user would want to keep" (:94-100) - so it never touches the superseded-but-populated store the gotcha is about. - The whole-data_dir -> sibling rename is a different fix: cmd/bd/doctor/fix/database_integrity.go:35,43-45 over getDatabasePath(beadsDir) (validation.go:15-21). - That fix opens with serverModeIntegrityRecoveryGuard, which refuses outright in Dolt server mode (:79-96). Rewritten to state all three facts and to tell the reader plainly that the move is theirs to make by hand. Kept the correct headline sentence. The paragraph deliberately does not assert anything about where the in-place backup lands under the legacy single-database layout (data_dir/.dolt), the one premise the review left unproven - the wording is scoped to the standard <data_dir>/<db>/ layout instead of minting a fresh unverified claim. [minor] Gotcha 2's mechanism sentence ("bd's ordinary open does not recreate them") is false for embedded mode: newStore -> initSchema (store.go:285,470) calls schema.MigrateUp (:574), and migrationWorkNeeded returns true whenever !ignoredSource.atLatest (schema.go:866-867) - and ignored_schema_migrations is itself in doltIgnorePatterns, so a fresh clone always qualifies. Replaced the universal with the actual condition. The replacement list of opens that do NOT self-heal was itself wrong on its first item; see iteration 2 below. The prescribed remedy was already correct and is unchanged. [minor] The doc's prose Freshness source list gained cmd/bd/init_safety_help.go but the enforcing DOCS array did not. Added to both scripts/check-doc-freshness.sh and the pinned row in scripts/check_doc_freshness_test.go - a coupled pair: editing only the script reds the pinned test with "Freshness source does not name cmd/bd/init_safety_help.go" (verified by running exactly that mutation). [nit] The docsync guard for the headline rule was two independent whole-file substring checks. Scoped it to Gotcha 1's own section and matched the advice as a phrase, and pinned both ends of the help text's #re-clone-gotchas cross-reference, which neither markdown link checker can see because it lives in a Go string. Five mutation legs, each reddening only its own assertion: inverting the advice, moving the phrase outside the section, renaming the heading, breaking the help anchor, and removing the Gotcha 1 heading. The inversion leg is the one that matters - the file still contained "outside" (2x) and "data_dir" (13x), so the old form stayed green on inverted advice. [nit] Bumped Last reviewed: to the revision date. === Iteration 2 === Both lanes verified all five iteration-1 fixes. Three prose findings remained, none a merge gate (scorecard: approve, Required Changes: none). All three are the same defect class - a sentence that quantifies over a set the author did not census - so each is fixed by removing the quantifier rather than by restating it more carefully. [minor] Gotcha 2's replacement enumeration was false on its first item: a server, shared or proxied open DOES replay the clone-local series in this doc's own scenario. Re-derived at head, both lanes independently: - internal/storage/uow/dolt_sql_provider.go:267-287 calls MigrateUpWithLock UNCONDITIONALLY on the non-team-server, non-preview arm; p.readOnly is consulted only after a RemoteMigrateGateError comes back (:288-296), so it cannot suppress the pass. - The gate cannot refuse a main-current clone: PendingVersions is mainSource.pendingVersions only (schema.go:525-527) and the gate early-returns nil on len(pending)==0 (remote_migrate_gate.go:731-737), so the ignored series is invisible to it. - migrationWorkNeeded is true whenever !ignoredSource.atLatest (schema.go:866-869), so the locked pass runs the full MigrateUp including ignoredSource.migrate (schema.go:822). DoltStore.initSchema reaches the same call on the writable-open path (dolt/store.go:3076). So the positive clause is widened to any writable open (embedded, server or proxied), and the negative clause is rewritten as a tautology plus an open list: the open that hit the error was not self-healing, and the kinds that skip or only verify "include" read-only/preview opens, team-server opens (verifyTeamServerSchema only checks - dolt_sql_provider.go:342-371), the preview-attach arm, and gate-refused opens. Each named arm was verified individually; the list deliberately does not claim to be exhaustive, which is what the previous wording got wrong. Nothing in docsync can enforce this paragraph, so an open list is also the honest shape. [minor] Gotcha 1's data_dir locator omitted the mode that overrides both knobs it names. ResolveDoltDir checks IsSharedServerMode() FIRST and returns SharedDoltDir() before it ever reaches projectDoltDirPath (doltserver.go:316-330); the knobs are BEADS_DOLT_SHARED_SERVER=1|true or the dolt.shared-server config key (:117-122), and the directory is ~/.beads/shared-server/dolt/, overridable via BEADS_SHARED_SERVER_DIR (:248-257, :275-285). Added as its own paragraph rather than growing the parenthetical, with the reason it matters most there: one shared data_dir holds every project's database, so a single stray subdirectory crash-loops the server for all of them. [nit] "neither of bd doctor --fix's TWO Dolt-database repairs" made a numeric claim the sentence does not need, and the count is wrong: cmd/bd/doctor/fix/repo_fingerprint.go:135-161 os.RemoveAll's cfg.DatabasePath(beadsDir) behind an interactive "This will DELETE %s. [y/N]", and cleanCruftBeadsDirFiles (artifacts.go:238) can remove a .beads subdirectory too when a redirect is expected. Dropping the word "two" would have left "neither", which is itself a two-quantifier, so the count is removed instead: "no bd doctor --fix repair performs this move here. The two that come closest are:" - now a statement about the two bullets that follow, not a census of the repairs. The operative universal survives the census (the move-performing rename sites are only database_integrity.go:46,54; the others delete or rename in place), so the reader's action is unchanged. Validation (iteration 2): go test -tags=gms_pure_go ./test/docsync (8 tests, green, zero skips, both InitSafety tests among them); go test -tags=integration -count=1 -run Freshness ./scripts (33 pass, 1 Windows-only skip); ./scripts/check-doc-freshness.sh PASS with docs/recovery/init-safety.md at 0 days old and all five of its Freshness sources resolving; git diff --check clean. Prose-only: no code, test or freshness-pair file changed this iteration. --------- Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| bench-ready-indexes | ||
| ci | ||
| gitattributespolicy | ||
| hooks | ||
| migration-test | ||
| prlintmake | ||
| repro-be-1he-slow-path | ||
| repro-dolt-hang | ||
| repro-dolt-prod-timeouts | ||
| bazel_policy_test.go | ||
| build-examples.sh | ||
| BUILD.bazel | ||
| bump-version.sh | ||
| check-build-tags.sh | ||
| check-cli-docs-drift.sh | ||
| check-doc-flags.sh | ||
| check-doc-freshness.sh | ||
| check-go-install-guidance.sh | ||
| check-migration-hygiene.sh | ||
| check-testing-short.sh | ||
| check-versions.sh | ||
| check_build_tags_test.go | ||
| check_doc_freshness_test.go | ||
| check_testing_short_test.go | ||
| ci_capability_selector_test.go | ||
| ci_workflow_apt_get_timeout_test.go | ||
| ci_workflow_test.go | ||
| clean-test-tmp.sh | ||
| complexity_script_test.go | ||
| conformance.sh | ||
| conformance_script_test.go | ||
| cross-version-smoke-test.sh | ||
| docs-autofix-push.sh | ||
| docs.md | ||
| gen-winres.sh | ||
| generate-cli-docs.sh | ||
| generate-newsletter.py | ||
| generate-newsletter_README.md | ||
| gh-body-lint | ||
| install-hooks.sh | ||
| install.sh | ||
| install_dolt_test.go | ||
| migrate-jsonl-to-dolt.sh | ||
| migrate-legacy-to-current.sh | ||
| mutation-equivalence.sh | ||
| pr-preflight.sh | ||
| pr_preflight_test.go | ||
| pull_dolt_image_test.go | ||
| README.md | ||
| release.sh | ||
| release_script_test.go | ||
| resolve-docs-bd.sh | ||
| sign-windows.sh | ||
| test-cgo.sh | ||
| test-git-remote.sh | ||
| test-icu-path.sh | ||
| test.sh | ||
| test_script_test.go | ||
| update-nix-vendorhash.sh | ||
| update-versions.sh | ||
| update-winget.sh | ||
| upgrade-smoke-test.sh | ||
| verify-cgo.sh | ||
Beads Scripts
Utility scripts for maintaining the beads project.
ci/
Repository-owned CI command wrappers. These scripts are the source of truth for the target CI tiers; Make targets are aliases for local discoverability.
make ci-pr-core
make ci-pr-policy
make ci-pr-lint
make ci-package-mcp
make ci-package-npm
Each wrapper auto-detects the repository root, sources .buildflags when it
invokes Go in the default build mode, and records per-command timing through
scripts/ci/lib/timing.sh.
Broad Go test wrappers also source scripts/ci/lib/test-env.sh, which creates a
temporary HOME/XDG/Dolt root, isolates Git global/system config, clears runtime
Beads/Dolt environment variables, and sets BEADS_TEST_SKIP=dolt before tests
run. This keeps local make test and make ci-pr-core results comparable to
the fast PR-core contract even on shared agent hosts. Set
BEADS_TEST_ENV_RUN_DOLT=1 only when intentionally running the Dolt-dependent
tests through these broad wrappers, or BEADS_TEST_ENV_DISABLE=1 when debugging
against your real local configuration.
The broad Go wrappers also cap package and test parallelism to 4 by default
(GO_TEST_PKG_PARALLEL and GO_TEST_PARALLEL). This avoids turning high-core
shared hosts into a different test topology than GitHub Actions.
make ci-pr-policy includes scripts/check-testing-short.sh, which enforces
that testing.Short() is only used for runtime, stress, or large-fixture skips.
Use build tags, environment checks, or named wrappers for integration/e2e/API
boundaries.
Package gate wrappers validate publishable/package-adjacent surfaces:
make ci-package-mcpbuilds or consumes abdbinary, puts it onPATHasbd, then runs locked MCP packageuv sync, Ruff, mypy, pytest, and build checks.make ci-package-npmbuilds or consumes the native binary expected bynpm-package/bin/bd, runs the npm package test suite, and checksnpm pack --dry-run.
Set BEADS_TEST_BD_BINARY=/path/to/bd for MCP and npm package gates to reuse a
prebuilt candidate binary instead of rebuilding it inside the wrapper.
pr-preflight.sh
Read-only PR safety check for agents and maintainers.
# Before implementing or opening a related PR
./scripts/pr-preflight.sh --search "topic keywords" --repo gastownhall/beads
# Before changing, closing, or merging an existing PR
./scripts/pr-preflight.sh 123 --repo gastownhall/beads
It reports contributor/fork status, draft/review/merge/check state, risky diff
signals such as .beads/ changes or missing tests, and the required
contributor-protection next steps. It does not replace code review or local
validation.
Base-branch health is supplemented by a warn-only PR-gate sample: the last 60
completed pull_request-event runs, grouped per workflow. A single workflow
whose decisive runs (>= 5, across >= 3 distinct head branches) are all
failure-class is reported as a broken PR gate — the case where a job that
exists only in the PR workflow is red for every PR while the base branch shows
green. This detector never blocks (deliberately: automation classifies
unrecognized [block] lines as genuine merge blockers and would park merge
lanes on a false positive); it is skipped entirely while the base branch is
red.
gh-body-lint
Lint Markdown files before posting them with gh ... --body-file.
./scripts/gh-body-lint body.md
./scripts/gh-body-lint --fix body.md
The lint catches literal \n sequences, which render poorly on GitHub, and
GH#123 references, which do not auto-link like #123 or owner/repo#123.
release.sh (⭐ The Easy Button)
One-command release from version bump to local installation.
Usage
# Full release (does everything)
./scripts/release.sh 0.9.3
# Preview what would happen
./scripts/release.sh 0.9.3 --dry-run
What It Does
This master script automates the entire release process:
- ✅ Stops running Dolt servers (avoids version conflicts)
- ✅ Runs tests and linting
- ✅ Bumps version in all files
- ✅ Commits and pushes version bump
- ✅ Creates and pushes git tag
- ✅ Verifies or opens the Homebrew core formula PR
- ✅ Upgrades local Homebrew installation
- ✅ Verifies everything works
After this script completes, your system is running the new version!
Examples
# Release version 0.9.3
./scripts/release.sh 0.9.3
# Preview a release (no changes made)
./scripts/release.sh 1.0.0 --dry-run
Prerequisites
- Clean git working directory
- All changes committed
- golangci-lint installed
- Homebrew installed (for local upgrade)
- Push access to gastownhall/beads
Output
The script provides colorful, step-by-step progress output:
- 🟨 Yellow: Current step
- 🟩 Green: Step completed
- 🟥 Red: Errors
- 🟦 Blue: Section headers
What Happens Next
After the script finishes:
- GitHub Actions builds binaries for all platforms (~5 minutes)
- PyPI package is published automatically
- Homebrew core formula is verified or tracked through its canonical PR
- Users can
brew upgrade beadsto get the new version after Homebrew merges - GitHub Release is created with binaries and changelog
bump-version.sh
Bumps the version number across all beads components in a single command.
Usage
# Show usage
./scripts/bump-version.sh
# Update versions (shows diff, no commit)
./scripts/bump-version.sh 0.9.3
# Update versions and auto-commit
./scripts/bump-version.sh 0.9.3 --commit
What It Does
Updates version in all these files:
cmd/bd/version.go- bd CLI version constantplugins/beads/.claude-plugin/plugin.json- Claude plugin versionplugins/beads/.codex-plugin/plugin.json- Codex plugin version.claude-plugin/marketplace.json- Claude marketplace plugin versionintegrations/beads-mcp/pyproject.toml- MCP server versionREADME.md- Alpha status versionPLUGIN.md- Version requirements
Features
- Validates semantic versioning format (MAJOR.MINOR.PATCH)
- Verifies all versions match after update
- Shows git diff of changes
- Auto-commits with standardized message (optional)
- Cross-platform compatible (macOS and Linux)
Examples
# Bump to 0.9.3 and review changes
./scripts/bump-version.sh 0.9.3
# Review the diff, then manually commit
# Bump to 1.0.0 and auto-commit
./scripts/bump-version.sh 1.0.0 --commit
git push origin main
Why This Script Exists
Previously, version bumps only updated cmd/bd/version.go, leaving other components out of sync. This script ensures all version numbers stay consistent across the project.
Safety
- Checks for uncommitted changes before proceeding
- Refuses to auto-commit if there are existing uncommitted changes
- Validates version format before making any changes
- Verifies all versions match after update
- Shows diff for review before commit
sign-windows.sh
Signs Windows executables with an Authenticode certificate using osslsigncode.
Usage
# Sign a Windows executable
./scripts/sign-windows.sh path/to/bd.exe
# Environment variables required for signing:
export WINDOWS_SIGNING_CERT_PFX_BASE64="<base64-encoded-pfx>"
export WINDOWS_SIGNING_CERT_PASSWORD="<certificate-password>"
What It Does
This script is called automatically by GoReleaser during the release process:
- Decodes the PFX certificate from base64
- Signs the Windows executable using osslsigncode
- Timestamps the signature using DigiCert's RFC3161 server
- Replaces the original binary with the signed version
- Verifies the signature was applied correctly
Prerequisites
osslsigncodeinstalled (apt install osslsigncodeorbrew install osslsigncode)- EV code signing certificate exported as PFX file
- GitHub secrets configured:
WINDOWS_SIGNING_CERT_PFX_BASE64- base64-encoded PFX fileWINDOWS_SIGNING_CERT_PASSWORD- certificate password
Graceful Degradation
If the signing secrets are not configured:
- The script prints a warning and exits successfully
- GoReleaser continues without signing
- The release proceeds with unsigned Windows binaries
This allows releases to work before a certificate is acquired.
Why This Script Exists
Windows code signing helps reduce antivirus false positives that affect Go binaries.
Kaspersky and other AV software commonly flag unsigned Go executables as potentially
malicious due to heuristic detection. See docs/reference/antivirus.md for details.
Future Scripts
Additional maintenance scripts may be added here as needed.