Compare commits
10 commits
main
...
bd-1zo-san
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ae927e533 | ||
|
|
a4ed0b1b90 | ||
|
|
d5030977c2 | ||
|
|
11315c8f9b | ||
|
|
72163551f0 | ||
|
|
43580da768 | ||
|
|
fb31a2191f | ||
|
|
7dcf57c409 | ||
|
|
a28a81fc9c | ||
|
|
00eb13a91e |
5586 changed files with 265392 additions and 1274048 deletions
|
|
@ -1,51 +1,59 @@
|
|||
---
|
||||
description: How to resolve merge conflicts in the beads Dolt database
|
||||
description: How to resolve merge conflicts in .beads/issues.jsonl
|
||||
---
|
||||
|
||||
# Resolving Beads Merge Conflicts
|
||||
# Resolving `issues.jsonl` Merge Conflicts
|
||||
|
||||
Beads uses Dolt as its storage backend. Dolt handles merges natively using its built-in three-way merge, similar to git.
|
||||
If you encounter a merge conflict in `.beads/issues.jsonl` that doesn't have standard git conflict markers (or if `bd merge` failed automatically), follow this procedure.
|
||||
|
||||
## 1. Check for Conflicts
|
||||
|
||||
```bash
|
||||
bd doctor
|
||||
bd dolt pull
|
||||
## 1. Identify the Conflict
|
||||
Check if `issues.jsonl` is in conflict:
|
||||
```powershell
|
||||
git status
|
||||
```
|
||||
|
||||
If `bd dolt pull` reports merge conflicts, Dolt will list the conflicting tables and rows.
|
||||
## 2. Extract the 3 Versions
|
||||
Git stores three versions of conflicted files in its index:
|
||||
1. Base (common ancestor)
|
||||
2. Ours (current branch)
|
||||
3. Theirs (incoming branch)
|
||||
|
||||
## 2. Resolve Conflicts
|
||||
|
||||
Dolt provides SQL-based conflict resolution:
|
||||
|
||||
```bash
|
||||
# View conflicts
|
||||
bd sql "SELECT * FROM dolt_conflicts"
|
||||
|
||||
# Resolve by accepting ours or theirs
|
||||
bd sql "CALL dolt_conflicts_resolve('--ours')"
|
||||
# OR
|
||||
bd sql "CALL dolt_conflicts_resolve('--theirs')"
|
||||
Extract them to temporary files:
|
||||
```powershell
|
||||
git show :1:.beads/issues.jsonl > beads.base.jsonl
|
||||
git show :2:.beads/issues.jsonl > beads.ours.jsonl
|
||||
git show :3:.beads/issues.jsonl > beads.theirs.jsonl
|
||||
```
|
||||
|
||||
## 3. Verify and Complete
|
||||
## 3. Run `bd merge` Manually
|
||||
Run the `bd merge` tool manually with the `--debug` flag to see what's happening.
|
||||
Syntax: `bd merge <output> <base> <ours> <theirs>`
|
||||
|
||||
```bash
|
||||
# Verify the resolution
|
||||
bd list --json | head
|
||||
|
||||
# Push the resolved state
|
||||
bd dolt push
|
||||
```powershell
|
||||
bd merge beads.merged.jsonl beads.base.jsonl beads.ours.jsonl beads.theirs.jsonl --debug
|
||||
```
|
||||
|
||||
## Legacy: JSONL Merge Conflicts
|
||||
## 4. Verify the Result
|
||||
Check the output of the command.
|
||||
- **Exit Code 0**: Success. `beads.merged.jsonl` contains the clean merge.
|
||||
- **Exit Code 1**: Conflicts remain. `beads.merged.jsonl` will contain conflict markers. You must edit it manually to resolve them.
|
||||
|
||||
If you encounter merge conflicts in `.beads/issues.jsonl` from a legacy setup, import the resolved file:
|
||||
Optionally, verify the content (e.g., check for missing IDs if you suspect data loss).
|
||||
|
||||
```bash
|
||||
# Resolve the git conflict in the JSONL file manually, then:
|
||||
bd import -i .beads/issues.jsonl
|
||||
## 5. Apply the Merge
|
||||
Overwrite the conflicted file with the resolved version:
|
||||
```powershell
|
||||
cp beads.merged.jsonl .beads/issues.jsonl
|
||||
```
|
||||
|
||||
## 6. Cleanup and Continue
|
||||
Stage the resolved file and continue the merge:
|
||||
```powershell
|
||||
git add .beads/issues.jsonl
|
||||
git merge --continue
|
||||
```
|
||||
|
||||
## 7. Cleanup Temporary Files
|
||||
```powershell
|
||||
rm beads.base.jsonl beads.ours.jsonl beads.theirs.jsonl beads.merged.jsonl
|
||||
```
|
||||
|
|
|
|||
10
.bazelignore
10
.bazelignore
|
|
@ -1,10 +0,0 @@
|
|||
npm-package/node_modules
|
||||
website
|
||||
node_modules
|
||||
.claude/worktrees
|
||||
.worktrees
|
||||
.beads
|
||||
.dolt
|
||||
dist
|
||||
.runtime
|
||||
tmp
|
||||
523
.bazelrc
523
.bazelrc
|
|
@ -1,523 +0,0 @@
|
|||
# Bazel configuration for beads. Bazel is beads' build and test system: CI
|
||||
# gates on the `bazel test` lanes in .github/workflows/bazel.yml, and
|
||||
# `make test`/`make check` run the same commands (engdocs/TESTING.md
|
||||
# "Building and Testing"). Plain `go build`/`go test` still work as an
|
||||
# inner-loop convenience but are not what CI enforces. Where actions run is
|
||||
# per machine, never committed here: contributors read the anonymous,
|
||||
# read-only cache with --config=fork-cache (defined below); maintainers with
|
||||
# an rbe-west client certificate execute remotely with --config=remote-exec.
|
||||
# Make either the default with a `build --config=...` line in the gitignored
|
||||
# .bazelrc.local. Bzlmod only; Bazel version is pinned in .bazelversion.
|
||||
common --enable_bzlmod
|
||||
common --color=no
|
||||
# C/C++ (and so cgo, -race and the Go stdlib) builds only with MODULE.bazel's
|
||||
# pinned LLVM toolchain: no host-detected local_config_cc to fall back to,
|
||||
# which would key actions to the client's gcc and lld and fail remote links
|
||||
# on workers without lld (scripts/bazel_hermetic_cc_test.go).
|
||||
common --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
|
||||
|
||||
# The pinned remote-worker host in every action key: //platforms:rbe_worker's
|
||||
# worker-env exec property is the sha256 of tools/rbe/worker-env.txt, and
|
||||
# rbe-west's schedulers run an action only on a worker that measured that
|
||||
# host (platforms/BUILD.bazel). Key-affecting, so unconditional: local,
|
||||
# fork-cache and remote runs hash alike.
|
||||
build --extra_execution_platforms=//platforms:rbe_worker
|
||||
|
||||
# ICU policy (engdocs/ICU-POLICY.md): build go-mysql-server with its pure-Go
|
||||
# regex backend so no target links libicu. MODULE.bazel carries the matching
|
||||
# gazelle_override for github.com/dolthub/go-mysql-server.
|
||||
build --@rules_go//go/config:tags=gms_pure_go
|
||||
|
||||
# Keep the client PATH/env out of action keys.
|
||||
build --incompatible_strict_action_env
|
||||
|
||||
test --test_output=errors
|
||||
# Test environment isolation (the pr-core `go test` environment of
|
||||
# scripts/ci/lib/test-env.sh): every test process runs under a wrapper that
|
||||
# gives it a private HOME, XDG_CONFIG_HOME, DOLT_ROOT_PATH, empty global
|
||||
# gitconfig and a short, per-process TMPDIR (unix-socket sun_path limit).
|
||||
# Client HOME/TMPDIR are never forwarded, so no host value enters the action key.
|
||||
test --run_under=//tools/bazel:test_env
|
||||
test --test_env=BD_DISABLE_METRICS=1
|
||||
test --test_env=BD_DISABLE_EVENT_FLUSH=1
|
||||
|
||||
# PR-core parity: the same test selection as scripts/ci/pr-core.sh (race,
|
||||
# -short, skips, tag filters); the environment comes from the wrapper above.
|
||||
test:prcore --@rules_go//go/config:race
|
||||
test:prcore --test_arg=-test.short
|
||||
# pr-core.sh's -parallel 4. Without it -test.parallel defaults to GOMAXPROCS,
|
||||
# the executor's core count (192 on a farm worker), not a runner's 4.
|
||||
test:prcore --test_arg=-test.parallel=4
|
||||
test:prcore --test_arg=-test.skip=^TestEmbedded
|
||||
test:prcore --test_env=BEADS_TEST_SKIP=dolt
|
||||
# As in pr.yml's PR Core step: a root or non-POSIX executor fails
|
||||
# TestAddExcludePatternsRefusesReadErrors instead of skipping it.
|
||||
test:prcore --test_env=BEADS_TEST_REQUIRE_EXCLUDE_PERMISSION=1
|
||||
# Every tag that belongs to another lane (scripts/bazel_policy_test.go
|
||||
# bazelPRCoreExcludedTags). integration-only targets run zero tests outside
|
||||
# --config=integration.
|
||||
test:prcore --test_tag_filters=-dolt-server,-dolt-server-proxied,-dolt-server-integration,-dolt-server-cmd,-embedded,-manual,-integration-only
|
||||
|
||||
test:ci --config=prcore
|
||||
test:ci --keep_going --test_summary=terse
|
||||
# tools/bazel/equivalence.py compares the Go tests Bazel ran with the ones
|
||||
# `go test` would run, from each target's test.xml. rules_go only lists passing
|
||||
# tests in test.xml under -test.v, and --remote_download_minimal would leave
|
||||
# test.xml on the remote side, so ask for both.
|
||||
test:ci --test_env=GO_TEST_WRAP_TESTV=1
|
||||
test:ci --remote_download_regex=.*/test\.xml$
|
||||
# bazel.yml publishes the non-race bd as pr.yml's ci-build-artifacts.
|
||||
test:ci --remote_download_regex=.*/bin/cmd/bd/bd_for_tests/bd$
|
||||
|
||||
# Embedded-Dolt tier: PR Risk's embedded jobs ("Test (Embedded Dolt Cmd
|
||||
# N/20)", "Test (Embedded Dolt Storage N/5)", "Test (Embedded Dolt
|
||||
# Conformance - core/audit)"), as the `embedded`-tagged variants of bd_test
|
||||
# and embeddeddolt_test. Race like the jobs' binaries, no -short, no
|
||||
# BEADS_TEST_SKIP; each variant sets BEADS_TEST_EMBEDDED_DOLT=1. The shard
|
||||
# variants run the jobs' shard scripts, so every Bazel shard runs exactly the
|
||||
# tests of the job with the same number.
|
||||
# Only the variants and what they need are built (the same race configuration
|
||||
# as --config=ci, so the two lanes share every compile).
|
||||
test:embedded --@rules_go//go/config:race
|
||||
test:embedded --test_tag_filters=embedded
|
||||
test:embedded --build_tests_only
|
||||
test:embedded --keep_going
|
||||
test:embedded --test_summary=terse
|
||||
# The variants are timeout = "eternal" because the jobs' Go timeouts are past
|
||||
# "long"; rbe-west rejects any action timeout over 1200s, so eternal means
|
||||
# 1200s here, and the effective limit of every variant is -test.timeout=19m
|
||||
# (the storage and cmd shard jobs pass 20m, conformance core/audit 30m), so
|
||||
# that Go's timeout, which dumps every goroutine, fires before Bazel's 1200s
|
||||
# kill, which does not (see the BUILD targets).
|
||||
test:embedded --test_timeout=-1,-1,-1,1200
|
||||
# The jobs pass no -parallel: GOMAXPROCS on a 4-vCPU runner.
|
||||
test:embedded --test_arg=-test.parallel=4
|
||||
test:embedded --test_env=GO_TEST_WRAP_TESTV=1
|
||||
test:embedded --remote_download_regex=.*/test\.xml$
|
||||
# Since D2 step 1 this lane is the tier's only pre-merge run on same-repo PRs
|
||||
# (pr-risk.yml's legacy jobs stand down). Its results are cached like every
|
||||
# lane's: an unchanged test reuses its recorded PASS, and nightly re-executes
|
||||
# everything (--config=fresh below).
|
||||
# No whole-invocation retry on a remote cache eviction ("Lost inputs"):
|
||||
# Bazel would re-run every test, and a test that failed in the first
|
||||
# attempt but passes in the retry would report green, unlike the legacy
|
||||
# jobs, which never retried. Evicted inputs fail the step instead; a
|
||||
# visible "Re-run failed jobs" retries it.
|
||||
test:embedded --experimental_remote_cache_eviction_retries=0
|
||||
# The race configuration's nogo validations run once, in bazel.yml's `test`
|
||||
# lane (`bazel test //... --config=ci`), which is a strict superset of every
|
||||
# race-group lane's RunNogo/ValidateNogo keys. --norun_validations is a
|
||||
# build-request option, not a configuration flag: it changes no action key
|
||||
# (compile, link and nogo actions are shared with `test` through the action
|
||||
# cache; test results are not, since each lane's test actions carry its own
|
||||
# test env and args) and discards no analysis; it only skips re-running nogo's
|
||||
# validation actions that the owner lane already runs on this configuration.
|
||||
# scripts/nogo_lint_policy_test.go's TestNogoConfigurationsHaveOneValidatingLane
|
||||
# pins `test` as this configuration's sole validating lane.
|
||||
test:embedded --norun_validations
|
||||
|
||||
# Dolt-server lane: what pr.yml's retired container-backed jobs ("Test
|
||||
# (storage domain + uow)" and "Contract corpus") ran, but every dolt
|
||||
# sql-server is a child of the test process, started from the pinned dolt in
|
||||
# the test wrapper's runfiles (BEADS_TEST_DOLT_SERVER=local, set by each
|
||||
# dolt-server target), so the targets run on remote workers and need no
|
||||
# docker. As those jobs: race (//cmd/bd/protocol's variant opts out, like its
|
||||
# job), no -short, no BEADS_TEST_SKIP=dolt, -test.parallel=4, and the
|
||||
# no--short twins of the job's other packages. Results are cacheable: every
|
||||
# input (test binary, dolt, env) is in the action key, and a server that
|
||||
# cannot start fails the target (BEADS_TEST_REQUIRE_DOLT_CONTAINER=1) instead
|
||||
# of skipping. test.xml is downloaded for tools/bazel/equivalence.py --job,
|
||||
# test.log for bazel.yml's failure artifact.
|
||||
test:doltserver --@rules_go//go/config:race
|
||||
test:doltserver --test_tag_filters=dolt-server
|
||||
test:doltserver --build_tests_only
|
||||
test:doltserver --keep_going
|
||||
test:doltserver --test_env=GO_TEST_WRAP_TESTV=1
|
||||
test:doltserver --test_arg=-test.parallel=4
|
||||
# Locally (rbe=off, no executor): at most 4 test processes, the jobs' 4-vCPU
|
||||
# runner shape; remote workers are not limited by it.
|
||||
test:doltserver --local_test_jobs=4
|
||||
test:doltserver --remote_download_regex=.*/test\.(log|xml)$
|
||||
# Race-group nogo is owned by the `test` lane; see test:embedded's comment
|
||||
# above.
|
||||
test:doltserver --norun_validations
|
||||
|
||||
# Proxied-server tier: PR Risk's "Test (Proxied Dolt Cmd N/15)" jobs, as
|
||||
# //cmd/bd:bd_proxied_test and //cmd/bd:bd_managed_local_test (the
|
||||
# managed-local lifecycle in a loopback-only network namespace) (the
|
||||
# dolt-server-proxied tag). Kept out of
|
||||
# --config=doltserver because bazel.yml runs that lane locally too (forks,
|
||||
# rbe=off), where 30 concurrent shards, each with a dolt sql-server busy on
|
||||
# ~4 cores, do not fit regardless of any single shard's wall time; bazel.yml
|
||||
# runs this one only with remote execution, in a job of its own
|
||||
# (bazel-proxied). The build is
|
||||
# --config=doltserver's: race, like PR Risk's /tmp/bd-cmd-test; the
|
||||
# subprocess bd is the non-race bd_for_tests, like the jobs'. Each shard runs its job's
|
||||
# shard script, whose -test.timeout=15m is past "long": the target is
|
||||
# eternal, which rbe-west caps at 1200s.
|
||||
test:doltserver-proxied --@rules_go//go/config:race
|
||||
test:doltserver-proxied --test_tag_filters=dolt-server-proxied
|
||||
test:doltserver-proxied --build_tests_only
|
||||
test:doltserver-proxied --keep_going
|
||||
test:doltserver-proxied --test_summary=terse
|
||||
test:doltserver-proxied --test_timeout=-1,-1,-1,1200
|
||||
test:doltserver-proxied --test_env=GO_TEST_WRAP_TESTV=1
|
||||
# The jobs pass no -parallel: GOMAXPROCS (the target's 4, a runner's vCPUs).
|
||||
test:doltserver-proxied --test_arg=-test.parallel=4
|
||||
test:doltserver-proxied --local_test_jobs=4
|
||||
test:doltserver-proxied --remote_download_regex=.*/test\.(log|xml)$
|
||||
# Since D2 step 2 this lane is the tier's only pre-merge run on same-repo
|
||||
# PRs. Results are cached like every lane's (nightly: --config=fresh).
|
||||
# No whole-invocation retry on a remote cache eviction ("Lost inputs"):
|
||||
# Bazel would re-run every test, and a test that failed in the first
|
||||
# attempt but passes in the retry would report green, unlike the legacy
|
||||
# jobs, which never retried. Evicted inputs fail the step instead; a
|
||||
# visible "Re-run failed jobs" retries it.
|
||||
test:doltserver-proxied --experimental_remote_cache_eviction_retries=0
|
||||
# Race-group nogo is owned by the `test` lane; see test:embedded's comment
|
||||
# above.
|
||||
test:doltserver-proxied --norun_validations
|
||||
|
||||
# dolt-server + proxied union (item 5): bazel.yml's bazel-dolt-race job runs
|
||||
# both tiers in one invocation in mode remote, in place of the bazel-doltserver
|
||||
# and bazel-proxied lanes, which still run --config=doltserver and
|
||||
# --config=doltserver-proxied in every other mode. Exactly the union of the two
|
||||
# member configs' lines, with one tag filter naming both tiers
|
||||
# (scripts/bazel_dolt_race_test.go). Every other flag is the same in both
|
||||
# members or outside any action key for the other: the race build,
|
||||
# -test.parallel=4 and GO_TEST_WRAP_TESTV=1 are common; the eternal timeout
|
||||
# applies to no dolt-server target; the eviction retry count is what
|
||||
# doltserver gets from --config=sole-run wherever it executes remotely;
|
||||
# test_summary, local_test_jobs and remote_download_regex are not in any action
|
||||
# key. So each member target's test action is unchanged (aquery: all 62
|
||||
# TestRunner actions byte-identical), and whichever arm the mode picks shares
|
||||
# cached results with the other. The member configs stay for those modes, make
|
||||
# and developers.
|
||||
test:dolt-race --@rules_go//go/config:race
|
||||
test:dolt-race --test_tag_filters=dolt-server,dolt-server-proxied
|
||||
test:dolt-race --build_tests_only
|
||||
test:dolt-race --keep_going
|
||||
test:dolt-race --test_summary=terse
|
||||
test:dolt-race --test_timeout=-1,-1,-1,1200
|
||||
test:dolt-race --test_env=GO_TEST_WRAP_TESTV=1
|
||||
test:dolt-race --test_arg=-test.parallel=4
|
||||
test:dolt-race --local_test_jobs=4
|
||||
test:dolt-race --remote_download_regex=.*/test\.(log|xml)$
|
||||
test:dolt-race --experimental_remote_cache_eviction_retries=0
|
||||
# The union carries its members' --norun_validations line
|
||||
# (TestBazelDoltRaceConfigIsMemberUnion needs no change: both members and the
|
||||
# union carry the same line).
|
||||
test:dolt-race --norun_validations
|
||||
|
||||
# Server-Dolt storage tier: PR Risk's "Test (Server Dolt Conformance)" and
|
||||
# "Test (Server Dolt Full Suite N/16)" jobs, as
|
||||
# //internal/storage/dolt:dolt_server_{conformance,full}_test
|
||||
# (dolt-server-integration tag): the integration-tagged internal/storage/dolt
|
||||
# tests, non-race like the jobs' binary, against a local dolt sql-server.
|
||||
# The build flags are exactly --config=integration's (the tags, and race for
|
||||
# everything the variants do not turn off), so the two lanes share every
|
||||
# compile: the variants' race-off binary lands in the configuration
|
||||
# --config=integration already builds the non-race //cmd/bd:bd_for_tests in.
|
||||
# A per-target gotags transition would instead compile the whole graph a
|
||||
# third time. No BEADS_TEST_SKIP, no -short; the full suite's
|
||||
# BEADS_TEST_ENV_RUN_DOLT=1 is target env. Remote only in bazel.yml, in a
|
||||
# job of its own (bazel-server-storage) that shares bazel-integration's
|
||||
# compiles through the remote cache.
|
||||
build:doltserver-integration --@rules_go//go/config:tags=gms_pure_go,integration
|
||||
test:doltserver-integration --@rules_go//go/config:race
|
||||
test:doltserver-integration --test_tag_filters=dolt-server-integration
|
||||
test:doltserver-integration --build_tests_only
|
||||
test:doltserver-integration --keep_going
|
||||
test:doltserver-integration --test_summary=terse
|
||||
test:doltserver-integration --test_timeout=-1,-1,-1,1200
|
||||
test:doltserver-integration --test_env=GO_TEST_WRAP_TESTV=1
|
||||
# The jobs pass no -parallel: GOMAXPROCS (the targets' 4, a runner's vCPUs).
|
||||
test:doltserver-integration --test_arg=-test.parallel=4
|
||||
test:doltserver-integration --local_test_jobs=4
|
||||
test:doltserver-integration --remote_download_regex=.*/test\.(log|xml)$
|
||||
# F5 S2 Variant A: this configuration (integration, doltserver-integration,
|
||||
# doltserver-cmd -- the same fingerprint, race=true plus
|
||||
# tags=gms_pure_go,integration) has no full-lane owner. Its nogo runs once,
|
||||
# narrowly, in bazel.yml's bazel-integration job: a `bazel build
|
||||
# --output_groups=nogo_fix` step over //internal/testutil/integration only
|
||||
# (the configuration's non-test library; the 56 integration-tagged _test.go
|
||||
# files this loses vet/lint coverage on are listed in
|
||||
# tools/nogo/unvalidated_integration_tests.txt, f5-spec.md §3/§5 S2).
|
||||
# --norun_validations is a build-request option, not a configuration flag:
|
||||
# it changes no action key and discards no analysis; it only skips
|
||||
# re-running nogo's validation actions, which bazel-integration's nogo-only
|
||||
# step already runs for this configuration's library files.
|
||||
# scripts/nogo_lint_policy_test.go's TestNogoConfigurationsHaveOneValidatingLane
|
||||
# pins the nogo-only step as this configuration's sole validating lane.
|
||||
test:doltserver-integration --norun_validations
|
||||
# Since D2 step 2 this lane is the tier's only pre-merge run on same-repo
|
||||
# PRs. Results are cached like every lane's (nightly: --config=fresh).
|
||||
# No whole-invocation retry on a remote cache eviction ("Lost inputs"):
|
||||
# Bazel would re-run every test, and a test that failed in the first
|
||||
# attempt but passes in the retry would report green, unlike the legacy
|
||||
# jobs, which never retried. Evicted inputs fail the step instead; a
|
||||
# visible "Re-run failed jobs" retries it.
|
||||
test:doltserver-integration --experimental_remote_cache_eviction_retries=0
|
||||
|
||||
# cmd/bd Dolt-server tier: //cmd/bd:bd_dolt_server_test (dolt-server-cmd
|
||||
# tag), the whole integration-tagged cmd/bd suite against a hermetic dolt
|
||||
# sql-server, i.e. the Dolt-gated cmd/bd tests every other lane skips
|
||||
# (BEADS_TEST_SKIP=dolt in --config=prcore/ci and --config=integration), and //tests/regression:regression_test
|
||||
# (the differential regression suite, formerly regression.yml, against the
|
||||
# catalog-pinned baseline in @bd_releases). The build flags are exactly
|
||||
# --config=integration's, so it compiles nothing bazel-integration does not
|
||||
# (shared through the remote cache). bazel.yml runs it where it runs the
|
||||
# integration lane (remote, or with the read-only cache in mode cache), in a
|
||||
# job of its own (bazel-cmd-dolt), advisory until pr.yml's
|
||||
# BAZEL_CMD_DOLT_REQUIRED says otherwise. No BEADS_TEST_SKIP, no -short.
|
||||
# Results are cacheable, as in --config=doltserver: every input is in the
|
||||
# action key, and a server that cannot start fails the target.
|
||||
build:doltserver-cmd --@rules_go//go/config:tags=gms_pure_go,integration
|
||||
test:doltserver-cmd --@rules_go//go/config:race
|
||||
test:doltserver-cmd --test_tag_filters=dolt-server-cmd
|
||||
test:doltserver-cmd --build_tests_only
|
||||
test:doltserver-cmd --keep_going
|
||||
test:doltserver-cmd --test_summary=terse
|
||||
test:doltserver-cmd --test_timeout=-1,-1,-1,1200
|
||||
# As in --config=integration: Go's own timeout fires first and dumps every
|
||||
# goroutine to test.log, which Bazel's kill at 1200s does not. Item 5 A2: the
|
||||
# -test.timeout=19m arg and the BEADS_TEST_REQUIRE_EXCLUDE_PERMISSION env moved
|
||||
# onto //cmd/bd:bd_dolt_server_test's and //tests/regression:regression_test's
|
||||
# own args/env (the rules), so --config=dolt-int below does not need them:
|
||||
# without the move, server-storage's 15m Go timeout would become 19m under
|
||||
# the union, and the env would leak into server-storage's targets. The final
|
||||
# argv and environment Bazel assembles (target args, then -test.timeout=19m,
|
||||
# then this config's own -test.parallel=4 test_arg; same env map either way)
|
||||
# are unchanged, so the remote action digest -- what RBE's cache keys on --
|
||||
# is unaffected and cached results should carry over. This IS a local
|
||||
# actionKey change for these two targets' 46 actions: --test_env is part of
|
||||
# the build configuration's own fingerprint, picked up by every target
|
||||
# analyzed under that configuration, unlike a target's own env attribute,
|
||||
# which only the target carries. To be confirmed in practice by the first
|
||||
# merge group's tests_cached == tests_total in ci-analytics, not claimed here
|
||||
# as already observed.
|
||||
test:doltserver-cmd --test_arg=-test.parallel=4
|
||||
test:doltserver-cmd --test_env=GO_TEST_WRAP_TESTV=1
|
||||
test:doltserver-cmd --local_test_jobs=4
|
||||
test:doltserver-cmd --remote_download_regex=.*/test\.(log|xml)$
|
||||
# F5 S2 Variant A: same configuration as --config=integration /
|
||||
# doltserver-integration above; see that block's comment for the owner
|
||||
# (bazel-integration's nogo-only step over //internal/testutil/integration).
|
||||
test:doltserver-cmd --norun_validations
|
||||
|
||||
# server-storage + cmd-dolt union (item 5 A2): bazel.yml's bazel-dolt-int job
|
||||
# runs both tiers in one invocation in mode remote, in place of the
|
||||
# bazel-server-storage and bazel-cmd-dolt jobs, which still run
|
||||
# --config=doltserver-integration and --config=doltserver-cmd in every other
|
||||
# mode (fork-ro, fork-rw, cache, local): there one client does both tiers'
|
||||
# work with no in-flight deduplication, so a union would cost the sum of the
|
||||
# tiers instead of the max. Exactly the union of the two member configs'
|
||||
# lines above, with one tag filter naming both members' tags
|
||||
# (scripts/bazel_dolt_int_test.go). Every other flag is the same in both
|
||||
# members: the race build, tags=gms_pure_go,integration, keep_going,
|
||||
# test_summary, the eternal 1200s timeout, GO_TEST_WRAP_TESTV=1,
|
||||
# -test.parallel=4, local_test_jobs, remote_download_regex and
|
||||
# norun_validations. So each member target's test action is unchanged in the
|
||||
# sense that matters for caching (aquery: all 63 TestRunner actions' remote
|
||||
# action digests are byte-identical, the key RBE's cache lookups use), though
|
||||
# each action's local actionKey differs since these flags now reach the
|
||||
# target via its own env/args rather than the member's build configuration.
|
||||
# Cached results carry over both ways regardless.
|
||||
# New for cmd-dolt here: --experimental_remote_cache_eviction_retries=0.
|
||||
# server-storage already has it (above); cmd-dolt did not (it has no
|
||||
# --config=sole-run of its own, unlike doltserver). Adding it to the union is
|
||||
# stricter for cmd-dolt (no whole-invocation retry on a remote cache
|
||||
# eviction) and policy-conformant with sole-run semantics; the eviction
|
||||
# allowlist in pr_risk_bazel_coverage_test.go records the new line.
|
||||
build:dolt-int --@rules_go//go/config:tags=gms_pure_go,integration
|
||||
test:dolt-int --@rules_go//go/config:race
|
||||
test:dolt-int --test_tag_filters=dolt-server-integration,dolt-server-cmd
|
||||
test:dolt-int --build_tests_only
|
||||
test:dolt-int --keep_going
|
||||
test:dolt-int --test_summary=terse
|
||||
test:dolt-int --test_timeout=-1,-1,-1,1200
|
||||
test:dolt-int --test_env=GO_TEST_WRAP_TESTV=1
|
||||
test:dolt-int --test_arg=-test.parallel=4
|
||||
test:dolt-int --local_test_jobs=4
|
||||
test:dolt-int --remote_download_regex=.*/test\.(log|xml)$
|
||||
test:dolt-int --norun_validations
|
||||
test:dolt-int --experimental_remote_cache_eviction_retries=0
|
||||
|
||||
# Integration lane: the `go test` main.yml's former "Main Linux integration"
|
||||
# jobs ran on push (this lane replaced them, and nightly.yml's retired Full
|
||||
# Test Suite, which ran the same `go test` over ./... in one job): every package
|
||||
# built with -tags=integration,gms_pure_go, race, no -short, no -skip,
|
||||
# BEADS_TEST_SKIP=dolt. The tag is set for the whole build, as `go test -tags`
|
||||
# does, not per target: gazelle generates srcs/deps with integration files
|
||||
# included (root BUILD.bazel `gazelle:build_tags`), rules_go drops them from
|
||||
# every other configuration, and //internal/testutil/integration (integration
|
||||
# files only) compiles to its real contents only here. A per-target `gotags`
|
||||
# would not save the compile either: it transitions the whole dep graph.
|
||||
build:integration --@rules_go//go/config:tags=gms_pure_go,integration
|
||||
test:integration --@rules_go//go/config:race
|
||||
test:integration --test_env=BEADS_TEST_SKIP=dolt
|
||||
# The variants the PR-core lane leaves out stay out, except integration-only
|
||||
# (targets with tests only under the tag): the jobs' BEADS_TEST_SKIP=dolt
|
||||
# keeps every container- or server-backed test skipped, which is what the
|
||||
# untagged base targets already do. scripts/bazel_policy_test.go derives the
|
||||
# required exclusions from the PR-core list, so a new lane tag lands here too.
|
||||
# pr-core-only targets (the historical-release suites: shell tests against
|
||||
# the release-shaped bd, which the PR-core lane already runs) stay out too.
|
||||
test:integration --test_tag_filters=-dolt-server,-dolt-server-proxied,-dolt-server-integration,-dolt-server-cmd,-embedded,-manual,-pr-core-only
|
||||
test:integration --build_tests_only
|
||||
test:integration --keep_going
|
||||
test:integration --test_summary=terse
|
||||
# The jobs pass no -p/-parallel: GOMAXPROCS on a 4-vCPU ubuntu-latest runner.
|
||||
test:integration --test_arg=-test.parallel=4
|
||||
# The jobs give each package binary -timeout=30m. rbe-west rejects an action
|
||||
# timeout over 1200s, so every size gets 1200s, and Go's own -test.timeout (19m,
|
||||
# after the 1200s rules_go derives from TEST_TIMEOUT: the last flag wins) fires
|
||||
# first and dumps every goroutine to test.log, which Bazel's kill does not.
|
||||
test:integration --test_timeout=1200
|
||||
test:integration --test_arg=-test.timeout=19m
|
||||
# The runner is not root, so TestAddExcludePatternsRefusesReadErrors runs
|
||||
# there; make a root executor fail it rather than skip (as test:prcore does).
|
||||
test:integration --test_env=BEADS_TEST_REQUIRE_EXCLUDE_PERMISSION=1
|
||||
# -test.v in test.xml, as in test:ci, for tools/bazel/equivalence.py.
|
||||
test:integration --test_env=GO_TEST_WRAP_TESTV=1
|
||||
# ci and integration build into the same output directory (the tags flag
|
||||
# does not change it), so they share bazel-testlogs: a lane's test.xml is
|
||||
# overwritten by the other lane's next run of the same target. Run
|
||||
# equivalence.py / check_testcases.py right after each lane's own
|
||||
# `bazel test`, before the other lane runs (or give the lanes separate jobs).
|
||||
test:integration --remote_download_regex=.*/test\.xml$
|
||||
# F5 S2 Variant A: same configuration as --config=doltserver-integration /
|
||||
# doltserver-cmd above; see that block's comment for the owner
|
||||
# (bazel-integration's nogo-only step over //internal/testutil/integration).
|
||||
# The 56 integration-tagged _test.go files this configuration no longer
|
||||
# validates in any full lane are the accepted loss, listed in
|
||||
# tools/nogo/unvalidated_integration_tests.txt.
|
||||
test:integration --norun_validations
|
||||
|
||||
# Pure-Go lane: pr.yml's "Check pure-Go and js/wasm boundaries
|
||||
# (CGO_ENABLED=0)" job. CGO is off for every Go target (rules_go drops
|
||||
# cgo-constrained files like go build does; third_party/patches/
|
||||
# gozstd_nocgo.patch lets dolt's store/nbs, an unused but declared dep,
|
||||
# compile; its package init panics, so a pure binary that links it fails when
|
||||
# run). bazel.yml builds bd and the job's pure test binaries, runs each of
|
||||
# them once (the contamination check `go build` does at compile time) and runs
|
||||
# its -short cmd/bd subset.
|
||||
build:pure --@rules_go//go/config:pure
|
||||
test:pure --test_arg=-test.short
|
||||
# The job passes no -parallel: GOMAXPROCS on a 4-vCPU runner.
|
||||
test:pure --test_arg=-test.parallel=4
|
||||
test:pure --test_env=GO_TEST_WRAP_TESTV=1
|
||||
test:pure --remote_download_regex=.*/test\.xml$
|
||||
|
||||
# js/wasm hook boundary (same job): build for GOOS=js GOARCH=wasm. Bazel
|
||||
# cannot run the wasm test binary itself; bazel.yml runs it with the Go SDK's
|
||||
# go_js_wasm_exec (node), like `go test -exec`. The test toolchain needs an
|
||||
# exec platform matching the target platform, hence
|
||||
# --use_target_platform_for_tests (no test action runs under this config).
|
||||
build:js-wasm --platforms=@rules_go//go/toolchain:js_wasm
|
||||
build:js-wasm --use_target_platform_for_tests
|
||||
build:js-wasm --remote_download_outputs=toplevel
|
||||
|
||||
# nogo (//tools/nogo: go test's vet checks plus the golangci-lint linters
|
||||
# .golangci.yml enables) runs beside every Go compile, so `bazel build`/
|
||||
# `bazel test` fails on a finding -- in bazel.yml's one validating (owner)
|
||||
# lane per configuration (since F5 S1: a race-group non-owner lane reuses
|
||||
# its owner's nogo results instead of re-running them; see
|
||||
# scripts/nogo_lint_policy_test.go's nogoConfigurations table).
|
||||
# --config=nogo asks for the analysis alone (the nogo_fix output group;
|
||||
# nothing is linked), in the race configuration bazel.yml's unit lane
|
||||
# (test:ci) builds, so a local run reuses CI's remote cache. make lint,
|
||||
# scripts/pr-lint and the pre-commit hook use it.
|
||||
build:nogo --@rules_go//go/config:race
|
||||
build:nogo --keep_going
|
||||
build:nogo --output_groups=nogo_fix
|
||||
# The same analyzers over the files only other platforms compile
|
||||
# (//go:build windows, darwin, !linux ...): scripts/pr-lint builds
|
||||
# //tools/bazel:release_cross, every go_library and go_binary split-transitioned
|
||||
# to rules_go's non-cgo platforms, for its windows/amd64 and darwin/arm64
|
||||
# passes (golangci-lint's former GOOS=windows/darwin legs). bazel.yml's pure
|
||||
# lane builds the same target for every release platform, which validates
|
||||
# nogo there too.
|
||||
build:nogo-cross --keep_going
|
||||
build:nogo-cross --output_groups=nogo_fix
|
||||
|
||||
# D2 step 3: bazel.yml's bazel-test, bazel-pure and bazel-doltserver lanes
|
||||
# add this in the remote modes, where (on same-repo PRs and merge groups)
|
||||
# they are the only pre-merge run of pr.yml's legacy PR Core,
|
||||
# pure-Go/js-wasm, domain+uow and contract corpus jobs, which never retried.
|
||||
# Like the retired PR Risk tiers' configs: no whole-invocation retry after
|
||||
# a remote cache eviction ("Lost inputs"), whose exit code outranks a test
|
||||
# failure, so a test that failed in the first attempt and passed in the
|
||||
# retry would report green.
|
||||
test:sole-run --experimental_remote_cache_eviction_retries=0
|
||||
|
||||
# Test result caching. Every lane caches its test results (read and write;
|
||||
# Bazel's default): a test whose action key (test binary, runfiles, test env,
|
||||
# platform) is unchanged reuses the PASS the farm recorded for it, on a PR
|
||||
# (any attempt), a merge group or a push to main, so only what a change
|
||||
# touched runs. Why that is safe:
|
||||
# - Identical key, identical test: these targets are hermetic (dolt and
|
||||
# every input are runfiles).
|
||||
# - A cached failure is never reused: Bazel treats a failed cached action
|
||||
# as a miss, so whatever failed re-runs.
|
||||
# - Only rbe-west's workers write the action cache (clients' writes are
|
||||
# refused), so a cached PASS is a real remote execution, not a client
|
||||
# upload.
|
||||
# - What is given up is re-sampling a nondeterministic (-race, timing)
|
||||
# test on unchanged inputs. nightly.yml passes fresh-test-results: true,
|
||||
# so bazel.yml appends this config last to every `bazel test` and the
|
||||
# whole suite re-executes once a night.
|
||||
# - No retries: --experimental_remote_cache_eviction_retries=0 (the
|
||||
# retired tiers' configs and sole-run) and no flaky attempts anywhere.
|
||||
# Policy: scripts/ci_merge_queue_test.go.
|
||||
test:fresh --nocache_test_results
|
||||
|
||||
# Read-only anonymous cache for fork PRs: rbe-west's rbe-cache endpoint serves
|
||||
# action-cache and CAS reads only (writes and Execute are refused by the farm)
|
||||
# and needs no credentials, so it is committed (scripts/bazel_policy_test.go
|
||||
# allowlists exactly the two endpoint lines). bazel.yml's rbe job selects it
|
||||
# (mode "cache") for fork pull requests; setup-bazel adds --config=fork-cache.
|
||||
# Only non-key flags differ from trusted runs, so fork actions hash like the
|
||||
# trusted ones and hit what trusted CI executed.
|
||||
build:fork-cache --remote_cache=grpcs://rbe-cache.ops.gascity.com:8443
|
||||
build:fork-cache --remote_instance_name=oss
|
||||
build:fork-cache --remote_accept_cached
|
||||
build:fork-cache --noremote_upload_local_results
|
||||
# bazel.yml passes --build_event_json_file and --profile; with a remote cache
|
||||
# Bazel would upload the files the build events reference (test logs, the
|
||||
# profile) over ByteStream. Fork runs upload nothing.
|
||||
build:fork-cache --experimental_build_event_upload_strategy=local
|
||||
build:fork-cache --remote_download_minimal
|
||||
# If the farm closes the endpoint (kill switch) GetCapabilities fails, and
|
||||
# Bazel 9 then fails every action unless both of these are set.
|
||||
build:fork-cache --remote_local_fallback
|
||||
build:fork-cache --incompatible_remote_local_fallback_for_remote_cache
|
||||
# Lookups are network-bound; local CPU work is still bounded by --local_resources.
|
||||
build:fork-cache --jobs=64
|
||||
# A slow (not closed) endpoint: each lookup gives up after 15s per attempt,
|
||||
# and the failure-rate circuit breaker stops calling the endpoint once too
|
||||
# many lookups fail (Bazel's default: 10% within 60s); the rest run locally.
|
||||
build:fork-cache --remote_timeout=15
|
||||
build:fork-cache --remote_retries=2
|
||||
build:fork-cache --experimental_circuit_breaker_strategy=failure
|
||||
# The farm admits 16 connections per source IP.
|
||||
build:fork-cache --remote_max_connections=8
|
||||
# No --remote_cache_compression here: setup-bazel's write-bazelrc.sh adds it
|
||||
# for fork-cache while rbe-cache advertises zstd (cache-zstd-probe.sh), so the
|
||||
# server decides and rollback needs no change here.
|
||||
|
||||
# Remote execution against any REAPI-compatible service. Only generic tuning
|
||||
# lives here; the executor endpoint and TLS credentials are never committed.
|
||||
# Developers put them in a gitignored user.bazelrc or .bazelrc.local; CI writes
|
||||
# a generated rc outside the workspace and passes it with --bazelrc.
|
||||
build:remote-exec --jobs=64
|
||||
build:remote-exec --remote_download_minimal
|
||||
build:remote-exec --remote_timeout=600
|
||||
build:remote-exec --remote_retries=3
|
||||
# Upload only remotely executed results. A locally executed action (a
|
||||
# no-remote-exec test, whose result depends on the host) must not seed the
|
||||
# shared cache that CI and every other developer read.
|
||||
build:remote-exec --noremote_upload_local_results
|
||||
|
||||
try-import %workspace%/.bazelrc.local
|
||||
try-import %workspace%/user.bazelrc
|
||||
|
|
@ -1 +0,0 @@
|
|||
9.3.0
|
||||
82
.beads-hooks/post-checkout
Executable file
82
.beads-hooks/post-checkout
Executable file
|
|
@ -0,0 +1,82 @@
|
|||
#!/usr/bin/env sh
|
||||
# bd-hooks-version: 0.25.1
|
||||
#
|
||||
# bd (beads) post-checkout hook
|
||||
#
|
||||
# This hook syncs the bd database after a branch checkout:
|
||||
# 1. Checks if any .beads/*.jsonl file was updated
|
||||
# 2. Runs 'bd sync --import-only' to import changes
|
||||
#
|
||||
# Arguments provided by git:
|
||||
# $1 = ref of previous HEAD
|
||||
# $2 = ref of new HEAD
|
||||
# $3 = flag (1 if branch checkout, 0 if file checkout)
|
||||
#
|
||||
# Install: cp examples/git-hooks/post-checkout .git/hooks/post-checkout && chmod +x .git/hooks/post-checkout
|
||||
|
||||
# Only run on branch checkouts
|
||||
if [ "$3" != "1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if bd is available
|
||||
if ! command -v bd >/dev/null 2>&1; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if we're in a bd workspace
|
||||
if [ ! -d .beads ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Detect git worktree: compare --git-dir and --git-common-dir
|
||||
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
|
||||
GIT_COMMON_DIR=$(git rev-parse --git-common-dir 2>/dev/null)
|
||||
if [ -n "$GIT_DIR" ] && [ -n "$GIT_COMMON_DIR" ]; then
|
||||
GIT_DIR_ABS=$(cd "$GIT_DIR" 2>/dev/null && pwd || echo "$GIT_DIR")
|
||||
GIT_COMMON_DIR_ABS=$(cd "$GIT_COMMON_DIR" 2>/dev/null && pwd || echo "$GIT_COMMON_DIR")
|
||||
|
||||
if [ "$GIT_DIR_ABS" != "$GIT_COMMON_DIR_ABS" ]; then
|
||||
# We're in a git worktree
|
||||
cat >&2 <<'EOF'
|
||||
|
||||
╔══════════════════════════════════════════════════════════════════════════╗
|
||||
║ Welcome to beads in git worktree! ║
|
||||
╠══════════════════════════════════════════════════════════════════════════╣
|
||||
║ Note: Daemon mode is not recommended with git worktrees. ║
|
||||
║ Worktrees share the same database, and the daemon may commit changes ║
|
||||
║ to the wrong branch. ║
|
||||
║ ║
|
||||
║ RECOMMENDED: Disable daemon for this session: ║
|
||||
║ export BEADS_NO_DAEMON=1 ║
|
||||
║ ║
|
||||
║ For more information: ║
|
||||
║ - Run: bd doctor ║
|
||||
║ - Read: docs/GIT_INTEGRATION.md (lines 10-53) ║
|
||||
║ ║
|
||||
║ Issue tracking: bd-dc9 ║
|
||||
╚══════════════════════════════════════════════════════════════════════════╝
|
||||
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if any JSONL file exists in .beads/
|
||||
if ! ls .beads/*.jsonl >/dev/null 2>&1; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Run bd sync --import-only to import the updated JSONL
|
||||
if ! output=$(bd sync --import-only 2>&1); then
|
||||
echo "Warning: Failed to sync bd changes after checkout" >&2
|
||||
echo "$output" >&2
|
||||
echo "" >&2
|
||||
echo "Run 'bd doctor --fix' to diagnose and repair" >&2
|
||||
# Don't fail the checkout, just warn
|
||||
fi
|
||||
|
||||
# Run quick health check (silent on success, hints if issues found)
|
||||
# This catches version mismatches, outdated hooks, etc.
|
||||
bd doctor --check-health 2>/dev/null || true
|
||||
|
||||
exit 0
|
||||
49
.beads-hooks/post-merge
Executable file
49
.beads-hooks/post-merge
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env sh
|
||||
# bd-hooks-version: 0.25.1
|
||||
#
|
||||
# bd (beads) post-merge hook
|
||||
#
|
||||
# This hook syncs the bd database after a git pull or merge:
|
||||
# 1. Checks if any .beads/*.jsonl file was updated
|
||||
# 2. Runs 'bd sync --import-only' to import changes
|
||||
#
|
||||
# Installation:
|
||||
# cp examples/git-hooks/post-merge .git/hooks/post-merge
|
||||
# chmod +x .git/hooks/post-merge
|
||||
#
|
||||
# Or use the install script:
|
||||
# examples/git-hooks/install.sh
|
||||
|
||||
# Check if bd is available
|
||||
if ! command -v bd >/dev/null 2>&1; then
|
||||
echo "Warning: bd command not found, skipping post-merge sync" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if we're in a bd workspace
|
||||
if [ ! -d .beads ]; then
|
||||
# Not a bd workspace, nothing to do
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if any JSONL file exists in .beads/
|
||||
if ! ls .beads/*.jsonl >/dev/null 2>&1; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Run bd sync --import-only to import the updated JSONL
|
||||
# This is more robust than direct import as it handles all edge cases
|
||||
# Capture both stdout and stderr to show user what went wrong
|
||||
if ! output=$(bd sync --import-only 2>&1); then
|
||||
echo "Warning: Failed to sync bd changes after merge" >&2
|
||||
echo "$output" >&2
|
||||
echo "" >&2
|
||||
echo "Run 'bd doctor --fix' to diagnose and repair" >&2
|
||||
# Don't fail the merge, just warn
|
||||
fi
|
||||
|
||||
# Run quick health check (silent on success, hints if issues found)
|
||||
# This catches version mismatches, outdated hooks, etc.
|
||||
bd doctor --check-health 2>/dev/null || true
|
||||
|
||||
exit 0
|
||||
46
.beads-hooks/pre-commit
Executable file
46
.beads-hooks/pre-commit
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env sh
|
||||
# bd-hooks-version: 0.29.0
|
||||
#
|
||||
# bd (beads) pre-commit hook
|
||||
#
|
||||
# This hook ensures that any pending bd issue changes are flushed to
|
||||
# .beads/issues.jsonl before the commit is created, preventing the
|
||||
# race condition where daemon auto-flush fires after the commit.
|
||||
#
|
||||
# Installation:
|
||||
# cp examples/git-hooks/pre-commit .git/hooks/pre-commit
|
||||
# chmod +x .git/hooks/pre-commit
|
||||
#
|
||||
# Or use the install script:
|
||||
# examples/git-hooks/install.sh
|
||||
|
||||
# Check if bd is available
|
||||
if ! command -v bd >/dev/null 2>&1; then
|
||||
echo "Warning: bd command not found, skipping pre-commit flush" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if we're in a bd workspace
|
||||
if [ ! -d .beads ]; then
|
||||
# Not a bd workspace, nothing to do
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Flush pending changes to JSONL
|
||||
# Use --flush-only to skip git operations (we're already in a git hook)
|
||||
# Suppress output unless there's an error
|
||||
# Note: We warn but don't fail - this allows commits to proceed even if
|
||||
# beads has issues (e.g., user removed .beads from their branch)
|
||||
if ! bd sync --flush-only >/dev/null 2>&1; then
|
||||
echo "Warning: Failed to flush bd changes to JSONL" >&2
|
||||
echo "Run 'bd sync --flush-only' manually to diagnose" >&2
|
||||
# Don't block the commit - user may have removed beads or have other issues
|
||||
fi
|
||||
|
||||
# Stage all tracked JSONL files (issues.jsonl is canonical, beads.jsonl for backward compat, deletions.jsonl for deletion propagation)
|
||||
# git add is harmless if file doesn't exist
|
||||
for f in .beads/beads.jsonl .beads/issues.jsonl .beads/deletions.jsonl; do
|
||||
[ -f "$f" ] && git add "$f" 2>/dev/null || true
|
||||
done
|
||||
|
||||
exit 0
|
||||
111
.beads-hooks/pre-push
Executable file
111
.beads-hooks/pre-push
Executable file
|
|
@ -0,0 +1,111 @@
|
|||
#!/usr/bin/env sh
|
||||
# bd-hooks-version: 0.24.2
|
||||
#
|
||||
# bd (beads) pre-push hook
|
||||
#
|
||||
# This hook prevents pushing stale JSONL by:
|
||||
# 1. Flushing any pending in-memory changes to JSONL (if bd available)
|
||||
# 2. Checking for uncommitted changes (staged, unstaged, untracked, deleted)
|
||||
# 3. Failing the push with clear instructions if changes found
|
||||
#
|
||||
# The pre-commit hook already exports changes, but this catches:
|
||||
# - Changes made between commit and push
|
||||
# - Pending debounced flushes (5s daemon delay)
|
||||
#
|
||||
# Installation:
|
||||
# cp examples/git-hooks/pre-push .git/hooks/pre-push
|
||||
# chmod +x .git/hooks/pre-push
|
||||
#
|
||||
# Or use the install script:
|
||||
# examples/git-hooks/install.sh
|
||||
|
||||
# Check if we're in a bd workspace
|
||||
if [ ! -d .beads ]; then
|
||||
# Not a bd workspace, nothing to do
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Skip if bd sync is already in progress (GH#532: prevents circular error)
|
||||
# bd sync sets this env var when pushing from worktree
|
||||
if [ -n "$BD_SYNC_IN_PROGRESS" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Optionally flush pending bd changes so they surface in JSONL
|
||||
# This prevents the race where a debounced flush lands after the check
|
||||
if command -v bd >/dev/null 2>&1; then
|
||||
bd sync --flush-only >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
# Collect all tracked or existing JSONL files (beads.jsonl, issues.jsonl for backward compat, deletions.jsonl for deletion propagation)
|
||||
FILES=""
|
||||
for f in .beads/beads.jsonl .beads/issues.jsonl .beads/deletions.jsonl; do
|
||||
# Include file if it exists in working tree OR is tracked by git (even if deleted)
|
||||
if git ls-files --error-unmatch "$f" >/dev/null 2>&1 || [ -f "$f" ]; then
|
||||
FILES="$FILES $f"
|
||||
fi
|
||||
done
|
||||
|
||||
# Check for any uncommitted changes using porcelain status
|
||||
# This catches: staged, unstaged, untracked, deleted, renamed, and conflicts
|
||||
if [ -n "$FILES" ]; then
|
||||
# shellcheck disable=SC2086
|
||||
if [ -n "$(git status --porcelain -- $FILES 2>/dev/null)" ]; then
|
||||
echo "❌ Error: Beads JSONL has uncommitted changes" >&2
|
||||
echo "" >&2
|
||||
echo "You made changes to bd issues between your last commit and this push." >&2
|
||||
echo "" >&2
|
||||
|
||||
# Check if bd is available and offer auto-sync
|
||||
if command -v bd >/dev/null 2>&1; then
|
||||
# Check if we're in an interactive terminal
|
||||
if [ -t 0 ]; then
|
||||
echo "Would you like to run 'bd sync' now to commit and push these changes? [y/N]" >&2
|
||||
read -r response
|
||||
case "$response" in
|
||||
[yY][eE][sS]|[yY])
|
||||
echo "" >&2
|
||||
echo "Running: bd sync" >&2
|
||||
if bd sync; then
|
||||
echo "" >&2
|
||||
echo "✓ Sync complete. Continuing with push..." >&2
|
||||
exit 0
|
||||
else
|
||||
echo "" >&2
|
||||
echo "❌ Sync failed. Push aborted." >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "" >&2
|
||||
echo "Push aborted. Run 'bd sync' manually when ready:" >&2
|
||||
echo "" >&2
|
||||
echo " bd sync" >&2
|
||||
echo " git push" >&2
|
||||
echo "" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
# Non-interactive: just show the message
|
||||
echo "Run 'bd sync' to commit these changes:" >&2
|
||||
echo "" >&2
|
||||
echo " bd sync" >&2
|
||||
echo "" >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# bd not available, fall back to manual git commands
|
||||
echo "Please commit the updated JSONL before pushing:" >&2
|
||||
echo "" >&2
|
||||
# shellcheck disable=SC2086
|
||||
echo " git add $FILES" >&2
|
||||
echo ' git commit -m "Update bd JSONL"' >&2
|
||||
echo " git push" >&2
|
||||
echo "" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
40
.beads/.gitignore
vendored
Normal file
40
.beads/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# SQLite databases
|
||||
*.db
|
||||
*.db?*
|
||||
*.db-journal
|
||||
*.db-wal
|
||||
*.db-shm
|
||||
|
||||
# Daemon runtime files
|
||||
daemon.lock
|
||||
daemon.log
|
||||
daemon.pid
|
||||
bd.sock
|
||||
sync-state.json
|
||||
last-touched
|
||||
|
||||
# Local version tracking (prevents upgrade notification spam after git ops)
|
||||
.local_version
|
||||
|
||||
# Legacy database files
|
||||
db.sqlite
|
||||
bd.db
|
||||
|
||||
# Worktree redirect file (contains relative path to main repo's .beads/)
|
||||
# Must not be committed as paths would be wrong in other clones
|
||||
redirect
|
||||
|
||||
# Merge artifacts (temporary files from 3-way merge)
|
||||
beads.base.jsonl
|
||||
beads.base.meta.json
|
||||
beads.left.jsonl
|
||||
beads.left.meta.json
|
||||
beads.right.jsonl
|
||||
beads.right.meta.json
|
||||
|
||||
# NOTE: Do NOT add negation patterns (e.g., !issues.jsonl) here.
|
||||
# They would override fork protection in .git/info/exclude, allowing
|
||||
# contributors to accidentally commit upstream issue databases.
|
||||
# The JSONL files (issues.jsonl, interactions.jsonl) and config files
|
||||
# are tracked by git by default since no pattern above ignores them.
|
||||
metadata.json
|
||||
291
.beads/BD_GUIDE.md
Normal file
291
.beads/BD_GUIDE.md
Normal file
|
|
@ -0,0 +1,291 @@
|
|||
<!-- Auto-generated by bd v0.24.2 - DO NOT EDIT MANUALLY -->
|
||||
<!-- Run 'bd onboard --output .beads/BD_GUIDE.md' to regenerate -->
|
||||
|
||||
# BD (Beads) Guide for AI Agents
|
||||
|
||||
This file contains canonical bd (beads) workflow instructions for AI agents.
|
||||
It is auto-generated and version-stamped to track bd upgrades.
|
||||
|
||||
> **For project-specific instructions**, see AGENTS.md in the repository root.
|
||||
> This file only covers bd tool usage, not project-specific workflows.
|
||||
|
||||
---
|
||||
|
||||
## Issue Tracking with bd (beads)
|
||||
|
||||
**IMPORTANT**: This project uses **bd (beads)** for ALL issue tracking. Do NOT use markdown TODOs, task lists, or other tracking methods.
|
||||
|
||||
### Why bd?
|
||||
|
||||
- Dependency-aware: Track blockers and relationships between issues
|
||||
- Git-friendly: Auto-syncs to JSONL for version control
|
||||
- Agent-optimized: JSON output, ready work detection, discovered-from links
|
||||
- Prevents duplicate tracking systems and confusion
|
||||
|
||||
### Quick Start
|
||||
|
||||
**Check for ready work:**
|
||||
```bash
|
||||
bd ready --json
|
||||
```
|
||||
|
||||
**Create new issues:**
|
||||
```bash
|
||||
bd create "Issue title" -t bug|feature|task -p 0-4 --json
|
||||
bd create "Issue title" -p 1 --deps discovered-from:bd-123 --json
|
||||
```
|
||||
|
||||
**Claim and update:**
|
||||
```bash
|
||||
bd update bd-42 --status in_progress --json
|
||||
bd update bd-42 --priority 1 --json
|
||||
```
|
||||
|
||||
**Complete work:**
|
||||
```bash
|
||||
bd close bd-42 --reason "Completed" --json
|
||||
```
|
||||
|
||||
### Issue Types
|
||||
|
||||
- `bug` - Something broken
|
||||
- `feature` - New functionality
|
||||
- `task` - Work item (tests, docs, refactoring)
|
||||
- `epic` - Large feature with subtasks
|
||||
- `chore` - Maintenance (dependencies, tooling)
|
||||
|
||||
### Priorities
|
||||
|
||||
- `0` - Critical (security, data loss, broken builds)
|
||||
- `1` - High (major features, important bugs)
|
||||
- `2` - Medium (default, nice-to-have)
|
||||
- `3` - Low (polish, optimization)
|
||||
- `4` - Backlog (future ideas)
|
||||
|
||||
### Workflow for AI Agents
|
||||
|
||||
1. **Check ready work**: `bd ready` shows unblocked issues
|
||||
2. **Claim your task**: `bd update <id> --status in_progress`
|
||||
3. **Work on it**: Implement, test, document
|
||||
4. **Discover new work?** Create linked issue:
|
||||
- `bd create "Found bug" -p 1 --deps discovered-from:<parent-id>`
|
||||
5. **Complete**: `bd close <id> --reason "Done"`
|
||||
6. **Commit together**: Always commit the `.beads/issues.jsonl` file together with the code changes so issue state stays in sync with code state
|
||||
|
||||
### Auto-Sync
|
||||
|
||||
bd automatically syncs with git:
|
||||
- Exports to `.beads/issues.jsonl` after changes (5s debounce)
|
||||
- Imports from JSONL when newer (e.g., after `git pull`)
|
||||
- No manual export/import needed!
|
||||
|
||||
### GitHub Copilot Integration
|
||||
|
||||
If using GitHub Copilot, also create `.github/copilot-instructions.md` for automatic instruction loading.
|
||||
Run `bd onboard` to get the content, or see step 2 of the onboard instructions.
|
||||
|
||||
### MCP Server (Recommended)
|
||||
|
||||
If using Claude or MCP-compatible clients, install the beads MCP server:
|
||||
|
||||
```bash
|
||||
pip install beads-mcp
|
||||
```
|
||||
|
||||
Add to MCP config (e.g., `~/.config/claude/config.json`):
|
||||
```json
|
||||
{
|
||||
"beads": {
|
||||
"command": "beads-mcp",
|
||||
"args": []
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Then use `mcp__beads__*` functions instead of CLI commands.
|
||||
|
||||
### Managing AI-Generated Planning Documents
|
||||
|
||||
AI assistants often create planning and design documents during development:
|
||||
- PLAN.md, IMPLEMENTATION.md, ARCHITECTURE.md
|
||||
- DESIGN.md, CODEBASE_SUMMARY.md, INTEGRATION_PLAN.md
|
||||
- TESTING_GUIDE.md, TECHNICAL_DESIGN.md, and similar files
|
||||
|
||||
**Best Practice: Use a dedicated directory for these ephemeral files**
|
||||
|
||||
**Recommended approach:**
|
||||
- Create a `history/` directory in the project root
|
||||
- Store ALL AI-generated planning/design docs in `history/`
|
||||
- Keep the repository root clean and focused on permanent project files
|
||||
- Only access `history/` when explicitly asked to review past planning
|
||||
|
||||
**Example .gitignore entry (optional):**
|
||||
```
|
||||
# AI planning documents (ephemeral)
|
||||
history/
|
||||
```
|
||||
|
||||
**Benefits:**
|
||||
- ✅ Clean repository root
|
||||
- ✅ Clear separation between ephemeral and permanent documentation
|
||||
- ✅ Easy to exclude from version control if desired
|
||||
- ✅ Preserves planning history for archeological research
|
||||
- ✅ Reduces noise when browsing the project
|
||||
|
||||
### Important Rules
|
||||
|
||||
- ✅ Use bd for ALL task tracking
|
||||
- ✅ Always use `--json` flag for programmatic use
|
||||
- ✅ Link discovered work with `discovered-from` dependencies
|
||||
- ✅ Check `bd ready` before asking "what should I work on?"
|
||||
- ✅ Store AI planning docs in `history/` directory
|
||||
- ❌ Do NOT create markdown TODO lists
|
||||
- ❌ Do NOT use external issue trackers
|
||||
- ❌ Do NOT duplicate tracking systems
|
||||
- ❌ Do NOT clutter repo root with planning documents
|
||||
|
||||
For more details, see README.md and QUICKSTART.md.
|
||||
|
||||
---
|
||||
|
||||
# GitHub Copilot Instructions for Beads
|
||||
|
||||
## Project Overview
|
||||
|
||||
**beads** (command: `bd`) is a Git-backed issue tracker designed for AI-supervised coding workflows. We dogfood our own tool for all task tracking.
|
||||
|
||||
**Key Features:**
|
||||
- Dependency-aware issue tracking
|
||||
- Auto-sync with Git via JSONL
|
||||
- AI-optimized CLI with JSON output
|
||||
- Built-in daemon for background operations
|
||||
- MCP server integration for Claude and other AI assistants
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- **Language**: Go 1.21+
|
||||
- **Storage**: SQLite (internal/storage/sqlite/)
|
||||
- **CLI Framework**: Cobra
|
||||
- **Testing**: Go standard testing + table-driven tests
|
||||
- **CI/CD**: GitHub Actions
|
||||
- **MCP Server**: Python (integrations/beads-mcp/)
|
||||
|
||||
## Coding Guidelines
|
||||
|
||||
### Testing
|
||||
- Always write tests for new features
|
||||
- Use `BEADS_DB=/tmp/test.db` to avoid polluting production database
|
||||
- Run `go test -short ./...` before committing
|
||||
- Never create test issues in production DB (use temporary DB)
|
||||
|
||||
### Code Style
|
||||
- Run `golangci-lint run ./...` before committing
|
||||
- Follow existing patterns in `cmd/bd/` for new commands
|
||||
- Add `--json` flag to all commands for programmatic use
|
||||
- Update docs when changing behavior
|
||||
|
||||
### Git Workflow
|
||||
- Always commit `.beads/issues.jsonl` with code changes
|
||||
- Run `bd sync` at end of work sessions
|
||||
- Install git hooks: `bd hooks install` (ensures DB ↔ JSONL consistency)
|
||||
|
||||
## Issue Tracking with bd
|
||||
|
||||
**CRITICAL**: This project uses **bd** for ALL task tracking. Do NOT create markdown TODO lists.
|
||||
|
||||
### Essential Commands
|
||||
|
||||
```bash
|
||||
# Find work
|
||||
bd ready --json # Unblocked issues
|
||||
bd stale --days 30 --json # Forgotten issues
|
||||
|
||||
# Create and manage
|
||||
bd create "Title" -t bug|feature|task -p 0-4 --json
|
||||
bd update <id> --status in_progress --json
|
||||
bd close <id> --reason "Done" --json
|
||||
|
||||
# Search
|
||||
bd list --status open --priority 1 --json
|
||||
bd show <id> --json
|
||||
|
||||
# Sync (CRITICAL at end of session!)
|
||||
bd sync # Force immediate export/commit/push
|
||||
```
|
||||
|
||||
### Workflow
|
||||
|
||||
1. **Check ready work**: `bd ready --json`
|
||||
2. **Claim task**: `bd update <id> --status in_progress`
|
||||
3. **Work on it**: Implement, test, document
|
||||
4. **Discover new work?** `bd create "Found bug" -p 1 --deps discovered-from:<parent-id> --json`
|
||||
5. **Complete**: `bd close <id> --reason "Done" --json`
|
||||
6. **Sync**: `bd sync` (flushes changes to git immediately)
|
||||
|
||||
### Priorities
|
||||
|
||||
- `0` - Critical (security, data loss, broken builds)
|
||||
- `1` - High (major features, important bugs)
|
||||
- `2` - Medium (default, nice-to-have)
|
||||
- `3` - Low (polish, optimization)
|
||||
- `4` - Backlog (future ideas)
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
beads/
|
||||
├── cmd/bd/ # CLI commands (add new commands here)
|
||||
├── internal/
|
||||
│ ├── types/ # Core data types
|
||||
│ └── storage/ # Storage layer
|
||||
│ └── sqlite/ # SQLite implementation
|
||||
├── integrations/
|
||||
│ └── beads-mcp/ # MCP server (Python)
|
||||
├── examples/ # Integration examples
|
||||
├── docs/ # Documentation
|
||||
└── .beads/
|
||||
├── beads.db # SQLite database (DO NOT COMMIT)
|
||||
└── issues.jsonl # Git-synced issue storage
|
||||
```
|
||||
|
||||
## Available Resources
|
||||
|
||||
### MCP Server (Recommended)
|
||||
Use the beads MCP server for native function calls instead of shell commands:
|
||||
- Install: `pip install beads-mcp`
|
||||
- Functions: `mcp__beads__ready()`, `mcp__beads__create()`, etc.
|
||||
- See `integrations/beads-mcp/README.md`
|
||||
|
||||
### Scripts
|
||||
- `./scripts/bump-version.sh <version> --commit` - Update all version files atomically
|
||||
- `./scripts/release.sh <version>` - Complete release workflow
|
||||
- `./scripts/update-homebrew.sh <version>` - Update Homebrew formula
|
||||
|
||||
### Key Documentation
|
||||
- **AGENTS.md** - Comprehensive AI agent guide (detailed workflows, advanced features)
|
||||
- **AGENT_INSTRUCTIONS.md** - Development procedures, testing, releases
|
||||
- **README.md** - User-facing documentation
|
||||
- **docs/CLI_REFERENCE.md** - Complete command reference
|
||||
|
||||
## Important Rules
|
||||
|
||||
- ✅ Use bd for ALL task tracking
|
||||
- ✅ Always use `--json` flag for programmatic use
|
||||
- ✅ Run `bd sync` at end of sessions
|
||||
- ✅ Test with `BEADS_DB=/tmp/test.db`
|
||||
- ❌ Do NOT create markdown TODO lists
|
||||
- ❌ Do NOT create test issues in production DB
|
||||
- ❌ Do NOT commit `.beads/beads.db` (JSONL only)
|
||||
|
||||
---
|
||||
|
||||
**For detailed workflows and advanced features, see [AGENTS.md](../AGENTS.md)**
|
||||
|
||||
---
|
||||
|
||||
**Generated by bd v0.24.2**
|
||||
|
||||
To regenerate this file after upgrading bd:
|
||||
```bash
|
||||
bd onboard --output .beads/BD_GUIDE.md
|
||||
```
|
||||
81
.beads/README.md
Normal file
81
.beads/README.md
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
# Beads - AI-Native Issue Tracking
|
||||
|
||||
Welcome to Beads! This repository uses **Beads** for issue tracking - a modern, AI-native tool designed to live directly in your codebase alongside your code.
|
||||
|
||||
## What is Beads?
|
||||
|
||||
Beads is issue tracking that lives in your repo, making it perfect for AI coding agents and developers who want their issues close to their code. No web UI required - everything works through the CLI and integrates seamlessly with git.
|
||||
|
||||
**Learn more:** [github.com/steveyegge/beads](https://github.com/steveyegge/beads)
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Essential Commands
|
||||
|
||||
```bash
|
||||
# Create new issues
|
||||
bd create "Add user authentication"
|
||||
|
||||
# View all issues
|
||||
bd list
|
||||
|
||||
# View issue details
|
||||
bd show <issue-id>
|
||||
|
||||
# Update issue status
|
||||
bd update <issue-id> --status in_progress
|
||||
bd update <issue-id> --status done
|
||||
|
||||
# Sync with git remote
|
||||
bd sync
|
||||
```
|
||||
|
||||
### Working with Issues
|
||||
|
||||
Issues in Beads are:
|
||||
- **Git-native**: Stored in `.beads/issues.jsonl` and synced like code
|
||||
- **AI-friendly**: CLI-first design works perfectly with AI coding agents
|
||||
- **Branch-aware**: Issues can follow your branch workflow
|
||||
- **Always in sync**: Auto-syncs with your commits
|
||||
|
||||
## Why Beads?
|
||||
|
||||
✨ **AI-Native Design**
|
||||
- Built specifically for AI-assisted development workflows
|
||||
- CLI-first interface works seamlessly with AI coding agents
|
||||
- No context switching to web UIs
|
||||
|
||||
🚀 **Developer Focused**
|
||||
- Issues live in your repo, right next to your code
|
||||
- Works offline, syncs when you push
|
||||
- Fast, lightweight, and stays out of your way
|
||||
|
||||
🔧 **Git Integration**
|
||||
- Automatic sync with git commits
|
||||
- Branch-aware issue tracking
|
||||
- Intelligent JSONL merge resolution
|
||||
|
||||
## Get Started with Beads
|
||||
|
||||
Try Beads in your own projects:
|
||||
|
||||
```bash
|
||||
# Install Beads
|
||||
curl -sSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash
|
||||
|
||||
# Initialize in your repo
|
||||
bd init
|
||||
|
||||
# Create your first issue
|
||||
bd create "Try out Beads"
|
||||
```
|
||||
|
||||
## Learn More
|
||||
|
||||
- **Documentation**: [github.com/steveyegge/beads/docs](https://github.com/steveyegge/beads/tree/main/docs)
|
||||
- **Quick Start Guide**: Run `bd quickstart`
|
||||
- **Examples**: [github.com/steveyegge/beads/examples](https://github.com/steveyegge/beads/tree/main/examples)
|
||||
|
||||
---
|
||||
|
||||
*Beads: Issue tracking that moves at the speed of thought* ⚡
|
||||
54
.beads/config.yaml
Normal file
54
.beads/config.yaml
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# Beads Configuration File
|
||||
# This file configures default behavior for all bd commands in this repository
|
||||
# All settings can also be set via environment variables (BD_* prefix)
|
||||
# or overridden with command-line flags
|
||||
|
||||
# Issue prefix for this repository (used by bd init)
|
||||
# If not set, bd init will auto-detect from directory name
|
||||
# Example: issue-prefix: "myproject" creates issues like "myproject-1", "myproject-2", etc.
|
||||
issue-prefix: "bd"
|
||||
|
||||
# Use no-db mode: load from JSONL, no SQLite, write back after each command
|
||||
# When true, bd will use .beads/issues.jsonl as the source of truth
|
||||
# instead of SQLite database
|
||||
# no-db: false
|
||||
|
||||
# Disable daemon for RPC communication (forces direct database access)
|
||||
# no-daemon: false
|
||||
|
||||
# Disable auto-flush of database to JSONL after mutations
|
||||
# no-auto-flush: false
|
||||
|
||||
# Disable auto-import from JSONL when it's newer than database
|
||||
# no-auto-import: false
|
||||
|
||||
# Enable JSON output by default
|
||||
# json: false
|
||||
|
||||
# Default actor for audit trails (overridden by BD_ACTOR or --actor)
|
||||
# actor: ""
|
||||
|
||||
# Path to database (overridden by BEADS_DB or --db)
|
||||
# db: ""
|
||||
|
||||
# Auto-start daemon if not running (can also use BEADS_AUTO_START_DAEMON)
|
||||
# auto-start-daemon: true
|
||||
|
||||
# Debounce interval for auto-flush (can also use BEADS_FLUSH_DEBOUNCE)
|
||||
# flush-debounce: "5s"
|
||||
|
||||
# Sync branch for multi-clone setups
|
||||
# When set, .beads changes are committed to this branch via worktree
|
||||
# instead of the current branch. This allows multiple clones to sync
|
||||
# beads data without polluting main branch commits.
|
||||
# Can also be set via BEADS_SYNC_BRANCH environment variable.
|
||||
sync-branch: "beads-metadata"
|
||||
|
||||
# Integration settings (access with 'bd config get/set')
|
||||
# These are stored in the database, not in this file:
|
||||
# - jira.url
|
||||
# - jira.project
|
||||
# - linear.url
|
||||
# - linear.api-key
|
||||
# - github.org
|
||||
# - github.repo
|
||||
12
.beads/cost_state.json
Normal file
12
.beads/cost_state.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"hourly_tokens_used": 84530,
|
||||
"hourly_cost_used": 0.39143399999999995,
|
||||
"window_start_time": "2025-11-21T22:59:34.058436-08:00",
|
||||
"issue_tokens_used": {
|
||||
"SYSTEM": 50702,
|
||||
"bd-9f86-baseline-test": 33055
|
||||
},
|
||||
"total_tokens_used": 84530,
|
||||
"total_cost_used": 0.39143399999999995,
|
||||
"last_updated": "2025-11-21T23:28:18.766601-08:00"
|
||||
}
|
||||
|
|
@ -5,10 +5,10 @@
|
|||
# until GitHub Actions finishes.
|
||||
#
|
||||
# Phases:
|
||||
# 1. Prep & Push: preflight -> push-tag (polecat work)
|
||||
# 1. Prep & Push: preflight → push-tag (polecat work)
|
||||
# 2. Gate: await-ci (async wait for release.yml)
|
||||
# 3. Verify: verify-github, verify-npm, verify-pypi, verify-homebrew-core (parallel)
|
||||
# 4. Install: local-install -> cleanup-stale-dolt-orphans -> release-complete
|
||||
# 3. Verify: verify-github, verify-npm, verify-pypi (parallel)
|
||||
# 4. Install: local-install → release-complete (fan-in)
|
||||
|
||||
formula = "beads-release"
|
||||
description = """
|
||||
|
|
@ -26,11 +26,11 @@ Gate (Async Wait):
|
|||
5. await-ci: Gate on GitHub Actions release.yml completion
|
||||
|
||||
Phase 2 (Parallel Verification):
|
||||
6. Verify GitHub release, npm package, PyPI package, Homebrew core formula (concurrent)
|
||||
6. Verify GitHub release, npm package, PyPI package (concurrent)
|
||||
|
||||
Phase 3 (Installation):
|
||||
7. Local installation update
|
||||
8. Stale Dolt orphan cleanup
|
||||
8. Daemon restart
|
||||
|
||||
## Usage
|
||||
|
||||
|
|
@ -48,7 +48,6 @@ until release.yml finishes. A new polecat (or the same one) resumes for Phases 2
|
|||
"""
|
||||
type = "workflow"
|
||||
phase = "vapor" # Ensures this runs as a wisp - bd pour will warn, gt sling --formula creates wisp
|
||||
pour = true # Materialize release steps for checkpoint/resume visibility
|
||||
version = 1
|
||||
|
||||
[vars.version]
|
||||
|
|
@ -74,7 +73,7 @@ git remote get-url origin
|
|||
git worktree list
|
||||
```
|
||||
|
||||
For worktree setups, releases should be done from the main worktree to ensure:
|
||||
For worktree setups, releases should be done from the **main worktree** to ensure:
|
||||
- Correct file paths in commits
|
||||
- Proper tag association
|
||||
- Clean branch history
|
||||
|
|
@ -84,7 +83,7 @@ If you're in a linked worktree:
|
|||
2. Switch to that directory before proceeding
|
||||
3. Or use: `cd $(git worktree list | head -1 | cut -d' ' -f1)`
|
||||
|
||||
Red flags:
|
||||
**Red flags:**
|
||||
- Remote URL doesn't match expected repository
|
||||
- You're in a linked worktree (not the main one)
|
||||
- `git status` shows different files than expected
|
||||
|
|
@ -101,13 +100,13 @@ Ensure working tree is clean before starting release.
|
|||
git status --short
|
||||
```
|
||||
|
||||
Handling uncommitted changes:
|
||||
**Handling uncommitted changes:**
|
||||
|
||||
If changes are in release-related files (CHANGELOG, version files), you may want to:
|
||||
- Include them in the release commit
|
||||
- Or stash and apply after version bump
|
||||
|
||||
If changes are in non-release files (e.g., .beads/config.yaml, .claude/settings.json, local configs):
|
||||
If changes are in **non-release files** (e.g., .beads/config.yaml, .claude/settings.json, local configs):
|
||||
```bash
|
||||
# Auto-stash non-release files
|
||||
git stash push -m "pre-release: non-release changes" -- .beads/ .claude/ *.local* .env*
|
||||
|
|
@ -116,7 +115,7 @@ git stash push -m "pre-release: non-release changes" -- .beads/ .claude/ *.local
|
|||
git status --short
|
||||
```
|
||||
|
||||
Important: The bump script may fail if non-release files are modified. Always stash:
|
||||
**Important:** The bump script may fail if non-release files are modified. Always stash:
|
||||
- `.beads/` directory (local config)
|
||||
- `.claude/` directory (agent settings)
|
||||
- Any `.local`, `.env`, or personal config files
|
||||
|
|
@ -134,20 +133,6 @@ needs = ["preflight-git"]
|
|||
description = """
|
||||
Ensure we're up to date with origin and branch is properly synced.
|
||||
|
||||
**Every `origin/...` below means the branch you are RELEASING FROM, which is
|
||||
`release/x.y.z` — never `main`.** Resetting a release branch onto main's tip
|
||||
destroys the reviewed release-prep commit and leaves you tagging an untested
|
||||
main SHA, which is exactly the failure the release-branch policy exists to
|
||||
prevent. Pin the name first and use the variable:
|
||||
|
||||
```bash
|
||||
# The branch you are releasing from. For a prerelease this is still the BASE
|
||||
# version's branch: an RC for 1.3.0 is cut on release/1.3.0.
|
||||
REL_BRANCH="release/1.3.0"
|
||||
|
||||
git rev-parse --abbrev-ref HEAD # must equal $REL_BRANCH
|
||||
```
|
||||
|
||||
```bash
|
||||
# Fetch latest from origin
|
||||
git fetch origin
|
||||
|
|
@ -156,33 +141,34 @@ git fetch origin
|
|||
git status -sb
|
||||
```
|
||||
|
||||
Branch sync verification:
|
||||
- "Your branch is behind" -> Pull needed, proceed with `git pull --rebase`
|
||||
- "Your branch is ahead" -> You have unpushed commits - review before release!
|
||||
- "Your branch has diverged" -> STOP - resolve divergence first
|
||||
**Branch sync verification:**
|
||||
- "Your branch is behind" → Pull needed, proceed with `git pull --rebase`
|
||||
- "Your branch is ahead" → You have unpushed commits - review before release!
|
||||
- "Your branch has diverged" → **STOP** - resolve divergence first
|
||||
|
||||
```bash
|
||||
# If branch is behind or even, pull latest
|
||||
git pull --rebase
|
||||
```
|
||||
|
||||
Recovering from divergence:
|
||||
**Recovering from divergence:**
|
||||
If your branch has diverged from origin (e.g., after a botched commit):
|
||||
```bash
|
||||
# Option 1: Back up first, ALWAYS
|
||||
# Option 1: Reset to origin (loses local commits)
|
||||
git reset --hard origin/main
|
||||
|
||||
# Option 2: Rebase local commits on top of origin
|
||||
git rebase origin/main
|
||||
|
||||
# Option 3: Create a backup branch first
|
||||
git branch backup-before-release
|
||||
|
||||
# Option 2: Reset to the release branch's origin (loses local commits)
|
||||
git reset --hard "origin/$REL_BRANCH"
|
||||
|
||||
# Option 3: Rebase local commits on top of it
|
||||
git rebase "origin/$REL_BRANCH"
|
||||
git reset --hard origin/main
|
||||
```
|
||||
|
||||
After pulling, verify sync:
|
||||
**After pulling, verify sync:**
|
||||
```bash
|
||||
git status -sb
|
||||
# Should show: "## release/1.3.0...origin/release/1.3.0" (no ahead/behind)
|
||||
# Should show: "## main...origin/main" (no ahead/behind)
|
||||
```
|
||||
"""
|
||||
|
||||
|
|
@ -193,7 +179,7 @@ needs = ["preflight-pull"]
|
|||
description = """
|
||||
Check if a previous release was started but not completed (version mismatch).
|
||||
|
||||
Compare versions across all sources:
|
||||
**Compare versions across all sources:**
|
||||
```bash
|
||||
# Last git tag
|
||||
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "none")
|
||||
|
|
@ -212,16 +198,16 @@ NPM_VERSION=$(jq -r '.version' npm-package/package.json)
|
|||
echo "npm version: $NPM_VERSION"
|
||||
```
|
||||
|
||||
Healthy state (ready for new release):
|
||||
**Healthy state (ready for new release):**
|
||||
- All versions match (e.g., all show 0.46.0)
|
||||
- Last tag matches code version
|
||||
|
||||
Half-done release detected if:
|
||||
**Half-done release detected if:**
|
||||
- CHANGELOG shows {{version}} but code shows previous version
|
||||
- Code version doesn't match last tag
|
||||
- npm/PyPI versions are out of sync
|
||||
|
||||
Recovery from half-done release:
|
||||
**Recovery from half-done release:**
|
||||
```bash
|
||||
# If CHANGELOG was updated but code wasn't bumped:
|
||||
# Either complete the release or revert CHANGELOG changes
|
||||
|
|
@ -261,22 +247,22 @@ needs = ["review-changes"]
|
|||
description = """
|
||||
Ensure CHANGELOG captures ALL commits since the last release.
|
||||
|
||||
Step 1: Count commits since last tag
|
||||
**Step 1: Count commits since last tag**
|
||||
```bash
|
||||
LAST_TAG=$(git describe --tags --abbrev=0)
|
||||
COMMIT_COUNT=$(git rev-list $LAST_TAG..HEAD --count)
|
||||
echo "Commits since $LAST_TAG: $COMMIT_COUNT"
|
||||
```
|
||||
|
||||
Step 2: List all commits with their messages
|
||||
**Step 2: List all commits with their messages**
|
||||
```bash
|
||||
git log $LAST_TAG..HEAD --oneline --no-merges
|
||||
```
|
||||
|
||||
Step 3: Cross-reference with CHANGELOG
|
||||
**Step 3: Cross-reference with CHANGELOG**
|
||||
Open CHANGELOG.md and verify every significant commit is documented in [Unreleased].
|
||||
|
||||
Red flags for stale CHANGELOG:
|
||||
**Red flags for stale CHANGELOG:**
|
||||
- If CHANGELOG was last modified days ago but there are recent commits
|
||||
- If commit count seems high but [Unreleased] section is sparse
|
||||
- If PR titles in commits don't match CHANGELOG entries
|
||||
|
|
@ -289,7 +275,7 @@ git log -1 --format="%ar" -- CHANGELOG.md
|
|||
git log -1 --format="%ar"
|
||||
```
|
||||
|
||||
If CHANGELOG is stale:
|
||||
**If CHANGELOG is stale:**
|
||||
1. Review all commits since last tag
|
||||
2. Add missing entries to appropriate sections (Added/Changed/Fixed)
|
||||
3. Group related changes
|
||||
|
|
@ -339,68 +325,159 @@ Focus on workflow-impacting changes agents need to know.
|
|||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "bump-versions"
|
||||
title = "Bump every version reference"
|
||||
id = "bump-version-go"
|
||||
title = "Bump version in version.go"
|
||||
needs = ["update-info-go"]
|
||||
description = """
|
||||
Run the one script that owns every version reference.
|
||||
Update the Go version constant.
|
||||
|
||||
```bash
|
||||
./scripts/update-versions.sh {{version}}
|
||||
# macOS
|
||||
sed -i '' 's/Version = "[^"]*"/Version = "{{version}}"/' cmd/bd/version.go
|
||||
|
||||
# Linux
|
||||
sed -i 's/Version = "[^"]*"/Version = "{{version}}"/' cmd/bd/version.go
|
||||
```
|
||||
|
||||
This is the ONLY sanctioned way to bump. Hand-rolled sed per file is how the
|
||||
set drifts: this formula used to carry its own copies and pointed at a
|
||||
`claude-plugin/` path that has not existed since the plugins moved under
|
||||
`plugins/beads/`, while missing the copilot plugin, the MCP lockfile and the
|
||||
tracked git-hook markers entirely — so it would have failed outright, or
|
||||
shipped inconsistent versions, on every step after the stale path.
|
||||
|
||||
`scripts/update-versions.sh` rewrites, in one pass:
|
||||
|
||||
- `cmd/bd/version.go` — the canonical version everything else is compared to
|
||||
- `plugins/beads/.claude-plugin/plugin.json`
|
||||
- `plugins/beads/.codex-plugin/plugin.json`
|
||||
- `plugins/beads/.copilot-plugin/plugin.json`
|
||||
- `.claude-plugin/marketplace.json`
|
||||
- `integrations/beads-mcp/pyproject.toml`
|
||||
- `integrations/beads-mcp/src/beads_mcp/__init__.py`
|
||||
- `integrations/beads-mcp/uv.lock` — via `uv lock`
|
||||
- `npm-package/package.json`
|
||||
- `.githooks/*` — the `BEGIN`/`END BEADS INTEGRATION v<version>` markers
|
||||
- `default.nix`
|
||||
- `cmd/bd/winres/winres.json`, `cmd/bd/winres/manifest.xml`
|
||||
- `README.md` — the static Alpha badge, if one is present (it is not today;
|
||||
README uses live npm/PyPI/GitHub badges)
|
||||
|
||||
Two of those have burned a release before, so check the script's output rather
|
||||
than assuming:
|
||||
|
||||
- **`uv` must be installed.** Without it the script WARNS and leaves
|
||||
`uv.lock` stale. The release workflow's MCP gate runs `uv sync --locked`,
|
||||
which fails only in the tag-triggered run — after the tag exists and can no
|
||||
longer be rewritten. That burned v1.1.1 and cost v1.1.0 and v1.1.2 their
|
||||
first runs. If you see `uv not found` or `uv lock failed`, stop and fix it:
|
||||
```bash
|
||||
uv lock --directory integrations/beads-mcp
|
||||
```
|
||||
- **The `.githooks/*` markers are rewritten wholesale**, not matched against
|
||||
the current version, because they can already be drifted when the bump runs
|
||||
(they still said v1.1.0 during the v1.2.0 bump).
|
||||
|
||||
Not covered here, by design: `CHANGELOG.md` and `cmd/bd/info.go` (earlier
|
||||
steps), and `default.nix`'s `vendorHash` (next step).
|
||||
|
||||
Verify:
|
||||
```bash
|
||||
git diff --stat
|
||||
grep 'Version = ' cmd/bd/version.go
|
||||
```
|
||||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "bump-plugin-json"
|
||||
title = "Bump version in plugin JSON files"
|
||||
needs = ["bump-version-go"]
|
||||
description = """
|
||||
Update Claude plugin manifest versions.
|
||||
|
||||
```bash
|
||||
# macOS/Linux with jq
|
||||
jq '.version = "{{version}}"' .claude-plugin/plugin.json > tmp && mv tmp .claude-plugin/plugin.json
|
||||
jq '.plugins[0].version = "{{version}}"' .claude-plugin/marketplace.json > tmp && mv tmp .claude-plugin/marketplace.json
|
||||
```
|
||||
|
||||
Verify:
|
||||
```bash
|
||||
jq -r '.version' .claude-plugin/plugin.json
|
||||
jq -r '.plugins[0].version' .claude-plugin/marketplace.json
|
||||
```
|
||||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "bump-mcp-python"
|
||||
title = "Bump version in MCP Python package"
|
||||
needs = ["bump-plugin-json"]
|
||||
description = """
|
||||
Update the beads-mcp Python package version.
|
||||
|
||||
```bash
|
||||
# macOS
|
||||
sed -i '' 's/version = "[^"]*"/version = "{{version}}"/' integrations/beads-mcp/pyproject.toml
|
||||
sed -i '' 's/__version__ = "[^"]*"/__version__ = "{{version}}"/' integrations/beads-mcp/src/beads_mcp/__init__.py
|
||||
|
||||
# Linux
|
||||
sed -i 's/version = "[^"]*"/version = "{{version}}"/' integrations/beads-mcp/pyproject.toml
|
||||
sed -i 's/__version__ = "[^"]*"/__version__ = "{{version}}"/' integrations/beads-mcp/src/beads_mcp/__init__.py
|
||||
```
|
||||
|
||||
Verify:
|
||||
```bash
|
||||
grep 'version = ' integrations/beads-mcp/pyproject.toml | head -1
|
||||
grep '__version__ = ' integrations/beads-mcp/src/beads_mcp/__init__.py
|
||||
```
|
||||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "bump-npm-package"
|
||||
title = "Bump version in npm package"
|
||||
needs = ["bump-mcp-python"]
|
||||
description = """
|
||||
Update the npm package version.
|
||||
|
||||
```bash
|
||||
# macOS/Linux with jq
|
||||
jq '.version = "{{version}}"' npm-package/package.json > tmp && mv tmp npm-package/package.json
|
||||
```
|
||||
|
||||
Verify:
|
||||
```bash
|
||||
jq -r '.version' npm-package/package.json
|
||||
```
|
||||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "bump-hook-templates"
|
||||
title = "Bump version in hook templates"
|
||||
needs = ["bump-npm-package"]
|
||||
description = """
|
||||
Update version comment in git hook templates.
|
||||
|
||||
```bash
|
||||
# macOS
|
||||
for f in cmd/bd/templates/hooks/pre-commit cmd/bd/templates/hooks/post-merge cmd/bd/templates/hooks/pre-push cmd/bd/templates/hooks/post-checkout; do
|
||||
sed -i '' 's/# bd-hooks-version: .*/# bd-hooks-version: {{version}}/' "$f"
|
||||
done
|
||||
|
||||
# Linux
|
||||
for f in cmd/bd/templates/hooks/pre-commit cmd/bd/templates/hooks/post-merge cmd/bd/templates/hooks/pre-push cmd/bd/templates/hooks/post-checkout; do
|
||||
sed -i 's/# bd-hooks-version: .*/# bd-hooks-version: {{version}}/' "$f"
|
||||
done
|
||||
```
|
||||
|
||||
Verify:
|
||||
```bash
|
||||
grep '# bd-hooks-version:' cmd/bd/templates/hooks/pre-commit
|
||||
```
|
||||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "bump-readme"
|
||||
title = "Bump version in README badge"
|
||||
needs = ["bump-hook-templates"]
|
||||
description = """
|
||||
Update the Alpha version badge in README.md.
|
||||
|
||||
```bash
|
||||
# macOS
|
||||
sed -i '' 's/Alpha (v[^)]*)/Alpha (v{{version}})/' README.md
|
||||
|
||||
# Linux
|
||||
sed -i 's/Alpha (v[^)]*)/Alpha (v{{version}})/' README.md
|
||||
```
|
||||
|
||||
Verify:
|
||||
```bash
|
||||
grep 'Alpha (v' README.md
|
||||
```
|
||||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "bump-default-nix"
|
||||
title = "Bump version in default.nix"
|
||||
needs = ["bump-readme"]
|
||||
description = """
|
||||
Update the Nix package version.
|
||||
|
||||
```bash
|
||||
# macOS
|
||||
sed -i '' 's/version = "[^"]*";/version = "{{version}}";/' default.nix
|
||||
|
||||
# Linux
|
||||
sed -i 's/version = "[^"]*";/version = "{{version}}";/' default.nix
|
||||
```
|
||||
|
||||
Verify:
|
||||
```bash
|
||||
grep 'version = ' default.nix
|
||||
```
|
||||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "update-vendorhash"
|
||||
title = "Update Nix vendorHash if needed"
|
||||
needs = ["bump-versions"]
|
||||
needs = ["bump-default-nix"]
|
||||
description = """
|
||||
Update vendorHash if go.mod/go.sum changed since last release.
|
||||
|
||||
|
|
@ -456,45 +533,17 @@ id = "verify-versions"
|
|||
title = "Verify version consistency"
|
||||
needs = ["stamp-changelog"]
|
||||
description = """
|
||||
Run the gate, not a hand-listed grep pile — the grep list is what drifts.
|
||||
Confirm all versions match {{version}}.
|
||||
|
||||
```bash
|
||||
./scripts/check-versions.sh
|
||||
grep 'Version = ' cmd/bd/version.go
|
||||
jq -r '.version' .claude-plugin/plugin.json
|
||||
jq -r '.version' npm-package/package.json
|
||||
grep 'version = ' integrations/beads-mcp/pyproject.toml
|
||||
grep 'version = ' default.nix
|
||||
```
|
||||
|
||||
`scripts/check-versions.sh` reads the canonical version out of
|
||||
`cmd/bd/version.go` and compares the gated files against it: all three plugin
|
||||
manifests (claude, codex, copilot), the marketplace, the MCP pyproject /
|
||||
`__init__.py` / `uv.lock` pin (plus `uv lock --check` for freshness when `uv`
|
||||
is present), the npm package, both `BEADS INTEGRATION` markers in every
|
||||
`.githooks/*` file, and the Windows PE metadata in `winres.json` and
|
||||
`manifest.xml`. It exits non-zero on any mismatch and names the file. This is
|
||||
the same script the release-tag pre-push hook and CI run, so a green run here
|
||||
is the real signal.
|
||||
|
||||
It must print `✓ Version files in sync at: {{version}}` before you continue.
|
||||
|
||||
**If it fails, do NOT just re-run the bump — that is a no-op here.**
|
||||
`update-versions.sh` derives the OLD version from `cmd/bd/version.go`, which by
|
||||
this point already reads `{{version}}`, so its substitutions rewrite
|
||||
`{{version}} -> {{version}}` and leave the drifted file exactly as it was while
|
||||
printing a green "Version constants updated". Only the `.githooks` markers
|
||||
(rewritten wholesale) and `uv.lock` (regenerated) heal on a re-run. The script
|
||||
prints the three remedies that do work; the usual one is to edit the named file
|
||||
to `{{version}}` and re-run the check.
|
||||
|
||||
`check-versions.sh` does NOT gate `default.nix` or `README.md`. Confirm
|
||||
`default.nix` yourself:
|
||||
|
||||
```bash
|
||||
grep 'version = ' default.nix # should be {{version}}
|
||||
```
|
||||
|
||||
(For a prerelease, do not expect the version string to appear uniformly in the
|
||||
winres files: `file_version`/`product_version` and the manifest's four-part
|
||||
version carry the BASE version because PE fields must be purely numeric, while
|
||||
`FileVersion`/`ProductVersion` carry the full `{{version}}`. check-versions.sh
|
||||
now encodes that split, so let it do the checking.)
|
||||
All should show {{version}}.
|
||||
"""
|
||||
|
||||
[[steps]]
|
||||
|
|
@ -513,74 +562,37 @@ Review the commit to ensure all expected files are included.
|
|||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "push-main"
|
||||
title = "Land the release prep as a PR"
|
||||
id = "create-tag"
|
||||
title = "Create release tag"
|
||||
needs = ["commit-release"]
|
||||
description = """
|
||||
Releases are cut from `release/x.y.z`, not from the tip of `main` — see the
|
||||
"Release Branches" section of RELEASING.md. **Nothing is pushed straight to the
|
||||
release branch, and nothing is tagged before the PR merges.**
|
||||
|
||||
The branch is named for the BASE version: a `1.3.0-rc.1` run still targets
|
||||
`release/1.3.0`. Derive it rather than substituting `{{version}}` directly,
|
||||
which would name a branch nothing ever creates and fail with
|
||||
`src refspec ... does not match any`:
|
||||
Create annotated git tag.
|
||||
|
||||
```bash
|
||||
BASE="$(printf '%s' "{{version}}" | sed 's/-.*//')"
|
||||
REL_BRANCH="release/$BASE"
|
||||
echo "$REL_BRANCH"
|
||||
```
|
||||
|
||||
Create the prep branch, push it, and open the PR:
|
||||
|
||||
```bash
|
||||
git checkout -b "release-prep/v{{version}}"
|
||||
git push -u origin "release-prep/v{{version}}"
|
||||
gh pr create --base "$REL_BRANCH" --label status/needs-review-auto
|
||||
```
|
||||
|
||||
Wait for it to merge, then take the merged state:
|
||||
|
||||
```bash
|
||||
git checkout "$REL_BRANCH" && git pull
|
||||
```
|
||||
|
||||
After the release ships, every commit that landed only on the release branch
|
||||
needs a forward-port PR to `main`, the version bump included:
|
||||
|
||||
```bash
|
||||
git log --oneline "main..$REL_BRANCH"
|
||||
```
|
||||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "create-tag"
|
||||
title = "Create release tag on the merged commit"
|
||||
needs = ["push-main"]
|
||||
description = """
|
||||
Create the annotated tag on the MERGED commit, with the release branch checked
|
||||
out and pulled (previous step).
|
||||
|
||||
```bash
|
||||
git rev-parse --abbrev-ref HEAD # must be the release branch, not the prep branch
|
||||
git tag -a v{{version}} -m "Release v{{version}}"
|
||||
```
|
||||
|
||||
Tagging before the merge is the failure to avoid, in two shapes. With branch
|
||||
protection on, the direct push is rejected after the tag already exists
|
||||
locally. With a squash merge, the tag points at a commit that is not an
|
||||
ancestor of the release branch — and goreleaser packages `CHANGELOG.md` *from
|
||||
the tag* into every published archive, so the release would ship the
|
||||
pre-review notes.
|
||||
|
||||
Verify: `git tag -l | tail -5`
|
||||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "push-main"
|
||||
title = "Push to main"
|
||||
needs = ["create-tag"]
|
||||
description = """
|
||||
Push the release commit to origin.
|
||||
|
||||
```bash
|
||||
git push origin main
|
||||
```
|
||||
|
||||
If rejected, someone else pushed. Pull, rebase, try again.
|
||||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "push-tag"
|
||||
title = "Push release tag"
|
||||
needs = ["create-tag"]
|
||||
needs = ["push-main"]
|
||||
description = """
|
||||
Push the version tag to trigger CI release.
|
||||
|
||||
|
|
@ -590,7 +602,7 @@ git push origin v{{version}}
|
|||
|
||||
This triggers GitHub Actions to build artifacts and publish.
|
||||
|
||||
Phase 1 Complete: After this step, signal phase-complete:
|
||||
**Phase 1 Complete**: After this step, signal phase-complete:
|
||||
```bash
|
||||
gt done --phase-complete
|
||||
```
|
||||
|
|
@ -640,7 +652,7 @@ needs = ["await-ci"]
|
|||
description = """
|
||||
Check the GitHub releases page.
|
||||
|
||||
https://github.com/gastownhall/beads/releases/tag/v{{version}}
|
||||
https://github.com/steveyegge/beads/releases/tag/v{{version}}
|
||||
|
||||
Verify:
|
||||
- Release created
|
||||
|
|
@ -688,66 +700,6 @@ Should show {{version}}.
|
|||
Note: PyPI may have a small propagation delay (1-2 min).
|
||||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "verify-homebrew-core"
|
||||
title = "Verify Homebrew core formula"
|
||||
needs = ["await-ci"]
|
||||
description = """
|
||||
Confirm Homebrew core has the stable formula update.
|
||||
|
||||
Release candidates are not published to Homebrew. If `{{version}}` contains a
|
||||
hyphen, record that Homebrew intentionally remains on the latest stable release
|
||||
and skip the rest of this step.
|
||||
|
||||
Stable releases:
|
||||
|
||||
1. Check whether Homebrew already opened the canonical bump PR:
|
||||
```bash
|
||||
gh pr list \
|
||||
--repo Homebrew/homebrew-core \
|
||||
--search "beads {{version}} in:title" \
|
||||
--state all
|
||||
```
|
||||
|
||||
2. If a BrewTestBot or `brew bump-formula-pr` PR already exists, track that PR.
|
||||
Do not open a duplicate manual PR. Do not push to the PR branch before
|
||||
Homebrew's bottle commits are pushed.
|
||||
|
||||
3. If no PR exists, open it with Homebrew's bump tool:
|
||||
```bash
|
||||
brew bump-formula-pr \
|
||||
--url="https://github.com/gastownhall/beads/archive/refs/tags/v{{version}}.tar.gz" \
|
||||
beads
|
||||
```
|
||||
|
||||
This computes the source checksum and lets Homebrew/BrewTestBot manage the
|
||||
bottle block. Do not remove or hand-edit the bottle block.
|
||||
|
||||
4. If a manual PR is unavoidable, fill in Homebrew's current PR template before
|
||||
opening or editing the PR:
|
||||
```bash
|
||||
gh api repos/Homebrew/homebrew-core/contents/.github/PULL_REQUEST_TEMPLATE.md \
|
||||
-H 'Accept: application/vnd.github.raw'
|
||||
```
|
||||
|
||||
Do not leave the checklist/body blank. An incomplete or stale template causes
|
||||
Homebrew automation to close the PR.
|
||||
|
||||
5. Verify the merged formula on `Homebrew/homebrew-core@main`:
|
||||
```bash
|
||||
gh api '/repos/Homebrew/homebrew-core/contents/Formula/b/beads.rb?ref=main' \
|
||||
-H 'Accept: application/vnd.github.raw' | tee /tmp/homebrew-beads.rb
|
||||
|
||||
grep -F 'homepage "https://github.com/gastownhall/beads"' /tmp/homebrew-beads.rb
|
||||
grep -F 'url "https://github.com/gastownhall/beads/archive/refs/tags/v{{version}}.tar.gz"' /tmp/homebrew-beads.rb
|
||||
grep -F 'bottle do' /tmp/homebrew-beads.rb
|
||||
```
|
||||
|
||||
6. Record the merged Homebrew PR on the release tracker. If a duplicate manual
|
||||
PR was closed by Homebrew automation after the canonical PR merged, leave it
|
||||
closed and note which PR is canonical.
|
||||
"""
|
||||
|
||||
# =============================================================================
|
||||
# Phase 3: Installation (Fan-in)
|
||||
# =============================================================================
|
||||
|
|
@ -755,131 +707,51 @@ Stable releases:
|
|||
[[steps]]
|
||||
id = "local-install"
|
||||
title = "Update local installation"
|
||||
needs = ["verify-github", "verify-npm", "verify-pypi", "verify-homebrew-core"]
|
||||
needs = ["verify-github", "verify-npm", "verify-pypi"]
|
||||
description = """
|
||||
Update local bd to the new version.
|
||||
|
||||
Step 1: Install release binary
|
||||
|
||||
Option A - Homebrew:
|
||||
Option 1 - Homebrew:
|
||||
```bash
|
||||
brew upgrade beads
|
||||
brew upgrade bd
|
||||
```
|
||||
|
||||
Option B - Install script:
|
||||
Option 2 - Install script:
|
||||
```bash
|
||||
curl -fsSL https://raw.githubusercontent.com/gastownhall/beads/main/scripts/install.sh | bash
|
||||
curl -fsSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash
|
||||
```
|
||||
|
||||
Step 2: Check for dev builds (developers only)
|
||||
|
||||
If you build bd from source, you may have multiple `bd` binaries in your PATH:
|
||||
```bash
|
||||
which -a bd
|
||||
```
|
||||
|
||||
Common locations:
|
||||
- `~/.local/bin/bd` - release binary (installed above)
|
||||
- `~/go/bin/bd` - Go dev build
|
||||
- Project worktree builds
|
||||
|
||||
If you have a dev build that takes precedence, rebuild from source:
|
||||
```bash
|
||||
# From the beads source directory
|
||||
make install
|
||||
|
||||
# Or using go install directly
|
||||
go install -ldflags="-X main.Build=$(git rev-parse --short HEAD)" ./cmd/bd
|
||||
```
|
||||
|
||||
Verify ALL bd binaries are updated:
|
||||
```bash
|
||||
# Check which bd runs by default
|
||||
which bd && bd --version
|
||||
|
||||
# If you have go/bin/bd, verify it too
|
||||
test -f ~/go/bin/bd && ~/go/bin/bd --version
|
||||
```
|
||||
|
||||
All should show {{version}}.
|
||||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "cleanup-stale-dolt-orphans"
|
||||
title = "Clean up stale Dolt orphans"
|
||||
needs = ["local-install"]
|
||||
description = """
|
||||
Clean up orphaned local Dolt server processes left behind by older bd runs.
|
||||
The active canonical server, embedded mode, and external Dolt hosts are left alone.
|
||||
|
||||
```bash
|
||||
STATUS_JSON=$(bd dolt status --json 2>/dev/null) || {
|
||||
echo "Could not query Dolt status."
|
||||
bd dolt status
|
||||
exit 1
|
||||
}
|
||||
MODE=$(printf "%s\n" "$STATUS_JSON" | sed -n 's/.*"mode"[[:space:]]*:[[:space:]]*"\\([^"]*\\)".*/\\1/p' | head -1)
|
||||
case "$MODE" in
|
||||
embedded)
|
||||
echo "Embedded Dolt mode; no server restart needed."
|
||||
;;
|
||||
external)
|
||||
echo "External Dolt mode; no local orphan cleanup needed."
|
||||
;;
|
||||
"")
|
||||
if ! printf "%s\n" "$STATUS_JSON" | grep -Eq '"(running|data_dir)"[[:space:]]*:'; then
|
||||
echo "Dolt status JSON did not identify a mode or local server state."
|
||||
bd dolt status
|
||||
exit 1
|
||||
fi
|
||||
bd dolt killall
|
||||
;;
|
||||
*)
|
||||
echo "Unrecognized Dolt mode: $MODE"
|
||||
bd dolt status
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
```
|
||||
|
||||
This step only reaps orphaned local Dolt processes. It does not stop the
|
||||
canonical active server.
|
||||
|
||||
Verify:
|
||||
```bash
|
||||
bd dolt status
|
||||
bd --version
|
||||
```
|
||||
|
||||
Should show {{version}}.
|
||||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "generate-newsletter"
|
||||
title = "Generate release newsletter"
|
||||
needs = ["push-tag"]
|
||||
id = "restart-daemons"
|
||||
title = "Restart daemons"
|
||||
needs = ["local-install"]
|
||||
description = """
|
||||
Generate a narrative newsletter summarizing this release.
|
||||
|
||||
The newsletter generator aggregates changelog, commits, new commands, and
|
||||
breaking changes into a narrative format suitable for users.
|
||||
Restart bd daemons to pick up new version.
|
||||
|
||||
```bash
|
||||
# Generate newsletter for this release
|
||||
uv run scripts/generate-newsletter.py --to-release v{{version}}
|
||||
|
||||
# Or specify the range explicitly (e.g., from last release)
|
||||
PREV_TAG=$(git describe --tags --abbrev=0 v{{version}}^)
|
||||
uv run scripts/generate-newsletter.py --from-release $PREV_TAG --to-release v{{version}}
|
||||
bd daemons killall
|
||||
```
|
||||
|
||||
The script outputs to NEWSLETTER.md by default. Review and commit if desired.
|
||||
Daemons will auto-restart with new version on next bd command.
|
||||
|
||||
Note: This step can run in parallel with verification steps since it only
|
||||
needs the tag to exist, not the CI artifacts.
|
||||
Verify:
|
||||
```bash
|
||||
bd daemons list
|
||||
```
|
||||
"""
|
||||
|
||||
[[steps]]
|
||||
id = "release-complete"
|
||||
title = "Release complete"
|
||||
needs = ["cleanup-stale-dolt-orphans", "generate-newsletter"]
|
||||
needs = ["restart-daemons"]
|
||||
description = """
|
||||
Release v{{version}} is complete!
|
||||
|
||||
|
|
@ -889,11 +761,9 @@ Summary:
|
|||
- CI artifacts built (via gate)
|
||||
- npm and PyPI packages verified
|
||||
- Local installation updated
|
||||
- Dolt servers refreshed if applicable
|
||||
- Newsletter generated
|
||||
- Daemons restarted
|
||||
|
||||
Optional next steps:
|
||||
- Review and publish NEWSLETTER.md
|
||||
- Announce on social media
|
||||
- Update documentation site
|
||||
- Close related milestone
|
||||
|
|
|
|||
6988
.beads/issues.jsonl
Normal file
6988
.beads/issues.jsonl
Normal file
File diff suppressed because one or more lines are too long
836
.beads/issues.jsonl.new
Normal file
836
.beads/issues.jsonl.new
Normal file
File diff suppressed because one or more lines are too long
24
.buildflags
24
.buildflags
|
|
@ -1,24 +0,0 @@
|
|||
# Canonical build flags for beads. Source this in any script that invokes
|
||||
# `go` to get the project-wide build settings. Scripts that intentionally
|
||||
# exercise the ICU path (e.g. scripts/test-cgo.sh) do NOT source this.
|
||||
#
|
||||
# Rationale: go-mysql-server links ICU by default under cgo. beads never
|
||||
# uses SQL REGEXP, so we always build with -tags=gms_pure_go. See
|
||||
# engdocs/ICU-POLICY.md for the full policy.
|
||||
|
||||
# Embedded Dolt requires CGO; server mode and nocgo builds do not. Default
|
||||
# to 1 for the embedded-capable build paths that sourced this, but respect
|
||||
# a caller who explicitly set CGO_ENABLED=0 (e.g. a static/nocgo build).
|
||||
: "${CGO_ENABLED:=1}"
|
||||
export CGO_ENABLED
|
||||
|
||||
# Build tag that tells go-mysql-server to use Go's stdlib regex instead of
|
||||
# the ICU-backed go-icu-regex. Exported so callers can compose with extra
|
||||
# tags: `go test -tags=regression,$BEADS_BUILD_TAGS ...`
|
||||
export BEADS_BUILD_TAGS="gms_pure_go"
|
||||
|
||||
# Propagate the tag via GOFLAGS so every subsequent bare `go` invocation
|
||||
# picks it up automatically. Idempotent: re-sourcing is a no-op.
|
||||
if [[ "${GOFLAGS:-}" != *gms_pure_go* ]]; then
|
||||
export GOFLAGS="${GOFLAGS:+$GOFLAGS }-tags=${BEADS_BUILD_TAGS}"
|
||||
fi
|
||||
|
|
@ -7,9 +7,9 @@
|
|||
"plugins": [
|
||||
{
|
||||
"name": "beads",
|
||||
"source": "./plugins/beads",
|
||||
"source": "./claude-plugin",
|
||||
"description": "AI-supervised issue tracker for coding workflows",
|
||||
"version": "1.3.0"
|
||||
"version": "0.48.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
21
.claude/commands/handoff.md
Normal file
21
.claude/commands/handoff.md
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
description: Hand off to fresh session, work continues from hook
|
||||
allowed-tools: Bash(gt mail send:*),Bash(gt handoff:*)
|
||||
argument-hint: [message]
|
||||
---
|
||||
|
||||
Hand off to a fresh session.
|
||||
|
||||
User's handoff message (if any): $ARGUMENTS
|
||||
|
||||
Execute these steps in order:
|
||||
|
||||
1. If user provided a message, send handoff mail to yourself first.
|
||||
Construct your mail address from your identity (e.g., beads/crew/emma for crew).
|
||||
Example: `gt mail send beads/crew/emma -s "HANDOFF: Session cycling" -m "USER_MESSAGE_HERE"`
|
||||
|
||||
2. Run the handoff command (this will respawn your session with a fresh Claude):
|
||||
`gt handoff`
|
||||
|
||||
Note: The new session will auto-prime via the SessionStart hook and find your handoff mail.
|
||||
End watch. A new session takes over, picking up any molecule on the hook.
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Block commands that burn through GitHub API rate limits or violate workflow.
|
||||
# The GitHub API allows 5000 requests/hour. `gh run watch` polls every 3
|
||||
# seconds (1200 req/hr), and has repeatedly exhausted the quota during
|
||||
# releases, blocking all crew members for up to an hour.
|
||||
|
||||
COMMAND=$(jq -r '.tool_input.command' < /dev/stdin)
|
||||
|
||||
if echo "$COMMAND" | grep -qE 'gh run watch|gh run list.*--watch'; then
|
||||
jq -n '{
|
||||
hookSpecificOutput: {
|
||||
hookEventName: "PreToolUse",
|
||||
permissionDecision: "deny",
|
||||
permissionDecisionReason: "BLOCKED: gh run watch polls every 3s and burns through the 5000/hr GitHub API rate limit. Use `gh run view <run-id>` for a single status check, or `sleep 600 && gh run view <id>` to wait and check once."
|
||||
}
|
||||
}'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Block cp/mv/rm without -f flag to prevent interactive prompt hangs.
|
||||
#
|
||||
# Problem: macOS shell profiles often alias cp/mv/rm with -i (interactive),
|
||||
# causing AI agents to hang indefinitely waiting for y/n input they can't
|
||||
# provide. Observed in multiple polecats during swarm operations.
|
||||
#
|
||||
# Solution: Block these commands unless -f flag or alias-bypass is present.
|
||||
# The agent can easily retry with -f added.
|
||||
|
||||
COMMAND=$(jq -r '.tool_input.command' < /dev/stdin)
|
||||
|
||||
for cmd in cp mv rm; do
|
||||
# Match: cmd at word boundary, followed by space and arguments
|
||||
# Skip if: -f flag present, or using 'command' builtin / absolute path / backslash
|
||||
if echo "$COMMAND" | grep -qE "(^|[;&|] *)${cmd} " && \
|
||||
! echo "$COMMAND" | grep -qE "(^|[;&|] *)${cmd} +-[a-eg-zA-Z]*f" && \
|
||||
! echo "$COMMAND" | grep -qE "(command +${cmd}|/bin/${cmd}|/usr/bin/${cmd})" && \
|
||||
! echo "$COMMAND" | grep -qE "(^|[;&|] *)\\\\${cmd} "; then
|
||||
jq -n --arg cmd "$cmd" '{
|
||||
hookSpecificOutput: {
|
||||
hookEventName: "PreToolUse",
|
||||
permissionDecision: "deny",
|
||||
permissionDecisionReason: ("BLOCKED: `" + $cmd + "` without `-f` flag may hang on interactive prompts (macOS often aliases `" + $cmd + "` to `" + $cmd + " -i`). Use `" + $cmd + " -f ...` instead, or prefix with `command " + $cmd + "` to bypass aliases.")
|
||||
}
|
||||
}'
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
{
|
||||
"hooks": {
|
||||
"PreToolUse": [
|
||||
{
|
||||
"matcher": "Bash",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-gh-watch.sh"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-interactive-cmds.sh"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,223 +0,0 @@
|
|||
---
|
||||
name: beads-docs
|
||||
description: >-
|
||||
Project conventions for writing, editing, restructuring, or reviewing the
|
||||
beads user documentation — the Mintlify site under docs/. Use this whenever
|
||||
you touch anything in docs/ (pages, concept docs, reference, integration
|
||||
guides, recovery runbooks, diagrams, docs.json navigation) or write/edit
|
||||
prose about beads, even when the request is just "fix the docs", "write a
|
||||
docs page", "the docs are wrong/confusing", "rename X across the docs", or
|
||||
an edit to a file under docs/. It defines the canonical concept model
|
||||
(bead → dependencies → ready work; formula → proto → molecule/wisp; gates;
|
||||
Dolt sync and federation), required terminology, the prose/emphasis/diagram
|
||||
conventions, the rule that generated docs are edited at their source, and
|
||||
the gates to run before docs work is done.
|
||||
---
|
||||
|
||||
# Writing beads docs
|
||||
|
||||
This is the house style for `docs/` — the beads user documentation, published
|
||||
as a Mintlify site. The goal is docs that motivate before they jargon, say the
|
||||
same thing the same way everywhere, show concepts as pictures and snippets
|
||||
instead of walls of prose, and never drift from the code. Apply it to any page
|
||||
you create, edit, or review.
|
||||
|
||||
The audience of `docs/` is a **user** of beads — a human or agent installing
|
||||
`bd`, tracking work, and syncing it. Contributor-facing material lives in
|
||||
`engdocs/` and `AGENTS.md` and follows different rules (it may describe the
|
||||
implementation literally). When this skill says "the docs," it means `docs/`.
|
||||
|
||||
## 1. The canonical model
|
||||
|
||||
Beads is a dependency-aware issue graph with a workflow layer on top. Teach it
|
||||
consistently and link to the canonical concept page —
|
||||
**`docs/core-concepts/index.md`** — rather than re-explaining it.
|
||||
|
||||
| Concept | Role | Key idea |
|
||||
|---|---|---|
|
||||
| **bead** (issue) | the unit of work | one tracked item with a hash ID (`bd-a1b2`), type, status, priority; "bead" and "issue" name the same thing |
|
||||
| **dependency** | ordering | `blocks` edges hide a bead from agents until its blockers close; `parent-child`, `related`, `discovered-from` organize without blocking |
|
||||
| **ready work** | what `bd ready` computes | open beads with no open blockers, excluding in_progress, blocked, deferred, and hooked — the claimable frontier |
|
||||
| **formula** | workflow source | a TOML/JSON file defining a DAG of steps; `bd cook` compiles it into a proto |
|
||||
| **proto** | workflow template | a template epic (label `template`) with `{{variables}}`; not live work |
|
||||
| **molecule** | instantiated workflow | real beads poured from a proto (`bd mol pour`); persistent |
|
||||
| **wisp** | ephemeral molecule | same instantiation, transient lifecycle (`bd mol wisp`); purged by `bd purge` |
|
||||
| **gate** | async wait | blocks a workflow step until closed — by a human, a timer, a GitHub run/PR, or a cross-rig bead |
|
||||
| **sync** | cross-machine movement | Dolt push/pull over `refs/dolt/data` on the git remote; `.beads/issues.jsonl` is a passive export, never the database |
|
||||
| **federation** | cross-repo sync | peer-to-peer sharing of beads across repos/organizations |
|
||||
|
||||
The pipeline worth internalizing: **formula → (cook) → proto → (pour) →
|
||||
molecule** or **→ (wisp) → wisp**. Gates pause molecule steps; `bd ready`
|
||||
surfaces the claimable steps; sync moves the whole graph between machines.
|
||||
|
||||
Storage facts that pages keep getting wrong: embedded mode (the default
|
||||
`bd init`) stores data at `.beads/embeddeddolt/`; server mode
|
||||
(`bd init --server`) uses `.beads/dolt/`. Never present `.beads/dolt/` as the
|
||||
general data path.
|
||||
|
||||
**Cross-project vocabulary (beads ↔ Gas City).** Gas City (the sibling
|
||||
project) shares the words molecule, formula, wisp, and gate, but the two doc
|
||||
corpora use them differently: Gas City's docs treat molecule/wisp as v1
|
||||
implementation detail (never a user concept), and a Gas City formula is an
|
||||
orchestration method the orchestrator runs across agents. In beads,
|
||||
molecule/wisp/proto ARE user concepts, and a formula is the TOML source you
|
||||
cook into a proto. Never import Gas City's definitions into beads pages (or
|
||||
vice versa); when a page must bridge the two projects, say explicitly which
|
||||
project's sense is meant.
|
||||
|
||||
## 2. Required terminology
|
||||
|
||||
Use the left column; never the right (except as noted). The full
|
||||
prose-vs-literal rename discipline is in
|
||||
[references/terminology.md](references/terminology.md).
|
||||
|
||||
| Use this | Not this | Notes |
|
||||
|---|---|---|
|
||||
| **bead** / **issue** | "task", "ticket", "TODO item" as the unit's name | Both terms are correct and interchangeable; lead with *bead* when teaching identity, use *issue* when mirroring CLI output or flags (`bd create`, "issue types"). "task" is one issue *type*, never the generic unit. |
|
||||
| **ready work** | "unblocked queue", "available tasks", "the ready set" as a formal term | Say what `bd ready` returns: open beads with no open blockers. |
|
||||
| **proto** | "template" as a noun for the concept | `template` stays only as the literal label name protos carry. |
|
||||
| **molecule** | "mol" in prose | `mol` is the command literal (`bd mol pour`); the concept is a molecule. |
|
||||
| **formula** | conflating formula with molecule/proto | The formula is the *file*; cooking makes a proto; pouring makes live work. |
|
||||
| **gate** | "barrier", "checkpoint", "lock" | Gates are async wait conditions with types (human, timer, gh:run, gh:pr, bead). |
|
||||
| **sync** = Dolt push/pull | export/import as a sync workflow | `bd dolt push` / `bd dolt pull` over `refs/dolt/data`. `.beads/issues.jsonl` is a passive export for viewers and interchange. |
|
||||
| **embedded mode** / **server mode** | "local mode", "daemon mode" for storage | Embedded is the default; data at `.beads/embeddeddolt/`. Server mode connects to `dolt sql-server`; data at `.beads/dolt/`. |
|
||||
| **federation** | "multi-repo sync" as a distinct feature name | Federation is the peer-to-peer cross-repo sharing feature. |
|
||||
| **hash ID** | "random ID", "UUID" | IDs like `bd-a1b2` are content-derived hashes sized adaptively to prevent collisions. |
|
||||
|
||||
## 3. Content stance
|
||||
|
||||
- **Motivate before you mechanize.** Lead a page with the problem it solves,
|
||||
then the solution, then the mechanics. Never open on vocabulary.
|
||||
- **Docs are not the project's history.** No `internal/*` package paths, no
|
||||
"this was removed in vX", no "(v0.20.1+)" gating on user pages — beads is a
|
||||
1.x product and pre-1.0 archaeology belongs in `engdocs/` or the CHANGELOG.
|
||||
- **Lead with the value.** Beads' value is persistent, dependency-aware memory
|
||||
for coding agents — agents that survive context loss because the work graph
|
||||
outlives the session. The comparison framing (vs GitHub Issues, Jira,
|
||||
markdown TODO lists) is the best newcomer conversion tool; keep it early
|
||||
where it exists.
|
||||
- **One concrete example beats three abstract sentences.** Where you assert a
|
||||
capability, show a `bd` invocation and what it prints.
|
||||
|
||||
## 4. Information architecture
|
||||
|
||||
Navigation lives in `docs/docs.json`: Getting Started, Core Concepts,
|
||||
Architecture, Workflows, Recovery, Multi-Agent, Integrations, Community, and
|
||||
Reference — with the generated CLI Reference nested inside Reference as a
|
||||
collapsed sub-group.
|
||||
|
||||
- **Every section has an index/Overview page** that introduces the section in
|
||||
a sentence or two, then lists every child page with a one-line accurate
|
||||
summary and link.
|
||||
- One page, one purpose. A page that tries to teach *and* specify does
|
||||
neither — split it and cross-link.
|
||||
- Concept material is unified on `core-concepts/index`; don't re-derive the
|
||||
model on other pages — link to it.
|
||||
- The repository map belongs in the README, not in `docs/`.
|
||||
|
||||
## 5. Prose doctrine — cut words, sharpen points
|
||||
|
||||
Most bloat is information stored in the wrong medium. Move it to a cheaper
|
||||
carrier, then delete what isn't pulling weight. Every page must **stand
|
||||
alone** — a reader landing cold needs a one-line setup, not a previous page.
|
||||
|
||||
**Convert** (move load off prose):
|
||||
- A relationship or sequence → a **diagram** (mermaid renders natively;
|
||||
richer diagrams follow the Excalidraw pipeline — see §7).
|
||||
- Parallel options/fields/comparisons → a **table**.
|
||||
- "you run X, which does Y" narration → an **annotated CLI snippet** (show
|
||||
the command and its output, comment the interesting lines).
|
||||
- Edge cases and deep mechanics → an `<Accordion>`, or a reference page.
|
||||
Keep the 80% case on the page.
|
||||
|
||||
**Delete** (the load was fake): throat-clearing openers ("In this section
|
||||
we'll…"), hedge chains ("generally / typically / in most cases"),
|
||||
restatement, narrating an artifact a snippet already shows, and adjectives
|
||||
standing in for evidence.
|
||||
|
||||
When you run a deliberate simplification pass, follow
|
||||
[references/simplification.md](references/simplification.md) — the per-page
|
||||
loop and the two guardrails that keep a trim honest: a **loss-check** (never
|
||||
drop a fact that lives nowhere else) and a **fact-check** (trimmed prose must
|
||||
not drift from the code).
|
||||
|
||||
## 6. Emphasis and formatting
|
||||
|
||||
- **Bold** *names a term*, on first mention only. *Italic* marks a property
|
||||
or contrast. ~1–2 marks per paragraph; never re-emphasize a term already
|
||||
introduced; never give one phrase both treatments.
|
||||
- No body `# H1` — the frontmatter `title` is the H1. Use `##`/`###`.
|
||||
- Links are root-relative and extensionless (`/getting-started/quickstart`).
|
||||
Links out of the site (engdocs/, repo files) use full GitHub URLs.
|
||||
- Mintlify parses `.md` as MDX: no HTML comments (`{/* … */}` instead), and
|
||||
angle-bracket placeholders like `<id>` must stay inside backticks or code
|
||||
fences.
|
||||
- Mintlify components (`<Note>`, `<Tip>`, `<Warning>`, `<Accordion>`)
|
||||
sparingly — they lose force with repetition.
|
||||
|
||||
## 7. Diagrams
|
||||
|
||||
Mermaid fences render natively — prefer them for graphs and flows. For richer
|
||||
diagrams use the Excalidraw pipeline: author the `.excalidraw` source under
|
||||
`docs/diagrams/excalidraw/`, render with `make diagrams-excalidraw` (source
|
||||
and rendered `.svg` are both committed), embed as
|
||||
`/diagrams/excalidraw-rendered/<name>.svg` with descriptive alt text, and
|
||||
keep labels short (a two-line "Name / role" beats a sentence crammed in a
|
||||
box). Two non-negotiables:
|
||||
|
||||
- **Rasterize and look at every rendered diagram** — text overflow and layout
|
||||
problems are invisible in a text diff.
|
||||
- **Diagrams and images cannot be reviewed in a diff.** Render them and get
|
||||
the maintainer's approval before committing.
|
||||
|
||||
## 8. Generated content is edited at its source
|
||||
|
||||
Never hand-edit a generated file. The generated surfaces are:
|
||||
|
||||
- `docs/cli-reference/*.md` and the CLI Reference pages array inside
|
||||
`docs/docs.json` — bd emits vendor-neutral pages (`bd help --docs-root`,
|
||||
from the Cobra command strings in `cmd/bd/*.go`) into an uncommitted
|
||||
staging tree, and `tools/docsmint` post-processes them into the committed
|
||||
Mintlify form. bd itself never emits Mintlify (or any site-generator)
|
||||
specifics; that lives in docsmint.
|
||||
- `docs/CLI_REFERENCE.md` — the single-file reference, emitted directly by
|
||||
`bd help --docs-root`.
|
||||
|
||||
To change wording in any of them, edit the Go source (`Short:`, `Long:`,
|
||||
`Example:` strings) and run `./scripts/generate-cli-docs.sh` (which runs both
|
||||
stages). To change the Mintlify page form itself (comment markers, link
|
||||
style, nav), edit `tools/docsmint` and its tests. The drift gates
|
||||
(`generate-cli-docs.sh --check`, `scripts/check-cli-docs-drift.sh` in PR CI,
|
||||
and the docs-autofix bot) fail or auto-fix any hand edit.
|
||||
|
||||
**The docs describe the pinned release, not main.** `docs/cli-docs.pin`
|
||||
names the release tag the whole docs corpus targets; the pipeline builds bd
|
||||
from that tag and validates against it, so a Go-source edit on main shows up
|
||||
in the committed docs only after the pin is bumped (at release time,
|
||||
followed by a regeneration). Hand-written pages follow the same policy:
|
||||
document what the pinned release does, never main-only features. See
|
||||
`engdocs/decisions/2026-07-17-docs-release-pin.md`.
|
||||
|
||||
## 9. Verify before you call it done
|
||||
|
||||
Run the gates in [references/verification.md](references/verification.md).
|
||||
The short list: `bazel test //test/docsync:docsync_test --config=ci`
|
||||
(nav↔file sync + link conventions),
|
||||
`./scripts/generate-cli-docs.sh --check` (generated docs fresh),
|
||||
`./scripts/check-doc-freshness.sh` (Last reviewed markers), and a live
|
||||
preview with `make docs-dev` (or `./mint.sh dev`) at `localhost:3000`.
|
||||
|
||||
When you **move or remove a page**: add a redirect to the `redirects` array
|
||||
in `docs/docs.json`, rewrite inbound links repo-wide (README, engdocs/,
|
||||
examples/, npm-package/, plugin resources — grep, don't guess), and check
|
||||
whether `bd` prints the old path (if so, fix the Go source and regenerate —
|
||||
never a pointer stub; decision 6 covers old routes with redirects).
|
||||
|
||||
## 10. Review and commit discipline
|
||||
|
||||
- **Author → the maintainer reviews → commit on explicit approval.** This
|
||||
matters most for diagrams and images, which can't be reviewed in a text
|
||||
diff.
|
||||
- Group commits by audience: user docs (`docs/`) separate from contributor
|
||||
docs (`engdocs/`, `AGENTS.md`) separate from generator/Go changes.
|
||||
- Track docs work as bd issues per `AGENTS.md`.
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
# Running a simplification pass
|
||||
|
||||
Read this when you're trimming a page or a whole section — "simplify the
|
||||
reference", "this page is a wall of text", "cut this down". SKILL.md §5–§7
|
||||
define the *moves* (convert to a cheaper carrier, delete dead load, emphasis,
|
||||
diagrams). This file is the *process*: how to run those moves across real
|
||||
pages without dropping facts or drifting from the code.
|
||||
|
||||
## The goal
|
||||
|
||||
Remove **redundancy and unnecessary words**, and make the point *sharper*,
|
||||
not thinner. **Word count is the output, not the target** — never trim toward
|
||||
a number. The win is almost never deleting information; it's moving it to a
|
||||
cheaper carrier (a table, an accordion, a diagram, or a link to the page that
|
||||
already owns it) and deleting what was only restatement.
|
||||
|
||||
How much a page sheds depends entirely on how much *genuine redundancy* it
|
||||
carries:
|
||||
|
||||
- A page that **restates what a sibling page owns** sheds a lot — replace the
|
||||
restatement with one sentence plus a link to the owner (usually
|
||||
`/core-concepts/index` for model material, `/cli-reference/<cmd>` for
|
||||
command detail).
|
||||
- A page whose length is **earned teaching** (worked examples plus the
|
||||
behavior they illustrate) barely moves — forcing it toward a number guts
|
||||
the teaching.
|
||||
- A page that is **already lean** gets left alone entirely.
|
||||
|
||||
Accordions and tables fold content for scannability without deleting words —
|
||||
don't measure that work by the word delta.
|
||||
|
||||
## The per-page loop
|
||||
|
||||
1. **Measure.** `wc -w <page>`; note the count.
|
||||
2. **Find opportunities, by carrier:** dedup-by-link, prose→table,
|
||||
prose→accordion, add/reuse a diagram, delete (throat-clearing, hedges,
|
||||
restatement).
|
||||
3. **Apply** the moves in the page's own voice. Never reflow prose you are
|
||||
*not* simplifying — it buries the real change in the diff.
|
||||
4. **Loss-check** (below).
|
||||
5. **Fact-check** (below).
|
||||
6. **Gates:** `bazel test //test/docsync:docsync_test --config=ci`, every
|
||||
fence parses, no body H1, no HTML comments (MDX), preview with
|
||||
`make docs-dev`.
|
||||
7. **Preview, then commit on approval** — one page or section per batch, so
|
||||
the reviewer can steer before a cut compounds across the section.
|
||||
|
||||
## Loss-check: simplification must not lose facts
|
||||
|
||||
Trimming is where real details quietly disappear. After a pass, diff the page
|
||||
against its pre-trim version and walk the removed lines:
|
||||
|
||||
> For each removed block: is it an important **fact, command, flag, config
|
||||
> key, caveat, behavior, or worked example** — and is it **preserved nowhere
|
||||
> else** (`grep` across `docs/` to check for relocation)?
|
||||
|
||||
Separate removals honestly:
|
||||
|
||||
- **Intentional cuts** (leave them gone): terminology migration,
|
||||
hedge/restatement deletion, content relocated to a better carrier (with a
|
||||
redirect), deliberately-retired stale claims (pre-1.0 gating, removed
|
||||
commands).
|
||||
- **Genuine losses** (restore): a real detail dropped with no home elsewhere.
|
||||
|
||||
Restore a genuine loss as a **sharpened clause, not restored bulk** — fold
|
||||
the missing *why* back into a sentence you kept rather than re-adding the
|
||||
paragraph you cut.
|
||||
|
||||
## Fact-check: simplified prose drifts from code
|
||||
|
||||
Authoring and trimming both introduce drift — a stale version number, a
|
||||
renamed flag surviving in prose, a rewritten sentence overstating the
|
||||
implementation. Before pushing, verify every **checkable claim** on the
|
||||
touched pages against the current code: CLI commands/subcommands/flags
|
||||
(cheapest check: the generated `docs/cli-reference/` pages, which are correct
|
||||
by construction), config keys and defaults (`internal/configfile/`,
|
||||
`cmd/bd/config.go`), environment variables, file and directory paths
|
||||
(embedded mode data lives at `.beads/embeddeddolt/`, server mode at
|
||||
`.beads/dolt/`), issue types and dependency types, and numeric defaults.
|
||||
|
||||
Verify **adversarially**: try to prove each claim *false* against a
|
||||
`file:line`, defaulting to "unverified" rather than "fine". In practice a
|
||||
verification pass catches several real errors per rewrite. Generated
|
||||
reference pages are exempt — they are correct by regeneration, and
|
||||
fact-checking them against their own source is circular.
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
# Renaming a concept across the docs
|
||||
|
||||
When the project's word for something changes, the rule is: **rename the
|
||||
concept in prose; preserve every literal that reflects the actual program.**
|
||||
The code and its output are the source of truth — if the docs rename a string
|
||||
the binary still prints, the docs now lie.
|
||||
|
||||
## The discipline
|
||||
|
||||
1. **Survey first.** Count occurrences in `docs/`, `engdocs/`, `README.md`,
|
||||
every `AGENTS.md` (root and nested), and `*.go`. Read enough to tell
|
||||
*prose* (the concept) from *literals*.
|
||||
2. **Rename prose only**, with judgment per occurrence — fix articles and
|
||||
grammar so it reads naturally.
|
||||
3. **Preserve literals:**
|
||||
- Real program output inside a code fence. Verify against `cmd/bd/` and
|
||||
`internal/` source; if the binary prints it, the doc must match.
|
||||
- Command and subcommand names (`bd mol`, `bd dep`), flags, JSON field
|
||||
names, config keys (`.beads/config.yaml`), label names (a proto's
|
||||
`template` label), issue types, file paths, and any backticked
|
||||
identifier.
|
||||
- A *different* thing with the same word (a "task" issue type vs a task in
|
||||
prose; Dolt's own "branch" vs a git branch).
|
||||
- **Generated files** (`docs/cli-reference/*`, `docs/CLI_REFERENCE.md`,
|
||||
the CLI pages array in `docs/docs.json`, `website/docs/cli-reference/`):
|
||||
never hand-edit. If the term must change there, change the Cobra strings
|
||||
in `cmd/bd/*.go` and run `./scripts/generate-cli-docs.sh`.
|
||||
4. **Don't touch the code or `engdocs/` implementation names** as part of a
|
||||
docs rename unless explicitly asked. Renaming the binary's output strings
|
||||
is a separate Go PR (with regenerated CLI docs), worth flagging as a
|
||||
follow-up so output and docs align.
|
||||
5. **Watch for collateral words.** A word-boundary match for `gate` must not
|
||||
touch "delegate" or "aggregate"; a `mol` rename must not mangle
|
||||
"molecule".
|
||||
6. **Verify after:** every remaining occurrence in `docs/` (outside generated
|
||||
files) should be a justified literal — audit them explicitly, classify
|
||||
each as "literal (correct)" or "missed prose (fix)".
|
||||
|
||||
## Settled literal notes (as of the Mintlify port)
|
||||
|
||||
- `mol` — command literal only (`bd mol pour`, `bd ready --mol`); the concept
|
||||
in prose is always **molecule**.
|
||||
- `template` — the label literal protos carry; the concept is **proto**.
|
||||
- `issue` vs `bead` — both are sanctioned; CLI output and flags say issue, so
|
||||
prose mirroring the CLI keeps issue. Don't "fix" one into the other
|
||||
mechanically.
|
||||
- `.beads/issues.jsonl` — always described as a passive export. Never call it
|
||||
the database, the sync protocol, or a backup.
|
||||
- Paths `bd` prints (`docs/RECOVERY.md`, `docs/SETUP.md`, …) — never
|
||||
recreate pointer stubs at old paths; moved pages are covered by the
|
||||
`redirects` array in `docs/docs.json` (decision 6 of
|
||||
`engdocs/decisions/2026-07-10-mintlify-docs-overhaul.md`). If bd prints an
|
||||
old path, fix the Go source so it prints the new one and regenerate.
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
# Verification gates
|
||||
|
||||
Run these before considering docs work complete. Ordered cheapest-first.
|
||||
|
||||
## Durable repo gates (committed — always available)
|
||||
|
||||
```bash
|
||||
# 1. Docs sync: docs.json nav <-> file consistency, link conventions
|
||||
# (root-relative extensionless in docs/, exact paths in engdocs/ and
|
||||
# curated root files), orphan detection (only CLI_REFERENCE.md is exempt).
|
||||
bazel test //test/docsync:docsync_test --config=ci
|
||||
|
||||
# 2. Generated CLI docs freshness: regenerates from the live command tree
|
||||
# and diffs docs/CLI_REFERENCE.md, docs/cli-reference/, and the CLI
|
||||
# pages array in docs/docs.json (bd emits generic pages to staging;
|
||||
# tools/docsmint produces the committed Mintlify form).
|
||||
./scripts/generate-cli-docs.sh --check
|
||||
# CI's blame-scoped variant (only fails PRs for drift they introduced):
|
||||
./scripts/check-cli-docs-drift.sh
|
||||
|
||||
# 3. Doc flags + freshness markers: stale flag/command references and the
|
||||
# `Last reviewed:` / `Freshness source:` markers on reference docs.
|
||||
# (make check-docs runs 1 + 3 together.)
|
||||
./scripts/check-doc-flags.sh ./bd
|
||||
./scripts/check-doc-freshness.sh
|
||||
|
||||
# 4. Live preview while editing.
|
||||
make docs-dev # or: ./mint.sh dev -> http://localhost:3000
|
||||
|
||||
# 5. Broken links the way CI checks them (baseline-aware on PRs via
|
||||
# .github/workflows/docs-mintlify.yml):
|
||||
./mint.sh broken-links
|
||||
```
|
||||
|
||||
## Principles the gates don't fully cover
|
||||
|
||||
- **Every code fence must be real.** A `bash` fence should show a command the
|
||||
current `bd` accepts (check the generated CLI reference); TOML fences for
|
||||
formulas must parse.
|
||||
- **MDX validity**: no HTML comments (`{/* … */}` instead), no bare
|
||||
angle-bracket placeholders outside backticks, balanced Mintlify components.
|
||||
- **No body `# H1`** — frontmatter `title` is the H1. (Beware false
|
||||
positives: `#` comments inside code fences are not H1s.)
|
||||
- **Freshness markers**: pages carrying `Last reviewed:` / `Freshness
|
||||
source:` lines (configuration, ide-setup, azure-devops, json-schema,
|
||||
init-safety runbooks) must keep them intact and current when edited —
|
||||
`scripts/check-doc-freshness.sh` enforces format, age, and that the named
|
||||
source paths exist.
|
||||
|
||||
## Moving or removing a page
|
||||
|
||||
Removing or merging a page breaks inbound links and external bookmarks. Do
|
||||
all of:
|
||||
|
||||
1. **Redirect** — add an entry to the `redirects` array in `docs/docs.json`
|
||||
from the old route to the new one.
|
||||
2. **Rewrite inbound links** — grep the whole repo, not just `docs/`:
|
||||
README.md, every AGENTS.md (root and nested), engdocs/, examples/,
|
||||
npm-package/, plugins/, integrations/, scripts, and Go comments.
|
||||
3. **Check bd's printed output** — if `bd` prints the old path (grep `cmd/`
|
||||
and `internal/templates/` for it), fix the Go source to print the new
|
||||
path and regenerate the CLI docs. Do **not** create a pointer stub at the
|
||||
old path — decision 6 (no pointer stubs; Mintlify redirects) accepts that
|
||||
old GitHub links printed by already-released binaries 404.
|
||||
4. **Fix anchor text** — if a link's label named the old page, update the
|
||||
label too, and dedupe links that now collapse to the same target.
|
||||
|
||||
## Review rule for images
|
||||
|
||||
Diagrams and images cannot be reviewed in a text diff. Render them (rasterize
|
||||
SVGs), look at them, and get the maintainer's approval before committing.
|
||||
71
.claude/skills/handoff/SKILL.md
Normal file
71
.claude/skills/handoff/SKILL.md
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
---
|
||||
name: handoff
|
||||
description: >
|
||||
Hand off to a fresh Claude session. Use when context is full, you've finished
|
||||
a logical chunk of work, or need a fresh perspective. Work continues from hook.
|
||||
allowed-tools: "Bash(gt handoff:*),Bash(gt mail send:*)"
|
||||
version: "1.0.0"
|
||||
author: "Gas Town"
|
||||
---
|
||||
|
||||
# Handoff - Session Cycling for Gas Town Agents
|
||||
|
||||
Hand off your current session to a fresh Claude instance while preserving work context.
|
||||
|
||||
## When to Use
|
||||
|
||||
- Context getting full (approaching token limit)
|
||||
- Finished a logical chunk of work
|
||||
- Need a fresh perspective on a problem
|
||||
- Human requests session cycling
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
/handoff [optional message]
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
1. If you provide a message, it's sent as handoff mail to yourself
|
||||
2. `gt handoff` respawns your session with a fresh Claude
|
||||
3. New session auto-primes via SessionStart hook
|
||||
4. Work continues from your hook (pinned molecule persists)
|
||||
|
||||
## Examples
|
||||
|
||||
```bash
|
||||
# Simple handoff (molecule persists, fresh context)
|
||||
/handoff
|
||||
|
||||
# Handoff with context notes
|
||||
/handoff "Found the bug in token refresh - check line 145 in auth.go first"
|
||||
```
|
||||
|
||||
## What Persists
|
||||
|
||||
- **Hooked molecule**: Your work assignment stays on your hook
|
||||
- **Beads state**: All issues, dependencies, progress
|
||||
- **Git state**: Commits, branches, staged changes
|
||||
|
||||
## What Resets
|
||||
|
||||
- **Conversation context**: Fresh Claude instance
|
||||
- **TodoWrite items**: Ephemeral, session-scoped
|
||||
- **In-memory state**: Any uncommitted analysis
|
||||
|
||||
## Implementation
|
||||
|
||||
When invoked, execute:
|
||||
|
||||
1. If user provided a message, send handoff mail:
|
||||
```bash
|
||||
gt mail send <your-address> -s "HANDOFF: Session cycling" -m "<message>"
|
||||
```
|
||||
|
||||
2. Run the handoff command:
|
||||
```bash
|
||||
gt handoff
|
||||
```
|
||||
|
||||
The new session will find your handoff mail and hooked work automatically.
|
||||
103
.claude/test-strategy.md
Normal file
103
.claude/test-strategy.md
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
# Test Running Strategy for Claude Code
|
||||
|
||||
## Critical Rules
|
||||
|
||||
1. **ALWAYS use `./scripts/test.sh` instead of `go test` directly**
|
||||
- It automatically skips broken tests from `.test-skip`
|
||||
- Uses appropriate timeouts (3m default)
|
||||
- Consistent with human developers and CI/CD
|
||||
|
||||
2. **Use `-run` to target specific tests when developing features**
|
||||
```bash
|
||||
# Good: When working on feature X
|
||||
./scripts/test.sh -run TestFeatureX ./cmd/bd/...
|
||||
|
||||
# Avoid: Running full suite unnecessarily
|
||||
./scripts/test.sh ./...
|
||||
```
|
||||
|
||||
3. **Understand the bottleneck: COMPILATION not EXECUTION**
|
||||
- 180s compilation time vs 3.8s actual test execution (cmd/bd)
|
||||
- Running subset of tests doesn't save much time (still recompiles)
|
||||
- But use `-run` anyway to avoid seeing unrelated failures
|
||||
|
||||
## Common Commands
|
||||
|
||||
```bash
|
||||
# Full test suite (what 'make test' runs)
|
||||
./scripts/test.sh
|
||||
|
||||
# Test specific package
|
||||
./scripts/test.sh ./cmd/bd/...
|
||||
./scripts/test.sh ./internal/storage/sqlite/...
|
||||
|
||||
# Test specific feature
|
||||
./scripts/test.sh -run TestCreate ./cmd/bd/...
|
||||
./scripts/test.sh -run TestImport
|
||||
|
||||
# Verbose output (when debugging)
|
||||
./scripts/test.sh -v -run TestSpecificTest
|
||||
```
|
||||
|
||||
## When Tests Fail
|
||||
|
||||
1. **Check if it's a known broken test:**
|
||||
```bash
|
||||
cat .test-skip
|
||||
```
|
||||
|
||||
2. **If it's new, investigate:**
|
||||
- Read the test failure message
|
||||
- Run with `-v` for more detail
|
||||
- Check if recent code changes broke it
|
||||
|
||||
3. **If unfixable now:**
|
||||
- File GitHub issue with details
|
||||
- Add to `.test-skip` with issue reference
|
||||
- Document in commit message
|
||||
|
||||
## Package Size Context
|
||||
|
||||
The `cmd/bd` package is LARGE:
|
||||
- 41,696 lines of code
|
||||
- 205 files (82 test files)
|
||||
- 313 individual tests
|
||||
- Compilation takes ~180 seconds
|
||||
|
||||
This is why:
|
||||
- Compilation is slow
|
||||
- Test script uses 3-minute timeout
|
||||
- Targeting specific tests is important
|
||||
|
||||
## Environment Variables
|
||||
|
||||
Use these when needed:
|
||||
|
||||
```bash
|
||||
# Custom timeout
|
||||
TEST_TIMEOUT=5m ./scripts/test.sh
|
||||
|
||||
# Verbose by default
|
||||
TEST_VERBOSE=1 ./scripts/test.sh
|
||||
|
||||
# Run pattern
|
||||
TEST_RUN=TestSomething ./scripts/test.sh
|
||||
```
|
||||
|
||||
## Quick Reference
|
||||
|
||||
| Task | Command |
|
||||
|------|---------|
|
||||
| Run all tests | `make test` or `./scripts/test.sh` |
|
||||
| Test one package | `./scripts/test.sh ./cmd/bd/...` |
|
||||
| Test one function | `./scripts/test.sh -run TestName` |
|
||||
| Verbose output | `./scripts/test.sh -v` |
|
||||
| Custom timeout | `./scripts/test.sh -timeout 10m` |
|
||||
| Skip additional test | `./scripts/test.sh -skip TestFoo` |
|
||||
|
||||
## Remember
|
||||
|
||||
- The test script is in `.gitignore` path: `scripts/test.sh`
|
||||
- Skip list is in repo root: `.test-skip`
|
||||
- Full documentation: `docs/TESTING.md`
|
||||
- Current broken tests: See GH issues #355, #356
|
||||
|
|
@ -74,5 +74,5 @@ git config --global user.email "your.email@example.com"
|
|||
|
||||
## Related Issues
|
||||
|
||||
- GitHub Issue [#229](https://github.com/gastownhall/beads/issues/229): Git hooks not available in devcontainers
|
||||
- GitHub Issue [#229](https://github.com/steveyegge/beads/issues/229): Git hooks not available in devcontainers
|
||||
- bd-ry1u: Publish official devcontainer configuration
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "beads Development Container",
|
||||
"image": "mcr.microsoft.com/devcontainers/go:2-1.24-bookworm",
|
||||
"image": "mcr.microsoft.com/devcontainers/go:1-1.24-bookworm",
|
||||
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/git:1": {
|
||||
|
|
|
|||
|
|
@ -1,30 +1,6 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Persist -tags=gms_pure_go in the go env config file (`go env -w`), so a
|
||||
# bare `go build`/`go test` run later from a shell that never sourced
|
||||
# .buildflags still picks up the tag (see engdocs/ICU-POLICY.md and
|
||||
# `make doctor-build`). Read the persisted value here, before sourcing
|
||||
# .buildflags below, since that export would otherwise shadow the on-disk
|
||||
# go env value for the rest of this script.
|
||||
echo "⚙️ Persisting -tags=gms_pure_go in go env..."
|
||||
PERSISTED_GOFLAGS="$(go env GOFLAGS)"
|
||||
if [[ "$PERSISTED_GOFLAGS" != *gms_pure_go* ]]; then
|
||||
if [[ "$PERSISTED_GOFLAGS" == *-tags=* ]]; then
|
||||
# Merge into the existing -tags value instead of appending a second
|
||||
# -tags flag: Go does not merge repeated -tags flags, so a second one
|
||||
# would silently replace the first and disable the existing tags.
|
||||
PERSISTED_GOFLAGS="$(printf '%s' "$PERSISTED_GOFLAGS" | sed -E 's/-tags=([^[:space:]]*)/-tags=\1,gms_pure_go/')"
|
||||
else
|
||||
PERSISTED_GOFLAGS="${PERSISTED_GOFLAGS:+$PERSISTED_GOFLAGS }-tags=gms_pure_go"
|
||||
fi
|
||||
go env -w GOFLAGS="$PERSISTED_GOFLAGS"
|
||||
fi
|
||||
|
||||
# Canonical build flags (GOFLAGS=-tags=gms_pure_go, CGO_ENABLED=1).
|
||||
# shellcheck source=../.buildflags
|
||||
source "$(dirname "$0")/../.buildflags"
|
||||
|
||||
echo "🔧 Building bd from source..."
|
||||
go build -o bd ./cmd/bd
|
||||
|
||||
|
|
|
|||
9
.gitattributes
vendored
9
.gitattributes
vendored
|
|
@ -1,8 +1 @@
|
|||
# Keep repository text deterministic on every host. The global rule makes future
|
||||
# text formats opt in automatically and protects LF-sensitive hook templates,
|
||||
# embedded Markdown bytes, migration content hashes, and generated-doc byte
|
||||
# comparisons without requiring workstation Git configuration.
|
||||
* text=auto eol=lf
|
||||
|
||||
# Tracked binary assets must never pass through text conversion or text diffs.
|
||||
*.jpg binary
|
||||
.beads/issues.jsonl merge=beads
|
||||
|
|
|
|||
|
|
@ -1,59 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
# --- BEGIN BEADS INTEGRATION v1.3.0 ---
|
||||
# This section is managed by beads. Do not remove these markers.
|
||||
if command -v bd >/dev/null 2>&1; then
|
||||
export BD_GIT_HOOK=1
|
||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||
case "$_bd_timeout" in
|
||||
*[!0-9]*|'') _bd_timeout_invalid=1 ;;
|
||||
*[1-9]*) _bd_timeout_invalid=0 ;;
|
||||
*) _bd_timeout_invalid=1 ;;
|
||||
esac
|
||||
if [ "$_bd_timeout_invalid" -eq 1 ]; then
|
||||
echo >&2 "beads: invalid BEADS_HOOK_TIMEOUT; using 300 seconds"
|
||||
_bd_timeout=300
|
||||
fi
|
||||
_bd_timeout_backend=none
|
||||
_bd_timeout_command=
|
||||
for _bd_timeout_candidate in timeout gtimeout; do
|
||||
if command -v "$_bd_timeout_candidate" >/dev/null 2>&1; then
|
||||
if _bd_timeout_version="$("$_bd_timeout_candidate" --version 2>/dev/null)"; then
|
||||
case "$_bd_timeout_version" in
|
||||
"timeout (GNU coreutils) "*|"timeout (uutils coreutils) "*) _bd_timeout_command=$_bd_timeout_candidate; break ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ -n "$_bd_timeout_command" ]; then
|
||||
_bd_timeout_backend=coreutils
|
||||
if "$_bd_timeout_command" -- "$_bd_timeout" bd hooks run post-checkout "$@"; then
|
||||
_bd_exit=0
|
||||
else
|
||||
_bd_exit=$?
|
||||
fi
|
||||
elif command -v perl >/dev/null 2>&1; then
|
||||
_bd_timeout_backend=perl
|
||||
if perl -e 'alarm shift; exec @ARGV' -- "$_bd_timeout" bd hooks run post-checkout "$@"; then
|
||||
_bd_exit=0
|
||||
else
|
||||
_bd_exit=$?
|
||||
fi
|
||||
else
|
||||
echo >&2 "beads: hook 'post-checkout' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||
if bd hooks run post-checkout "$@"; then
|
||||
_bd_exit=0
|
||||
else
|
||||
_bd_exit=$?
|
||||
fi
|
||||
fi
|
||||
if { [ "$_bd_timeout_backend" = coreutils ] && [ "$_bd_exit" -eq 124 ]; } || { [ "$_bd_timeout_backend" = perl ] && [ "$_bd_exit" -eq 142 ]; }; then
|
||||
echo >&2 "beads: hook 'post-checkout' timed out after ${_bd_timeout}s — continuing without beads"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ "$_bd_exit" -eq 3 ]; then
|
||||
echo >&2 "beads: database not initialized — skipping hook 'post-checkout'"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi
|
||||
fi
|
||||
# --- END BEADS INTEGRATION v1.3.0 ---
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
# --- BEGIN BEADS INTEGRATION v1.3.0 ---
|
||||
# This section is managed by beads. Do not remove these markers.
|
||||
if command -v bd >/dev/null 2>&1; then
|
||||
export BD_GIT_HOOK=1
|
||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||
case "$_bd_timeout" in
|
||||
*[!0-9]*|'') _bd_timeout_invalid=1 ;;
|
||||
*[1-9]*) _bd_timeout_invalid=0 ;;
|
||||
*) _bd_timeout_invalid=1 ;;
|
||||
esac
|
||||
if [ "$_bd_timeout_invalid" -eq 1 ]; then
|
||||
echo >&2 "beads: invalid BEADS_HOOK_TIMEOUT; using 300 seconds"
|
||||
_bd_timeout=300
|
||||
fi
|
||||
_bd_timeout_backend=none
|
||||
_bd_timeout_command=
|
||||
for _bd_timeout_candidate in timeout gtimeout; do
|
||||
if command -v "$_bd_timeout_candidate" >/dev/null 2>&1; then
|
||||
if _bd_timeout_version="$("$_bd_timeout_candidate" --version 2>/dev/null)"; then
|
||||
case "$_bd_timeout_version" in
|
||||
"timeout (GNU coreutils) "*|"timeout (uutils coreutils) "*) _bd_timeout_command=$_bd_timeout_candidate; break ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ -n "$_bd_timeout_command" ]; then
|
||||
_bd_timeout_backend=coreutils
|
||||
if "$_bd_timeout_command" -- "$_bd_timeout" bd hooks run post-merge "$@"; then
|
||||
_bd_exit=0
|
||||
else
|
||||
_bd_exit=$?
|
||||
fi
|
||||
elif command -v perl >/dev/null 2>&1; then
|
||||
_bd_timeout_backend=perl
|
||||
if perl -e 'alarm shift; exec @ARGV' -- "$_bd_timeout" bd hooks run post-merge "$@"; then
|
||||
_bd_exit=0
|
||||
else
|
||||
_bd_exit=$?
|
||||
fi
|
||||
else
|
||||
echo >&2 "beads: hook 'post-merge' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||
if bd hooks run post-merge "$@"; then
|
||||
_bd_exit=0
|
||||
else
|
||||
_bd_exit=$?
|
||||
fi
|
||||
fi
|
||||
if { [ "$_bd_timeout_backend" = coreutils ] && [ "$_bd_exit" -eq 124 ]; } || { [ "$_bd_timeout_backend" = perl ] && [ "$_bd_exit" -eq 142 ]; }; then
|
||||
echo >&2 "beads: hook 'post-merge' timed out after ${_bd_timeout}s — continuing without beads"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ "$_bd_exit" -eq 3 ]; then
|
||||
echo >&2 "beads: database not initialized — skipping hook 'post-merge'"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi
|
||||
fi
|
||||
# --- END BEADS INTEGRATION v1.3.0 ---
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Pre-commit hook: auto-format with gofmt, then lint and vet with nogo.
|
||||
# Installed via: git config core.hooksPath .githooks
|
||||
# See also: make install (sets hooksPath automatically)
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Only check staged Go files (Added, Copied, Modified). No early exit here:
|
||||
# the beads section at the bottom must run for non-Go commits too.
|
||||
staged_go_files=$(git diff --cached --name-only --diff-filter=ACM -- '*.go')
|
||||
if [ -n "$staged_go_files" ]; then
|
||||
# Auto-format and re-stage, through the go.mod-pinned gofmt. A bare PATH
|
||||
# gofmt belongs to the host toolchain, and on a host newer than the go
|
||||
# directive it rewrites and re-stages files into a form CI's gofmt rejects
|
||||
# -- silently, on every Go commit. See scripts/ci/gofmt-bin.sh.
|
||||
gofmt_bin="$(./scripts/ci/gofmt-bin.sh)"
|
||||
echo "$staged_go_files" | xargs "$gofmt_bin" -w
|
||||
echo "$staged_go_files" | xargs git add
|
||||
|
||||
# Lint and vet: nogo (//tools/nogo) over the staged files' Bazel packages,
|
||||
# the analyzers bazel.yml gates on (go test's vet checks plus the
|
||||
# golangci-lint linters .golangci.yml enables). Findings fail the commit;
|
||||
# nogo prints a `patch -p1` command for the ones with suggested fixes.
|
||||
# Needs bazel (or bazelisk) on PATH; the windows/darwin passes run in CI
|
||||
# and in `make lint`.
|
||||
make lint-changed LINT_CHANGED_SCOPE=staged || exit 1
|
||||
fi
|
||||
|
||||
# --- BEGIN BEADS INTEGRATION v1.3.0 ---
|
||||
# This section is managed by beads. Do not remove these markers.
|
||||
if command -v bd >/dev/null 2>&1; then
|
||||
export BD_GIT_HOOK=1
|
||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||
case "$_bd_timeout" in
|
||||
*[!0-9]*|'') _bd_timeout_invalid=1 ;;
|
||||
*[1-9]*) _bd_timeout_invalid=0 ;;
|
||||
*) _bd_timeout_invalid=1 ;;
|
||||
esac
|
||||
if [ "$_bd_timeout_invalid" -eq 1 ]; then
|
||||
echo >&2 "beads: invalid BEADS_HOOK_TIMEOUT; using 300 seconds"
|
||||
_bd_timeout=300
|
||||
fi
|
||||
_bd_timeout_backend=none
|
||||
_bd_timeout_command=
|
||||
for _bd_timeout_candidate in timeout gtimeout; do
|
||||
if command -v "$_bd_timeout_candidate" >/dev/null 2>&1; then
|
||||
if _bd_timeout_version="$("$_bd_timeout_candidate" --version 2>/dev/null)"; then
|
||||
case "$_bd_timeout_version" in
|
||||
"timeout (GNU coreutils) "*|"timeout (uutils coreutils) "*) _bd_timeout_command=$_bd_timeout_candidate; break ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ -n "$_bd_timeout_command" ]; then
|
||||
_bd_timeout_backend=coreutils
|
||||
if "$_bd_timeout_command" -- "$_bd_timeout" bd hooks run pre-commit "$@"; then
|
||||
_bd_exit=0
|
||||
else
|
||||
_bd_exit=$?
|
||||
fi
|
||||
elif command -v perl >/dev/null 2>&1; then
|
||||
_bd_timeout_backend=perl
|
||||
if perl -e 'alarm shift; exec @ARGV' -- "$_bd_timeout" bd hooks run pre-commit "$@"; then
|
||||
_bd_exit=0
|
||||
else
|
||||
_bd_exit=$?
|
||||
fi
|
||||
else
|
||||
echo >&2 "beads: hook 'pre-commit' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||
if bd hooks run pre-commit "$@"; then
|
||||
_bd_exit=0
|
||||
else
|
||||
_bd_exit=$?
|
||||
fi
|
||||
fi
|
||||
if { [ "$_bd_timeout_backend" = coreutils ] && [ "$_bd_exit" -eq 124 ]; } || { [ "$_bd_timeout_backend" = perl ] && [ "$_bd_exit" -eq 142 ]; }; then
|
||||
echo >&2 "beads: hook 'pre-commit' timed out after ${_bd_timeout}s — continuing without beads"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ "$_bd_exit" -eq 3 ]; then
|
||||
echo >&2 "beads: database not initialized — skipping hook 'pre-commit'"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi
|
||||
fi
|
||||
# --- END BEADS INTEGRATION v1.3.0 ---
|
||||
|
|
@ -1,152 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Pre-push hook: run the Bazel test suite for branch pushes that change Go or
|
||||
# Bazel inputs (scripts/pre-push-suite.sh), and when pushing a release tag
|
||||
# (refs/tags/v*), refuse the push if version constants disagree. The version
|
||||
# check stops a release from being tagged/published with drifted versions (the
|
||||
# failure mode that left main red after the 1.0.5 release) before it ever
|
||||
# reaches CI.
|
||||
#
|
||||
# Installed via: git config core.hooksPath .githooks
|
||||
# See also: make install (sets hooksPath automatically)
|
||||
#
|
||||
# Bypass (not recommended for release tags): git push --no-verify
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# git feeds "<local ref> <local sha> <remote ref> <remote sha>" lines on stdin.
|
||||
# Capture it so the chained beads hook at the bottom still sees the ref list.
|
||||
push_refs="$(cat)"
|
||||
|
||||
pushing_version_tag=0
|
||||
while read -r local_ref _local_sha _remote_ref _remote_sha; do
|
||||
case "$local_ref" in
|
||||
refs/tags/v[0-9]*) pushing_version_tag=1 ;;
|
||||
esac
|
||||
done <<< "$push_refs"
|
||||
|
||||
if [ "$pushing_version_tag" -eq 1 ]; then
|
||||
repo_root="$(git rev-parse --show-toplevel)"
|
||||
# Skip on older checkouts without the consistency check; do not block.
|
||||
if [ -x "$repo_root/scripts/check-versions.sh" ]; then
|
||||
while read -r local_ref _local_sha _remote_ref _remote_sha; do
|
||||
case "$local_ref" in
|
||||
refs/tags/v[0-9]*)
|
||||
tag_version="${local_ref#refs/tags/v}"
|
||||
echo "Release tag v$tag_version push detected — verifying version consistency..."
|
||||
checker_status=0
|
||||
(cd "$repo_root" && ./scripts/check-versions.sh --expect "$tag_version") || checker_status=$?
|
||||
if [ "$checker_status" -ne 0 ]; then
|
||||
echo ""
|
||||
if [ "$checker_status" -eq 1 ]; then
|
||||
echo "❌ Refusing to push release tag v$tag_version: versions are inconsistent." >&2
|
||||
echo " See the checker output above for what is inconsistent and how to fix it." >&2
|
||||
elif [ "$checker_status" -eq 3 ]; then
|
||||
echo "❌ Refusing to push release tag v$tag_version: the tag does not match this checkout's release version." >&2
|
||||
echo " The release surfaces agree with each other, so do NOT re-run update-versions.sh." >&2
|
||||
echo " Push only the tag matching this checkout (see CONTRIBUTING.md)." >&2
|
||||
else
|
||||
echo "❌ Refusing to push release tag v$tag_version: version checker unavailable or failed (exit $checker_status)." >&2
|
||||
echo " Check the Go toolchain and checker diagnostics above." >&2
|
||||
fi
|
||||
echo " Override with --no-verify only if you know what you are doing." >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done <<< "$push_refs"
|
||||
fi
|
||||
fi
|
||||
|
||||
# The push-time test suite (scripts/pre-push-suite.sh): bazel.yml's test lane,
|
||||
# `bazel test //... --config=ci`, for branch pushes whose new commits change
|
||||
# Go or Bazel inputs. A tag push, a deletion, or a docs-only push skips it.
|
||||
# BD_PREPUSH_SUITE=go runs plain go test instead, under a banner.
|
||||
#
|
||||
# The decision keys on the remote ref and the shas, never on the local ref's
|
||||
# shape: for `git push origin HEAD` and `HEAD:refs/heads/x` git passes the
|
||||
# literal local ref `HEAD`, which a `refs/heads/*` match would skip (#7351).
|
||||
zero_sha=0000000000000000000000000000000000000000
|
||||
suite_needed=0
|
||||
while read -r _local_ref local_sha remote_ref remote_sha; do
|
||||
case "$remote_ref" in
|
||||
refs/tags/*) continue ;;
|
||||
esac
|
||||
if [ "$local_sha" = "$zero_sha" ] || ! git cat-file -e "$local_sha^{commit}" 2>/dev/null; then
|
||||
continue
|
||||
fi
|
||||
base="$remote_sha"
|
||||
if [ "$base" = "$zero_sha" ] || ! git cat-file -e "$base^{commit}" 2>/dev/null; then
|
||||
# A new remote branch: compare against main's merge-base.
|
||||
base="$(git merge-base "$local_sha" origin/main 2>/dev/null || true)"
|
||||
fi
|
||||
if [ -z "$base" ] || git diff --name-only "$base" "$local_sha" -- \
|
||||
'*.go' 'go.mod' 'go.sum' '*.bazel' '*.bzl' '.bazelrc' '.bazelversion' 'MODULE.bazel.lock' | grep -q .; then
|
||||
suite_needed=1
|
||||
fi
|
||||
done <<< "$push_refs"
|
||||
|
||||
if [ "$suite_needed" -eq 1 ]; then
|
||||
repo_root="$(git rev-parse --show-toplevel)"
|
||||
"$repo_root/scripts/pre-push-suite.sh" </dev/null
|
||||
fi
|
||||
|
||||
exec < <(printf '%s\n' "$push_refs")
|
||||
|
||||
# --- BEGIN BEADS INTEGRATION v1.3.0 ---
|
||||
# This section is managed by beads. Do not remove these markers.
|
||||
if command -v bd >/dev/null 2>&1; then
|
||||
export BD_GIT_HOOK=1
|
||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||
case "$_bd_timeout" in
|
||||
*[!0-9]*|'') _bd_timeout_invalid=1 ;;
|
||||
*[1-9]*) _bd_timeout_invalid=0 ;;
|
||||
*) _bd_timeout_invalid=1 ;;
|
||||
esac
|
||||
if [ "$_bd_timeout_invalid" -eq 1 ]; then
|
||||
echo >&2 "beads: invalid BEADS_HOOK_TIMEOUT; using 300 seconds"
|
||||
_bd_timeout=300
|
||||
fi
|
||||
_bd_timeout_backend=none
|
||||
_bd_timeout_command=
|
||||
for _bd_timeout_candidate in timeout gtimeout; do
|
||||
if command -v "$_bd_timeout_candidate" >/dev/null 2>&1; then
|
||||
if _bd_timeout_version="$("$_bd_timeout_candidate" --version 2>/dev/null)"; then
|
||||
case "$_bd_timeout_version" in
|
||||
"timeout (GNU coreutils) "*|"timeout (uutils coreutils) "*) _bd_timeout_command=$_bd_timeout_candidate; break ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ -n "$_bd_timeout_command" ]; then
|
||||
_bd_timeout_backend=coreutils
|
||||
if "$_bd_timeout_command" -- "$_bd_timeout" bd hooks run pre-push "$@"; then
|
||||
_bd_exit=0
|
||||
else
|
||||
_bd_exit=$?
|
||||
fi
|
||||
elif command -v perl >/dev/null 2>&1; then
|
||||
_bd_timeout_backend=perl
|
||||
if perl -e 'alarm shift; exec @ARGV' -- "$_bd_timeout" bd hooks run pre-push "$@"; then
|
||||
_bd_exit=0
|
||||
else
|
||||
_bd_exit=$?
|
||||
fi
|
||||
else
|
||||
echo >&2 "beads: hook 'pre-push' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||
if bd hooks run pre-push "$@"; then
|
||||
_bd_exit=0
|
||||
else
|
||||
_bd_exit=$?
|
||||
fi
|
||||
fi
|
||||
if { [ "$_bd_timeout_backend" = coreutils ] && [ "$_bd_exit" -eq 124 ]; } || { [ "$_bd_timeout_backend" = perl ] && [ "$_bd_exit" -eq 142 ]; }; then
|
||||
echo >&2 "beads: hook 'pre-push' timed out after ${_bd_timeout}s — continuing without beads"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ "$_bd_exit" -eq 3 ]; then
|
||||
echo >&2 "beads: database not initialized — skipping hook 'pre-push'"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi
|
||||
fi
|
||||
# --- END BEADS INTEGRATION v1.3.0 ---
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
# --- BEGIN BEADS INTEGRATION v1.3.0 ---
|
||||
# This section is managed by beads. Do not remove these markers.
|
||||
if command -v bd >/dev/null 2>&1; then
|
||||
export BD_GIT_HOOK=1
|
||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||
case "$_bd_timeout" in
|
||||
*[!0-9]*|'') _bd_timeout_invalid=1 ;;
|
||||
*[1-9]*) _bd_timeout_invalid=0 ;;
|
||||
*) _bd_timeout_invalid=1 ;;
|
||||
esac
|
||||
if [ "$_bd_timeout_invalid" -eq 1 ]; then
|
||||
echo >&2 "beads: invalid BEADS_HOOK_TIMEOUT; using 300 seconds"
|
||||
_bd_timeout=300
|
||||
fi
|
||||
_bd_timeout_backend=none
|
||||
_bd_timeout_command=
|
||||
for _bd_timeout_candidate in timeout gtimeout; do
|
||||
if command -v "$_bd_timeout_candidate" >/dev/null 2>&1; then
|
||||
if _bd_timeout_version="$("$_bd_timeout_candidate" --version 2>/dev/null)"; then
|
||||
case "$_bd_timeout_version" in
|
||||
"timeout (GNU coreutils) "*|"timeout (uutils coreutils) "*) _bd_timeout_command=$_bd_timeout_candidate; break ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ -n "$_bd_timeout_command" ]; then
|
||||
_bd_timeout_backend=coreutils
|
||||
if "$_bd_timeout_command" -- "$_bd_timeout" bd hooks run prepare-commit-msg "$@"; then
|
||||
_bd_exit=0
|
||||
else
|
||||
_bd_exit=$?
|
||||
fi
|
||||
elif command -v perl >/dev/null 2>&1; then
|
||||
_bd_timeout_backend=perl
|
||||
if perl -e 'alarm shift; exec @ARGV' -- "$_bd_timeout" bd hooks run prepare-commit-msg "$@"; then
|
||||
_bd_exit=0
|
||||
else
|
||||
_bd_exit=$?
|
||||
fi
|
||||
else
|
||||
echo >&2 "beads: hook 'prepare-commit-msg' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||
if bd hooks run prepare-commit-msg "$@"; then
|
||||
_bd_exit=0
|
||||
else
|
||||
_bd_exit=$?
|
||||
fi
|
||||
fi
|
||||
if { [ "$_bd_timeout_backend" = coreutils ] && [ "$_bd_exit" -eq 124 ]; } || { [ "$_bd_timeout_backend" = perl ] && [ "$_bd_exit" -eq 142 ]; }; then
|
||||
echo >&2 "beads: hook 'prepare-commit-msg' timed out after ${_bd_timeout}s — continuing without beads"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ "$_bd_exit" -eq 3 ]; then
|
||||
echo >&2 "beads: database not initialized — skipping hook 'prepare-commit-msg'"
|
||||
_bd_exit=0
|
||||
fi
|
||||
if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi
|
||||
fi
|
||||
# --- END BEADS INTEGRATION v1.3.0 ---
|
||||
26
.github/CODEOWNERS
vendored
26
.github/CODEOWNERS
vendored
|
|
@ -1,26 +0,0 @@
|
|||
# CODEOWNERS — review ownership
|
||||
#
|
||||
# Changes under cmd/bd/init*.go interact with init-safety invariants
|
||||
# documented in engdocs/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
|
||||
engdocs/adr/0002-init-safety-invariants.md @gastownhall/beads-maintainers
|
||||
|
||||
# Schema-migration critical path (bd-6dnrw.15). The 2026 Apr-Jun window
|
||||
# shipped a corrupting migration (PR 4039, DEFAULT (UUID()) PK, zero reviews,
|
||||
# self-merged), a duplicate version number (PR 4027), and in-place edits to
|
||||
# released migrations (PRs 3991/3918/3942). Migration changes get at least
|
||||
# one human maintainer review; scripts/check-migration-hygiene.sh enforces
|
||||
# the mechanical invariants in CI, and reviewers should treat allowlist
|
||||
# additions and hygiene-script changes with the same suspicion as the
|
||||
# migrations themselves. NOTE: GitHub only enforces CODEOWNERS when branch
|
||||
# protection has "require review from Code Owners" enabled (bd-6dnrw.23).
|
||||
internal/storage/schema/migrations/ @gastownhall/beads-maintainers
|
||||
scripts/check-migration-hygiene.sh @gastownhall/beads-maintainers
|
||||
94
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
94
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
|
@ -1,94 +0,0 @@
|
|||
name: Bug report
|
||||
description: Report broken behavior in bd.
|
||||
title: "bug: "
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for the report. This issue is the record a fix PR links to, so the more evidence here, the better. You can open a fix PR right away; no approval is needed first.
|
||||
|
||||
**Agents filling in this form:** answer each question only from evidence you have. If you cannot answer a question from the evidence, write exactly `NOT_ENOUGH_INFO` instead of guessing.
|
||||
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: Before you continue
|
||||
options:
|
||||
- label: I searched existing issues and did not find a duplicate.
|
||||
required: true
|
||||
- label: I reproduced this with stock `bd`, without an orchestrator or agent framework in the loop.
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: summary
|
||||
attributes:
|
||||
label: Summary
|
||||
description: What is broken, in one or two sentences.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: repro
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: Exact commands, starting from a fresh directory where possible.
|
||||
render: shell
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: Expected behavior
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: actual
|
||||
attributes:
|
||||
label: Actual behavior
|
||||
description: Include the full error output.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: bd version
|
||||
description: Output of `bd version`.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: mode
|
||||
attributes:
|
||||
label: Storage mode
|
||||
options:
|
||||
- Embedded (default `bd init`)
|
||||
- Server mode (`bd init --server`)
|
||||
- Proxied server
|
||||
- Not sure
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: os
|
||||
attributes:
|
||||
label: Operating system
|
||||
placeholder: "macOS 15.5 (arm64), Ubuntu 24.04, Windows 11, ..."
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: impact
|
||||
attributes:
|
||||
label: Impact
|
||||
description: Who is affected, how severe it is (data loss, blocked, workaround exists), and how often it happens.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: context
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Logs, `bd doctor` output, root-cause notes, or a proposed fix.
|
||||
11
.github/ISSUE_TEMPLATE/config.yml
vendored
11
.github/ISSUE_TEMPLATE/config.yml
vendored
|
|
@ -1,11 +0,0 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Documentation
|
||||
url: https://beads.gascity.com/
|
||||
about: Installation, concepts, CLI reference, and troubleshooting.
|
||||
- name: Questions and ideas
|
||||
url: https://github.com/gastownhall/beads/discussions
|
||||
about: Ask usage questions or float an idea before it is ready to be an issue.
|
||||
- name: Security vulnerability
|
||||
url: https://github.com/gastownhall/beads/security/policy
|
||||
about: Report security issues privately, never in a public issue.
|
||||
108
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
108
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
|
|
@ -1,108 +0,0 @@
|
|||
name: Feature request
|
||||
description: Propose a change to bd, with the information needed to accept it.
|
||||
title: "feat: "
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
This form collects the context reviewers and future readers need for a change worth discussing. You can open your PR right after filing; no approval is needed first. Small, self-explanatory changes can skip the issue and go straight to a PR. Read the [project charter](https://github.com/gastownhall/beads/blob/main/engdocs/PROJECT_CHARTER.md) first — beads owns issue-tracking primitives, not orchestration policy or storage-engine behavior.
|
||||
|
||||
**Agents filling in this form:** answer each question only from evidence you have. If you cannot answer a question from the evidence, write exactly `NOT_ENOUGH_INFO` instead of guessing.
|
||||
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: Before you continue
|
||||
options:
|
||||
- label: I searched existing issues and pull requests and did not find a duplicate.
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: motivation
|
||||
attributes:
|
||||
label: Motivation
|
||||
description: The problem, and who has it. Describe the pain, not the implementation you prefer.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: proposal
|
||||
attributes:
|
||||
label: Proposed change
|
||||
description: The behavior, command, flag, or API you want.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: impact
|
||||
attributes:
|
||||
label: Impact
|
||||
description: Who is affected and how — users, agents, integrations, downstream consumers of the `--json` output.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: risk
|
||||
attributes:
|
||||
label: Risk and compatibility
|
||||
description: Schema or migration changes, wire or `--json` output changes, behavior changes for existing workspaces, and how to roll back.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: verification
|
||||
attributes:
|
||||
label: Verification plan
|
||||
description: How we will know it works end to end, beyond unit tests.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: alternatives
|
||||
attributes:
|
||||
label: Alternatives considered
|
||||
description: Current workarounds, issue metadata, an integration or plugin, or other designs.
|
||||
|
||||
- type: dropdown
|
||||
id: size
|
||||
attributes:
|
||||
label: Estimated size
|
||||
options:
|
||||
- XS (under 50 lines)
|
||||
- S (under 200 lines)
|
||||
- M (under 500 lines)
|
||||
- L (under 1,000 lines)
|
||||
- XL (more than 1,000 lines; likely needs splitting)
|
||||
- Not sure
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: intent
|
||||
attributes:
|
||||
label: Intent
|
||||
options:
|
||||
- I am opening or will open a PR
|
||||
- I'm reporting the need; someone else would implement it
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: ai
|
||||
attributes:
|
||||
label: AI assistance
|
||||
description: Was an AI agent used to draft this issue?
|
||||
options:
|
||||
- "No"
|
||||
- Yes, partly
|
||||
- Yes, mostly
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: checkboxes
|
||||
id: accountability
|
||||
attributes:
|
||||
label: Accountability
|
||||
options:
|
||||
- label: A human has read this issue and stands behind it.
|
||||
required: true
|
||||
24
.github/PULL_REQUEST_TEMPLATE.md
vendored
24
.github/PULL_REQUEST_TEMPLATE.md
vendored
|
|
@ -1,24 +0,0 @@
|
|||
<!--
|
||||
Link an issue when there is one (`Closes #123`); it is recommended for
|
||||
user-visible bugs and changes worth discussing, and optional for small,
|
||||
self-explanatory fixes. Either way, say why the change is needed below. See
|
||||
CONTRIBUTING.md#issues-and-pull-requests.
|
||||
-->
|
||||
|
||||
Closes #
|
||||
|
||||
## What changed
|
||||
|
||||
<!-- One or two plain-language sentences. -->
|
||||
|
||||
## Evidence it works
|
||||
|
||||
<!-- Commands a reviewer can run and what they show, end to end.
|
||||
"Unit tests pass" alone is not evidence. -->
|
||||
|
||||
## Checklist
|
||||
|
||||
- [ ] The why is documented: in a linked issue (reproduction or motivation, impact, risk) or in this description.
|
||||
- [ ] `make test` (the Bazel test lane, nogo lint included) and any other lane `engdocs/TESTING.md` selects pass locally.
|
||||
- [ ] User-facing behavior changes are reflected in `docs/` or the generated CLI reference.
|
||||
- [ ] If an invariant or rule changed, the owning `AGENTS.md` is updated.
|
||||
158
.github/actions/setup-bazel/action.yml
vendored
158
.github/actions/setup-bazel/action.yml
vendored
|
|
@ -1,158 +0,0 @@
|
|||
name: setup-bazel
|
||||
description: >
|
||||
Install a sha256-pinned Bazelisk, have it download the sha256-pinned Bazel
|
||||
release .bazelversion names (never from the runner cache), restore the
|
||||
runner Bazel cache (--repository_cache only, whose entries Bazel re-hashes
|
||||
on use),
|
||||
and write a CI bazelrc outside the workspace. When the caller passes all of
|
||||
BAZEL_REMOTE_EXECUTOR, RBE_TLS_CERT and RBE_TLS_KEY in the step env, that rc
|
||||
enables --config=remote-exec for every bazel command; with none of them the
|
||||
job runs locally; with BAZEL_FORK_CACHE=true (and no secrets) it enables
|
||||
the read-only fork cache (--config=fork-cache), and with BAZEL_RRC_READ=true
|
||||
too (the remote repo contents cache readers) Bazel's remote repo contents
|
||||
cache through rbe-cache while it answers; with BAZEL_FORK_REMOTE=true
|
||||
(fork and Dependabot PRs, bazel.yml modes fork-ro/fork-rw; needs
|
||||
RBE_FORK_PR and RBE_FORK_TIER) it gets a short-lived certificate from
|
||||
rbe-fork-mint (fork-credential.sh, proving the run with a CSR artifact) and
|
||||
enables remote execution on rbe-fork; a partial set, or two of these
|
||||
together, fails. `bazel` on PATH is a wrapper that always passes the
|
||||
generated rc.
|
||||
outputs:
|
||||
remote:
|
||||
description: '"true" when remote execution is configured'
|
||||
value: ${{ steps.rc.outputs.remote }}
|
||||
cache:
|
||||
description: '"true" when the read-only fork cache (rbe-cache) is configured'
|
||||
value: ${{ steps.rc.outputs.cache }}
|
||||
cache-restored:
|
||||
description: '"true" when a runner Bazel cache was restored (any prefix match)'
|
||||
value: ${{ steps.restore.outputs.cache-matched-key != '' }}
|
||||
cache-hit:
|
||||
description: '"true" when the cache for this .bazelversion and MODULE.bazel.lock was restored exactly'
|
||||
value: ${{ steps.restore.outputs.cache-hit }}
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
# Keyed on what determines its content; saved only by a push to main that
|
||||
# missed the exact key (see the caller's "Save Bazel runner cache" step).
|
||||
# A lock change restores the previous lock's entry, which still holds most
|
||||
# of the downloads. It holds only the content-addressable repository cache,
|
||||
# which Bazel checks against each download's sha256 on every hit; the
|
||||
# unverified repo contents cache is off (write-bazelrc.sh) and the Bazel
|
||||
# binary is not cached, so a poisoned entry (a cache written by an
|
||||
# untrusted run) cannot change what executes. v3: v2 also held Bazelisk's
|
||||
# download and the contents cache. v4: MODULE.bazel joins the key because
|
||||
# the lock does not record non-registry repository rules (llvm_dist), so
|
||||
# v3 kept restoring the 1.94 GB LLVM .tar.xz after the switch to the
|
||||
# 149 MB slice.
|
||||
- name: Restore Bazel runner cache
|
||||
id: restore
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ runner.temp }}/bazel-ci-cache
|
||||
key: bazel-repo-v4-${{ runner.os }}-${{ hashFiles('.bazelversion', 'MODULE.bazel', 'MODULE.bazel.lock') }}
|
||||
restore-keys: |
|
||||
bazel-repo-v4-${{ runner.os }}-
|
||||
|
||||
- name: Install Bazelisk
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
version=v1.29.0
|
||||
case "$(uname -m)" in
|
||||
x86_64) arch=amd64; sha=5a408715e932c0250d28bd84555f12edbf70117de42f9181691c736eacc4a992 ;;
|
||||
aarch64 | arm64) arch=arm64; sha=e20e8b0f4f240091b7a55bf17b9398bd4f40ee70ae0208dff95dd4c445fb4010 ;;
|
||||
*) echo "setup-bazel: unsupported arch $(uname -m)" >&2; exit 1 ;;
|
||||
esac
|
||||
curl -fsSL --retry 3 --max-time 120 -o "$RUNNER_TEMP/bazelisk" \
|
||||
"https://github.com/bazelbuild/bazelisk/releases/download/${version}/bazelisk-linux-${arch}"
|
||||
echo "${sha} $RUNNER_TEMP/bazelisk" | sha256sum -c -
|
||||
sudo install -m 755 "$RUNNER_TEMP/bazelisk" /usr/local/bin/bazelisk
|
||||
rm -f "$RUNNER_TEMP/bazelisk"
|
||||
# The Bazel release .bazelversion names, pinned like Bazelisk above
|
||||
# (the release's bazel-<v>-linux-<arch>.sha256). Bazelisk verifies
|
||||
# only fresh downloads, so its home is a fresh directory outside the
|
||||
# runner cache: every job downloads and verifies Bazel. A .bazelversion
|
||||
# bump adds its pair here (policy-tested).
|
||||
bazel_version="$(tr -d '[:space:]' < .bazelversion)"
|
||||
case "$bazel_version/$arch" in
|
||||
9.2.0/amd64) bazel_sha=7668a95db1250f12c40407251e4e203b4ec8bf39bc495d2f485b2d8c99048694 ;;
|
||||
9.2.0/arm64) bazel_sha=049dd21f40ad979db11c3ee68c96a42ce75f1185e69ac61ab20de1501427a410 ;;
|
||||
9.3.0/amd64) bazel_sha=d302d22ed77ee5658b87857249baa579db84300ecebe0a1e9a357b5b20f80eb8 ;;
|
||||
9.3.0/arm64) bazel_sha=615cc2509819047e4930fe6643c5f01ebd705ccadf75e8f0b85f9b83cc6a6ca0 ;;
|
||||
*) echo "setup-bazel: no pinned sha256 for Bazel '$bazel_version' ($arch); add it from the release's .sha256 file" >&2; exit 1 ;;
|
||||
esac
|
||||
{
|
||||
echo "BAZELISK_HOME=$RUNNER_TEMP/bazelisk-home"
|
||||
echo "BAZELISK_VERIFY_SHA256=$bazel_sha"
|
||||
echo "BAZEL_CI_BAZEL_SHA256=$bazel_sha"
|
||||
} >> "$GITHUB_ENV"
|
||||
|
||||
# Fork and Dependabot runs (no secrets, no OIDC): a key and a CSR, the CSR
|
||||
# as an artifact of this run (the mint's proof that the request comes
|
||||
# from a running job of it), then the certificate. The key stays in the
|
||||
# secret dir; the CSR and the certificate are public.
|
||||
# fork-credential.sh key does nothing (no outputs) unless the caller set
|
||||
# BAZEL_FORK_REMOTE=true; the next two steps follow its csr output.
|
||||
- name: rbe-fork key and CSR
|
||||
id: fork-key
|
||||
shell: bash
|
||||
env:
|
||||
BAZEL_CI_SECRET_DIR: ${{ runner.temp }}/bazel-ci-secret
|
||||
run: bash "$GITHUB_ACTION_PATH/fork-credential.sh" key
|
||||
|
||||
- name: rbe-fork CSR artifact (proof of this run)
|
||||
id: fork-csr
|
||||
if: steps.fork-key.outputs.csr != ''
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: ${{ steps.fork-key.outputs.artifact-name }}
|
||||
path: ${{ steps.fork-key.outputs.csr }}
|
||||
retention-days: 1
|
||||
if-no-files-found: error
|
||||
compression-level: 0
|
||||
|
||||
- name: rbe-fork certificate (rbe-fork-mint)
|
||||
id: fork-cert
|
||||
if: steps.fork-key.outputs.csr != ''
|
||||
shell: bash
|
||||
env:
|
||||
BAZEL_CI_SECRET_DIR: ${{ runner.temp }}/bazel-ci-secret
|
||||
ARTIFACT_ID: ${{ steps.fork-csr.outputs.artifact-id }}
|
||||
run: bash "$GITHUB_ACTION_PATH/fork-credential.sh" cert
|
||||
|
||||
- name: Write CI bazelrc
|
||||
id: rc
|
||||
shell: bash
|
||||
env:
|
||||
BAZEL_CI_CACHE_DIR: ${{ runner.temp }}/bazel-ci-cache
|
||||
BAZEL_CI_SECRET_DIR: ${{ runner.temp }}/bazel-ci-secret
|
||||
RBE_FORK_CERT_FILE: ${{ steps.fork-cert.outputs.cert }}
|
||||
RBE_FORK_KEY_FILE: ${{ steps.fork-cert.outputs.key }}
|
||||
RBE_FORK_ENDPOINT: ${{ steps.fork-cert.outputs.endpoint }}
|
||||
RBE_FORK_INSTANCE: ${{ steps.fork-cert.outputs.instance }}
|
||||
run: bash "$GITHUB_ACTION_PATH/write-bazelrc.sh"
|
||||
|
||||
- name: Install bazel wrapper
|
||||
shell: bash
|
||||
env:
|
||||
RC: ${{ steps.rc.outputs.rc }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
printf '%s\n' '#!/usr/bin/env bash' "exec /usr/local/bin/bazelisk --bazelrc=\"$RC\" \"\$@\"" > "$RUNNER_TEMP/bazel-wrapper"
|
||||
sudo install -m 755 "$RUNNER_TEMP/bazel-wrapper" /usr/local/bin/bazel
|
||||
rm -f "$RUNNER_TEMP/bazel-wrapper"
|
||||
# Downloads Bazel (Bazelisk checks BAZELISK_VERIFY_SHA256; the
|
||||
# wrapper's --bazelrc would make --version an unknown startup
|
||||
# option), then checks again: every Bazel binary in Bazelisk's home
|
||||
# is the pinned release.
|
||||
/usr/local/bin/bazelisk --version
|
||||
n=0
|
||||
while IFS= read -r -d '' bin; do
|
||||
echo "${BAZEL_CI_BAZEL_SHA256} $bin" | sha256sum -c - >/dev/null
|
||||
n=$((n + 1))
|
||||
done < <(find "$BAZELISK_HOME/downloads" -type f -path '*/bin/bazel' -print0)
|
||||
if [ "$n" -eq 0 ]; then
|
||||
echo "setup-bazel: no Bazel binary under $BAZELISK_HOME" >&2
|
||||
exit 1
|
||||
fi
|
||||
151
.github/actions/setup-bazel/cache-rrc-probe.sh
vendored
151
.github/actions/setup-bazel/cache-rrc-probe.sh
vendored
|
|
@ -1,151 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# May this fork-cache lane read Bazel's remote repo contents cache through
|
||||
# rbe-west's anonymous read-only cache (rbe-cache :8443, .bazelrc's
|
||||
# fork-cache) right now? Exits 0 only when the kill switch below is on,
|
||||
# rbe-cache answers a REAPI GetCapabilities for instance oss with gRPC status
|
||||
# 0 and a ServerCapabilities that has cache_capabilities, and then answers a
|
||||
# GetActionResult for a key no action has, and a ByteStream Read for a blob
|
||||
# the CAS does not hold, each with NOT_FOUND (gRPC 5): the whole read chain
|
||||
# (Caddy, nativelink-anon, the action cache and the CAS) is up. Anything else
|
||||
# exits nonzero: switched off, an HTTP or gRPC error, a refused connection,
|
||||
# a timeout, an answer that does not parse, no curl or python3. The caller
|
||||
# then writes no repo contents cache lines, and never fails on it. The
|
||||
# verdict carries the GetCapabilities TCP connect time without the DNS
|
||||
# lookup (about one round trip to rbe-cache), for the lane's step summary.
|
||||
#
|
||||
# Why a probe: with the startup flag set and the cache unreachable (closed
|
||||
# by rbe-west's kill switch, or down), Bazel retries every repository
|
||||
# against it before fetching it itself (engdocs/design/
|
||||
# bazel-remote-repo-contents-cache.md, R6), which costs far more than the
|
||||
# cache saves. Fork pull_request runs see no repository variables, so the
|
||||
# opt-out is the committed line below and the server's own answer.
|
||||
#
|
||||
# Three gRPC calls over curl's HTTP/2, the first answer decoded by
|
||||
# python3's standard library: no grpcurl, no new action. Nothing goes to
|
||||
# stdout (callers write their rc from it); one verdict line goes to stderr. A copy lives in gascity
|
||||
# (tools/rbe/) and beads (.github/actions/setup-bazel/); keep in sync, except
|
||||
# the kill switch, which is each repository's own.
|
||||
#
|
||||
# Tests only: RBE_CACHE_PROBE_URL (a stand-in server) and
|
||||
# RBE_CACHE_PROBE_MAX_TIME (seconds).
|
||||
set -uo pipefail
|
||||
|
||||
# Kill switch: off stops this repository's fork-cache lanes reading the
|
||||
# remote repo contents cache (they fetch external repositories themselves),
|
||||
# with a one-line pull request; on lets rbe-cache's answer decide. To stop
|
||||
# every reader of rbe-cache, set it off in both copies (gascity and beads).
|
||||
# It reaches a lane when the lane's checkout carries it.
|
||||
fork_rrc_read=on
|
||||
|
||||
url=${RBE_CACHE_PROBE_URL:-https://rbe-cache.ops.gascity.com:8443}
|
||||
max_time=${RBE_CACHE_PROBE_MAX_TIME:-5}
|
||||
|
||||
rtt=
|
||||
no() {
|
||||
echo "rbe-cache rrc probe: $*${rtt:+ ($rtt)}; this lane fetches external repositories itself" >&2
|
||||
exit 1
|
||||
}
|
||||
[ "$fork_rrc_read" = on ] || no "switched off (fork_rrc_read=$fork_rrc_read in $(basename "$0"))"
|
||||
command -v curl >/dev/null 2>&1 || no "no curl"
|
||||
command -v python3 >/dev/null 2>&1 || no "no python3"
|
||||
tmp=$(mktemp -d) || no "no temp dir"
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
|
||||
# call WHAT METHOD REQ: one gRPC call (METHOD: service/method); the answer's
|
||||
# messages go to $tmp/body, its grpc-status to $st, and the TCP connect time
|
||||
# without the DNS lookup to $tc. Fails the probe (prefixed with WHAT) on a
|
||||
# transport error or a non-200 answer.
|
||||
call() {
|
||||
local what=$1 out code dns
|
||||
out=$(curl -sS --http2 --connect-timeout 3 --max-time "$max_time" \
|
||||
-H 'content-type: application/grpc' -H 'te: trailers' \
|
||||
--data-binary @"$3" -D "$tmp/head" -o "$tmp/body" -w '%{http_code} %{time_namelookup} %{time_connect}' \
|
||||
"$url/$2" 2>"$tmp/err") ||
|
||||
no "$what$(tr '\n' ' ' <"$tmp/err")"
|
||||
read -r code dns tc <<<"$out"
|
||||
tc=$(awk -v d="$dns" -v c="$tc" 'BEGIN { if (c > d) printf "%.6f", c - d }' 2>/dev/null) || tc=
|
||||
[ "$code" = 200 ] || no "${what}HTTP $code"
|
||||
# grpc-status is a trailer; curl writes trailers after the headers.
|
||||
st=$(tr -d '\r' <"$tmp/head" | sed -n 's/^grpc-status: *//Ip' | tail -1)
|
||||
}
|
||||
|
||||
# GetCapabilitiesRequest{instance_name: "oss"} (fork-cache's
|
||||
# --remote_instance_name) as one uncompressed gRPC message.
|
||||
printf '\000\000\000\000\005\012\003oss' >"$tmp/req" || no "cannot write the request"
|
||||
call "" build.bazel.remote.execution.v2.Capabilities/GetCapabilities "$tmp/req"
|
||||
rtt=$(awk -v s="$tc" 'BEGIN { if (s > 0) printf "tcp connect %.1f ms", s * 1000 }' 2>/dev/null) || rtt=
|
||||
[ "$st" = 0 ] || no "gRPC status ${st:-missing}"
|
||||
|
||||
why=$(python3 -I - "$tmp/body" <<'PY'
|
||||
import sys
|
||||
|
||||
|
||||
def varint(b, i):
|
||||
v = s = 0
|
||||
while True:
|
||||
if i >= len(b) or s > 63:
|
||||
raise ValueError("truncated varint")
|
||||
c = b[i]
|
||||
i += 1
|
||||
v |= (c & 0x7F) << s
|
||||
s += 7
|
||||
if c < 0x80:
|
||||
return v, i
|
||||
|
||||
|
||||
def fields(b):
|
||||
i = 0
|
||||
while i < len(b):
|
||||
key, i = varint(b, i)
|
||||
num, wire = key >> 3, key & 7
|
||||
if wire == 0:
|
||||
v, i = varint(b, i)
|
||||
elif wire == 1:
|
||||
v, i = b[i:i + 8], i + 8
|
||||
elif wire == 2:
|
||||
n, i = varint(b, i)
|
||||
v, i = b[i:i + n], i + n
|
||||
elif wire == 5:
|
||||
v, i = b[i:i + 4], i + 4
|
||||
else:
|
||||
raise ValueError("wire type %d" % wire)
|
||||
if i > len(b):
|
||||
raise ValueError("truncated field %d" % num)
|
||||
yield num, wire, v
|
||||
|
||||
|
||||
try:
|
||||
body = open(sys.argv[1], "rb").read()
|
||||
if len(body) < 5 or body[0] != 0:
|
||||
raise ValueError("not an uncompressed gRPC message")
|
||||
n = int.from_bytes(body[1:5], "big")
|
||||
if len(body) != 5 + n:
|
||||
raise ValueError("gRPC length %d, %d bytes" % (n, len(body) - 5))
|
||||
# ServerCapabilities.cache_capabilities
|
||||
cache = [v for num, wire, v in fields(body[5:]) if num == 1 and wire == 2]
|
||||
except (OSError, ValueError) as e:
|
||||
print("unreadable answer (%s)" % e)
|
||||
sys.exit(2)
|
||||
if not cache:
|
||||
print("no cache_capabilities in the answer")
|
||||
sys.exit(1)
|
||||
PY
|
||||
) || no "${why:-python3 failed}"
|
||||
|
||||
# GetActionResultRequest{instance_name: "oss", action_digest: {hash:
|
||||
# sha256("cache-rrc-probe: no action has this key"), size_bytes: 1}}: a key
|
||||
# no action has, so the action cache behind rbe-cache must say NOT_FOUND.
|
||||
key=ad12d7a2f1dec188fc1f2c4f5535a4a65eb630fa2f309eca423695e6ec7abee7
|
||||
printf '\000\000\000\000\113\012\003oss\022\104\012\100%s\020\001' "$key" >"$tmp/req" ||
|
||||
no "cannot write the request"
|
||||
call "GetActionResult: " build.bazel.remote.execution.v2.ActionCache/GetActionResult "$tmp/req"
|
||||
[ "$st" = 5 ] || no "GetActionResult: gRPC status ${st:-missing}, want 5 (NOT_FOUND)"
|
||||
|
||||
# ReadRequest{resource_name: "oss/blobs/<the same hash>/1"}: a blob the CAS
|
||||
# does not hold (its content would have to hash to that key), so the CAS
|
||||
# behind rbe-cache must say NOT_FOUND.
|
||||
printf '\000\000\000\000\116\012\114oss/blobs/%s/1' "$key" >"$tmp/req" ||
|
||||
no "cannot write the request"
|
||||
call "ByteStream Read: " google.bytestream.ByteStream/Read "$tmp/req"
|
||||
[ "$st" = 5 ] || no "ByteStream Read: gRPC status ${st:-missing}, want 5 (NOT_FOUND)"
|
||||
echo "rbe-cache rrc probe: rbe-cache answers GetCapabilities, GetActionResult and ByteStream Read${rtt:+ ($rtt)}; this lane reads the remote repo contents cache" >&2
|
||||
119
.github/actions/setup-bazel/cache-zstd-probe.sh
vendored
119
.github/actions/setup-bazel/cache-zstd-probe.sh
vendored
|
|
@ -1,119 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Does rbe-west's anonymous read-only cache (rbe-cache :8443, .bazelrc's
|
||||
# fork-cache) advertise zstd right now? Exits 0 only when its REAPI
|
||||
# GetCapabilities answer lists ZSTD in cache_capabilities.supported_compressors,
|
||||
# the field Bazel checks before it accepts --remote_cache_compression (it
|
||||
# refuses a remote that does not list it). Anything else exits nonzero: not
|
||||
# listed, an HTTP or gRPC error, a refused connection, a timeout, an answer
|
||||
# that does not parse, no curl or python3. The caller then leaves the flag
|
||||
# off, and never fails on it.
|
||||
#
|
||||
# So the server decides, at run time: when rbe-west turns zstd on, fork-cache
|
||||
# runs use it; when it turns it off (rollback), they stop. No repository
|
||||
# variable (fork pull_request runs see none) and no revert.
|
||||
#
|
||||
# One unary gRPC call over curl's HTTP/2, decoded by python3's standard
|
||||
# library: no grpcurl, no new action. Nothing goes to stdout (callers write
|
||||
# their rc from it); one verdict line goes to stderr. A byte copy lives in
|
||||
# gascity (tools/rbe/) and beads (.github/actions/setup-bazel/); keep in sync.
|
||||
#
|
||||
# Tests only: RBE_CACHE_PROBE_URL (a stand-in server) and
|
||||
# RBE_CACHE_PROBE_MAX_TIME (seconds).
|
||||
set -uo pipefail
|
||||
url=${RBE_CACHE_PROBE_URL:-https://rbe-cache.ops.gascity.com:8443}
|
||||
max_time=${RBE_CACHE_PROBE_MAX_TIME:-5}
|
||||
|
||||
no() {
|
||||
echo "rbe-cache zstd probe: $*; the fork cache stays identity" >&2
|
||||
exit 1
|
||||
}
|
||||
command -v curl >/dev/null 2>&1 || no "no curl"
|
||||
command -v python3 >/dev/null 2>&1 || no "no python3"
|
||||
tmp=$(mktemp -d) || no "no temp dir"
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
|
||||
# GetCapabilitiesRequest{instance_name: "oss"} (fork-cache's
|
||||
# --remote_instance_name) as one uncompressed gRPC message.
|
||||
printf '\000\000\000\000\005\012\003oss' >"$tmp/req" || no "cannot write the request"
|
||||
code=$(curl -sS --http2 --connect-timeout 3 --max-time "$max_time" \
|
||||
-H 'content-type: application/grpc' -H 'te: trailers' \
|
||||
--data-binary @"$tmp/req" -D "$tmp/head" -o "$tmp/body" -w '%{http_code}' \
|
||||
"$url/build.bazel.remote.execution.v2.Capabilities/GetCapabilities" 2>"$tmp/err") ||
|
||||
no "$(tr '\n' ' ' <"$tmp/err")"
|
||||
[ "$code" = 200 ] || no "HTTP $code"
|
||||
# grpc-status is a trailer; curl writes trailers after the headers.
|
||||
st=$(tr -d '\r' <"$tmp/head" | sed -n 's/^grpc-status: *//Ip' | tail -1)
|
||||
[ "$st" = 0 ] || no "gRPC status ${st:-missing}"
|
||||
|
||||
why=$(python3 -I - "$tmp/body" <<'PY'
|
||||
import sys
|
||||
|
||||
ZSTD = 1 # build.bazel.remote.execution.v2.Compressor.Value.ZSTD
|
||||
|
||||
|
||||
def varint(b, i):
|
||||
v = s = 0
|
||||
while True:
|
||||
if i >= len(b) or s > 63:
|
||||
raise ValueError("truncated varint")
|
||||
c = b[i]
|
||||
i += 1
|
||||
v |= (c & 0x7F) << s
|
||||
s += 7
|
||||
if c < 0x80:
|
||||
return v, i
|
||||
|
||||
|
||||
def fields(b):
|
||||
i = 0
|
||||
while i < len(b):
|
||||
key, i = varint(b, i)
|
||||
num, wire = key >> 3, key & 7
|
||||
if wire == 0:
|
||||
v, i = varint(b, i)
|
||||
elif wire == 1:
|
||||
v, i = b[i:i + 8], i + 8
|
||||
elif wire == 2:
|
||||
n, i = varint(b, i)
|
||||
v, i = b[i:i + n], i + n
|
||||
elif wire == 5:
|
||||
v, i = b[i:i + 4], i + 4
|
||||
else:
|
||||
raise ValueError("wire type %d" % wire)
|
||||
if i > len(b):
|
||||
raise ValueError("truncated field %d" % num)
|
||||
yield num, wire, v
|
||||
|
||||
|
||||
try:
|
||||
body = open(sys.argv[1], "rb").read()
|
||||
if len(body) < 5 or body[0] != 0:
|
||||
raise ValueError("not an uncompressed gRPC message")
|
||||
n = int.from_bytes(body[1:5], "big")
|
||||
if len(body) != 5 + n:
|
||||
raise ValueError("gRPC length %d, %d bytes" % (n, len(body) - 5))
|
||||
compressors = []
|
||||
for num, wire, v in fields(body[5:]):
|
||||
if num != 1 or wire != 2: # ServerCapabilities.cache_capabilities
|
||||
continue
|
||||
for cnum, cwire, cv in fields(v):
|
||||
if cnum != 6: # CacheCapabilities.supported_compressors
|
||||
continue
|
||||
if cwire == 0:
|
||||
compressors.append(cv)
|
||||
elif cwire == 2: # packed
|
||||
j = 0
|
||||
while j < len(cv):
|
||||
x, j = varint(cv, j)
|
||||
compressors.append(x)
|
||||
except (OSError, ValueError) as e:
|
||||
print("unreadable answer (%s)" % e)
|
||||
sys.exit(2)
|
||||
if ZSTD in compressors:
|
||||
print("advertises zstd")
|
||||
sys.exit(0)
|
||||
print("zstd not advertised (supported_compressors %s)" % compressors)
|
||||
sys.exit(1)
|
||||
PY
|
||||
) || no "${why:-python3 failed}"
|
||||
echo "rbe-cache zstd probe: $why; the fork cache uses zstd" >&2
|
||||
91
.github/actions/setup-bazel/fork-credential.sh
vendored
91
.github/actions/setup-bazel/fork-credential.sh
vendored
|
|
@ -1,91 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# setup-bazel: a short-lived rbe-west client certificate for fork and
|
||||
# Dependabot pull_request runs, which get no secrets and no OIDC token
|
||||
# (infra nativelink-cas/west README "rbe-fork"). Two steps around the CSR
|
||||
# artifact upload (action.yml):
|
||||
#
|
||||
# fork-credential.sh key an EC P-256 key in BAZEL_CI_SECRET_DIR (outside the
|
||||
# workspace; PKCS#8: Bazel's Netty TLS refuses a
|
||||
# SEC1 "EC PRIVATE KEY"), and a CSR for the upload.
|
||||
# Outputs: csr (path), artifact-name.
|
||||
# fork-credential.sh cert asks rbe-fork-mint for a certificate naming the
|
||||
# uploaded artifact (ARTIFACT_ID). Outputs: cert,
|
||||
# key, endpoint, instance, tier.
|
||||
#
|
||||
# The mint signs only for an in-progress pull_request run of this repository
|
||||
# whose artifact holds this CSR (only code running in the run can upload one),
|
||||
# at the head of RBE_FORK_PR. It decides the tier from the PR's author and the
|
||||
# run's triggering actor; RBE_FORK_TIER is what the rbe job's status probe
|
||||
# said, and a different answer fails the job (re-run all jobs). The key never
|
||||
# leaves the runner; the certificate is public. Nothing here is secret enough
|
||||
# to mask, but the key file is 0600 like the CI key.
|
||||
set -euo pipefail
|
||||
MINT=${RBE_FORK_MINT:-https://rbe-mint.ops.gascity.com:8444}
|
||||
ENDPOINT_RE=${RBE_FORK_ENDPOINT_RE:-'^grpcs://rbe-fork\.ops\.gascity\.com:8444$'}
|
||||
dir=${BAZEL_CI_SECRET_DIR:?BAZEL_CI_SECRET_DIR is required}
|
||||
out=${GITHUB_OUTPUT:-/dev/stdout}
|
||||
|
||||
case "${1:-}" in
|
||||
key)
|
||||
# Only fork and Dependabot runs (bazel.yml modes fork-ro/fork-rw).
|
||||
[ "${BAZEL_FORK_REMOTE:-}" = true ] || exit 0
|
||||
install -d -m 0700 "$dir"
|
||||
csr_dir="${RUNNER_TEMP:?}/rbe-csr"
|
||||
rm -rf "$csr_dir" && install -d -m 0700 "$csr_dir"
|
||||
umask 077
|
||||
openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out "$dir/fork.key" 2>/dev/null
|
||||
openssl req -new -key "$dir/fork.key" -subj "/CN=rbe-fork-request" -out "$csr_dir/csr.pem"
|
||||
job=${GITHUB_JOB:?}
|
||||
[[ $job =~ ^[a-z0-9][a-z0-9_-]{0,39}$ ]] || { echo "setup-bazel: job id '$job' does not fit the mint's job pattern" >&2; exit 1; }
|
||||
{
|
||||
echo "csr=$csr_dir/csr.pem"
|
||||
echo "artifact-name=rbe-csr-$job-${GITHUB_RUN_ATTEMPT:?}-$(openssl rand -hex 8)"
|
||||
} >>"$out"
|
||||
;;
|
||||
cert)
|
||||
: "${ARTIFACT_ID:?}" "${RBE_FORK_PR:?}" "${RBE_FORK_TIER:?}" "${GITHUB_REPOSITORY:?}" "${GITHUB_RUN_ID:?}"
|
||||
body=$(jq -cn --arg repo "${GITHUB_REPOSITORY#*/}" --argjson run "$GITHUB_RUN_ID" \
|
||||
--argjson attempt "${GITHUB_RUN_ATTEMPT:?}" --argjson pr "$RBE_FORK_PR" --arg job "${GITHUB_JOB:?}" \
|
||||
--argjson artifact "$ARTIFACT_ID" \
|
||||
'{repo: $repo, run_id: $run, run_attempt: $attempt, pr: $pr, job: $job, artifact_id: $artifact}')
|
||||
reply="$dir/mint.json"
|
||||
code=000
|
||||
for attempt in 1 2 3 4; do
|
||||
# --connect-timeout: a closed gate drops the SYN; fail fast, not in 60 s.
|
||||
code=$(curl -sS -o "$reply" -w '%{http_code}' --connect-timeout 5 --max-time 60 \
|
||||
-H 'content-type: application/json' --data "$body" "$MINT/v1/cert") || code=000
|
||||
# Retry what may pass on its own: a rate or live-certificate limit (429;
|
||||
# the rates are per minute, the backoff sums to one), the mint could not
|
||||
# reach GitHub (502), or the network (000). Everything else is an answer.
|
||||
case "$code" in 429 | 502 | 000) ;; *) break ;; esac
|
||||
[ "$attempt" -eq 4 ] || sleep $((attempt * 10))
|
||||
done
|
||||
if [ "$code" != 200 ]; then
|
||||
echo "::error title=rbe-fork mint refused (HTTP $code)::$(jq -r '.error // empty' "$reply" 2>/dev/null || true)"
|
||||
exit 1
|
||||
fi
|
||||
endpoint=$(jq -r .endpoint "$reply")
|
||||
instance=$(jq -r .instance "$reply")
|
||||
tier=$(jq -r .tier "$reply")
|
||||
[[ $endpoint =~ $ENDPOINT_RE ]] || { echo "::error::rbe-fork mint returned endpoint '$endpoint'" >&2; exit 1; }
|
||||
case "$tier/$instance" in ro/oss-fork | rw/oss) ;; *) echo "::error::rbe-fork mint returned tier '$tier' instance '$instance'" >&2; exit 1 ;; esac
|
||||
if [ "$tier" != "$RBE_FORK_TIER" ]; then
|
||||
echo "::error title=rbe-fork tier changed::the mint says '$tier', this run's mode says '$RBE_FORK_TIER' (allowlist changed?); re-run all jobs"
|
||||
exit 1
|
||||
fi
|
||||
umask 077
|
||||
jq -r .cert_pem "$reply" >"$dir/fork.crt"
|
||||
openssl x509 -in "$dir/fork.crt" -noout -subject -enddate
|
||||
{
|
||||
echo "cert=$dir/fork.crt"
|
||||
echo "key=$dir/fork.key"
|
||||
echo "endpoint=$endpoint"
|
||||
echo "instance=$instance"
|
||||
echo "tier=$tier"
|
||||
} >>"$out"
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 key|cert" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
288
.github/actions/setup-bazel/write-bazelrc.sh
vendored
288
.github/actions/setup-bazel/write-bazelrc.sh
vendored
|
|
@ -1,288 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Write the CI bazelrc for .github/actions/setup-bazel.
|
||||
#
|
||||
# Always: --repository_cache under BAZEL_CI_CACHE_DIR (the directory the
|
||||
# runner cache saves and restores; Bazel checks every hit's sha256) and no
|
||||
# repo contents cache (--repo_contents_cache=: its extracted repos would be
|
||||
# restored from the runner cache unverified). Never --disk_cache: remote runs have the
|
||||
# remote cache, and a local run's disk cache (about 7 GB) would not fit next to
|
||||
# its output base on a hosted runner.
|
||||
#
|
||||
# Remote execution only when all three of BAZEL_REMOTE_EXECUTOR, RBE_TLS_CERT
|
||||
# and RBE_TLS_KEY are set (repo secrets; empty on fork PRs, so those runs stay
|
||||
# local). Exactly one or two of them is a misconfiguration and fails. Optional:
|
||||
# RBE_TLS_CA (base64 PEM CA bundle) and RBE_INSTANCE (instance name; a warning
|
||||
# when empty, because the default instance may share its action cache with
|
||||
# other repos on the same farm). Cert and key are base64-encoded PEM (raw PEM
|
||||
# is accepted too). Every line of the decoded PEM is masked in the job log.
|
||||
#
|
||||
# CI uploads only remotely executed results (--noremote_upload_local_results):
|
||||
# a job's locally executed actions (PR code included) never enter the shared
|
||||
# action cache from here. Developer rcs keep Bazel's default.
|
||||
#
|
||||
# The rc and the key material go to BAZEL_CI_SECRET_DIR, which must be outside
|
||||
# the workspace (tests that walk the checkout must never see an endpoint or a
|
||||
# cert path) and outside BAZEL_CI_CACHE_DIR (the runner cache must never store
|
||||
# credentials). The endpoint is masked in the job log.
|
||||
#
|
||||
# BAZEL_FORK_CACHE=true (bazel.yml mode "cache": rbe=cache dispatches, and
|
||||
# fork/Dependabot runs while rbe-fork is closed) appends --config=fork-cache:
|
||||
# .bazelrc's credential-free, read-only rbe-west cache. While that cache
|
||||
# advertises zstd (cache-zstd-probe.sh asks its GetCapabilities; any failure
|
||||
# means no) it also asks for zstd transfers (--remote_cache_compression). A
|
||||
# probe, not a repository variable: fork pull_request runs see no vars. No
|
||||
# other mode ever asks, because only the anonymous cache can advertise zstd,
|
||||
# and Bazel refuses a remote that does not. With BAZEL_RRC_READ=true too
|
||||
# (bazel.yml's remote repo contents cache readers alone: the jobs whose
|
||||
# configs rrc-lane-commands.txt seeds), and while rbe-cache answers
|
||||
# (cache-rrc-probe.sh, which also holds the committed kill switch), it reads
|
||||
# Bazel's remote repo contents cache, as those jobs' trusted readers do: the
|
||||
# trees rrc-seed wrote on main pushes, through rbe-cache's anonymous AC and
|
||||
# CAS reads. The job's step summary says whether it reads, and why.
|
||||
#
|
||||
# RBE_FORK_CERT_FILE + RBE_FORK_KEY_FILE + RBE_FORK_ENDPOINT + RBE_FORK_INSTANCE
|
||||
# (bazel.yml modes fork-ro/fork-rw: fork-credential.sh's outputs, a
|
||||
# short-lived rbe-fork-mint certificate) enable --config=remote-exec against
|
||||
# rbe-fork: instance oss-fork (the fork pool, nothing cached) or oss
|
||||
# (allowlisted authors: the OSS pool, results cached by the workers). The
|
||||
# three modes are mutually exclusive.
|
||||
#
|
||||
# Outputs (to $GITHUB_OUTPUT when set, else stdout): rc=<path>,
|
||||
# remote=true|false, cache=true|false.
|
||||
set -euo pipefail
|
||||
|
||||
cache_dir="${BAZEL_CI_CACHE_DIR:?BAZEL_CI_CACHE_DIR is required}"
|
||||
secret_dir="${BAZEL_CI_SECRET_DIR:?BAZEL_CI_SECRET_DIR is required}"
|
||||
workspace="${GITHUB_WORKSPACE:-$PWD}"
|
||||
|
||||
abs() { mkdir -p "$1" && (cd "$1" && pwd -P); }
|
||||
cache_dir="$(abs "$cache_dir")"
|
||||
secret_dir="$(abs "$secret_dir")"
|
||||
workspace="$(cd "$workspace" && pwd -P)"
|
||||
case "$secret_dir/" in
|
||||
"$workspace"/*)
|
||||
echo "setup-bazel: BAZEL_CI_SECRET_DIR ($secret_dir) must be outside the workspace" >&2
|
||||
exit 1
|
||||
;;
|
||||
"$cache_dir"/*)
|
||||
echo "setup-bazel: BAZEL_CI_SECRET_DIR must not be inside the cached BAZEL_CI_CACHE_DIR" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
chmod 700 "$secret_dir"
|
||||
mkdir -p "$cache_dir/repo"
|
||||
|
||||
mask() {
|
||||
local v="${1:-}"
|
||||
[[ -z "$v" ]] && return 0
|
||||
printf '::add-mask::%s\n' "$v"
|
||||
}
|
||||
|
||||
# Mask the endpoint and its bare host[:port]: Bazel prints bytestream:// URIs
|
||||
# that carry the host without the scheme.
|
||||
executor="${BAZEL_REMOTE_EXECUTOR:-}"
|
||||
if [[ -n "$executor" ]]; then
|
||||
mask "$executor"
|
||||
hostport="${executor#*://}"
|
||||
hostport="${hostport%%/*}"
|
||||
mask "$hostport"
|
||||
mask "${hostport%:*}"
|
||||
# Bazel's connection errors print the resolved address ("host/1.2.3.4:443").
|
||||
if command -v getent >/dev/null 2>&1; then
|
||||
while read -r addr _; do
|
||||
mask "$addr"
|
||||
done < <(getent ahosts "${hostport%:*}" 2>/dev/null | sort -u -k1,1)
|
||||
fi
|
||||
fi
|
||||
|
||||
cert="${RBE_TLS_CERT:-}"
|
||||
key="${RBE_TLS_KEY:-}"
|
||||
ca="${RBE_TLS_CA:-}"
|
||||
instance="${RBE_INSTANCE:-}"
|
||||
fork_cache="${BAZEL_FORK_CACHE:-}"
|
||||
rrc_reader="${BAZEL_RRC_READ:-}"
|
||||
fork_cert="${RBE_FORK_CERT_FILE:-}"
|
||||
fork_key="${RBE_FORK_KEY_FILE:-}"
|
||||
fork_endpoint="${RBE_FORK_ENDPOINT:-}"
|
||||
fork_instance="${RBE_FORK_INSTANCE:-}"
|
||||
fork_fields=0
|
||||
for v in "$fork_cert" "$fork_key" "$fork_endpoint" "$fork_instance"; do
|
||||
[[ -n "$v" ]] && fork_fields=$((fork_fields + 1))
|
||||
done
|
||||
case "$fork_fields/$fork_instance" in
|
||||
0/ | 4/oss | 4/oss-fork) ;;
|
||||
*)
|
||||
echo "setup-bazel: RBE_FORK_CERT_FILE, RBE_FORK_KEY_FILE, RBE_FORK_ENDPOINT and RBE_FORK_INSTANCE (oss or oss-fork) go together" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
case "$fork_cache" in
|
||||
"" | true) ;;
|
||||
*)
|
||||
echo "setup-bazel: BAZEL_FORK_CACHE must be \"true\" or empty, got \"$fork_cache\"" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
case "$rrc_reader" in
|
||||
"" | true) ;;
|
||||
*)
|
||||
echo "setup-bazel: BAZEL_RRC_READ must be \"true\" or empty, got \"$rrc_reader\"" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
rc="$secret_dir/ci.bazelrc"
|
||||
umask 077
|
||||
{
|
||||
echo "# Generated by .github/actions/setup-bazel; not a workspace file."
|
||||
echo "common --repository_cache=$cache_dir/repo"
|
||||
# The repo contents cache (default: under the repository cache, so in
|
||||
# the runner cache) holds extracted repos Bazel never re-verifies; off.
|
||||
echo "common --repo_contents_cache="
|
||||
# Every mode fetches external repositories on the runner. gazelle's
|
||||
# go_repository fetches Go modules with the go command (fetch_repo), not
|
||||
# Bazel's downloader, and the go command never retries: one TLS
|
||||
# handshake timeout against proxy.golang.org failed a whole lane. With
|
||||
# "|" the go command moves to the next entry on any error (a ","
|
||||
# list only on 404/410): the proxy twice, then the module's origin.
|
||||
# fetch_repo checks every module against its go.sum hash whatever the
|
||||
# source. Key neutral: repository fetching only, no action reads it.
|
||||
echo "common --repo_env=GOPROXY=https://proxy.golang.org|https://proxy.golang.org|direct"
|
||||
# Bazel's own downloader (the Go SDK, http_archive) already retries;
|
||||
# give slow TLS handshakes and reads twice the default timeouts.
|
||||
echo "common --http_timeout_scaling=2.0"
|
||||
# The client's JVM heap. Bazel's default caps it at 25% of RAM, about
|
||||
# 2 GB on the 8 GB 2 vCPU runners every remote lane uses; //... analysis
|
||||
# fits today, with little headroom. A startup option: key neutral, it only
|
||||
# restarts the server. Each lane reports peak-heap-size to size this.
|
||||
echo "startup --host_jvm_args=-Xmx4g"
|
||||
} >"$rc"
|
||||
|
||||
# write_pem DEST VALUE: decode base64 (or accept raw PEM) and check it is PEM.
|
||||
write_pem() {
|
||||
local dest="$1" body="$2"
|
||||
body="$(printf '%s' "$body" | tr -d '\r')"
|
||||
if [[ "$body" != *"-----BEGIN "* ]]; then
|
||||
if ! body="$(printf '%s' "$body" | tr -d '\n ' | base64 -d 2>/dev/null)"; then
|
||||
echo "setup-bazel: $(basename "$dest") secret is neither PEM nor base64 PEM" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
if [[ "$body" != *"-----BEGIN "* ]]; then
|
||||
echo "setup-bazel: $(basename "$dest") secret does not decode to PEM" >&2
|
||||
return 1
|
||||
fi
|
||||
# GitHub masks the secret as stored (base64), not what it decodes to.
|
||||
local line
|
||||
while IFS= read -r line; do
|
||||
[[ -z "$line" || "$line" == -----* ]] || mask "$line"
|
||||
done <<<"$body"
|
||||
printf '%s\n' "$body" >"$dest"
|
||||
chmod 600 "$dest"
|
||||
}
|
||||
|
||||
set_fields=0
|
||||
for v in "$executor" "$cert" "$key"; do
|
||||
[[ -n "$v" ]] && set_fields=$((set_fields + 1))
|
||||
done
|
||||
|
||||
remote=false
|
||||
cache=false
|
||||
if [[ "$fork_fields" -eq 4 ]]; then
|
||||
if [[ "$set_fields" -ne 0 || "$fork_cache" == true ]]; then
|
||||
echo "setup-bazel: the rbe-fork certificate, the remote execution secrets and BAZEL_FORK_CACHE are mutually exclusive" >&2
|
||||
exit 1
|
||||
fi
|
||||
{
|
||||
echo "build:remote-exec --remote_executor=$fork_endpoint"
|
||||
echo "build:remote-exec --tls_client_certificate=$fork_cert"
|
||||
echo "build:remote-exec --tls_client_key=$fork_key"
|
||||
echo "build:remote-exec --remote_instance_name=$fork_instance"
|
||||
echo "build:remote-exec --noremote_upload_local_results"
|
||||
# The farm admits 128 connections per source IP (Blacksmith runners
|
||||
# share addresses). Key-neutral, like everything in this rc.
|
||||
echo "build:remote-exec --remote_max_connections=8"
|
||||
echo "build --config=remote-exec"
|
||||
} >>"$rc"
|
||||
remote=true
|
||||
echo "setup-bazel: remote execution on rbe-fork (instance $fork_instance, short-lived certificate)"
|
||||
elif [[ "$set_fields" -eq 3 ]]; then
|
||||
if [[ "$fork_cache" == true ]]; then
|
||||
echo "setup-bazel: BAZEL_FORK_CACHE and the remote execution secrets are mutually exclusive" >&2
|
||||
exit 1
|
||||
fi
|
||||
write_pem "$secret_dir/client.crt" "$cert"
|
||||
write_pem "$secret_dir/client.key" "$key"
|
||||
# Outside the rc block below: write_pem's mask commands go to the log.
|
||||
if [[ -n "$ca" ]]; then
|
||||
write_pem "$secret_dir/ca.crt" "$ca"
|
||||
fi
|
||||
{
|
||||
echo "build:remote-exec --remote_executor=$executor"
|
||||
echo "build:remote-exec --tls_client_certificate=$secret_dir/client.crt"
|
||||
echo "build:remote-exec --tls_client_key=$secret_dir/client.key"
|
||||
if [[ -n "$ca" ]]; then
|
||||
echo "build:remote-exec --tls_certificate=$secret_dir/ca.crt"
|
||||
fi
|
||||
if [[ -n "$instance" ]]; then
|
||||
echo "build:remote-exec --remote_instance_name=$instance"
|
||||
fi
|
||||
echo "build:remote-exec --noremote_upload_local_results"
|
||||
# Every command in this job (test, run //:gazelle, query) uses the
|
||||
# executor; the committed .bazelrc holds the generic remote-exec tuning.
|
||||
echo "build --config=remote-exec"
|
||||
} >>"$rc"
|
||||
if [[ -z "$instance" ]]; then
|
||||
echo "::warning title=RBE_INSTANCE not set::remote execution uses the executor's default instance, whose action cache other repos on the farm may share; set RBE_INSTANCE to a beads-only instance"
|
||||
fi
|
||||
remote=true
|
||||
echo "setup-bazel: remote execution enabled"
|
||||
elif [[ "$set_fields" -ne 0 ]]; then
|
||||
echo "setup-bazel: remote execution is partially configured; BAZEL_REMOTE_EXECUTOR, RBE_TLS_CERT and RBE_TLS_KEY must be set together (or none, for local execution)" >&2
|
||||
exit 1
|
||||
elif [[ "$fork_cache" == true ]]; then
|
||||
# The remote repo contents cache, read-only, for the jobs that opt in
|
||||
# (BAZEL_RRC_READ: only their configs are seeded), while rbe-cache
|
||||
# answers and the probe's kill switch (fork_rrc_read) is on. With the
|
||||
# startup flag set and the cache unreachable, every repository first
|
||||
# fails a lookup (gascity engdocs/design/bazel-remote-repo-contents-cache.md,
|
||||
# R6), so a closed or down rbe-cache gets no lines, and a notice says
|
||||
# why. That holds at probe time only: after loading, Bazel fetches the
|
||||
# files lazily, and losing rbe-cache then fails the command (R4). Both
|
||||
# lines are key neutral, as for the trusted readers; fork-cache uploads
|
||||
# nothing, and rbe-cache refuses every write.
|
||||
rrc_read=false
|
||||
if [[ "$rrc_reader" != true ]]; then
|
||||
why="not a remote repo contents cache reader (no BAZEL_RRC_READ)"
|
||||
elif why=$(bash "$(dirname "${BASH_SOURCE[0]}")/cache-rrc-probe.sh" 2>&1); then
|
||||
rrc_read=true
|
||||
echo "$why"
|
||||
else
|
||||
echo "::notice title=No remote repo contents cache::$why"
|
||||
fi
|
||||
echo "Fork cache remote repo contents cache read: **$([[ "$rrc_read" == true ]] && echo on || echo off)** (${why#rbe-cache rrc probe: })" >>"${GITHUB_STEP_SUMMARY:-/dev/null}"
|
||||
# zstd for the anonymous cache's transfers while it advertises zstd:
|
||||
# transport only, so action keys are unchanged. The probes never fail
|
||||
# this script; they only decide the lines.
|
||||
{
|
||||
echo "build --config=fork-cache"
|
||||
if bash "$(dirname "${BASH_SOURCE[0]}")/cache-zstd-probe.sh"; then
|
||||
echo "build:fork-cache --remote_cache_compression"
|
||||
fi
|
||||
if [[ "$rrc_read" == true ]]; then
|
||||
echo "startup --experimental_remote_repo_contents_cache"
|
||||
echo "common --loading_phase_threads=64"
|
||||
fi
|
||||
} >>"$rc"
|
||||
cache=true
|
||||
echo "setup-bazel: read-only remote cache (rbe-cache); executing locally"
|
||||
else
|
||||
echo "setup-bazel: no remote execution secrets; running locally"
|
||||
fi
|
||||
|
||||
out="${GITHUB_OUTPUT:-/dev/stdout}"
|
||||
{
|
||||
echo "rc=$rc"
|
||||
echo "remote=$remote"
|
||||
echo "cache=$cache"
|
||||
} >>"$out"
|
||||
17
.github/allowed-actions.json
vendored
17
.github/allowed-actions.json
vendored
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"github_owned_allowed": true,
|
||||
"verified_allowed": false,
|
||||
"patterns_allowed": [
|
||||
"DeterminateSystems/determinate-nix-action@*",
|
||||
"DeterminateSystems/nix-installer-action@*",
|
||||
"anchore/sbom-action@*",
|
||||
"codecov/codecov-action@*",
|
||||
"cygwin/cygwin-install-action@*",
|
||||
"docker/setup-buildx-action@*",
|
||||
"dorny/paths-filter@*",
|
||||
"goreleaser/goreleaser-action@*",
|
||||
"msys2/setup-msys2@*",
|
||||
"ossf/scorecard-action@*",
|
||||
"peter-evans/create-pull-request@*"
|
||||
]
|
||||
}
|
||||
21
.github/bazel-farm-allowlist.txt
vendored
21
.github/bazel-farm-allowlist.txt
vendored
|
|
@ -1,21 +0,0 @@
|
|||
# GitHub users whose fork PRs get the Bazel remote-execution farm
|
||||
# (.github/workflows/bazel-farm.yml). One numeric user id per line, the login
|
||||
# as a comment; blank lines and # comments are ignored. Ids, not logins: a
|
||||
# renamed account's old login can be registered by anyone. Look an id up
|
||||
# with: gh api users/<login> --jq .id
|
||||
#
|
||||
# Read only from the base branch (the pull_request_target run's own commit),
|
||||
# never from a PR: editing this file in a PR changes nothing until it merges.
|
||||
# Both the PR author and the user who triggered the run (opener or pusher)
|
||||
# must be listed, and the PR must come from the author's own fork. A listed
|
||||
# user gets same-repo-PR-level trust: its PR code runs with the RBE client
|
||||
# certificate. Same people as gascity's .github/blacksmith-allowlist.txt.
|
||||
# rbe-west's rbe-fork-mint reads this file too, from the default branch, by
|
||||
# the same rules: a listed author's own-fork PR, triggered by a listed user,
|
||||
# gets rbe-fork tier rw (bazel.yml mode fork-rw: the trusted OSS pool) when
|
||||
# the farm has rw switched on; everyone else gets tier ro (fork pool). A
|
||||
# line that is not a numeric id makes the mint treat the list as empty.
|
||||
8082291 # julianknutsen
|
||||
91582 # quad341
|
||||
36544495 # sjarmak
|
||||
2568253 # csells
|
||||
143
.github/copilot-instructions.md
vendored
143
.github/copilot-instructions.md
vendored
|
|
@ -1,15 +1,134 @@
|
|||
# GitHub Copilot instructions for beads
|
||||
# GitHub Copilot Instructions for Beads
|
||||
|
||||
The canonical contributor instructions for this repository are in
|
||||
[AGENTS.md](../AGENTS.md); area-specific rules are in the nested `AGENTS.md`
|
||||
files listed in its routing table. Read those, not this file, for workflow,
|
||||
build, test, and scope rules.
|
||||
## Project Overview
|
||||
|
||||
The rules most often missed in review:
|
||||
**beads** (command: `bd`) is a Git-backed issue tracker designed for AI-supervised coding workflows. We dogfood our own tool for all task tracking.
|
||||
|
||||
- A PR must close a documented GitHub issue (filed before or alongside it).
|
||||
- Build with `make install`, never `go build -o bd ./cmd/bd` or `go install ./cmd/bd`.
|
||||
- `make ci-pr-lint` must pass with zero issues; choose tests with
|
||||
[engdocs/TESTING.md](../engdocs/TESTING.md).
|
||||
- Never create test issues in a production database; use `t.TempDir()`.
|
||||
- CLI output uses small Unicode status symbols, never emoji icons.
|
||||
**Key Features:**
|
||||
- Dependency-aware issue tracking
|
||||
- Auto-sync with Git via JSONL
|
||||
- AI-optimized CLI with JSON output
|
||||
- Built-in daemon for background operations
|
||||
- MCP server integration for Claude and other AI assistants
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- **Language**: Go 1.21+
|
||||
- **Storage**: SQLite (internal/storage/sqlite/)
|
||||
- **CLI Framework**: Cobra
|
||||
- **Testing**: Go standard testing + table-driven tests
|
||||
- **CI/CD**: GitHub Actions
|
||||
- **MCP Server**: Python (integrations/beads-mcp/)
|
||||
|
||||
## Coding Guidelines
|
||||
|
||||
### Testing
|
||||
- Always write tests for new features
|
||||
- Use `BEADS_DB=/tmp/test.db` to avoid polluting production database
|
||||
- Run `go test -short ./...` before committing
|
||||
- Never create test issues in production DB (use temporary DB)
|
||||
|
||||
### Code Style
|
||||
- Run `golangci-lint run ./...` before committing
|
||||
- Follow existing patterns in `cmd/bd/` for new commands
|
||||
- Add `--json` flag to all commands for programmatic use
|
||||
- Update docs when changing behavior
|
||||
|
||||
### Git Workflow
|
||||
- Always commit `.beads/issues.jsonl` with code changes
|
||||
- Run `bd sync` at end of work sessions
|
||||
- Install git hooks: `bd hooks install` (ensures DB ↔ JSONL consistency)
|
||||
|
||||
## Issue Tracking with bd
|
||||
|
||||
**CRITICAL**: This project uses **bd** for ALL task tracking. Do NOT create markdown TODO lists.
|
||||
|
||||
### Essential Commands
|
||||
|
||||
```bash
|
||||
# Find work
|
||||
bd ready --json # Unblocked issues
|
||||
bd stale --days 30 --json # Forgotten issues
|
||||
|
||||
# Create and manage (ALWAYS include --description)
|
||||
bd create "Title" --description="Detailed context" -t bug|feature|task -p 0-4 --json
|
||||
bd update <id> --status in_progress --json
|
||||
bd close <id> --reason "Done" --json
|
||||
|
||||
# Search
|
||||
bd list --status open --priority 1 --json
|
||||
bd show <id> --json
|
||||
|
||||
# Sync (CRITICAL at end of session!)
|
||||
bd sync # Force immediate export/commit/push
|
||||
```
|
||||
|
||||
### Workflow
|
||||
|
||||
1. **Check ready work**: `bd ready --json`
|
||||
2. **Claim task**: `bd update <id> --status in_progress`
|
||||
3. **Work on it**: Implement, test, document
|
||||
4. **Discover new work?** `bd create "Found bug" --description="What was found and why" -p 1 --deps discovered-from:<parent-id> --json`
|
||||
5. **Complete**: `bd close <id> --reason "Done" --json`
|
||||
6. **Sync**: `bd sync` (flushes changes to git immediately)
|
||||
|
||||
**IMPORTANT**: Always include `--description` when creating issues. Issues without descriptions lack context for future work.
|
||||
|
||||
### Priorities
|
||||
|
||||
- `0` - Critical (security, data loss, broken builds)
|
||||
- `1` - High (major features, important bugs)
|
||||
- `2` - Medium (default, nice-to-have)
|
||||
- `3` - Low (polish, optimization)
|
||||
- `4` - Backlog (future ideas)
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
beads/
|
||||
├── cmd/bd/ # CLI commands (add new commands here)
|
||||
├── internal/
|
||||
│ ├── types/ # Core data types
|
||||
│ └── storage/ # Storage layer
|
||||
│ └── sqlite/ # SQLite implementation
|
||||
├── integrations/
|
||||
│ └── beads-mcp/ # MCP server (Python)
|
||||
├── examples/ # Integration examples
|
||||
├── docs/ # Documentation
|
||||
└── .beads/
|
||||
├── beads.db # SQLite database (DO NOT COMMIT)
|
||||
└── issues.jsonl # Git-synced issue storage
|
||||
```
|
||||
|
||||
## Available Resources
|
||||
|
||||
### MCP Server (Recommended)
|
||||
Use the beads MCP server for native function calls instead of shell commands:
|
||||
- Install: `pip install beads-mcp`
|
||||
- Functions: `mcp__beads__ready()`, `mcp__beads__create()`, etc.
|
||||
- See `integrations/beads-mcp/README.md`
|
||||
|
||||
### Scripts
|
||||
- `./scripts/bump-version.sh <version> --commit` - Update all version files atomically
|
||||
- `./scripts/release.sh <version>` - Complete release workflow
|
||||
- `./scripts/update-homebrew.sh <version>` - Update Homebrew formula
|
||||
|
||||
### Key Documentation
|
||||
- **AGENTS.md** - Comprehensive AI agent guide (detailed workflows, advanced features)
|
||||
- **AGENT_INSTRUCTIONS.md** - Development procedures, testing, releases
|
||||
- **README.md** - User-facing documentation
|
||||
- **docs/CLI_REFERENCE.md** - Complete command reference
|
||||
|
||||
## Important Rules
|
||||
|
||||
- ✅ Use bd for ALL task tracking
|
||||
- ✅ Always use `--json` flag for programmatic use
|
||||
- ✅ Run `bd sync` at end of sessions
|
||||
- ✅ Test with `BEADS_DB=/tmp/test.db`
|
||||
- ❌ Do NOT create markdown TODO lists
|
||||
- ❌ Do NOT create test issues in production DB
|
||||
- ❌ Do NOT commit `.beads/beads.db` (JSONL only)
|
||||
|
||||
---
|
||||
|
||||
**For detailed workflows and advanced features, see [AGENTS.md](../AGENTS.md)**
|
||||
|
|
|
|||
43
.github/dependabot.yml
vendored
43
.github/dependabot.yml
vendored
|
|
@ -5,39 +5,10 @@ updates:
|
|||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
# Headroom above the group count: grouped PRs count as one, but SemVer-major
|
||||
# singles plus the testcontainers group plus a migration window with old
|
||||
# singleton PRs still open must not wedge at the limit (dependabot opens no
|
||||
# new version PR while the limit is saturated).
|
||||
open-pull-requests-limit: 10
|
||||
open-pull-requests-limit: 5
|
||||
labels:
|
||||
- "dependencies"
|
||||
- "go"
|
||||
# Group minor/patch Go bumps into a single PR. Every gomod bump rewrites
|
||||
# go.sum, which invalidates the nix vendorHash in default.nix; N singleton
|
||||
# PRs mean N vendorHash bot-commits and N '@dependabot recreate' rounds
|
||||
# after each merge (see update-vendor-hash.yml caveat). One grouped PR
|
||||
# gets one bot-computed hash. SemVer-majors stay separate so they cannot
|
||||
# block the routine group (note: pre-1.0 modules ship breaking changes as
|
||||
# "minor" bumps, which do ride in the group — dependabot classifies by
|
||||
# version arithmetic only).
|
||||
#
|
||||
# testcontainers-go and its modules/dolt child must bump in lockstep
|
||||
# (the module requires a matching root), and the project pins 0.x
|
||||
# releases with routine breaking changes — so they get their own group:
|
||||
# always coupled together, never blocking go-deps.
|
||||
groups:
|
||||
testcontainers:
|
||||
applies-to: version-updates
|
||||
patterns:
|
||||
- "github.com/testcontainers/testcontainers-go*"
|
||||
go-deps:
|
||||
applies-to: version-updates
|
||||
exclude-patterns:
|
||||
- "github.com/testcontainers/testcontainers-go*"
|
||||
update-types:
|
||||
- "minor"
|
||||
- "patch"
|
||||
|
||||
# GitHub Actions
|
||||
- package-ecosystem: "github-actions"
|
||||
|
|
@ -48,14 +19,9 @@ updates:
|
|||
labels:
|
||||
- "dependencies"
|
||||
- "ci"
|
||||
groups:
|
||||
actions:
|
||||
applies-to: version-updates
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
# Python (beads-mcp)
|
||||
- package-ecosystem: "uv"
|
||||
- package-ecosystem: "pip"
|
||||
directory: "/integrations/beads-mcp"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
|
@ -64,8 +30,3 @@ updates:
|
|||
- "dependencies"
|
||||
- "python"
|
||||
- "mcp"
|
||||
groups:
|
||||
beads-mcp-python:
|
||||
applies-to: version-updates
|
||||
patterns:
|
||||
- "*"
|
||||
|
|
|
|||
44
.github/pages-redirect/index.html
vendored
44
.github/pages-redirect/index.html
vendored
|
|
@ -1,44 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="robots" content="noindex" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="redirect-destination" content="https://beads.gascity.com" />
|
||||
<meta http-equiv="refresh" content="1; url=https://beads.gascity.com/" />
|
||||
<title>Beads documentation has moved</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
The Beads documentation has moved to
|
||||
<a id="destination" href="https://beads.gascity.com/">beads.gascity.com</a>.
|
||||
</p>
|
||||
<noscript>
|
||||
<p>
|
||||
JavaScript is required to preserve this page's path. Continue to the
|
||||
<a href="https://beads.gascity.com/">current Beads documentation</a>.
|
||||
</p>
|
||||
</noscript>
|
||||
<script>
|
||||
(function () {
|
||||
var path = window.location.pathname;
|
||||
var destinationPath = path;
|
||||
|
||||
if (path === "/beads" || path === "/beads/") {
|
||||
destinationPath = "/";
|
||||
} else if (path.indexOf("/beads/") === 0) {
|
||||
destinationPath = path.slice("/beads".length);
|
||||
}
|
||||
|
||||
var destination =
|
||||
document.querySelector('meta[name="redirect-destination"]').content +
|
||||
destinationPath +
|
||||
window.location.search +
|
||||
window.location.hash;
|
||||
|
||||
document.getElementById("destination").href = destination;
|
||||
window.location.replace(destination);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
125
.github/scripts/bazel-farm-authorize.sh
vendored
125
.github/scripts/bazel-farm-authorize.sh
vendored
|
|
@ -1,125 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# bazel-farm.yml's authorize job: may this pull_request_target run hand a
|
||||
# fork PR's head to bazel.yml with the RBE secrets? Runs from a checkout of
|
||||
# the base branch (the run's own commit), never the PR; reads event facts
|
||||
# from the environment only (the workflow never interpolates them into a
|
||||
# script). Writes allowed=true|false to $GITHUB_OUTPUT and the reason to the
|
||||
# log and step summary. Exits non-zero only on a broken invocation.
|
||||
#
|
||||
# Allowed only when all hold:
|
||||
# EVENT_NAME is pull_request_target and ACTION is opened or synchronize
|
||||
# (reopened and ready_for_review would re-test a head no listed user
|
||||
# necessarily pushed: a fork collaborator's push while the PR was closed
|
||||
# or a draft);
|
||||
# BASE_REPO is REPOSITORY and HEAD_REPO is another repository (a fork);
|
||||
# HEAD_OWNER_ID (the head repository owner's numeric id) is PR_AUTHOR_ID:
|
||||
# the PR comes from the author's own fork, not from a third party's fork
|
||||
# whose owner could push between the author's review and "Create";
|
||||
# BASE_REF is DEFAULT_BRANCH;
|
||||
# HEAD_SHA is a full 40-hex commit id (what bazel.yml checks out);
|
||||
# PR_AUTHOR_ID and SENDER_ID (numeric user ids) are both on ALLOWLIST.
|
||||
# SENDER is who triggered this event: the pusher on synchronize, so a
|
||||
# collaborator on a listed author's fork cannot push code that runs with
|
||||
# secrets. Ids, not logins: a renamed account's old login can be
|
||||
# registered by anyone. Logins (PR_AUTHOR, SENDER) are for the log only.
|
||||
#
|
||||
# ALLOWLIST: one numeric user id per line; # starts a comment (the login,
|
||||
# for humans). Any other entry is a broken allowlist and fails the job.
|
||||
#
|
||||
# Inputs (environment): ALLOWLIST (file path), EVENT_NAME, ACTION,
|
||||
# REPOSITORY, BASE_REPO, HEAD_REPO, HEAD_OWNER_ID, BASE_REF, DEFAULT_BRANCH,
|
||||
# HEAD_SHA, PR_AUTHOR, PR_AUTHOR_ID, SENDER, SENDER_ID, GITHUB_OUTPUT;
|
||||
# GITHUB_STEP_SUMMARY optional.
|
||||
|
||||
set -euo pipefail
|
||||
# Byte semantics for the [A-Za-z0-9] / [0-9] classes and lower(): in some
|
||||
# UTF-8 locales they match or fold non-ASCII (e.g. the Kelvin sign to k).
|
||||
export LC_ALL=C
|
||||
|
||||
# ASCII lowercase. Not ${v,,}: that is bash >= 4, and macOS ships bash 3.2.
|
||||
# shellcheck disable=SC2018,SC2019 # ASCII only, on purpose (logins, repo names)
|
||||
lower() {
|
||||
printf '%s' "${1:-}" | tr 'A-Z' 'a-z'
|
||||
}
|
||||
|
||||
: "${GITHUB_OUTPUT:?GITHUB_OUTPUT is not set}"
|
||||
allowlist="${ALLOWLIST:?ALLOWLIST is not set}"
|
||||
if [[ ! -f "$allowlist" ]]; then
|
||||
echo "::error::allowlist $allowlist is missing" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
decide() {
|
||||
allowed=false
|
||||
reason="$1"
|
||||
}
|
||||
|
||||
# A login: GitHub's charset, lowercased. Anything else never matches.
|
||||
login() {
|
||||
local v="${1:-}"
|
||||
if [[ "$v" =~ ^[A-Za-z0-9]([A-Za-z0-9-]{0,38})$ ]]; then
|
||||
lower "$v"
|
||||
fi
|
||||
}
|
||||
|
||||
# A numeric GitHub user id; anything else is not one.
|
||||
is_id() {
|
||||
[[ "${1:-}" =~ ^[1-9][0-9]{0,19}$ ]]
|
||||
}
|
||||
|
||||
ids=()
|
||||
while IFS= read -r line || [[ -n "$line" ]]; do
|
||||
line="${line%%#*}"
|
||||
line="${line//[[:space:]]/}"
|
||||
[[ -n "$line" ]] || continue
|
||||
if ! is_id "$line"; then
|
||||
echo "::error::allowlist $allowlist has an entry that is not a numeric user id" >&2
|
||||
exit 1
|
||||
fi
|
||||
ids+=("$line")
|
||||
done < "$allowlist"
|
||||
|
||||
listed() {
|
||||
local want="${1:-}" id
|
||||
is_id "$want" || return 1
|
||||
for id in "${ids[@]}"; do
|
||||
if [[ "$id" == "$want" ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
allowed=true
|
||||
reason="author and sender are on the allowlist"
|
||||
author="${PR_AUTHOR:-}"
|
||||
sender="${SENDER:-}"
|
||||
if [[ "${EVENT_NAME:-}" != pull_request_target ]]; then
|
||||
decide "event is not pull_request_target"
|
||||
elif ! [[ "${ACTION:-}" =~ ^(opened|synchronize)$ ]]; then
|
||||
decide "action is not opened or synchronize"
|
||||
elif [[ -z "${REPOSITORY:-}" || "${BASE_REPO:-}" != "$REPOSITORY" ]]; then
|
||||
decide "PR base repository is not this repository"
|
||||
elif [[ -z "${HEAD_REPO:-}" || "$(lower "$HEAD_REPO")" == "$(lower "${REPOSITORY:-}")" ]]; then
|
||||
decide "PR head is not a fork (same-repo PRs use pr.yml's remote run)"
|
||||
elif ! is_id "${HEAD_OWNER_ID:-}" || [[ "${HEAD_OWNER_ID}" != "${PR_AUTHOR_ID:-}" ]]; then
|
||||
decide "PR head is not the author's own fork"
|
||||
elif [[ -z "${DEFAULT_BRANCH:-}" || "${BASE_REF:-}" != "$DEFAULT_BRANCH" ]]; then
|
||||
decide "PR does not target the default branch"
|
||||
elif ! [[ "${HEAD_SHA:-}" =~ ^[0-9a-f]{40}$ ]]; then
|
||||
decide "head SHA is not a full commit id"
|
||||
elif ! listed "${PR_AUTHOR_ID:-}"; then
|
||||
decide "PR author is not on the allowlist"
|
||||
elif ! listed "${SENDER_ID:-}"; then
|
||||
decide "the user who triggered this run is not on the allowlist"
|
||||
fi
|
||||
|
||||
# Logins are printed only after the charset check (log-injection safe).
|
||||
shown_author="$(login "$author")"
|
||||
shown_sender="$(login "$sender")"
|
||||
echo "allowed=$allowed" >> "$GITHUB_OUTPUT"
|
||||
msg="Bazel farm: allowed=$allowed ($reason; author ${shown_author:-<invalid>}, sender ${shown_sender:-<invalid>})"
|
||||
echo "$msg"
|
||||
if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then
|
||||
echo "$msg" >> "$GITHUB_STEP_SUMMARY"
|
||||
fi
|
||||
62
.github/scripts/bazel-gate.sh
vendored
62
.github/scripts/bazel-gate.sh
vendored
|
|
@ -1,62 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# pr.yml's ci-gate view of its bazel.yml call (the `bazel` job). bazel.yml's
|
||||
# rbe job decides the execution mode once and exports it as the call's
|
||||
# rbe-mode / rbe-enabled outputs; this script reads those outputs and never
|
||||
# re-derives the decision (repo variable, fork, secrets) itself.
|
||||
#
|
||||
# bazel-gate.sh skips the Bazel gate ids whose job is skipped by design
|
||||
# in this mode, for CI_GATE_SKIPPED_OK:
|
||||
# skip: every lane and the aggregate (BAZEL)
|
||||
# local: the remote-only BAZEL_EMBEDDED,
|
||||
# BAZEL_PROXIED, BAZEL_SERVER_STORAGE,
|
||||
# BAZEL_INTEGRATION and BAZEL_CMD_DOLT
|
||||
# cache: BAZEL_EMBEDDED, BAZEL_PROXIED,
|
||||
# BAZEL_SERVER_STORAGE (integration
|
||||
# and cmd-dolt run with the read-only
|
||||
# cache)
|
||||
# remote, fork-ro, fork-rw: none
|
||||
# bazel-gate.sh aggregate the value to gate on for BAZEL: the call's
|
||||
# aggregate result, or, when the mode is missing
|
||||
# or invalid (the rbe job failed, the call never
|
||||
# started), an unexpected value that ci-gate.sh
|
||||
# rejects.
|
||||
#
|
||||
# Any other skip, a failure, a cancellation, or a lane that should run but
|
||||
# reported nothing (pr.yml maps an empty output to skipped) fails the gate.
|
||||
#
|
||||
# Inputs (environment): BAZEL_RBE_MODE, BAZEL_RBE_ENABLED (the call's
|
||||
# rbe-mode / rbe-enabled outputs), BAZEL_CALL (needs.bazel.result).
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
mode="${BAZEL_RBE_MODE:-}"
|
||||
enabled="${BAZEL_RBE_ENABLED:-}"
|
||||
valid=false
|
||||
case "$mode/$enabled" in
|
||||
remote/true | fork-ro/true | fork-rw/true | local/false | cache/false | skip/false) valid=true ;;
|
||||
esac
|
||||
|
||||
case "${1:-}" in
|
||||
skips)
|
||||
skips=()
|
||||
if [[ "$valid" == true ]]; then
|
||||
case "$mode" in
|
||||
skip) skips+=(BAZEL BAZEL_TEST BAZEL_PURE BAZEL_RELEASE_CROSS BAZEL_EMBEDDED BAZEL_INTEGRATION BAZEL_DOLTSERVER BAZEL_PROXIED BAZEL_SERVER_STORAGE BAZEL_CMD_DOLT) ;;
|
||||
local) skips+=(BAZEL_EMBEDDED BAZEL_INTEGRATION BAZEL_PROXIED BAZEL_SERVER_STORAGE BAZEL_CMD_DOLT) ;;
|
||||
cache) skips+=(BAZEL_EMBEDDED BAZEL_PROXIED BAZEL_SERVER_STORAGE) ;;
|
||||
esac
|
||||
fi
|
||||
echo "${skips[*]-}"
|
||||
;;
|
||||
aggregate)
|
||||
if [[ "$valid" != true ]]; then
|
||||
echo "invalid-rbe-mode:$(printf '%s/%s' "$mode" "$enabled" | tr -cd 'a-z/')"
|
||||
else
|
||||
echo "${BAZEL_CALL:-}"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 skips|aggregate" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
56
.github/scripts/ci-gate.sh
vendored
56
.github/scripts/ci-gate.sh
vendored
|
|
@ -1,56 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Evaluate an aggregate GitHub Actions gate from needs.*.result values.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
gate_name="${CI_GATE_NAME:-CI Gate}"
|
||||
required_vars="${CI_GATE_REQUIRED:-}"
|
||||
skipped_ok_vars=" ${CI_GATE_SKIPPED_OK:-} "
|
||||
failed=0
|
||||
|
||||
is_skipped_ok() {
|
||||
local var="$1"
|
||||
[[ "$skipped_ok_vars" == *" $var "* ]]
|
||||
}
|
||||
|
||||
report_failure() {
|
||||
local message="$1"
|
||||
echo "::error::$message"
|
||||
failed=1
|
||||
}
|
||||
|
||||
if [[ -z "$required_vars" ]]; then
|
||||
report_failure "CI_GATE_REQUIRED is empty for $gate_name"
|
||||
fi
|
||||
|
||||
for var in $required_vars; do
|
||||
result="${!var:-}"
|
||||
case "$result" in
|
||||
success)
|
||||
echo "ok: $var=$result"
|
||||
;;
|
||||
skipped)
|
||||
if is_skipped_ok "$var"; then
|
||||
echo "ok: $var=$result (allowed)"
|
||||
else
|
||||
report_failure "$var was skipped"
|
||||
fi
|
||||
;;
|
||||
failure|cancelled)
|
||||
report_failure "$var=$result"
|
||||
;;
|
||||
"")
|
||||
report_failure "$var is unset"
|
||||
;;
|
||||
*)
|
||||
report_failure "$var has unexpected result: $result"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "$failed" -ne 0 ]]; then
|
||||
echo "$gate_name failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$gate_name passed"
|
||||
151
.github/scripts/docs-render-check.sh
vendored
151
.github/scripts/docs-render-check.sh
vendored
|
|
@ -1,151 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# docs-render-check.sh — baseline-aware Mintlify broken-link check for CI.
|
||||
#
|
||||
# Runs `mint broken-links` on the HEAD docs tree. When the HEAD has broken
|
||||
# page links, materializes the BASE docs tree (via git archive) and reports
|
||||
# only NET-NEW breakage — links that the PR introduced, not pre-existing ones.
|
||||
# Static-asset refs (.png/.svg/.jpg/.gif) are excluded: mint over-reports
|
||||
# in-tree images the published build serves fine.
|
||||
#
|
||||
# Usage:
|
||||
# docs-render-check.sh [<base-ref>]
|
||||
#
|
||||
# <base-ref> The base branch/sha to compare against (default: origin/main).
|
||||
# Enables baseline-aware net-new detection.
|
||||
#
|
||||
# Exit codes:
|
||||
# 0 — no net-new page-link regressions
|
||||
# 1 — net-new page-link regressions found (details on stdout), or the
|
||||
# mint tool itself failed to produce a broken-links report
|
||||
#
|
||||
# Requires: git, npx (Node.js)
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
DOCS_DIR="docs"
|
||||
DOCS_CONFIG="$DOCS_DIR/docs.json"
|
||||
BASE_REF="${1:-origin/main}"
|
||||
# Pinned so a floating release can't silently change the output format this
|
||||
# script parses (keep in sync with mint.sh).
|
||||
MINT_VERSION="${MINT_VERSION:-4.2.687}"
|
||||
MINT_CMD="${MINT_CMD:-npx --yes mint@$MINT_VERSION}"
|
||||
|
||||
WORK_TMP="$(mktemp -d)"
|
||||
trap 'rm -rf "$WORK_TMP"' EXIT
|
||||
|
||||
# Verify we have a Mintlify docs tree.
|
||||
if [[ ! -f "$DOCS_CONFIG" ]]; then
|
||||
echo "docs-render-check: no docs/docs.json found — skipping" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Static-asset refs are excluded: mint over-reports in-tree images the
|
||||
# published build serves fine.
|
||||
ASSET_EXTS='\.png$|\.svg$|\.jpg$|\.jpeg$|\.gif$|\.ico$|\.webp$|\.woff2?$|\.ttf$|\.eot$'
|
||||
|
||||
# has_report <mint-output-file> — did mint produce a broken-links report at
|
||||
# all (as opposed to dying on a registry outage / crash)?
|
||||
has_report() {
|
||||
grep -qE '✗|broken' "$1" 2>/dev/null
|
||||
}
|
||||
|
||||
# Parse `mint broken-links` report lines. Each broken link looks like:
|
||||
# [broken-links] tutorials/01-beads.md -> /tutorials/01-beads.md
|
||||
# or
|
||||
# ✗ /tutorials/01-beads.md
|
||||
# Capture path-shaped tokens on report lines only — root-relative (/foo) or
|
||||
# relative with a slash — excluding URLs and static assets. The same parser
|
||||
# runs on both HEAD and BASE output, so residual noise cancels out in the
|
||||
# net-new comparison.
|
||||
parse_mint_broken_links() {
|
||||
local file="$1"
|
||||
grep -E '✗|broken' "$file" 2>/dev/null \
|
||||
| grep -oE '[/][^ )]+|[A-Za-z0-9_.-]+/[^ )]+' \
|
||||
| grep -vE '^https?:|^[A-Za-z0-9_.-]+\.[A-Za-z]{2,}/' \
|
||||
| grep -vE "$ASSET_EXTS" \
|
||||
| sort -u || true
|
||||
}
|
||||
|
||||
# --- run_mint <docs-root> <output-file> → exit code -------------------------
|
||||
run_mint() {
|
||||
local root="$1"
|
||||
local out="$2"
|
||||
cd "$root"
|
||||
if $MINT_CMD broken-links >"$out" 2>&1; then
|
||||
cd - >/dev/null
|
||||
return 0
|
||||
fi
|
||||
cd - >/dev/null
|
||||
return 1
|
||||
}
|
||||
|
||||
HEAD_OUT="$WORK_TMP/head-mint.txt"
|
||||
BASE_OUT="$WORK_TMP/base-mint.txt"
|
||||
BASE_TREE="$WORK_TMP/base-docs"
|
||||
|
||||
# --- HEAD check --------------------------------------------------------------
|
||||
HEAD_EXIT=0
|
||||
run_mint "." "$HEAD_OUT" || HEAD_EXIT=$?
|
||||
|
||||
if [[ $HEAD_EXIT -eq 0 ]]; then
|
||||
echo "docs-render-check: no broken links in HEAD — PASS" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
HEAD_LINKS="$WORK_TMP/head-links.txt"
|
||||
parse_mint_broken_links "$HEAD_OUT" | sort -u >"$HEAD_LINKS"
|
||||
|
||||
if [[ ! -s "$HEAD_LINKS" ]]; then
|
||||
if has_report "$HEAD_OUT"; then
|
||||
# mint produced a report, but every flagged link is a static asset
|
||||
# we deliberately ignore. Pass.
|
||||
echo "docs-render-check: mint flagged only static-asset links — PASS" >&2
|
||||
exit 0
|
||||
fi
|
||||
# mint exited non-zero without producing a broken-links report at all
|
||||
# (registry outage, crash, output-format change). Fail closed rather
|
||||
# than let the gate silently stop enforcing.
|
||||
echo "::error::docs-render-check: mint failed without producing a broken-links report — tool failure, not a clean run"
|
||||
echo "mint output follows:" >&2
|
||||
cat "$HEAD_OUT" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- BASE check (baseline-aware) --------------------------------------------
|
||||
mkdir -p "$BASE_TREE"
|
||||
if git archive "$BASE_REF" -- "$DOCS_DIR" 2>/dev/null | tar -x -C "$BASE_TREE"; then
|
||||
BASE_EXIT=0
|
||||
run_mint "$BASE_TREE" "$BASE_OUT" || BASE_EXIT=$?
|
||||
BASE_LINKS="$WORK_TMP/base-links.txt"
|
||||
parse_mint_broken_links "$BASE_OUT" | sort -u >"$BASE_LINKS"
|
||||
# Net-new = in HEAD but NOT in BASE.
|
||||
NEW_LINKS="$WORK_TMP/new-links.txt"
|
||||
comm -23 "$HEAD_LINKS" "$BASE_LINKS" >"$NEW_LINKS"
|
||||
else
|
||||
echo "docs-render-check: could not materialize base tree from $BASE_REF — checking HEAD only" >&2
|
||||
cp "$HEAD_LINKS" "$WORK_TMP/new-links.txt"
|
||||
NEW_LINKS="$WORK_TMP/new-links.txt"
|
||||
fi
|
||||
|
||||
if [[ ! -s "$NEW_LINKS" ]]; then
|
||||
echo "docs-render-check: broken links exist but none are net-new — PASS (pre-existing baseline)" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# --- NET-NEW regressions found — fail with explanation --------------
|
||||
echo ""
|
||||
echo "::error::docs-render-check: net-new broken Mintlify page links detected"
|
||||
echo ""
|
||||
echo "The following page links are newly broken by this PR:"
|
||||
while IFS= read -r link; do
|
||||
echo " $link"
|
||||
done <"$NEW_LINKS"
|
||||
echo ""
|
||||
echo "──────────────────────────────────────────────────────────────────────────"
|
||||
echo "docs/ is authored for the Mintlify site (the beads Mintlify site),"
|
||||
echo "not for direct GitHub viewing. These paths/links are intentional —"
|
||||
echo "please don't reformat them for GitHub. If something is genuinely broken"
|
||||
echo "on the live site, note it in the PR and we'll fix it Mintlify-side."
|
||||
echo "──────────────────────────────────────────────────────────────────────────"
|
||||
exit 1
|
||||
545
.github/scripts/embedded-cmd-test-shards.txt
vendored
545
.github/scripts/embedded-cmd-test-shards.txt
vendored
|
|
@ -1,545 +0,0 @@
|
|||
# Embedded-Dolt cmd/bd test shard manifest.
|
||||
#
|
||||
# Format: <total_shards> <shard_number> <top_level_test_name>
|
||||
#
|
||||
# 100-shard split for the Bazel-only embedded-Dolt cmd tier
|
||||
# (bazel-embedded in .github/workflows/bazel.yml), bin-packed
|
||||
# longest-first by measured wall-time from
|
||||
# scripts/ci/embedded_cmd_test_durations.json (see that file for provenance
|
||||
# and its "relative weight, not absolute SLA" caveat) onto the shard
|
||||
# whose estimated wall time grows least: serial tests (no top-level
|
||||
# t.Parallel) add up, parallel ones share -test.parallel=4.
|
||||
# Regenerate with scripts/ci/gen_embedded_cmd_shard_manifest.py 100
|
||||
# --weights=duration --write after adding, splitting or removing
|
||||
# TestEmbedded* functions in cmd/bd/*_test.go. --write is
|
||||
# incremental: it keeps every already-assigned test on its current shard
|
||||
# and only places newly-discovered names, onto whichever shard is
|
||||
# currently lightest, so two unrelated PRs that each add one test do not
|
||||
# textually conflict or silently invalidate each other's packing. Pass
|
||||
# --repack to force a full from-scratch rebalance instead (a deliberate,
|
||||
# separate change — expect a large diff). --check only verifies every
|
||||
# discovered name is listed here exactly once (no stale or duplicate
|
||||
# entries); it does NOT verify the packing is still well-balanced.
|
||||
#
|
||||
# This file is generated: notes added here are erased by the next
|
||||
# regeneration. Add them to the generator or the durations file instead.
|
||||
|
||||
100 1 TestEmbeddedUpdateConcurrent
|
||||
|
||||
100 2 TestEmbeddedShowConcurrent
|
||||
|
||||
100 3 TestEmbeddedCloseConcurrent
|
||||
|
||||
100 4 TestEmbeddedEpicConcurrent
|
||||
|
||||
100 5 TestEmbeddedConfigConcurrent
|
||||
|
||||
100 6 TestEmbeddedListFilteringBasicAndLabels
|
||||
|
||||
100 7 TestEmbeddedDepConcurrent
|
||||
|
||||
100 8 TestEmbeddedMaxRowsListLimitInteraction
|
||||
|
||||
100 9 TestEmbeddedChildrenConcurrent
|
||||
|
||||
100 10 TestEmbeddedCreateScalarAndRelationships
|
||||
|
||||
100 11 TestEmbeddedKVConcurrent
|
||||
|
||||
100 12 TestEmbeddedGatedRendering
|
||||
|
||||
100 13 TestEmbeddedListFilteringStatusAndHierarchy
|
||||
|
||||
100 14 TestEmbeddedReopenConcurrent
|
||||
|
||||
100 15 TestEmbeddedPurgeWispsPlaneRetention
|
||||
|
||||
100 16 TestEmbeddedMemoryConcurrent
|
||||
|
||||
100 17 TestEmbeddedReopen
|
||||
|
||||
100 18 TestEmbeddedLabelPropagateRename
|
||||
100 18 TestEmbeddedPrune_protectsBeadCitedByCustomStatusBead
|
||||
|
||||
100 19 TestEmbeddedLabelConcurrent
|
||||
100 19 TestEmbeddedNewDoltStore_StrictReadOnlyRefusesWritesOnFreshDatabase
|
||||
|
||||
100 20 TestEmbeddedInitRoleRoutingRetainedFork
|
||||
100 20 TestEmbeddedMigrateSchema_IdentityMismatchRefusesBeforeApplying
|
||||
|
||||
100 21 TestEmbeddedMaxRowsReady
|
||||
100 21 TestEmbeddedMigratePersonal_movesIssues
|
||||
|
||||
100 22 TestEmbeddedCount
|
||||
100 22 TestEmbeddedIfRevisionCloseReplaysMoleculeAutoClose
|
||||
|
||||
100 23 TestEmbeddedCountConcurrent
|
||||
100 23 TestEmbeddedExportExcludeOwner_flag
|
||||
|
||||
100 24 TestEmbeddedEventsTailFollowReportsTruncationOnTheStream
|
||||
100 24 TestEmbeddedUndeferConcurrent
|
||||
100 24 TestEmbeddedWispGCProtectsActiveWisps
|
||||
|
||||
100 25 TestEmbeddedDoltRemoteAdd_LocalOnly_FiresBeforeGuard
|
||||
100 25 TestEmbeddedMaxRowsListBasic
|
||||
100 25 TestEmbeddedRemovedBackendHealRejectionPerBackend
|
||||
|
||||
100 26 TestEmbeddedDoltRemoteAdd_JSON_AllowGitOrigin_WarningOnStderr
|
||||
100 26 TestEmbeddedExternalMutationPolicy
|
||||
100 26 TestEmbeddedPersistentPreRunLogsAndSkipsIdentityCheckForFreshEmbeddedWorkspace
|
||||
|
||||
100 27 TestEmbeddedDoltRemoteAdd_GitOriginCollision_RefusalMessageCopy
|
||||
100 27 TestEmbeddedNewDoltStoreFromConfig_DottedDBName
|
||||
100 27 TestEmbeddedShipConcurrent
|
||||
|
||||
100 28 TestEmbeddedDoltLocalOnly_RemoteAdd_RefusesExitOne
|
||||
100 28 TestEmbeddedHistoryConcurrent
|
||||
100 28 TestEmbeddedImportChunkedRealStoreResumeConverges
|
||||
|
||||
100 29 TestEmbeddedDoltLocalOnly_RemoteAdd_ErrorOnStderr
|
||||
100 29 TestEmbeddedEpicCloseEligibleReasonFlag
|
||||
100 29 TestEmbeddedImportChunkedNoReadyWindowWithReadinessEdgeIntoCycle
|
||||
|
||||
100 30 TestEmbeddedCloseGuardsAndEpics
|
||||
100 30 TestEmbeddedDoltLocalOnly_Push_ExitsZeroWithMessage
|
||||
100 30 TestEmbeddedImportChunkedCrossBucketBlocksEdgesResumeBackfills
|
||||
|
||||
100 31 TestEmbeddedDoltLocalOnly_ConfigRoundTrip
|
||||
100 31 TestEmbeddedIfRevisionCloseWarnsOnForcedOpenChildren
|
||||
100 31 TestEmbeddedInitSelectedExcludeRoutingForkInvalidQuiet
|
||||
|
||||
100 32 TestEmbeddedDoctorUnsupportedJSON
|
||||
100 32 TestEmbeddedIfRevisionAdvertisedOnFourVerbs
|
||||
100 32 TestEmbeddedListSearchAndOutputFormats
|
||||
|
||||
100 33 TestEmbeddedBootstrapJSONLAndGitOrigin
|
||||
100 33 TestEmbeddedDeleteJournalsTheRequestingActor
|
||||
100 33 TestEmbeddedExportExcludeOwner_verbose
|
||||
|
||||
100 34 TestEmbeddedCopyIssueRelations_preservesCommentWithTimestamp
|
||||
100 34 TestEmbeddedEventsTailReportsTruncationToTheCLI
|
||||
100 34 TestEmbeddedUnclaimBatchAndRefusals
|
||||
100 34 TestEmbeddedWispGCPurgeClosedDoesNotCascadeIntoLiveSteps
|
||||
|
||||
100 35 TestEmbeddedAutoPruneRespectsBdConfigSet
|
||||
100 35 TestEmbeddedEventsReadNoticesADisabledJournal
|
||||
100 35 TestEmbeddedGateCreateBeadRename
|
||||
100 35 TestEmbeddedVersionedHistoryEnvIsProcessWideAndOnlyTurnsRecordingOn
|
||||
|
||||
100 36 TestEmbeddedAutoPruneLeavesAnUnboundedJournalAlone
|
||||
100 36 TestEmbeddedDoltRemoteResetData_UnknownRemote
|
||||
100 36 TestEmbeddedGateConcurrent
|
||||
100 36 TestEmbeddedUnclaimIfAssigneeCLIDifferentSpelling
|
||||
|
||||
100 37 TestEmbeddedAutoPruneBoundsTheJournalAfterAMutatingCommand
|
||||
100 37 TestEmbeddedDoltRemoteResetData_CloudRemoteRefused
|
||||
100 37 TestEmbeddedMaxRowsDepTreeAndDuplicates
|
||||
100 37 TestEmbeddedSpawnMolecule_SubstitutesTemplatedStepFields
|
||||
|
||||
100 38 TestEmbeddedGraphConcurrent
|
||||
100 38 TestEmbeddedRoutedCreateJournalsIntoTheTargetWorkspace
|
||||
100 38 TestEmbeddedUnclaimIfAssigneeFlagValidation
|
||||
|
||||
100 39 TestEmbeddedIfRevisionRejectsLabelAndParentEdits
|
||||
100 39 TestEmbeddedMaxRowsGraph
|
||||
100 39 TestEmbeddedNewDoltStoreFromConfig_NoMetadata
|
||||
|
||||
100 40 TestEmbeddedIfRevisionOutranksReassignFenceCLI
|
||||
100 40 TestEmbeddedNewDoltStoreFromConfig_HyphenatedDBName
|
||||
100 40 TestEmbeddedUpdateLifecycleClaimParentCommit
|
||||
|
||||
100 41 TestEmbeddedDuplicateConcurrent
|
||||
100 41 TestEmbeddedVersionedHistoryFollowsTheStoreItWritesInto
|
||||
|
||||
100 42 TestEmbeddedInitAForkAutoContributor
|
||||
100 42 TestEmbeddedUpdateIfGuardsFlagValidation
|
||||
|
||||
100 43 TestEmbeddedIfRevisionMultiIDRejected
|
||||
100 43 TestEmbeddedInitExplicitBeadsDirIsAuthoritative
|
||||
|
||||
100 44 TestEmbeddedIfRevisionComposesWithIfAssigneeIfStatus
|
||||
100 44 TestEmbeddedStaleConcurrent
|
||||
|
||||
100 45 TestEmbeddedGraph
|
||||
100 45 TestEmbeddedUpdateIfGuardsCLI
|
||||
|
||||
100 46 TestEmbeddedCloseAlreadyClosedClaimNextAndMolecule
|
||||
100 46 TestEmbeddedIfRevisionMatchAndMismatch
|
||||
|
||||
100 47 TestEmbeddedListSearchAndOutputSearchAndSort
|
||||
100 47 TestEmbeddedRevisionRemintMatrix
|
||||
|
||||
100 48 TestEmbeddedDeferConcurrent
|
||||
100 48 TestEmbeddedReassignFenceCLI
|
||||
|
||||
100 49 TestEmbeddedBackupRestoreStrictReadonly
|
||||
100 49 TestEmbeddedInitAPushConsentAndRemoteBootstrap
|
||||
100 49 TestEmbeddedMigratePersonal_abortOnNoConfirm
|
||||
|
||||
100 50 TestEmbeddedDiffConcurrent
|
||||
100 50 TestEmbeddedDoltRemoteAdd_AllowGitOrigin_WarningOnStderr
|
||||
100 50 TestEmbeddedImportChunkedWaitsForChildImportedLaterStaysBlocked
|
||||
100 50 TestEmbeddedVersionOutputShape
|
||||
|
||||
100 51 TestEmbeddedDoltRemoteAdd_AllowGitOrigin_Exits0
|
||||
100 51 TestEmbeddedHistoryAndShowAsOfReadDoltCommits
|
||||
100 51 TestEmbeddedImportChunkedStaleRejectedRowKeepsDeferredDepsOut
|
||||
100 51 TestEmbeddedInitGitBootstrapRoutingFreshQuiet
|
||||
|
||||
100 52 TestEmbeddedConfigSetOtherKeysSkipTheVersionedHistoryScan
|
||||
100 52 TestEmbeddedDoltLocalOnly_Push_LocalStoreCopy
|
||||
100 52 TestEmbeddedImportChunkedNoReadyWindowAtAnyFreezePoint
|
||||
100 52 TestEmbeddedSwarmConcurrent
|
||||
|
||||
100 53 TestEmbeddedDoltLocalOnly_Push_JSON_DisabledStatus
|
||||
100 53 TestEmbeddedIfRevisionOrdinaryCAS
|
||||
100 53 TestEmbeddedImportChunkedMixedRegularWispCrossBucketEdgesWired
|
||||
100 53 TestEmbeddedInitSelectedExcludeRoutingStealthDecoyQuiet
|
||||
|
||||
100 54 TestEmbeddedDiscoveryPinsEnvFileReadonly
|
||||
100 54 TestEmbeddedFormatJSONAliasMatchesJSON
|
||||
100 54 TestEmbeddedGraphModeDependencyWorkspaceUnaffected
|
||||
100 54 TestEmbeddedInitAgentArtifactsGolden
|
||||
100 54 TestEmbeddedSearchConcurrent
|
||||
100 54 TestEmbeddedShowAsOfFailureExitCodes
|
||||
|
||||
100 55 TestEmbeddedDoltLocalOnly_Pull_JSON_DisabledStatus
|
||||
100 55 TestEmbeddedImportChunkedConcurrentUpdateKeepsDeferredDeps
|
||||
100 55 TestEmbeddedUndefer
|
||||
100 55 TestEmbeddedVersionedHistorySwitchScansEveryRowNotOnePage
|
||||
|
||||
100 56 TestEmbeddedDepNoCycleCheck
|
||||
100 56 TestEmbeddedDoltLocalOnly_Pull_ExitsZeroWithMessage
|
||||
100 56 TestEmbeddedImportChunkedConcurrentUpdateKeepsBlockingDeps
|
||||
100 56 TestEmbeddedVersionedHistorySwitchRoundTrip
|
||||
|
||||
100 57 TestEmbeddedDoltLocalOnly_DoltStatus_ShowsDisabled
|
||||
100 57 TestEmbeddedIfRevisionDeletePreflightGoneIsPreconditionFailed
|
||||
100 57 TestEmbeddedQueryConcurrent
|
||||
100 57 TestEmbeddedVersionedHistorySwitchRefusesUnversionableMetadata
|
||||
|
||||
100 58 TestEmbeddedDepAAddRejectionsAndBulk
|
||||
100 58 TestEmbeddedDoctorUnsupportedProse
|
||||
100 58 TestEmbeddedIfRevisionCascadeDelete
|
||||
100 58 TestEmbeddedVersionedHistorySwitchRefusesAnUnrecordableGateTimeout
|
||||
|
||||
100 59 TestEmbeddedDeferAutoWake
|
||||
100 59 TestEmbeddedDoctorSupportedChecks
|
||||
100 59 TestEmbeddedIdentityGateRendersSchemaSkewFromForwardDriftedWorkspace
|
||||
100 59 TestEmbeddedVersionedHistorySetManyRefusesUnversionableMetadata
|
||||
|
||||
100 60 TestEmbeddedCommentsCLI
|
||||
100 60 TestEmbeddedCorruptMetadataFailsLoudUntilRestored
|
||||
100 60 TestEmbeddedExportExcludeOwner_config
|
||||
100 60 TestEmbeddedRoutedWriteMissDoesNotCreateTargetDatabase
|
||||
100 60 TestEmbeddedWispGCPurgeClosedStillPurgesFullyClosedMolecules
|
||||
|
||||
100 61 TestEmbeddedBootstrapCloneFailureScrubsCredentials
|
||||
100 61 TestEmbeddedContributorRoutedWritesCommitInPlanning
|
||||
100 61 TestEmbeddedEventsPruneHonorsRetainRowsFloorFromConfig
|
||||
100 61 TestEmbeddedUpdateRoutedStoreCommitsTargetHead
|
||||
100 61 TestEmbeddedVersionedHistoryConfigSetWritesTheStoreRow
|
||||
|
||||
100 62 TestEmbeddedAutoPruneDoesNotRunForReadOnlyCommands
|
||||
100 62 TestEmbeddedDoltRemoteResetData_GitBacked
|
||||
100 62 TestEmbeddedGateCheckSkipsTemplateGates
|
||||
100 62 TestEmbeddedReadyBlockersAndLabels
|
||||
100 62 TestEmbeddedUnclaimIfAssigneeCLI
|
||||
|
||||
100 63 TestEmbeddedDepAndLinkBatchAutoCommitDoesNotAdvanceHead
|
||||
100 63 TestEmbeddedGateCheckLimitCountsOnlyLiveGates
|
||||
100 63 TestEmbeddedIfRevisionDeletePreflightGoneParentIsPreconditionFailed
|
||||
100 63 TestEmbeddedListPageEdges
|
||||
|
||||
100 64 TestEmbeddedAutoExportExcludeOwner_config
|
||||
100 64 TestEmbeddedDoltRemoteAdd_NoGitOrigin_ProceedsNormally
|
||||
100 64 TestEmbeddedGateWaiterCheckLifecycle
|
||||
100 64 TestEmbeddedPromoteMovesAWispParent
|
||||
100 64 TestEmbeddedSpawnMolecule_PreservesStepLabels
|
||||
|
||||
100 65 TestEmbeddedIfRevisionPreflightGoneIsPreconditionFailedOnEveryVerb
|
||||
100 65 TestEmbeddedRemovedBackendHealRoundTrip
|
||||
100 65 TestEmbeddedSupersede
|
||||
|
||||
100 66 TestEmbeddedCloseBasicIsolatedStores
|
||||
100 66 TestEmbeddedShowCommentsTail
|
||||
|
||||
100 67 TestEmbeddedAdminCompactReadOnlyAllowed
|
||||
100 67 TestEmbeddedAutoImportFallback_ConflictSkip_DoesNotClobber
|
||||
100 67 TestEmbeddedBootstrapConcurrent
|
||||
100 67 TestEmbeddedCountIncludeInfra
|
||||
100 67 TestEmbeddedCreateCommitPending
|
||||
100 67 TestEmbeddedCreateDryRunRepoDoesNotInitializeTarget
|
||||
100 67 TestEmbeddedCreateRepoFromNonBeadsCwd
|
||||
100 67 TestEmbeddedCreateRepoRelativeUninitRefused
|
||||
100 67 TestEmbeddedHooks
|
||||
100 67 TestEmbeddedOnboard
|
||||
100 67 TestEmbeddedPrime
|
||||
100 67 TestEmbeddedPromote
|
||||
100 67 TestEmbeddedQuickstart
|
||||
100 67 TestEmbeddedQuickstartConcurrent
|
||||
100 67 TestEmbeddedWhere
|
||||
100 67 TestEmbeddedWhereConcurrent
|
||||
|
||||
100 68 TestEmbeddedAutoImportFallback_ConflictSkip_EmptyDBImportsAll
|
||||
100 68 TestEmbeddedBlocked
|
||||
100 68 TestEmbeddedCompactConcurrent
|
||||
100 68 TestEmbeddedContext
|
||||
100 68 TestEmbeddedCreateJSONEchoesSubSecondTimestamps
|
||||
100 68 TestEmbeddedDoltBlockedAndCommit
|
||||
100 68 TestEmbeddedDoltConcurrent
|
||||
100 68 TestEmbeddedInfo
|
||||
100 68 TestEmbeddedInfoSuppressGitHooks
|
||||
100 68 TestEmbeddedOrphans
|
||||
100 68 TestEmbeddedRoutedMutatingSiblingDeleteCloseDelete
|
||||
100 68 TestEmbeddedSetupConcurrent
|
||||
100 68 TestEmbeddedTodoConcurrent
|
||||
100 68 TestEmbeddedTypes
|
||||
|
||||
100 69 TestEmbeddedCompact
|
||||
100 69 TestEmbeddedConfigValidateJSONNoWorkspaceWritesStdout
|
||||
100 69 TestEmbeddedCreateConcurrent
|
||||
100 69 TestEmbeddedDepBulkNoCycleCheckKeepsWholeGraphGate
|
||||
100 69 TestEmbeddedDuplicatesSharedFixture
|
||||
100 69 TestEmbeddedGateListScoped
|
||||
100 69 TestEmbeddedGetDependencies
|
||||
100 69 TestEmbeddedInfoConcurrent
|
||||
100 69 TestEmbeddedRenamePrefixConcurrent
|
||||
100 69 TestEmbeddedRoutedSiblingWritesCommitTargetHeadNote
|
||||
100 69 TestEmbeddedTypesConcurrent
|
||||
100 69 TestEmbeddedUpdateBatchAutoCommitDoesNotAdvanceHead
|
||||
|
||||
100 70 TestEmbeddedExportConcurrent
|
||||
100 70 TestEmbeddedFlattenConcurrent
|
||||
100 70 TestEmbeddedGCDryRunAndSkips
|
||||
100 70 TestEmbeddedImportConcurrent
|
||||
100 70 TestEmbeddedImportUpsertAndPrefixSync
|
||||
100 70 TestEmbeddedLabelAddRemoveMultiAndDuplicate
|
||||
100 70 TestEmbeddedMemory
|
||||
100 70 TestEmbeddedMigrateConcurrent
|
||||
100 70 TestEmbeddedPurgeConcurrent
|
||||
100 70 TestEmbeddedRoutedMutatingSiblingAssignTagDepTag
|
||||
|
||||
100 71 TestEmbeddedCloseJSONReportsMoleculeAutoClose
|
||||
100 71 TestEmbeddedInitRoleRoutingExplicitDefault
|
||||
100 71 TestEmbeddedPrimeChangeDirRedirectNoticeFollowsTarget
|
||||
100 71 TestEmbeddedRoutedCreateHonorsTheEnvOverrideOverTheTargetsConfig
|
||||
100 71 TestEmbeddedSearchRoutesAgree
|
||||
|
||||
100 72 TestEmbeddedContributorCreateMultiple
|
||||
100 72 TestEmbeddedCreateWithGitRemote
|
||||
100 72 TestEmbeddedFederationConcurrent
|
||||
100 72 TestEmbeddedGateCreateRepoErrorsList
|
||||
100 72 TestEmbeddedHumanConcurrent
|
||||
100 72 TestEmbeddedImportPromotedWispRoundtrip
|
||||
100 72 TestEmbeddedPrimeChangeDirPrimesTarget
|
||||
100 72 TestEmbeddedRoutedMutatingSiblingDeleteCloseClose
|
||||
100 72 TestEmbeddedRoutedSiblingWritesCommitTargetHeadReopen
|
||||
100 72 TestEmbeddedUpdateFieldsMappingAndRefs
|
||||
|
||||
100 73 TestEmbeddedCompactMisdatedChild
|
||||
100 73 TestEmbeddedExportFlags
|
||||
100 73 TestEmbeddedFederationPeers
|
||||
100 73 TestEmbeddedGateCreateFlags
|
||||
100 73 TestEmbeddedGateCreateReady
|
||||
100 73 TestEmbeddedPrimeChangeDirDefaultTemplateMatchesTarget
|
||||
100 73 TestEmbeddedQuickConcurrent
|
||||
100 73 TestEmbeddedRenamePrefixBasic
|
||||
100 73 TestEmbeddedRoutedMutatingSiblingAssignTagDepDepAdd
|
||||
|
||||
100 74 TestEmbeddedBlockedConcurrent
|
||||
100 74 TestEmbeddedBranch
|
||||
100 74 TestEmbeddedCountIncludeEphemeral
|
||||
100 74 TestEmbeddedDepAddWispSource
|
||||
100 74 TestEmbeddedMigrate
|
||||
100 74 TestEmbeddedPrimeConcurrent
|
||||
100 74 TestEmbeddedRestore
|
||||
100 74 TestEmbeddedVCConcurrent
|
||||
|
||||
100 75 TestEmbeddedCommentsCLIConcurrent
|
||||
100 75 TestEmbeddedContextConcurrent
|
||||
100 75 TestEmbeddedFlatten
|
||||
100 75 TestEmbeddedInitC
|
||||
100 75 TestEmbeddedListComments
|
||||
100 75 TestEmbeddedOpen_EmptyDatabaseRejected
|
||||
100 75 TestEmbeddedReclaimRunsTheLeaseReclaimerRole
|
||||
100 75 TestEmbeddedRoutedSiblingWritesCommitTargetHeadComment
|
||||
100 75 TestEmbeddedVCStatusAndCommit
|
||||
|
||||
100 76 TestEmbeddedCloseAlreadyClosedContinue
|
||||
100 76 TestEmbeddedCloseAlreadyClosedMultipleIDs
|
||||
100 76 TestEmbeddedExportFormats
|
||||
100 76 TestEmbeddedGCForceWithDecay
|
||||
100 76 TestEmbeddedGCFullAndNoForcePrompts
|
||||
100 76 TestEmbeddedInitAGitOriginRemote
|
||||
100 76 TestEmbeddedLabelAddRemoveRemove
|
||||
100 76 TestEmbeddedOnboardConcurrent
|
||||
|
||||
100 77 TestEmbeddedClaimPools
|
||||
100 77 TestEmbeddedConfigNoWorkspaceStoreFreeCommands
|
||||
100 77 TestEmbeddedCreateStorageClassConflicts
|
||||
100 77 TestEmbeddedExternalCapabilityReadyAfterShip
|
||||
100 77 TestEmbeddedHumanListStatsRespondDismiss
|
||||
100 77 TestEmbeddedMemoryCorpusBudget
|
||||
100 77 TestEmbeddedOrphansConcurrent
|
||||
100 77 TestEmbeddedStatus
|
||||
|
||||
100 78 TestEmbeddedBranchConcurrent
|
||||
100 78 TestEmbeddedComments
|
||||
100 78 TestEmbeddedDepBRemove
|
||||
100 78 TestEmbeddedLabelAddRemoveAdd
|
||||
100 78 TestEmbeddedShip
|
||||
100 78 TestEmbeddedUpdateFieldsNotesOverwrite
|
||||
100 78 TestEmbeddedVCCommitVariantsAndMerge
|
||||
100 78 TestEmbeddedVersionConcurrent
|
||||
|
||||
100 79 TestEmbeddedCreateCrossRepoUninit
|
||||
100 79 TestEmbeddedDeleteJSONDependencyErrorContract
|
||||
100 79 TestEmbeddedEpicCloseEligibleNotEligible
|
||||
100 79 TestEmbeddedInitABasic
|
||||
100 79 TestEmbeddedInitBRemoteSchemaAndCloneFailure
|
||||
100 79 TestEmbeddedRenamePrefixEdgeCases
|
||||
100 79 TestEmbeddedUpdateFieldsNotesClearAndDefer
|
||||
|
||||
100 80 TestEmbeddedCreateCrossRepoWithParent
|
||||
100 80 TestEmbeddedCreateFormCommitsLabelOnlyCreate
|
||||
100 80 TestEmbeddedCreateStorageClassBasic
|
||||
100 80 TestEmbeddedRoutedMutatingSiblingAssignTagDepAssign
|
||||
100 80 TestEmbeddedStatusConcurrent
|
||||
100 80 TestEmbeddedSwarmCreate
|
||||
100 80 TestEmbeddedSwarmValidate
|
||||
|
||||
100 81 TestEmbeddedAdminCompactTier2Honesty
|
||||
100 81 TestEmbeddedBackup
|
||||
100 81 TestEmbeddedDeleteForceAndBatch
|
||||
100 81 TestEmbeddedGateCreateBeadCheck
|
||||
100 81 TestEmbeddedGateList
|
||||
100 81 TestEmbeddedRestoreConcurrent
|
||||
100 81 TestEmbeddedStaleLabelFilters
|
||||
100 81 TestEmbeddedStateConcurrent
|
||||
|
||||
100 82 TestEmbeddedCreateCrossRepoDryRunWithParent
|
||||
100 82 TestEmbeddedDeleteBasic
|
||||
100 82 TestEmbeddedDepBTreeAndCycles
|
||||
100 82 TestEmbeddedDirectCommitPathsBatchAutoCommitDoesNotAdvanceHead
|
||||
100 82 TestEmbeddedHooksConcurrent
|
||||
100 82 TestEmbeddedImportFromSources
|
||||
100 82 TestEmbeddedStale
|
||||
|
||||
100 83 TestEmbeddedAdminBlocked
|
||||
100 83 TestEmbeddedAutoImportJSONLConcurrentWriter
|
||||
100 83 TestEmbeddedInitBAutoCommitAndJSONLRemote
|
||||
100 83 TestEmbeddedLabelEditReportsPrefix
|
||||
100 83 TestEmbeddedMaxRowsDoctorAndConfig
|
||||
100 83 TestEmbeddedPurgeFiltered
|
||||
100 83 TestEmbeddedReadyConcurrent
|
||||
|
||||
100 84 TestEmbeddedDoltRemoteAdd_GitOriginCollision_Exits1
|
||||
100 84 TestEmbeddedInitGitBootstrapRoutingDecoyInvalid
|
||||
100 84 TestEmbeddedInitSelectedExcludeRoutingStealthInvalid
|
||||
100 84 TestEmbeddedMigratePersonal_preservesComments
|
||||
|
||||
100 85 TestEmbeddedBootstrapExistingDryRunInit
|
||||
100 85 TestEmbeddedChildrenBasicAndEmpty
|
||||
100 85 TestEmbeddedCreateGraphAndBulk
|
||||
100 85 TestEmbeddedCreateRepoRelativeExistingWorkspaceUnaffected
|
||||
100 85 TestEmbeddedIfRevisionReopenGuardDirect
|
||||
100 85 TestEmbeddedInitArtifactRouting
|
||||
|
||||
100 86 TestEmbeddedDoltRemoteAdd_DifferentURL_ProceedsNormally
|
||||
100 86 TestEmbeddedExplicitHierarchicalParentEdges
|
||||
100 86 TestEmbeddedInitHooksRouting
|
||||
100 86 TestEmbeddedMigratePersonal_noopWhenEmpty
|
||||
|
||||
100 87 TestEmbeddedCreateRepoProxiedTargetError
|
||||
100 87 TestEmbeddedGateInheritsDownParentChain
|
||||
100 87 TestEmbeddedReadyClaimConcurrent
|
||||
100 87 TestEmbeddedState
|
||||
100 87 TestEmbeddedSupersedeConcurrent
|
||||
100 87 TestEmbeddedSwarmCreateForceAndErrors
|
||||
|
||||
100 88 TestEmbeddedChangeDirOverridesInheritedBeadsDir
|
||||
100 88 TestEmbeddedDepAAddAndList
|
||||
100 88 TestEmbeddedKV
|
||||
100 88 TestEmbeddedMaxRowsReadyMerge
|
||||
100 88 TestEmbeddedPromoteCLI
|
||||
100 88 TestEmbeddedUnclaimSuccess
|
||||
|
||||
100 89 TestEmbeddedBackupConcurrent
|
||||
100 89 TestEmbeddedCreateDryRunDoesNotMigrate
|
||||
100 89 TestEmbeddedGateShowResolve
|
||||
100 89 TestEmbeddedInitBStealthAndForceReinit
|
||||
100 89 TestEmbeddedLabelEditReportsNoop
|
||||
100 89 TestEmbeddedShowBasicsAndJSON
|
||||
|
||||
100 90 TestEmbeddedAutoImportJSONLSkipsNonEmpty
|
||||
100 90 TestEmbeddedConfig
|
||||
100 90 TestEmbeddedFindDuplicatesConcurrent
|
||||
100 90 TestEmbeddedLabelEditReportsListAndTemplate
|
||||
100 90 TestEmbeddedLintConcurrent
|
||||
100 90 TestEmbeddedUpdateLifecycleDefer
|
||||
100 90 TestEmbeddedVersion
|
||||
|
||||
100 91 TestEmbeddedDuplicate
|
||||
100 91 TestEmbeddedPreviewDoesNotConsumeVersionMarker
|
||||
100 91 TestEmbeddedPruneDryRunAndFilters
|
||||
100 91 TestEmbeddedReadOnlyCommandsSpawnNoGit
|
||||
100 91 TestEmbeddedShowUnresolvableDeps
|
||||
100 91 TestEmbeddedTypesAgreeWithCreate
|
||||
|
||||
100 92 TestEmbeddedAutoImportJSONLNoExplicitCommit
|
||||
100 92 TestEmbeddedDefer
|
||||
100 92 TestEmbeddedDepAAddTypesAndFlags
|
||||
100 92 TestEmbeddedEpicCloseEligibleClosesEpics
|
||||
100 92 TestEmbeddedSetup
|
||||
100 92 TestEmbeddedSwarmStatusList
|
||||
|
||||
100 93 TestEmbeddedCreateStorageClassBatchAndMisc
|
||||
100 93 TestEmbeddedDeletePreviewAndGuards
|
||||
100 93 TestEmbeddedDepBRemoveOutputAndRelatesTo
|
||||
100 93 TestEmbeddedListConcurrent
|
||||
100 93 TestEmbeddedPruneSafetyAndScope
|
||||
100 93 TestEmbeddedShowDetailAndCurrentFlags
|
||||
|
||||
100 94 TestEmbeddedCreateDryRunCrossRepoDoesNotMigrateTarget
|
||||
100 94 TestEmbeddedDepListSingleIDWarnsOnDroppedExternalEdge
|
||||
100 94 TestEmbeddedEpicCloseEligibleReasonOutput
|
||||
100 94 TestEmbeddedFederationStatus
|
||||
100 94 TestEmbeddedGCConcurrent
|
||||
100 94 TestEmbeddedReadyDefaultJSONAndFlags
|
||||
|
||||
100 95 TestEmbeddedChildrenJSONAndAllStatuses
|
||||
100 95 TestEmbeddedFindDuplicates
|
||||
100 95 TestEmbeddedImportClosedChildWhoseParentWasDeleted
|
||||
100 95 TestEmbeddedInitConcurrent
|
||||
100 95 TestEmbeddedQuick
|
||||
|
||||
100 96 TestEmbeddedDiff
|
||||
100 96 TestEmbeddedDuplicatesConcurrent
|
||||
100 96 TestEmbeddedHistory
|
||||
100 96 TestEmbeddedShowDetailAndCurrentHistoryAndCurrent
|
||||
100 96 TestEmbeddedSquashWispMoleculeClearsRootEphemeral
|
||||
|
||||
100 97 TestEmbeddedDuplicatesOwnWorkspaces
|
||||
100 97 TestEmbeddedHumanPositionalFileAndGuards
|
||||
100 97 TestEmbeddedPurgeBasics
|
||||
100 97 TestEmbeddedQuietFlagSuppressesSuccessOutput
|
||||
100 97 TestEmbeddedSearchStatusLimitSortDatesMetadata
|
||||
|
||||
100 98 TestEmbeddedCloseBasicSharedStore
|
||||
100 98 TestEmbeddedContributorCreateRoutesToPlanning
|
||||
100 98 TestEmbeddedGCConditionalMatcherDecode
|
||||
100 98 TestEmbeddedQuery
|
||||
100 98 TestEmbeddedTodo
|
||||
|
||||
100 99 TestEmbeddedBlockedLabelFilters
|
||||
100 99 TestEmbeddedDoltRemoteAndPush
|
||||
100 99 TestEmbeddedEpicStatus
|
||||
100 99 TestEmbeddedInitSelectedExcludeRoutingForkDecoyAuto
|
||||
100 99 TestEmbeddedSearchQueryStatusAssigneeLabels
|
||||
|
||||
100 100 TestEmbeddedContributorCreateShowReadsRouted
|
||||
100 100 TestEmbeddedCreateCrossRepo
|
||||
100 100 TestEmbeddedInitGitBootstrapRoutingExistingExplicit
|
||||
100 100 TestEmbeddedLint
|
||||
100 100 TestEmbeddedPromoteCLIConcurrent
|
||||
157
.github/scripts/embedded-storage-test-shard.sh
vendored
157
.github/scripts/embedded-storage-test-shard.sh
vendored
|
|
@ -1,157 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# embedded-storage-test-shard.sh — run a shard of embedded dolt storage tests.
|
||||
#
|
||||
# Usage: embedded-storage-test-shard.sh <shard_number> <total_shards>
|
||||
#
|
||||
# Discovers all top-level Test* functions from
|
||||
# internal/storage/embeddeddolt/*_test.go, excluding TestConformance. That
|
||||
# suite runs in the dedicated test-embedded-conformance job instead, sharded
|
||||
# by sub-test path (core/audit) rather than by top-level function name; this
|
||||
# manifest's exact-name matching does not cover it. See
|
||||
# engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md for why the two use different
|
||||
# sharding mechanisms.
|
||||
#
|
||||
# Tests listed in embedded-storage-test-shards.txt for the requested shard
|
||||
# count use that committed assignment; newly-added tests fall back to
|
||||
# hash(name) % total. Runs the matching subset using the pre-built test
|
||||
# binary at BEADS_TEST_EMBEDDED_TEST_BINARY (or /tmp/embeddeddolt-test).
|
||||
#
|
||||
# Every store-open in these tests re-runs the full migration chain, which
|
||||
# grows with each migration (bd-lrgn1 pushed a slow runner past the old
|
||||
# unsharded job's 20m). The manifest spreads TestEmbeddedMigration* /
|
||||
# TestEmbeddedMigrate* tests round-robin across shards (~2-3 each of ~11
|
||||
# total) rather than clustering them, so each shard's migration-chain
|
||||
# overhead is a fraction of what the unsharded job carried.
|
||||
#
|
||||
# Environment:
|
||||
# BEADS_TEST_EMBEDDED_DOLT=1 required (tests skip without it)
|
||||
# BEADS_TEST_EMBEDDED_TEST_BINARY=<path> pre-built storage test binary
|
||||
# (default: /tmp/embeddeddolt-test)
|
||||
# BEADS_TEST_SHARD_LIST_ONLY=1 print selected tests without running them
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SHARD_NUMBER="${1:?usage: $0 <shard_number> <total_shards>}"
|
||||
TOTAL_SHARDS="${2:?usage: $0 <shard_number> <total_shards>}"
|
||||
shift 2
|
||||
|
||||
if ! [[ "$SHARD_NUMBER" =~ ^[0-9]+$ ]] || ! [[ "$TOTAL_SHARDS" =~ ^[0-9]+$ ]]; then
|
||||
echo "Shard number and total shards must be positive integers" >&2
|
||||
exit 1
|
||||
fi
|
||||
if (( TOTAL_SHARDS < 1 || SHARD_NUMBER < 1 || SHARD_NUMBER > TOTAL_SHARDS )); then
|
||||
echo "Invalid shard ${SHARD_NUMBER}/${TOTAL_SHARDS}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SHARD_INDEX=$(( SHARD_NUMBER - 1 ))
|
||||
MANIFEST="${BEADS_TEST_SHARD_MANIFEST:-.github/scripts/embedded-storage-test-shards.txt}"
|
||||
|
||||
# Discover all top-level Test* functions except TestConformance, which is
|
||||
# sharded separately (core/audit sub-test partition in the workflow, not this
|
||||
# manifest) because it is a single top-level function with sub-tests reached
|
||||
# via -test.run path regex, not distinct top-level function names.
|
||||
ALL_TESTS=$(grep -rh '^func Test' internal/storage/embeddeddolt/*_test.go \
|
||||
| sed 's/func \(Test[A-Za-z0-9_]*\).*/\1/' \
|
||||
| grep -v '^TestConformance$' \
|
||||
| sort -u)
|
||||
|
||||
if [ -z "$ALL_TESTS" ]; then
|
||||
echo "No Test* functions found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
declare -A ALL_TEST_SET=()
|
||||
while IFS= read -r name; do
|
||||
ALL_TEST_SET["$name"]=1
|
||||
done <<< "$ALL_TESTS"
|
||||
|
||||
declare -A MANIFEST_SHARDS=()
|
||||
if [ -f "$MANIFEST" ]; then
|
||||
while IFS= read -r line || [ -n "$line" ]; do
|
||||
line="${line%%#*}"
|
||||
read -r manifest_total manifest_shard test_name extra <<< "$line"
|
||||
if [ -z "${manifest_total:-}" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ -n "${extra:-}" ] || ! [[ "$manifest_total" =~ ^[0-9]+$ ]] || ! [[ "$manifest_shard" =~ ^[0-9]+$ ]] || ! [[ "$test_name" =~ ^Test[A-Za-z0-9_]+$ ]] || [ "$test_name" = "TestConformance" ]; then
|
||||
echo "Invalid shard manifest line: $line" >&2
|
||||
exit 1
|
||||
fi
|
||||
if (( manifest_total != TOTAL_SHARDS )); then
|
||||
continue
|
||||
fi
|
||||
if (( manifest_shard < 1 || manifest_shard > TOTAL_SHARDS )); then
|
||||
echo "Invalid shard ${manifest_shard}/${manifest_total} for $test_name in $MANIFEST" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ -n "${MANIFEST_SHARDS[$test_name]:-}" ]; then
|
||||
echo "Duplicate shard manifest entry for $test_name in $MANIFEST" >&2
|
||||
exit 1
|
||||
fi
|
||||
MANIFEST_SHARDS["$test_name"]="$manifest_shard"
|
||||
done < "$MANIFEST"
|
||||
fi
|
||||
|
||||
for name in "${!MANIFEST_SHARDS[@]}"; do
|
||||
if [ -z "${ALL_TEST_SET[$name]:-}" ]; then
|
||||
echo "Shard manifest entry does not match a discovered test: $name" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
SHARD_TESTS=()
|
||||
MANIFEST_COUNT=0
|
||||
FALLBACK_COUNT=0
|
||||
while IFS= read -r name; do
|
||||
assigned_shard="${MANIFEST_SHARDS[$name]:-}"
|
||||
if [ -n "$assigned_shard" ]; then
|
||||
if (( assigned_shard == SHARD_NUMBER )); then
|
||||
SHARD_TESTS+=("$name")
|
||||
MANIFEST_COUNT=$(( MANIFEST_COUNT + 1 ))
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
# Use cksum for a portable numeric hash fallback for newly-added tests.
|
||||
hash=$(printf %s "$name" | cksum | cut -d ' ' -f 1)
|
||||
if (( hash % TOTAL_SHARDS == SHARD_INDEX )); then
|
||||
SHARD_TESTS+=("$name")
|
||||
FALLBACK_COUNT=$(( FALLBACK_COUNT + 1 ))
|
||||
fi
|
||||
done <<< "$ALL_TESTS"
|
||||
|
||||
if [ ${#SHARD_TESTS[@]} -eq 0 ]; then
|
||||
echo "Shard ${SHARD_NUMBER}/${TOTAL_SHARDS}: no tests assigned (all hashed to other shards)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Build the -run regex: "^(TestA|TestB|TestC)$"
|
||||
RUN_REGEX="^($(IFS='|'; echo "${SHARD_TESTS[*]}"))$"
|
||||
|
||||
echo "Shard ${SHARD_NUMBER}/${TOTAL_SHARDS}: running ${#SHARD_TESTS[@]} test(s)"
|
||||
echo " manifest: ${MANIFEST_COUNT}, fallback: ${FALLBACK_COUNT}"
|
||||
printf " %s\n" "${SHARD_TESTS[@]}"
|
||||
echo ""
|
||||
|
||||
# Use pre-built test binary if available, otherwise fall back to go test.
|
||||
STORAGE_BINARY="${BEADS_TEST_EMBEDDED_TEST_BINARY:-/tmp/embeddeddolt-test}"
|
||||
if [ "${BEADS_TEST_SHARD_LIST_ONLY:-}" = "1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 20m, as embedded-test-shard.sh: under -race, TestBatchApplyContract alone
|
||||
# takes ~10m at the 1000-item issueops.MaxApplyBatchItems cap, and the
|
||||
# heaviest shard projects to ~13m (see embedded-storage-test-shards.txt).
|
||||
# The jobs' timeout-minutes (25) leave room for setup after this fires.
|
||||
if [ -x "$STORAGE_BINARY" ]; then
|
||||
exec "$STORAGE_BINARY" -test.v -test.count=1 -test.timeout=20m \
|
||||
-test.run "$RUN_REGEX" \
|
||||
"$@"
|
||||
else
|
||||
echo "Warning: pre-built test binary not found at $STORAGE_BINARY, falling back to go test"
|
||||
exec go test -tags=gms_pure_go -v -race -count=1 -timeout 20m \
|
||||
-run "$RUN_REGEX" \
|
||||
"$@" \
|
||||
./internal/storage/embeddeddolt/
|
||||
fi
|
||||
608
.github/scripts/embedded-storage-test-shards.txt
vendored
608
.github/scripts/embedded-storage-test-shards.txt
vendored
|
|
@ -1,608 +0,0 @@
|
|||
# Embedded storage test shard manifest.
|
||||
#
|
||||
# Format: <total_shards> <shard_number> <top_level_test_name>
|
||||
#
|
||||
# There is no committed recent per-test duration artifact for these tests
|
||||
# (engdocs/CI_CLEANUP_PLAN.md records only whole-job wall clock for the
|
||||
# unsharded storage job, and engdocs/CI_TEST_SURFACE_AUDIT.md does not track
|
||||
# per-test timing here either). This manifest assigns tests round-robin over
|
||||
# the alphabetically sorted discovered-test list for the 5-shard CI matrix,
|
||||
# which spreads adjacent same-prefix families (e.g. the seven
|
||||
# TestEmbeddedMergeAndSettle* tests and the TestEmbeddedMigration* tests)
|
||||
# across different shards instead of clustering them in one, as a balance
|
||||
# heuristic in the absence of timing data. embedded-storage-test-shard.sh
|
||||
# continues to hash-distribute newly-added tests that are not listed here. TestConformance is deliberately
|
||||
# excluded — it runs in the separate test-embedded-conformance job, which
|
||||
# shards by sub-test path (core/audit), not by top-level function name, and
|
||||
# is a different mechanism from this manifest.
|
||||
#
|
||||
# Several tests are placed by measured -race duration instead (PR Risk run
|
||||
# 36807191489, at the 1000-item issueops.MaxApplyBatchItems cap):
|
||||
# TestBatchApplyContract (604s) on shard 4, which has ~3m of other tests,
|
||||
# and TestLargeBatchApplyWallClock_Embedded (261s) on shard 5. Hashed,
|
||||
# TestBatchApplyContract shared shard 2 with ~5m of other tests and ran it
|
||||
# past the job's old 15m timeout; placed so, the heaviest shard projects to
|
||||
# ~13m.
|
||||
#
|
||||
# TestLargeBatchApplyStatementCounts_Embedded (247s in that same run) was
|
||||
# later split into TestLargeBatchApplyStatementCounts356_Embedded,
|
||||
# TestLargeBatchApplyStatementCounts712_Embedded and
|
||||
# TestLargeBatchApplyStatementCountsClassic40_Embedded (slice F1, CI shard
|
||||
# balance; see internal/storage/embeddeddolt/large_batch_apply_measure_test.go).
|
||||
# All 3 are kept on shard 2, where the single test used to live, rather than
|
||||
# rebalanced across this frozen 5-shard block.
|
||||
5 1 TestActiveDatabaseSizeFailsForMissingEmbeddedDatabase
|
||||
5 2 TestActiveDatabaseSizeScopesToActiveEmbeddedDatabase
|
||||
5 3 TestAddDependency
|
||||
5 4 TestAddLabel
|
||||
5 4 TestBatchApplyContract
|
||||
5 5 TestBuildDSN_NoDatabase
|
||||
5 1 TestBuildDSN_SpacesInPath
|
||||
5 2 TestBuildDSN_WithDatabase
|
||||
5 3 TestCleanGitRemoteCacheGarbage
|
||||
5 4 TestCleanGitRemoteCacheGarbage_NoCacheDir
|
||||
5 5 TestCleanGitRemoteCacheGarbage_Throttled
|
||||
5 1 TestConcurrencyMultiProcess
|
||||
5 2 TestConcurrentOpenReturnsCached
|
||||
5 3 TestCountsIncludeWispDependencies
|
||||
5 4 TestCreateIssue
|
||||
5 5 TestCreateIssues
|
||||
5 1 TestCreateIssuesRejectStaleUpserts
|
||||
5 2 TestCreateRejectsCrossTableIDCollision
|
||||
5 1 TestEmbeddedConfigCommitStagesConfig
|
||||
5 2 TestEmbeddedDirtyTablesGate_BlocksReopenThenWorkingSetReconcileRecovers
|
||||
5 3 TestEmbeddedGetMergeBlockersOnAQuietStore
|
||||
5 4 TestEmbeddedMergeAndSettleDirtyWorkingSetSurvivesRefusedMerge
|
||||
5 5 TestEmbeddedMergeAndSettleFKCascadeRepair
|
||||
5 1 TestEmbeddedMergeAndSettleMemoryConfigConflict
|
||||
5 2 TestEmbeddedMergeAndSettleMetadataConflict
|
||||
5 3 TestEmbeddedMergeAndSettleRefusesUnknownTable
|
||||
5 4 TestEmbeddedMergeAndSettleReportsOperatorConflicts
|
||||
5 5 TestEmbeddedMergeAndSettleSkipsNonMemoryConfigConflict
|
||||
5 1 TestEmbeddedMigrateConvergesUnderConcurrentInterruptedRetries_4566
|
||||
5 2 TestEmbeddedMigrateRepairedDependenciesIDColumnCommitsAtomicallyWithVersion53_4690
|
||||
5 3 TestEmbeddedMigrateSelfHealsAfterMidPassFault_4566
|
||||
5 4 TestEmbeddedMigrateStepCommitLeavesUntouchedUserDirt_4566
|
||||
5 5 TestEmbeddedMigration0047DelegatesToSplitTargetRepairAndConvergesThroughIgnoredChain
|
||||
5 1 TestEmbeddedMigration0057ConvertsTextEventsColumnsToLongtext
|
||||
5 2 TestEmbeddedMigration0058AddsOnlyMissingConstraintInMixedPopulation
|
||||
5 3 TestEmbeddedMigration0058CleansOrphanedAndInvalidWispDependenciesRowsBeforeAddingConstraints
|
||||
5 4 TestEmbeddedMigration0058HealsAlreadyAffectedDatabase
|
||||
5 5 TestEmbeddedOpenForReadOnlyCommand_LenientGate
|
||||
5 1 TestEmbeddedOpenReadOnly_FreshDatabaseNoWrites
|
||||
5 2 TestEmbeddedOpenReadOnly_SkipsGateAndMigrations
|
||||
5 3 TestEmbeddedRecomputeAllBlockedDirtyGraphIsTyped
|
||||
5 4 TestEmbeddedRecomputeAllBlockedWiring
|
||||
5 5 TestEmbeddedRemoteMigrateGate_BlocksReopen
|
||||
5 1 TestEmbeddedSyncCommitsConfigBeforeMerge
|
||||
5 4 TestEventsSinceEmbedded
|
||||
5 5 TestGetDependentRecordsEmbedded
|
||||
5 1 TestGetDependentRecordsForIssuesEmbedded
|
||||
5 2 TestGetIssue
|
||||
5 3 TestGetIssueCommentsPageEmbedded
|
||||
5 4 TestGetLabels
|
||||
5 5 TestGetNextChildID
|
||||
5 1 TestGetReadyWorkIncludeEphemeralAppliesWispFilters
|
||||
5 2 TestGetReadyWorkIncludeEphemeralExcludesNonReadyWisps
|
||||
5 3 TestGetReadyWorkMoleculeFilter
|
||||
5 4 TestHeartbeatRejectsWispEmbedded
|
||||
5 5 TestHelperProcess
|
||||
5 1 TestHistory_NullTextColumns
|
||||
5 2 TestHookFiringStoreCreateIssuesFiresDependencyUpdatesFromEmbeddedStore
|
||||
5 3 TestIsBlockedBatchEmbedded
|
||||
5 2 TestLargeBatchApplyStatementCounts356_Embedded
|
||||
5 2 TestLargeBatchApplyStatementCounts712_Embedded
|
||||
5 2 TestLargeBatchApplyStatementCountsClassic40_Embedded
|
||||
5 5 TestLargeBatchApplyWallClock_Embedded
|
||||
5 4 TestLeaseLifecycleEmbedded
|
||||
5 5 TestListWisps
|
||||
5 1 TestOpenAfterCloseCreatesNewStore
|
||||
5 2 TestOpenDifferentDirsReturnsDifferentStores
|
||||
5 3 TestOpenReturnsCachedStore
|
||||
5 4 TestPromoteStillWorksWithCollisionGuard
|
||||
5 5 TestReclaimAnyReplicaOverride
|
||||
5 1 TestReclaimExpiredLeaseSurvivesRestartEmbedded
|
||||
5 2 TestReclaimRefusesForeignReplicaLease
|
||||
5 3 TestReopenIssue
|
||||
5 4 TestSchemaAfterInit
|
||||
5 5 TestUnknownProvenanceLeaseStaysReclaimable
|
||||
5 1 TestUpdateIssueType
|
||||
5 2 TestUpdateMergeOps_DoltEngine
|
||||
5 3 TestUpdateMergeOps_DoltEngine_TwoIssues
|
||||
|
||||
# Embedded-Dolt storage test shard manifest.
|
||||
#
|
||||
# Format: <total_shards> <shard_number> <top_level_test_name>
|
||||
#
|
||||
# 40-shard split for the Bazel-only embedded-Dolt storage tier
|
||||
# (bazel-embedded in .github/workflows/bazel.yml), bin-packed
|
||||
# longest-processing-time-first by measured wall-time from
|
||||
# scripts/ci/embedded_storage_test_durations.json (see that file for provenance
|
||||
# and its "relative weight, not absolute SLA" caveat).
|
||||
# Regenerate with scripts/ci/gen_embedded_storage_shard_manifest.py 40
|
||||
# --weights=duration --write after adding or removing Test* functions in
|
||||
# internal/storage/embeddeddolt/*_test.go. --write is incremental: it
|
||||
# keeps every already-assigned test on its current shard and only places
|
||||
# newly-discovered names, onto whichever shard is currently lightest, so
|
||||
# two unrelated PRs that each add one test do not textually conflict or
|
||||
# silently invalidate each other's packing. Pass --repack to force a full
|
||||
# from-scratch rebalance instead (a deliberate, separate change — expect a
|
||||
# large diff). --check only verifies every discovered name is listed here
|
||||
# exactly once (no stale or duplicate entries); it does NOT verify the
|
||||
# packing is still well-balanced.
|
||||
#
|
||||
# This file is generated: notes added here are erased by the next
|
||||
# regeneration. Add them to the generator or the durations file instead.
|
||||
|
||||
40 1 TestLifecycleCloseReopenContract
|
||||
|
||||
40 2 TestBatchApplyContract
|
||||
|
||||
40 3 TestActiveDatabaseSizeFailsForMissingEmbeddedDatabase
|
||||
40 3 TestActiveDatabaseSizeScopesToActiveEmbeddedDatabase
|
||||
40 3 TestBuildDSN_NoDatabase
|
||||
40 3 TestBuildDSN_SpacesInPath
|
||||
40 3 TestBuildDSN_WithDatabase
|
||||
40 3 TestCleanGitRemoteCacheGarbage
|
||||
40 3 TestCleanGitRemoteCacheGarbage_NoCacheDir
|
||||
40 3 TestCleanGitRemoteCacheGarbage_Throttled
|
||||
40 3 TestCommitAllOutOfBandChangeAndHonestNoOp
|
||||
40 3 TestCreateBatchEquivalencePartsCoverEveryScenario
|
||||
40 3 TestCreateBatchFastPathsMatchPerRowLarge_Embedded
|
||||
40 3 TestCrossRecordInvariantContract
|
||||
40 3 TestDepRekeyMarkerStillInIgnoredSeries
|
||||
40 3 TestDoltCommitResponseLossIsIndeterminate
|
||||
40 3 TestEmbeddedDependencyEditorRefusesADottedChildGatedOnItsOwnParent
|
||||
40 3 TestEmbeddedDoltStoreIssueLifecycleBuildsOperations
|
||||
40 3 TestEmbeddedDoltStoreIssueLifecycleRejectsNilStore
|
||||
40 3 TestEmbeddedOpenReadOnly_FreshDatabaseNoWrites
|
||||
40 3 TestEmbeddedSQLCommitResponseLossIsIndeterminate
|
||||
40 3 TestEpochContract
|
||||
40 3 TestExpectedRevisionContract
|
||||
40 3 TestGitRefPinsMatchDolt
|
||||
40 3 TestHasRepository
|
||||
40 3 TestHelperProcess
|
||||
40 3 TestLargeBatchApplyStatementCounts712_Embedded
|
||||
40 3 TestLargeGraphCreateTiming_Embedded
|
||||
40 3 TestLenientGateWarningBody_BluntRefusalKeepsSharedGuidance
|
||||
40 3 TestLenientGateWarningBody_ShapedDecisions
|
||||
40 3 TestLenientGateWarning_ComposedOutput
|
||||
40 3 TestMain
|
||||
40 3 TestPushCommitsPendingChangesFirst
|
||||
40 3 TestRemoteEntryPointsUseVersionControlOps
|
||||
40 3 TestRetentionContract
|
||||
40 3 TestStageAndCommitAfterSQLCommitResponseLossIsIndeterminateAndNotReplayed
|
||||
40 3 TestTransactionCleanupAfterSQLCommitIsIndeterminate
|
||||
40 3 TestTransactionCleanupBeforeSQLCommitRemainsDefinite
|
||||
40 3 TestUnknownProvenanceLeaseStaysReclaimable
|
||||
|
||||
40 4 TestBlockedListerContract
|
||||
40 4 TestCreateBatchFastPathsMatchPerRowSmallDepAdd_Embedded
|
||||
40 4 TestEmbeddedIssueOperationsUpdateLabelPatchOrdering
|
||||
40 4 TestEmbeddedReaderGetMissIsNotFoundAndBackendFailureDoesNotDecay
|
||||
40 4 TestEmbeddedReaderListFilterFamiliesNarrowToTheirRows
|
||||
40 4 TestMergeAndSettleWithStrategy_EmptyStrategyMatchesMergeAndSettle
|
||||
|
||||
40 5 TestEmbeddedClaimerRefusesIncompleteRequestsAndAnAbsentIDWithoutTouchingState
|
||||
40 5 TestEmbeddedIssueOperationsCloseAndReopenAWisp
|
||||
40 5 TestEmbeddedReaderListKeysetPositionResumesTheCreatedDescIDAscOrder
|
||||
40 5 TestRecordVersionKeepsSubSecondChangeAt
|
||||
40 5 TestWithPeerAuth
|
||||
|
||||
40 6 TestCreateBatchFastPathsMatchPerRowApplyWaitsFor_Embedded
|
||||
40 6 TestEmbeddedMergeAndSettleFKCascadeRepair
|
||||
40 6 TestEmbeddedMergeAndSettleSkipsNonMemoryConfigConflict
|
||||
40 6 TestEmbeddedReaderListKeysetPositionNarrowsWithoutReplacingTheOtherPredicates
|
||||
40 6 TestEmbeddedRelationsAnswersAWispTargetInTheOutDirection
|
||||
40 6 TestPromoteStillWorksWithCollisionGuard
|
||||
40 6 TestSearchWithMissingWispPlaneTables
|
||||
40 6 TestVersionedHistoryKeepsNumbersTheStoreDistinguishesApart
|
||||
|
||||
40 7 TestConcurrencyMultiProcess
|
||||
40 7 TestEmbeddedBatchCloserRecordsOneHistoryEntryForWhatLanded
|
||||
40 7 TestEmbeddedDependencyEditorAcceptsAnExternalTarget
|
||||
40 7 TestEmbeddedDependencyEditorRelatesToAddLeavesItsSourceUnblocked
|
||||
40 7 TestEmbeddedIssueOperationsUpdateMetadataReplaceClearsAndValidates
|
||||
40 7 TestEmbeddedLenientOpenWarning_DataBehind
|
||||
40 7 TestEmbeddedRelationsLeavesTheCallersRequestAlone
|
||||
40 7 TestLoseVersionLeavesTheEpochTablesCommitted
|
||||
40 7 TestMergeAndSettleWithStrategy_ResolvesDeclinedConflict
|
||||
|
||||
40 8 TestDeleterContract
|
||||
40 8 TestEmbeddedDependencyEditorRoutesWispSourcedRemovalToTheWispPlane
|
||||
40 8 TestEmbeddedMergeAndSettleDirtyWorkingSetSurvivesRefusedMerge
|
||||
40 8 TestEmbeddedMintLeavesUpdatedAtWhereHistoryOffDoes
|
||||
40 8 TestEmbeddedReaderGetBriefDepsProjectsTheDependencyRows
|
||||
40 8 TestEmbeddedRelationsOrdersNeighborsFromBothPlanesTogether
|
||||
40 8 TestEmbeddedReopenIssueCategorySemantics
|
||||
40 8 TestGetIssueCommentsPageEmbedded
|
||||
40 8 TestListWisps
|
||||
|
||||
40 9 TestBumpEpochCarryingNeitherCarriesNorServesARowFromAFutureEpoch
|
||||
40 9 TestEmbeddedDependencyEditorRefusesCrossPlaneCycle
|
||||
40 9 TestEmbeddedDependencyEditorSameTypeReAddIsIdempotent
|
||||
40 9 TestEmbeddedDependencyEditorSnapshotsTheRequest
|
||||
40 9 TestEmbeddedMigration0058AddsOnlyMissingConstraintInMixedPopulation
|
||||
40 9 TestEmbeddedReaderReadyPageWiderThanTheHydrationBatchIsStillThatPrefix
|
||||
40 9 TestEmbeddedReadyClaimerHydratesOnlyItsBlocksEdgesIntoTheCardinalities
|
||||
40 9 TestGetReadyWorkIncludeEphemeralExcludesNonReadyWisps
|
||||
40 9 TestPristineEmbeddedDoltFixtureRelocatesPrefixes
|
||||
40 9 TestUpdateMergeOps_DoltEngine
|
||||
|
||||
40 10 TestEmbeddedClaimerStampsStartedAtOnceAcrossTheTwoWritesItChoosesBetween
|
||||
40 10 TestEmbeddedDependencyEditorRemoveIsIdempotent
|
||||
40 10 TestEmbeddedIssueOperationsUpdateClaimCASAndTransferMatrix
|
||||
40 10 TestEmbeddedReaderGetResolvesTheExactIDAcrossBothPlanes
|
||||
40 10 TestEmbeddedReaderReadyEphemeralPageKeepsBothPlanesCountsAtItsBoundary
|
||||
40 10 TestGraphCounterContract
|
||||
40 10 TestIgnoredCursorHealRespectsOperatorOverride
|
||||
40 10 TestRunInTransactionPostCommitStageFailureIsIndeterminate
|
||||
40 10 TestVersionedHistoryOffMatchesPreStackGolden_Embedded
|
||||
40 10 TestWithPeerAuth_WarnsWhenStoredPeerSuppressesAmbientPasswordAmbient
|
||||
|
||||
40 11 TestABumpUnderOneStoreIDMovesTheEpochSeenThroughEveryStoreID
|
||||
40 11 TestEmbeddedBatchCreateFirstVersionCarriesCreationTimeEdges
|
||||
40 11 TestEmbeddedClaimerRefusalMessagesCarryTheirFragments
|
||||
40 11 TestEmbeddedGuardedUpdateMintsOnceAfterItsPatches
|
||||
40 11 TestEmbeddedMergeAndSettleRefusesUnknownTable
|
||||
40 11 TestEmbeddedReaderListMaxRowsBoundaryIsLimitPlusOffset
|
||||
40 11 TestEmbeddedReadyClaimerRecordsOneHistoryEntryForAWin
|
||||
40 11 TestEventsJournal_ActorMatrixOnEmbedded
|
||||
40 11 TestMemoriesContract
|
||||
40 11 TestWithPeerAuth_WarnsWhenStoredPeerSuppressesAmbientPasswordStored
|
||||
|
||||
40 12 TestCounterExcludeStatusAcceptsAWorkspaceCustomStatusWithoutIncludeInfra
|
||||
40 12 TestEmbeddedClaimerAcceptsAConfiguredActiveStatusAndRefusesAConfiguredWipOne
|
||||
40 12 TestEmbeddedClaimerRefusesAWispIDAsNotFound
|
||||
40 12 TestEmbeddedDependencyEditorVersionsOnlyARealAddOrRemove
|
||||
40 12 TestEmbeddedIgnoredMigration0023RepairsForkLineageJournalShape
|
||||
40 12 TestEmbeddedIssueOperationsCreateUnderAParentMintsTheNextChildID
|
||||
40 12 TestEmbeddedReadyClaimerAnswersTheQuestionReaderReadyLists
|
||||
40 12 TestHistoryPresenceContract
|
||||
40 12 TestLifecycleUpdateContract
|
||||
40 12 TestReaderListExcludeStatusAcceptsAWorkspaceCustomStatus
|
||||
|
||||
40 13 TestEmbeddedDepRekeyConvergesRenameChain
|
||||
40 13 TestEmbeddedDependencyEditorAppliesParentChildBeforeBlockingEdges
|
||||
40 13 TestEmbeddedDependencyEditorRefusesAGhostSource
|
||||
40 13 TestEmbeddedIssueOperationsCreateParentChildRecomputesWaitsForClosure
|
||||
40 13 TestEmbeddedIssueOperationsUpdateClaimPatchAppliesAfterClaim
|
||||
40 13 TestEmbeddedIssueOperationsUpdateFoldsMetadataIntoOneEvent
|
||||
40 13 TestEmbeddedPre0058RepairMarchesDriftedWispDependenciesToFinalShape
|
||||
40 13 TestEmbeddedRelationsDirectionSelectsTheInverseGraph
|
||||
40 13 TestGraphWalkPlansHonorJoinHints
|
||||
|
||||
40 14 TestBatchCreatorContract
|
||||
40 14 TestBlockingAnnotatorContract
|
||||
40 14 TestCountsIncludeWispDependencies
|
||||
40 14 TestEmbeddedIssueOperationsPersistenceRollbackWispAndDetachedResults
|
||||
40 14 TestEmbeddedOpenForRemoteSync_DataBehind
|
||||
40 14 TestEmbeddedReaderOffsetSkipsTheRowsBeforeThePage
|
||||
40 14 TestEmbeddedReaderReadyDefaultTypeExclusionsYieldToAnExplicitType
|
||||
40 14 TestEmbeddedReadyClaimerClaimsTheFrontRowAndReturnsThePostClaimState
|
||||
40 14 TestEmbeddedReadyClaimerDoesNotMutateTheCallerRequest
|
||||
40 14 TestHeartbeatIssueCommitsARefusalOnlyWhenItReadTheIssueEmbedded
|
||||
40 14 TestHistory_NullTextColumns
|
||||
|
||||
40 15 TestCreateIssuesRejectStaleUpserts
|
||||
40 15 TestDecryptPassword_ShortCiphertextClassifiesAsKeyMismatch
|
||||
40 15 TestEmbeddedGetMergeBlockersOnAQuietStore
|
||||
40 15 TestEmbeddedIgnoredMigration0023NoopsWithoutItsTables
|
||||
40 15 TestEmbeddedIssueOperationsRequestValuesAreNotMutated
|
||||
40 15 TestEmbeddedReaderReadyBriefDropsTheFreeFormTextAndNothingElse
|
||||
40 15 TestEmbeddedRelationsFiltersByAnOpenTypeVocabulary
|
||||
40 15 TestGetIssue
|
||||
40 15 TestLegacyTrackedIgnoredCursorHealsOnOpen
|
||||
40 15 TestMoleculeContract
|
||||
40 15 TestReadyWorkPageTotalFilterMatrix
|
||||
|
||||
40 16 TestDescendantWalkReachesEveryTargetKindAndStopsOnCycles
|
||||
40 16 TestEmbeddedDependencyEditorAddedEchoesTheRequestOrder
|
||||
40 16 TestEmbeddedDependencyEditorRemovesOnlyTheNamedEdge
|
||||
40 16 TestEmbeddedReaderDoesNotMutateTheCallerRequest
|
||||
40 16 TestEmbeddedReaderListLimitBoundaryUnderASortTheDatabaseCanExpress
|
||||
40 16 TestEmbeddedRenameKeepsDependencyIDsDeterministic
|
||||
40 16 TestExternalCapabilityBlocksEmbeddedReadyAndAppearsInTree
|
||||
40 16 TestGetReadyWorkIncludeEphemeralAppliesWispFilters
|
||||
40 16 TestMergeWithStrategy_OursKeepsLocal
|
||||
40 16 TestWithPeerAuth_DivergedRemoteURLFailsClosed
|
||||
|
||||
40 17 TestAddDependency
|
||||
40 17 TestEmbeddedBatchCloserWispItemClosesAndEarnsTheClaim
|
||||
40 17 TestEmbeddedDependencyEditorSameTypeReAddWithChangedThreadMintsOneVersion
|
||||
40 17 TestEmbeddedIssueOperationsUpdateIssuePlaneOnlyRefusesWisps
|
||||
40 17 TestEmbeddedIssueOperationsUpdateStatusCrossingSettlesAConditionalBlocksDepender
|
||||
40 17 TestEmbeddedReaderListRejectsATypeOutsideTheWorkspaceVocabulary
|
||||
40 17 TestEmbeddedReadyClaimerLeasesADurableWinButNotAnEphemeralOne
|
||||
40 17 TestHeartbeatMatchesActorAcrossSpellingEmbedded
|
||||
40 17 TestStatsReporterContract
|
||||
40 17 TestVersionReconcilerContract
|
||||
|
||||
40 18 TestCreateBatchParticipationGeneration
|
||||
40 18 TestEmbeddedBatchCloserIdempotentRecloseIsAPerItemSuccess
|
||||
40 18 TestEmbeddedDependencyEditorMixedBatchWritesBothPlanes
|
||||
40 18 TestEmbeddedIssueOperationsUpdateRawMetadataTakesTheFunnelsValueShapes
|
||||
40 18 TestEmbeddedMergeAndSettleMemoryConfigConflict
|
||||
40 18 TestEmbeddedReaderListIncludeEphemeralMergesThePlanesIntoOneOrder
|
||||
40 18 TestEmbeddedReaderListParentReachesEveryDescendantAndOnlyItsOwn
|
||||
40 18 TestMetadataCASContract
|
||||
40 18 TestOpenDifferentDirsReturnsDifferentStores
|
||||
40 18 TestPromoteClearsNoHistory
|
||||
40 18 TestRemoteVerbPlainRemoteWithoutAuthPresentsNone
|
||||
|
||||
40 19 TestEmbeddedDependencyEditorRetypeRefusalLeavesTheOriginalEdge
|
||||
40 19 TestEmbeddedIssueOperationsUpdateInvalidIssueTypePreservesValidationSentinel
|
||||
40 19 TestEmbeddedMigration0062FlipsEventsToIgnoredPlane
|
||||
40 19 TestEmbeddedReaderListMaxRowsIsHonored
|
||||
40 19 TestEmbeddedRelationsAnswersInThePinnedOrder
|
||||
40 19 TestIgnoredCursorHealConvergesFromEveryCrashState
|
||||
40 19 TestOpenAfterCloseCreatesNewStore
|
||||
40 19 TestOpenReturnsCachedStore
|
||||
40 19 TestParticipationGenerationFixtureKitIsWired
|
||||
40 19 TestRemoteVerbsPresentStoredPeerCredentials
|
||||
40 19 TestRenameLabelMintsOneVersionPerTouchedBead
|
||||
|
||||
40 20 TestBumpEpochCarryingCarriesOnlyTheLineageHoldingTheNewestRow
|
||||
40 20 TestCreateIssue
|
||||
40 20 TestEmbeddedCheckedWrappersRouteTheirPreconditions
|
||||
40 20 TestEmbeddedIssueOperationsCreateRoutesInfraTypesToWisps
|
||||
40 20 TestEmbeddedMigrateStepCommitLeavesUntouchedUserDirt_4566
|
||||
40 20 TestEmbeddedOpenReadOnly_SkipsGateAndMigrations
|
||||
40 20 TestEmbeddedReadyClaimerClaimsAnEphemeralRowTheFilterAdmits
|
||||
40 20 TestEventsJournalRestartAndRetentionBoundary
|
||||
40 20 TestForeignSkipDetailIsBounded
|
||||
40 20 TestHeartbeatRejectsWispEmbedded
|
||||
40 20 TestIgnoredCursorHealNeverResurrectsRolledBackVersions
|
||||
|
||||
40 21 TestBumpEpochCarryingCarriesTheLiveRowsOfEveryStoreInTheDatabase
|
||||
40 21 TestCreateRejectsCrossTableIDCollision
|
||||
40 21 TestEmbeddedBatchCloserItemsAnswerToTheCloseGuards
|
||||
40 21 TestEmbeddedDependencyEditorAcceptsATypeOutsideTheConstants
|
||||
40 21 TestEmbeddedIssueOperationsUpdateParentStagesBlockedStateAndRollsBackFailure
|
||||
40 21 TestEmbeddedMigration0047DelegatesToSplitTargetRepairAndConvergesThroughIgnoredChain
|
||||
40 21 TestEmbeddedRelationsLeavesAnExternalTargetOutOfTheAnswer
|
||||
40 21 TestEmbeddedRemoteMigrateGate_BlocksReopen
|
||||
40 21 TestEmbeddedRoleFixtureKitCountHistoryMovesWithACommit
|
||||
40 21 TestEmbeddedTransactionStandaloneWispLifecyclePersistsWithoutDoltCommit
|
||||
40 21 TestLargeBatchApplyWallClock_Embedded
|
||||
|
||||
40 22 TestEdgeReaderContract
|
||||
40 22 TestEmbeddedDepRekeyAbortLeavesMarkerUnrecorded
|
||||
40 22 TestEmbeddedDepRekeyRefusesToWriteIntoDirtyDependencies
|
||||
40 22 TestEmbeddedDependencyEditorRefusesSelfDependencyWithTheProbeSkipped
|
||||
40 22 TestEmbeddedReaderListStatusAcceptsACommaSeparatedORSet
|
||||
40 22 TestEmbeddedReaderReadyLimitBoundary
|
||||
40 22 TestEventsAutoPruneKeepsAnUnboundedJournalUnbounded
|
||||
40 22 TestEventsJournalPruneNeverSplitsASkewedPair
|
||||
40 22 TestLargeBatchApplyStatementCounts356_Embedded
|
||||
40 22 TestLeaseLifecycleEmbedded
|
||||
40 22 TestPolicyBlockingAnnotatorForeignOpensAreSublinear
|
||||
|
||||
40 23 TestAsOfReadContract
|
||||
40 23 TestEmbeddedBatchCloserBackendFailureReturnsNoOutcomes
|
||||
40 23 TestEmbeddedBatchCloserClaimNextHydratesWhenSomethingClosed
|
||||
40 23 TestEmbeddedDependencyEditorAcceptsBlockingAcrossIssueTypes
|
||||
40 23 TestEmbeddedDependencyEditorRecordsNoHistoryForAnAllEphemeralRequest
|
||||
40 23 TestEmbeddedMigrateConvergesUnderConcurrentInterruptedRetries_4566
|
||||
40 23 TestEmbeddedReaderListEmptyPageIsWellFormed
|
||||
40 23 TestEmbeddedReadyClaimerFencesTheClaimByEveryLabelSetAndTheParentItWasGiven
|
||||
40 23 TestEmbeddedRoleFixtureKitHooksAreUsable
|
||||
40 23 TestEventsAutoPruneBoundsTheJournalToTheFloors
|
||||
40 23 TestJournalContract
|
||||
|
||||
40 24 TestBootstrapperContract
|
||||
40 24 TestEmbeddedBatchCloserOutcomesMirrorItemsIndexForIndex
|
||||
40 24 TestEmbeddedClaimerReclaimsAcrossSpellingWithoutWriting
|
||||
40 24 TestEmbeddedConfigCommitStagesConfig
|
||||
40 24 TestEmbeddedIgnoredSeriesConvergesWithFreshInitShape
|
||||
40 24 TestEmbeddedIssueOperationsCreateWithDependenciesSettlesInTheCreatingTransaction
|
||||
40 24 TestEmbeddedMigrateSelfHealsAfterMidPassFault_4566
|
||||
40 24 TestEmbeddedReaderListQueryMatchesTheTitleOrTheID
|
||||
40 24 TestEmbeddedReaderListWispTypeNarrowsTheAdmittedPlaneRatherThanAdmittingIt
|
||||
40 24 TestIgnoredCursorHealResumeRespectsOperatorOverride
|
||||
40 24 TestLargeBatchApplyStatementCountsClassic40_Embedded
|
||||
40 24 TestReopenIssue
|
||||
|
||||
40 25 TestBatchGetterContract
|
||||
40 25 TestDatabases
|
||||
40 25 TestDualWriteFixtureKitIsWired
|
||||
40 25 TestEmbeddedBatchCloserClaimNextIsNilWhenNothingClosed
|
||||
40 25 TestEmbeddedIssueOperationsUpdateClaimHonorsConfiguredActiveStatuses
|
||||
40 25 TestEmbeddedReadyClaimerLeavesEphemeralRowsOutOfTheDefaultReadySet
|
||||
40 25 TestEmbeddedReadyClaimerRejectsLimitOffsetBriefAndEmptyActor
|
||||
40 25 TestGetDependentRecordsForIssuesEmbedded
|
||||
40 25 TestHeartbeaterContract
|
||||
40 25 TestIgnoredCursorHealIsIdempotent
|
||||
40 25 TestIsBlockedBatchEmbedded
|
||||
40 25 TestReadyWorkPageTotal
|
||||
40 25 TestWithPeerAuth_RestoresAbsentEnv
|
||||
|
||||
40 26 TestEmbeddedIssueOperationsCreateClosedDerivesTheClosedStamp
|
||||
40 26 TestEmbeddedMigration0058CleansOrphanedAndInvalidWispDependenciesRowsBeforeAddingConstraints
|
||||
40 26 TestEmbeddedOpenForReadOnlyCommand_LenientGate
|
||||
40 26 TestEmbeddedReaderListReadyFlagCarriesTheAssigneeAndPriorityFilters
|
||||
40 26 TestEmbeddedReaderReadyParentScopesToItsTransitiveDescendants
|
||||
40 26 TestEmbeddedReadyClaimerSkipsIneligibleFrontRows
|
||||
40 26 TestEmbeddedRecomputeAllBlockedDirtyGraphIsTyped
|
||||
40 26 TestEmbeddedRelationsRefusesTheZeroDirection
|
||||
40 26 TestHookFiringStoreCreateIssuesFiresDependencyUpdatesFromEmbeddedStore
|
||||
40 26 TestReclaimAnyReplicaOverride
|
||||
40 26 TestWithPeerAuth_EnvFallbackDoesNotObservePeerCredentials
|
||||
|
||||
40 27 TestEmbeddedBatchCloserDurableHistoryNeverNamesAWisp
|
||||
40 27 TestEmbeddedBatchCloserRequestValidationReturnsZeroResultAndChangesNothing
|
||||
40 27 TestEmbeddedDependencyEditorAcceptsADiamond
|
||||
40 27 TestEmbeddedDependencyEditorAddMarksItsSourceInTheSameVerb
|
||||
40 27 TestEmbeddedMigration0058HealsAlreadyAffectedDatabase
|
||||
40 27 TestEmbeddedReaderGetOptionalRowListsAreOffByDefault
|
||||
40 27 TestEmbeddedRelationsRefusesATypeFilterOverTheColumnLength
|
||||
40 27 TestEventsJournalReadRefusesAnInteriorHole
|
||||
40 27 TestPartitionWispIDs
|
||||
40 27 TestRemoteGitDataRefOnEngine
|
||||
40 27 TestSweeperContract
|
||||
|
||||
40 28 TestBumpEpochCarryingDoesNotCarryALostLineage
|
||||
40 28 TestEmbeddedBatchCloserForceBypassesOnlyClosePolicy
|
||||
40 28 TestEmbeddedBatchCloserSettlesTheDependersOfWhatItClosed
|
||||
40 28 TestEmbeddedClaimerClaimsAnUnassignedOpenIssueAndAnswersTheBareRow
|
||||
40 28 TestEmbeddedClaimerReclaimsItsOwnInProgressIssueWithoutWriting
|
||||
40 28 TestEmbeddedClaimerTakesAPoolAssignedIssueButRefusesAForeignHolder
|
||||
40 28 TestEmbeddedIssueOperationsUpdateLabelPatchValueRules
|
||||
40 28 TestEmbeddedIssueOperationsUpdateRefusesATypeOutsideTheWorkspaceVocabulary
|
||||
40 28 TestEmbeddedReaderListReadyFlagAnswersTheBlockerAwareSet
|
||||
40 28 TestRenameLabel
|
||||
40 28 TestUpdateIssueType
|
||||
40 28 TestWithPeerAuth_RestoresEnvWhenCallbackFails
|
||||
|
||||
40 29 TestEmbeddedBatchCloserClaimFilterValueFailureIsARequestValidationFailure
|
||||
40 29 TestEmbeddedBatchCloserClaimNextIsNilWhenTheFrontIsEmpty
|
||||
40 29 TestEmbeddedDepRekeyMergesFreshDuplicateEdges
|
||||
40 29 TestEmbeddedDependencyEditorRecordsOneHistoryEntryPerLandedRequest
|
||||
40 29 TestEmbeddedMergeAndSettleMetadataConflict
|
||||
40 29 TestEmbeddedReaderListDefaultExclusionsAndTheirOverrides
|
||||
40 29 TestEmbeddedReaderListTimeBoundsAreStrictAndWholeSecond
|
||||
40 29 TestEmbeddedReaderReadySetOwnsItsStatusPinnedAndTemplateDecisions
|
||||
40 29 TestEmbeddedTransactionSameStatusDoesNotPublishUnrelatedDurableChanges
|
||||
40 29 TestEventsJournalAccessor
|
||||
40 29 TestLeaseReclaimerContract
|
||||
40 29 TestLifecycleCreateContract
|
||||
|
||||
40 30 TestCounterContract
|
||||
40 30 TestCycleDetectorContract
|
||||
40 30 TestEmbeddedClaimerTakesAnOpenIssueTheActorAlreadyHolds
|
||||
40 30 TestEmbeddedCommitToleratesNothingToCommit
|
||||
40 30 TestEmbeddedEveryAcceptedLifecycleMutationMintsOneVersion
|
||||
40 30 TestEmbeddedIssueOperationsUpdateClaimConflictCarriesTheLosingState
|
||||
40 30 TestEmbeddedIssueOperationsUpdateStampsStartedAtOnceOnTheFirstInProgress
|
||||
40 30 TestEmbeddedReaderReadySortPoliciesOrderTheSameRows
|
||||
40 30 TestEmbeddedTransactionStandaloneWispMutationDoesNotPublishUnrelatedDurableChanges
|
||||
40 30 TestLegacyTrackedIgnoredCursorUnwedgesPull
|
||||
40 30 TestUpdateMergeOps_DoltEngine_TwoIssues
|
||||
|
||||
40 31 TestBumpEpochCarryingWritesOneCarryRowPerLiveIDNamingTheLineageRoot
|
||||
40 31 TestDualWriteContract
|
||||
40 31 TestEmbeddedDependencyEditorAcceptsAForeignRepoTarget
|
||||
40 31 TestEmbeddedDependencyEditorMaintainsBlockedStateAcrossPlanes
|
||||
40 31 TestEmbeddedDependencyEditorWritesTheTargetIntoItsTypedColumn
|
||||
40 31 TestEmbeddedMigrateConsent_BehindAndDirtyWorkingSetReconcileRecovers
|
||||
40 31 TestEmbeddedReaderListPriorityKeysetWalkOverAnOversizedEqualKeyRunLosesNothingAndRepeatsNothing
|
||||
40 31 TestEmbeddedTransactionWispLifecyclePersistsDurableDependent
|
||||
40 31 TestEventsSinceEmbedded
|
||||
40 31 TestGetLabels
|
||||
40 31 TestReadyCounterContract
|
||||
40 31 TestWithPeerAuth_KeyMismatchFailsClosed
|
||||
|
||||
40 32 TestCurrentAddressForNeverReseedsAnAbsentStoreEpochRow
|
||||
40 32 TestEmbeddedClaimerGrantsALiveLeaseOnTheRowItWonAndLeavesARefusedOneAlone
|
||||
40 32 TestEmbeddedDependencyEditorRefusesAMissingLocalTarget
|
||||
40 32 TestEmbeddedDirtyTablesGate_BlocksReopenThenWorkingSetReconcileRecovers
|
||||
40 32 TestEmbeddedIgnoredMigration0019CreatesEventsForFreshClones
|
||||
40 32 TestEmbeddedIssueOperationsCreateReverseNonBlockingStagesConcreteTables
|
||||
40 32 TestEmbeddedReadyClaimerEmptyFrontIsNormal
|
||||
40 32 TestEmbeddedRecomputeAllBlockedWiring
|
||||
40 32 TestEventsJournal_EmbeddedConcurrentGaplessNoDup
|
||||
40 32 TestGetNextChildID
|
||||
40 32 TestRemoteVerbPlainRemoteKeepsAmbientEnv
|
||||
40 32 TestWithPeerAuth_MissingRemoteFailsClosed
|
||||
|
||||
40 33 TestEmbeddedBatchCloserDuplicateItemRecloseAtItsOwnIndex
|
||||
40 33 TestEmbeddedDependencyEditorClosedChildAddSatisfiesAnAnyChildrenGate
|
||||
40 33 TestEmbeddedDependencyEditorValidationRefusalsWriteNothing
|
||||
40 33 TestEmbeddedIgnoredMigration0023NoopsOnHealthyWorkspace
|
||||
40 33 TestEmbeddedMoveIssuePersistenceEphemeralNoHistorySmoke
|
||||
40 33 TestEmbeddedRelationsResolvesTheAnchorIDExactly
|
||||
40 33 TestEmbeddedSyncCommitsConfigBeforeMerge
|
||||
40 33 TestEventsAutoPruneThrottleSkipsTheSecondPass
|
||||
40 33 TestFirstMintLeavesTheEpochTablesCommitted
|
||||
40 33 TestGetDependentRecordsEmbedded
|
||||
40 33 TestPruneEventsBatchDeletesTheLowestSeqsOnly
|
||||
40 33 TestTreeWalkerContract
|
||||
|
||||
40 34 TestAddLabel
|
||||
40 34 TestBumpEpochCarryingLeavesTheEpochTablesCommitted
|
||||
40 34 TestDecryptPassword_KeyMismatchNamesTheLocalKey
|
||||
40 34 TestEmbeddedBlockedRecheckRecordsUnblockingWrites
|
||||
40 34 TestEmbeddedDependencyEditorAttributesItsEventsToTheActor
|
||||
40 34 TestEmbeddedDependencyEditorSameTypeReAddWithIdenticalMetadataIsANoOp
|
||||
40 34 TestEmbeddedIssueOperationsCreateAggregatesRelations
|
||||
40 34 TestEmbeddedReaderReadyDeferredAndEphemeralGates
|
||||
40 34 TestEmbeddedReaderReadyPageIsThePrefixOfTheUnboundedAnswerCountsIncluded
|
||||
40 34 TestMergeWithStrategy_TheirsResolvesAndCommits
|
||||
40 34 TestQuerierContract
|
||||
40 34 TestReadyWorkStatementBudget
|
||||
|
||||
40 35 TestEmbeddedBatchCloserAllIdempotentBatchLandsNothing
|
||||
40 35 TestEmbeddedClaimIssueWrapperClaimsTheWispPlane
|
||||
40 35 TestEmbeddedDependencyEditorGateScopeFollowsTheEdgeType
|
||||
40 35 TestEmbeddedDependencyEditorRefusesASamePlaneEdgeClosingACrossPlaneCycle
|
||||
40 35 TestEmbeddedDependencyEditorRepeatsWithinOneRequestCollapse
|
||||
40 35 TestEmbeddedIssueOperationsUpdateAllScalarAndPointerFieldsReportChanged
|
||||
40 35 TestEmbeddedIssueOperationsUpdateWritesEveryScalarPatchField
|
||||
40 35 TestMerge_NoStrategyStillErrorsWithEscapeHatchHint
|
||||
40 35 TestReadEventsAutoPruneStateResolvesBothHalvesInOneQuery
|
||||
40 35 TestReadyWorkWithMissingDeferredParentTables
|
||||
40 35 TestReclaimExpiredLeaseSurvivesRestartEmbedded
|
||||
|
||||
40 36 TestBumpEpochCarryingFailsAndRollsBackWhenARowAlreadyExistsAtTheNewEpoch
|
||||
40 36 TestCommenterContract
|
||||
40 36 TestConcurrentOpenReturnsCached
|
||||
40 36 TestEmbeddedBatchCloserAllRefusedBatchRecordsNoHistory
|
||||
40 36 TestEmbeddedDependencyEditorRefusalWritesNothing
|
||||
40 36 TestEmbeddedDependencyEditorSkipPerEdgeCycleCheckDropsOnlyTheProbe
|
||||
40 36 TestEmbeddedMigration0057ConvertsTextEventsColumnsToLongtext
|
||||
40 36 TestEmbeddedReaderListReadyFlagRefusesAFilterItCannotCarry
|
||||
40 36 TestEmbeddedRelationsRefusesAnUnusableTypeFilter
|
||||
40 36 TestGetReadyWorkMoleculeFilter
|
||||
40 36 TestReleaserContract
|
||||
40 36 TestSchemaAfterInit
|
||||
|
||||
40 37 TestEmbeddedBatchCloserClaimNextSeesAnUnblockingFromItsOwnBatch
|
||||
40 37 TestEmbeddedBatchCloserOutcomeSnapshotIsTheDocumentedShape
|
||||
40 37 TestEmbeddedDependencyEditorRecordsOneHistoryEntryForAMixedPlaneRequest
|
||||
40 37 TestEmbeddedDependencyEditorRefusesACycleThroughAParentChildHop
|
||||
40 37 TestEmbeddedDependencyEditorRemoveUnmarksItsSourceAndDescendants
|
||||
40 37 TestEmbeddedIssueOperationsCreateEmptyIDPreservesParentAndReverseDependencies
|
||||
40 37 TestEmbeddedLenientOpenWarning_OtherRefusalsKeepBluntGuidance
|
||||
40 37 TestEmbeddedMergeAndSettleReportsOperatorConflicts
|
||||
40 37 TestEmbeddedReaderListBriefDropsTheFreeFormTextAndNothingElse
|
||||
40 37 TestEmbeddedReaderListNaturalNumericIDSortTrimsAfterTheFetch
|
||||
40 37 TestEpochWritesReportAnUnpublishedCommitAsIndeterminate
|
||||
40 37 TestIgnoredCursorHealRespectsOverrideUnderBroaderPattern
|
||||
|
||||
40 38 TestCreateIssues
|
||||
40 38 TestEmbeddedClaimerRefusesABuiltInIneligibleStatusWithTheStateThatRefusedIt
|
||||
40 38 TestEmbeddedDependencyEditorRefusesBlockingEdgeAcrossItsOwnHierarchy
|
||||
40 38 TestEmbeddedIssueOperationsUpdateClosedFieldsMatchClose
|
||||
40 38 TestEmbeddedIssueOperationsUpdateNotesConflictPreservesValidationSentinel
|
||||
40 38 TestEmbeddedReaderGetDetailShapeMatchesTheSeededIssue
|
||||
40 38 TestEmbeddedReaderListCountsAreBlocksOnlyWhereGetCountsEveryEdge
|
||||
40 38 TestEmbeddedReaderListKeysetWalkOverAnOversizedGroupLosesNothingAndRepeatsNothing
|
||||
40 38 TestEmbeddedTempRebuildIntermediatesNeverReachHistory
|
||||
40 38 TestEventsJournalPruneWhenEveryRowIsOlderThanTheCutoff
|
||||
40 38 TestPolicyBlockingAnnotatorBatchEqualsPerItem
|
||||
40 38 TestWithPeerAuth_ConcurrentPeersDoNotMixCredentials
|
||||
|
||||
40 39 TestDualWriteContractFlagOff
|
||||
40 39 TestEmbeddedBatchCloserPerItemRefusalIsAResultAndSurvivorsCommit
|
||||
40 39 TestEmbeddedBlockedRecheckFailureKeepsTheWrite
|
||||
40 39 TestEmbeddedDependencyEditorMixedBatchRefusalRollsBackBothPlanes
|
||||
40 39 TestEmbeddedIssueOperationsClaimLeavesBlockedStateAlone
|
||||
40 39 TestEmbeddedMigrateRepairedDependenciesIDColumnCommitsAtomicallyWithVersion53_4690
|
||||
40 39 TestEmbeddedReaderListSkipCountsDropsTheCardinalitiesAndNothingElse
|
||||
40 39 TestEmbeddedRelationsResolvesAWispAnchor
|
||||
40 39 TestParticipationGenerationFence
|
||||
40 39 TestPreviewStoreRefusesLocalMetadataWrite
|
||||
40 39 TestReclaimRefusesForeignReplicaLease
|
||||
40 39 TestWorkspaceConfigContract
|
||||
|
||||
40 40 TestCountsWithMissingWispPlaneTables
|
||||
40 40 TestEmbeddedBatchCloserDoesNotMutateTheCallerRequest
|
||||
40 40 TestEmbeddedBlockedRecheckSettlesWhatTheWriteRecorded
|
||||
40 40 TestEmbeddedDepRekeyRepairsHalfRekeyedDuplicateEdge
|
||||
40 40 TestEmbeddedDependencyEditorRefusesBlockingEdgeAcrossAWispHierarchy
|
||||
40 40 TestEmbeddedDependencyEditorRoutesWispSourcedEdgeToTheWispPlane
|
||||
40 40 TestEmbeddedDependencyEditorSameTypeReAddWithChangedMetadataMintsOneVersion
|
||||
40 40 TestEmbeddedIssueOperationsUpdateStatusCrossingSettlesDependers
|
||||
40 40 TestEmbeddedOpenForRemoteSync_OtherRefusalsStayFatal
|
||||
40 40 TestEmbeddedRelationsSeparatesNoNeighborsFromNoSuchIssue
|
||||
40 40 TestEmbeddedReopenCustomDoneFallsBackWhenNormalizedTableMissing
|
||||
139
.github/scripts/embedded-test-shard.sh
vendored
139
.github/scripts/embedded-test-shard.sh
vendored
|
|
@ -1,139 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# embedded-test-shard.sh — run a shard of embedded dolt cmd/bd tests.
|
||||
#
|
||||
# Usage: embedded-test-shard.sh <shard_number> <total_shards>
|
||||
#
|
||||
# Discovers all TestEmbedded* top-level functions in cmd/bd/*_test.go.
|
||||
# Tests listed in embedded-cmd-test-shards.txt for the requested shard count use
|
||||
# that committed assignment; newly-added tests fall back to hash(name) % total.
|
||||
# Runs the matching subset using the pre-built test binary at
|
||||
# BEADS_TEST_CMD_BINARY (or /tmp/bd-cmd-test).
|
||||
#
|
||||
# Environment:
|
||||
# BEADS_TEST_EMBEDDED_DOLT=1 required (tests skip without it)
|
||||
# BEADS_TEST_BD_BINARY=<path> optional pre-built bd binary (used by tests)
|
||||
# BEADS_TEST_CMD_BINARY=<path> pre-built cmd/bd test binary (default: /tmp/bd-cmd-test)
|
||||
# BEADS_TEST_SHARD_LIST_ONLY=1 print selected tests without running them
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SHARD_NUMBER="${1:?usage: $0 <shard_number> <total_shards>}"
|
||||
TOTAL_SHARDS="${2:?usage: $0 <shard_number> <total_shards>}"
|
||||
shift 2
|
||||
|
||||
if ! [[ "$SHARD_NUMBER" =~ ^[0-9]+$ ]] || ! [[ "$TOTAL_SHARDS" =~ ^[0-9]+$ ]]; then
|
||||
echo "Shard number and total shards must be positive integers" >&2
|
||||
exit 1
|
||||
fi
|
||||
if (( TOTAL_SHARDS < 1 || SHARD_NUMBER < 1 || SHARD_NUMBER > TOTAL_SHARDS )); then
|
||||
echo "Invalid shard ${SHARD_NUMBER}/${TOTAL_SHARDS}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SHARD_INDEX=$(( SHARD_NUMBER - 1 ))
|
||||
MANIFEST="${BEADS_TEST_SHARD_MANIFEST:-.github/scripts/embedded-cmd-test-shards.txt}"
|
||||
|
||||
# Discover all top-level TestEmbedded* functions across every cmd/bd test
|
||||
# file, by name rather than by file glob (as proxied-test-shard.sh does): a
|
||||
# test gated on BEADS_TEST_EMBEDDED_DOLT runs in this lane or in none, wherever
|
||||
# it lives. scripts/embedded_lane_coverage_test.go fails on a gated test this
|
||||
# selection misses.
|
||||
ALL_TESTS=$(grep -rh '^func TestEmbedded' cmd/bd/*_test.go \
|
||||
| sed 's/func \(TestEmbedded[A-Za-z0-9_]*\).*/\1/' \
|
||||
| sort -u)
|
||||
|
||||
if [ -z "$ALL_TESTS" ]; then
|
||||
echo "No TestEmbedded* functions found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
declare -A ALL_TEST_SET=()
|
||||
while IFS= read -r name; do
|
||||
ALL_TEST_SET["$name"]=1
|
||||
done <<< "$ALL_TESTS"
|
||||
|
||||
declare -A MANIFEST_SHARDS=()
|
||||
if [ -f "$MANIFEST" ]; then
|
||||
while IFS= read -r line || [ -n "$line" ]; do
|
||||
line="${line%%#*}"
|
||||
read -r manifest_total manifest_shard test_name extra <<< "$line"
|
||||
if [ -z "${manifest_total:-}" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ -n "${extra:-}" ] || ! [[ "$manifest_total" =~ ^[0-9]+$ ]] || ! [[ "$manifest_shard" =~ ^[0-9]+$ ]] || ! [[ "$test_name" =~ ^TestEmbedded[A-Za-z0-9_]+$ ]]; then
|
||||
echo "Invalid shard manifest line: $line" >&2
|
||||
exit 1
|
||||
fi
|
||||
if (( manifest_total != TOTAL_SHARDS )); then
|
||||
continue
|
||||
fi
|
||||
if (( manifest_shard < 1 || manifest_shard > TOTAL_SHARDS )); then
|
||||
echo "Invalid shard ${manifest_shard}/${manifest_total} for $test_name in $MANIFEST" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ -n "${MANIFEST_SHARDS[$test_name]:-}" ]; then
|
||||
echo "Duplicate shard manifest entry for $test_name in $MANIFEST" >&2
|
||||
exit 1
|
||||
fi
|
||||
MANIFEST_SHARDS["$test_name"]="$manifest_shard"
|
||||
done < "$MANIFEST"
|
||||
fi
|
||||
|
||||
for name in "${!MANIFEST_SHARDS[@]}"; do
|
||||
if [ -z "${ALL_TEST_SET[$name]:-}" ]; then
|
||||
echo "Shard manifest entry does not match a discovered test: $name" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
SHARD_TESTS=()
|
||||
MANIFEST_COUNT=0
|
||||
FALLBACK_COUNT=0
|
||||
while IFS= read -r name; do
|
||||
assigned_shard="${MANIFEST_SHARDS[$name]:-}"
|
||||
if [ -n "$assigned_shard" ]; then
|
||||
if (( assigned_shard == SHARD_NUMBER )); then
|
||||
SHARD_TESTS+=("$name")
|
||||
MANIFEST_COUNT=$(( MANIFEST_COUNT + 1 ))
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
# Use cksum for a portable numeric hash fallback for newly-added tests.
|
||||
hash=$(printf %s "$name" | cksum | cut -d ' ' -f 1)
|
||||
if (( hash % TOTAL_SHARDS == SHARD_INDEX )); then
|
||||
SHARD_TESTS+=("$name")
|
||||
FALLBACK_COUNT=$(( FALLBACK_COUNT + 1 ))
|
||||
fi
|
||||
done <<< "$ALL_TESTS"
|
||||
|
||||
if [ ${#SHARD_TESTS[@]} -eq 0 ]; then
|
||||
echo "Shard ${SHARD_NUMBER}/${TOTAL_SHARDS}: no tests assigned (all hashed to other shards)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Build the -run regex: "^(TestA|TestB|TestC)$"
|
||||
RUN_REGEX="^($(IFS='|'; echo "${SHARD_TESTS[*]}"))$"
|
||||
|
||||
echo "Shard ${SHARD_NUMBER}/${TOTAL_SHARDS}: running ${#SHARD_TESTS[@]} test(s)"
|
||||
echo " manifest: ${MANIFEST_COUNT}, fallback: ${FALLBACK_COUNT}"
|
||||
printf " %s\n" "${SHARD_TESTS[@]}"
|
||||
echo ""
|
||||
|
||||
# Use pre-built test binary if available, otherwise fall back to go test.
|
||||
CMD_BINARY="${BEADS_TEST_CMD_BINARY:-/tmp/bd-cmd-test}"
|
||||
if [ "${BEADS_TEST_SHARD_LIST_ONLY:-}" = "1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -x "$CMD_BINARY" ]; then
|
||||
exec "$CMD_BINARY" -test.v -test.count=1 -test.timeout=20m \
|
||||
-test.run "$RUN_REGEX" \
|
||||
"$@"
|
||||
else
|
||||
echo "Warning: pre-built test binary not found at $CMD_BINARY, falling back to go test"
|
||||
exec go test -tags=gms_pure_go -v -race -count=1 -timeout 20m \
|
||||
-run "$RUN_REGEX" \
|
||||
"$@" \
|
||||
./cmd/bd/
|
||||
fi
|
||||
288
.github/scripts/proxied-cmd-test-shards.txt
vendored
288
.github/scripts/proxied-cmd-test-shards.txt
vendored
|
|
@ -1,288 +0,0 @@
|
|||
# Proxied-server cmd test shard manifest.
|
||||
#
|
||||
# Format: <total_shards> <shard_number> <top_level_test_name>
|
||||
#
|
||||
# 34-shard split for the Bazel-only proxied-server tier
|
||||
# (bazel-proxied in .github/workflows/bazel.yml), bin-packed
|
||||
# longest-processing-time-first by measured wall-time from
|
||||
# scripts/ci/proxied_test_durations.json (see that file for
|
||||
# provenance and its "relative weight, not absolute SLA" caveat).
|
||||
# Regenerate with scripts/ci/gen_proxied_shard_manifest.py 34
|
||||
# --weights=duration --write after adding or removing
|
||||
# TestProxiedServer*/TestServerMode* functions. --write is incremental:
|
||||
# it keeps every already-assigned test on its current shard and only
|
||||
# places newly-discovered names, onto whichever shard is currently
|
||||
# lightest, so two unrelated PRs that each add one test do not textually
|
||||
# conflict or silently invalidate each other's packing. Pass --repack to
|
||||
# force a full from-scratch rebalance instead (a deliberate, separate
|
||||
# change — expect a large diff). --check only verifies every discovered
|
||||
# name is listed here exactly once (no stale or duplicate entries); it
|
||||
# does NOT verify the packing is still well-balanced, so a reweighted
|
||||
# proxied_test_durations.json does not by itself fail --check — rerun
|
||||
# with --repack periodically (or whenever shard loads look uneven in CI)
|
||||
# to rebalance on purpose. Newly-added tests not listed here
|
||||
# hash-distribute via proxied-test-shard.sh: cksum(name) % total,
|
||||
# unrelated to proxied_test_durations.json (that file only feeds this
|
||||
# generator's own cost estimate for a test it has not measured yet).
|
||||
#
|
||||
# This file is generated: notes added here are erased by the next
|
||||
# regeneration. Add them to the generator or the durations file
|
||||
# instead.
|
||||
|
||||
34 1 TestProxiedServerDep2
|
||||
34 1 TestProxiedServerMolProgress
|
||||
34 1 TestProxiedServerReadyClaimConcurrent
|
||||
34 1 TestProxiedServerServeActivatesTheEventsJournal
|
||||
34 1 TestProxiedServerServeRelease
|
||||
|
||||
34 2 TestProxiedServerDepListSingleIDWarnsOnDroppedExternalEdge
|
||||
34 2 TestProxiedServerGateList
|
||||
34 2 TestProxiedServerList
|
||||
34 2 TestProxiedServerServeRemoveDependency
|
||||
34 2 TestProxiedServerUpdateC
|
||||
|
||||
34 3 TestProxiedServerAutoPrune
|
||||
34 3 TestProxiedServerClose2B
|
||||
34 3 TestProxiedServerEventsJournalOffByDefault
|
||||
34 3 TestProxiedServerIfRevisionCloseMismatchRefuses
|
||||
34 3 TestProxiedServerMolLastActivity
|
||||
34 3 TestProxiedServerPurgeWispsPlaneRetention
|
||||
34 3 TestProxiedServerServeLifecycle
|
||||
34 3 TestProxiedServerStatuses
|
||||
|
||||
34 4 TestProxiedServerMolStale
|
||||
34 4 TestProxiedServerReadyConcurrent
|
||||
34 4 TestProxiedServerServeRelatedIssues
|
||||
34 4 TestProxiedServerServeSettingsWrites
|
||||
34 4 TestProxiedServerShow2
|
||||
34 4 TestServerModeServeSkipsPostRunMaintenance
|
||||
|
||||
34 5 TestProxiedServerHistoryRemoteRefusalFrontDoorMatrix
|
||||
34 5 TestProxiedServerInfo
|
||||
34 5 TestProxiedServerNote
|
||||
34 5 TestProxiedServerOutageReconnectAcceptanceMatrix
|
||||
34 5 TestProxiedServerUpdate3
|
||||
34 5 TestServerModeDeferAutoWake
|
||||
|
||||
34 6 TestProxiedServerPing
|
||||
34 6 TestProxiedServerQuick
|
||||
34 6 TestProxiedServerServeReadsTheJournalItJustWrote
|
||||
34 6 TestProxiedServerSwarm
|
||||
34 6 TestProxiedServerUpdate2B
|
||||
34 6 TestProxiedServerVersionedHistorySwitchRefusesAnUnrecordableGateTimeout
|
||||
34 6 TestProxiedServerWispList
|
||||
|
||||
34 7 TestProxiedServerCloseConcurrent
|
||||
34 7 TestProxiedServerCreateInfraTypeRoutesToWisps
|
||||
34 7 TestProxiedServerDeleteIfRevisionSingleWinner
|
||||
34 7 TestProxiedServerExternalCreate
|
||||
34 7 TestProxiedServerIfRevisionGuardDelete
|
||||
34 7 TestProxiedServerIfRevisionTargetGoneIsPreconditionFailed
|
||||
34 7 TestProxiedServerLabelC
|
||||
34 7 TestProxiedServerMoleculeLifecycleAgreesOnEveryRoute
|
||||
34 7 TestProxiedServerTypesAgreeWithCreate
|
||||
|
||||
34 8 TestProxiedServerClose2
|
||||
34 8 TestProxiedServerDeleteWisp
|
||||
34 8 TestProxiedServerExport
|
||||
34 8 TestProxiedServerFindDuplicates
|
||||
34 8 TestProxiedServerGateCheck
|
||||
34 8 TestProxiedServerServeReadParity
|
||||
|
||||
34 9 TestProxiedServerCloseSiblingBlockersFanIn
|
||||
34 9 TestProxiedServerGateLifecycle
|
||||
34 9 TestProxiedServerHistoryRemoteSupportedFrontDoorParity
|
||||
34 9 TestProxiedServerIfRevisionGuardReopen
|
||||
34 9 TestProxiedServerIfRevisionOutranksReassignFence
|
||||
34 9 TestProxiedServerServeRefusesTheJournalWhenItIsDisabled
|
||||
34 9 TestProxiedServerUpdate
|
||||
34 9 TestServerModeServe
|
||||
|
||||
34 10 TestProxiedServerContext
|
||||
34 10 TestProxiedServerCreate2B
|
||||
34 10 TestProxiedServerGateCheckB
|
||||
34 10 TestProxiedServerServeRefusesAStreamOnADisabledJournal
|
||||
34 10 TestProxiedServerTypes
|
||||
34 10 TestProxiedServerUpdate2C
|
||||
|
||||
34 11 TestProxiedServerBatchParity
|
||||
34 11 TestProxiedServerCompactHistory
|
||||
34 11 TestProxiedServerPour
|
||||
34 11 TestProxiedServerQuery
|
||||
34 11 TestProxiedServerReady
|
||||
34 11 TestProxiedServerServeAddDependencies
|
||||
|
||||
34 12 TestProxiedServerBlocked
|
||||
34 12 TestProxiedServerChildren
|
||||
34 12 TestProxiedServerCleanDatabases
|
||||
34 12 TestProxiedServerReadyB
|
||||
34 12 TestProxiedServerReadyWisp
|
||||
34 12 TestProxiedServerReclaim
|
||||
34 12 TestProxiedServerShowCommentsTail
|
||||
34 12 TestProxiedServerUnclaim
|
||||
|
||||
34 13 TestProxiedServerCompactDolt
|
||||
34 13 TestProxiedServerCreate2
|
||||
34 13 TestProxiedServerGraph
|
||||
34 13 TestProxiedServerHistoryRemoteSupportedDirectParity
|
||||
34 13 TestProxiedServerMolSquash
|
||||
34 13 TestProxiedServerPromote
|
||||
34 13 TestProxiedServerServeRefusesAStaleCheckpointWithGone
|
||||
|
||||
34 14 TestProxiedServerAssign
|
||||
34 14 TestProxiedServerCloseB
|
||||
34 14 TestProxiedServerDuplicates
|
||||
34 14 TestProxiedServerHeartbeat
|
||||
34 14 TestProxiedServerIfRevisionCloseReplaysMoleculeAutoClose
|
||||
34 14 TestProxiedServerInitIfMissing
|
||||
34 14 TestProxiedServerMolReadyGated
|
||||
|
||||
34 15 TestProxiedServerDepConcurrent
|
||||
34 15 TestProxiedServerImport
|
||||
34 15 TestProxiedServerMoleculeFrontDoorWriteParity
|
||||
34 15 TestProxiedServerReopenConcurrent
|
||||
34 15 TestProxiedServerSQL
|
||||
|
||||
34 16 TestProxiedServerBackupRefusedOnExternalTopology
|
||||
34 16 TestProxiedServerCascadeParity
|
||||
34 16 TestProxiedServerConfigSetMany
|
||||
34 16 TestProxiedServerKV
|
||||
34 16 TestProxiedServerServeCount
|
||||
34 16 TestProxiedServerServeCreate
|
||||
34 16 TestProxiedServerUpdateHooks
|
||||
|
||||
34 17 TestProxiedServerDep
|
||||
34 17 TestProxiedServerMultiStatementSQL
|
||||
34 17 TestProxiedServerOrphans
|
||||
34 17 TestProxiedServerPrime
|
||||
34 17 TestProxiedServerSQLDatabaseFlag
|
||||
34 17 TestProxiedServerServeModeGate
|
||||
34 17 TestServerModeServeIgnoresGraphModeDependency
|
||||
|
||||
34 18 TestProxiedServerClose3
|
||||
34 18 TestProxiedServerCount
|
||||
34 18 TestProxiedServerCountIncludeInfra
|
||||
34 18 TestProxiedServerDoltRemoteRemove
|
||||
34 18 TestProxiedServerMolShow
|
||||
34 18 TestProxiedServerWispCreateRejectsEnumViolatingVar
|
||||
|
||||
34 19 TestProxiedServerCreate
|
||||
34 19 TestProxiedServerMolCurrent
|
||||
34 19 TestProxiedServerServeBatchClose
|
||||
34 19 TestProxiedServerShow3
|
||||
34 19 TestServerModeTypesAgreeWithCreate
|
||||
|
||||
34 20 TestProxiedServerDelete
|
||||
34 20 TestProxiedServerLint
|
||||
34 20 TestProxiedServerPriority
|
||||
34 20 TestProxiedServerShow2B
|
||||
34 20 TestProxiedServerWispGC
|
||||
34 20 TestServerModeSharedServeGlobalReportsTheServedDatabase
|
||||
|
||||
34 21 TestProxiedServerBatchDepAddRefusesADottedChildGatedOnItsParent
|
||||
34 21 TestProxiedServerConfig
|
||||
34 21 TestProxiedServerExternalPolicyDirectParity
|
||||
34 21 TestProxiedServerMoleculeFrontDoorDirectServerProxyParity
|
||||
34 21 TestProxiedServerPathHelpers
|
||||
34 21 TestProxiedServerPrune
|
||||
34 21 TestProxiedServerServeClose
|
||||
34 21 TestProxiedServerUnclaimIfAssigneeParity
|
||||
|
||||
34 22 TestProxiedServerGateCreateInheritsRepoMetadata
|
||||
34 22 TestProxiedServerRecomputeBlocked
|
||||
34 22 TestProxiedServerServeEdgeCounts
|
||||
34 22 TestProxiedServerTag
|
||||
34 22 TestProxiedServerUpdateB
|
||||
34 22 TestProxiedServerUpdateConcurrentMetadata
|
||||
|
||||
34 23 TestProxiedServerDep2B
|
||||
34 23 TestProxiedServerIfRevisionGuardUpdate
|
||||
34 23 TestProxiedServerListWatchCountsTheOffsetIntoMaxRows
|
||||
34 23 TestProxiedServerMolBurn
|
||||
34 23 TestProxiedServerSearchRoutesAgree
|
||||
34 23 TestProxiedServerServeUpdate
|
||||
34 23 TestProxiedServerUpdateConcurrentClaim
|
||||
34 23 TestProxiedServerUpdateWisp
|
||||
|
||||
34 24 TestProxiedServerDeleteBlockedJSONSingleDoc
|
||||
34 24 TestProxiedServerDeleteForceOrphans
|
||||
34 24 TestProxiedServerHuman
|
||||
34 24 TestProxiedServerIfRevisionDeleteMatchAndMismatch
|
||||
34 24 TestProxiedServerIfRevisionGuardAssign
|
||||
34 24 TestProxiedServerListComments
|
||||
34 24 TestProxiedServerListSortRetiresTheWalk
|
||||
34 24 TestProxiedServerShowWatch
|
||||
34 24 TestProxiedServerUpdateIfGuards
|
||||
|
||||
34 25 TestProxiedServerInitExplicitBeadsDirIsAuthoritative
|
||||
34 25 TestProxiedServerSetState
|
||||
34 25 TestProxiedServerShow
|
||||
34 25 TestProxiedServerShowB
|
||||
34 25 TestProxiedServerStale
|
||||
34 25 TestProxiedServerWispCreate
|
||||
|
||||
34 26 TestProxiedServerDeferAutoWake
|
||||
34 26 TestProxiedServerExternalMutationPolicy
|
||||
34 26 TestProxiedServerReopenB
|
||||
34 26 TestProxiedServerSearch
|
||||
34 26 TestProxiedServerServeClaim
|
||||
34 26 TestProxiedServerShow3B
|
||||
|
||||
34 27 TestProxiedServerDeferUndefer
|
||||
34 27 TestProxiedServerGatedRendering
|
||||
34 27 TestProxiedServerHistory
|
||||
34 27 TestProxiedServerLabel
|
||||
34 27 TestProxiedServerLabelB
|
||||
34 27 TestProxiedServerUpdateClosePolicy
|
||||
|
||||
34 28 TestProxiedServerDep2C
|
||||
34 28 TestProxiedServerDoltLifecycle
|
||||
34 28 TestProxiedServerIfRevisionCloseWarnsOnForcedOpenChildren
|
||||
34 28 TestProxiedServerReady2
|
||||
34 28 TestProxiedServerReassignFence
|
||||
34 28 TestProxiedServerSQLStatementRouting
|
||||
34 28 TestProxiedServerServeClaimNext
|
||||
34 28 TestProxiedServerUpdateConcurrentAppendNotes
|
||||
|
||||
34 29 TestProxiedServerGateFrontDoorDirectServerProxyParity
|
||||
34 29 TestProxiedServerMolDistill
|
||||
34 29 TestProxiedServerReopen
|
||||
34 29 TestProxiedServerServeDelete
|
||||
34 29 TestProxiedServerState
|
||||
|
||||
34 30 TestProxiedServerDeleteConcurrent
|
||||
34 30 TestProxiedServerReadyC
|
||||
34 30 TestProxiedServerServeAddComment
|
||||
34 30 TestProxiedServerStatus
|
||||
34 30 TestProxiedServerTodo
|
||||
34 30 TestProxiedServerUpdate2
|
||||
34 30 TestProxiedServerVersionedHistoryServeActivatesTheProviderFromItsOwnRow
|
||||
|
||||
34 31 TestProxiedServerCloseBeadGate
|
||||
34 31 TestProxiedServerComment
|
||||
34 31 TestProxiedServerConfigB
|
||||
34 31 TestProxiedServerEventsJournal
|
||||
34 31 TestProxiedServerGateAddWaiterConvoy
|
||||
34 31 TestProxiedServerIfRevisionGuardClose
|
||||
34 31 TestProxiedServerMolBond
|
||||
|
||||
34 32 TestProxiedServerCleanDatabasesPurgeDropped
|
||||
34 32 TestProxiedServerConfigConcurrent
|
||||
34 32 TestProxiedServerDepB
|
||||
34 32 TestProxiedServerServeStreamsTheJournalItIsWriting
|
||||
34 32 TestProxiedServerServeUpdateClaim
|
||||
34 32 TestProxiedServerStorageClass
|
||||
|
||||
34 33 TestProxiedServerBatchDefersThenDoltCommitAdvancesHeadOnce
|
||||
34 33 TestProxiedServerClose
|
||||
34 33 TestProxiedServerGC
|
||||
34 33 TestProxiedServerMemory
|
||||
34 33 TestProxiedServerPourRejectsEnumViolatingVar
|
||||
34 33 TestProxiedServerRelate
|
||||
|
||||
34 34 TestProxiedServerClose4
|
||||
34 34 TestProxiedServerCreate2C
|
||||
34 34 TestProxiedServerEdit
|
||||
34 34 TestProxiedServerEpic
|
||||
34 34 TestProxiedServerLink
|
||||
34 34 TestProxiedServerServeReadRevision
|
||||
153
.github/scripts/proxied-test-shard.sh
vendored
153
.github/scripts/proxied-test-shard.sh
vendored
|
|
@ -1,153 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# proxied-test-shard.sh — run a shard of proxied-server dolt cmd/bd tests.
|
||||
#
|
||||
# Usage: proxied-test-shard.sh <shard_number> <total_shards>
|
||||
#
|
||||
# Discovers all TestProxiedServer* and TestServerMode* top-level functions
|
||||
# across cmd/bd/*_test.go (the proxied integration suites plus
|
||||
# TestProxiedServerExternalCreate and the TestProxiedServerPathHelpers unit
|
||||
# test, widening the lane's historical `-run '^TestProxiedServer'`). The
|
||||
# TestServerMode* suites all gate on requireSharedProxiedServer and drive the
|
||||
# same shared dolt sql-server, and this lane is the only one that sets
|
||||
# BEADS_TEST_PROXIED_SERVER=1, so it is the only place they run: before the
|
||||
# widening a top-level TestServerMode* entry point matched no discovery pattern
|
||||
# here, so it skipped everywhere else and was never executed by CI at all.
|
||||
# The TestProxiedServer* side is mixed and should not be generalized over: most
|
||||
# gate on requireSharedProxiedServer, the rest on requireProxiedServerEnv, and
|
||||
# TestProxiedServerPathHelpers (pure path helpers) has no gate and no build tag,
|
||||
# so that one also runs in every ordinary `go test ./cmd/bd/` lane.
|
||||
#
|
||||
# Tests listed in proxied-cmd-test-shards.txt for the requested shard count use
|
||||
# that committed assignment; newly-added tests fall back to hash(name) % total.
|
||||
# Runs the matching subset using the pre-built test binary at
|
||||
# BEADS_TEST_CMD_BINARY (or /tmp/bd-cmd-test).
|
||||
#
|
||||
# Environment:
|
||||
# BEADS_TEST_PROXIED_SERVER=1 required (tests skip without it)
|
||||
# BEADS_TEST_BD_BINARY=<path> pre-built bd binary used as the subprocess
|
||||
# BEADS_TEST_CMD_BINARY=<path> pre-built cmd/bd test binary (default: /tmp/bd-cmd-test)
|
||||
# BEADS_TEST_SHARD_MANIFEST=<path> override committed manifest path
|
||||
# BEADS_TEST_SHARD_LIST_ONLY=1 print selected tests without running them
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SHARD_NUMBER="${1:?usage: $0 <shard_number> <total_shards>}"
|
||||
TOTAL_SHARDS="${2:?usage: $0 <shard_number> <total_shards>}"
|
||||
shift 2
|
||||
|
||||
if ! [[ "$SHARD_NUMBER" =~ ^[0-9]+$ ]] || ! [[ "$TOTAL_SHARDS" =~ ^[0-9]+$ ]]; then
|
||||
echo "Shard number and total shards must be positive integers" >&2
|
||||
exit 1
|
||||
fi
|
||||
if (( TOTAL_SHARDS < 1 || SHARD_NUMBER < 1 || SHARD_NUMBER > TOTAL_SHARDS )); then
|
||||
echo "Invalid shard ${SHARD_NUMBER}/${TOTAL_SHARDS}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SHARD_INDEX=$(( SHARD_NUMBER - 1 ))
|
||||
MANIFEST="${BEADS_TEST_SHARD_MANIFEST:-.github/scripts/proxied-cmd-test-shards.txt}"
|
||||
|
||||
# Discover all top-level TestProxiedServer*/TestServerMode* functions across
|
||||
# every cmd/bd test file (integration suites live in
|
||||
# *_proxied_integration_test.go, but TestProxiedServerExternalCreate,
|
||||
# TestProxiedServerPathHelpers and the TestServerMode* suites do not, so match
|
||||
# by name rather than by file glob).
|
||||
ALL_TESTS=$(grep -rhE '^func Test(ProxiedServer|ServerMode)' cmd/bd/*_test.go \
|
||||
| sed -E 's/func (Test(ProxiedServer|ServerMode)[A-Za-z0-9_]*).*/\1/' \
|
||||
| sort -u)
|
||||
|
||||
if [ -z "$ALL_TESTS" ]; then
|
||||
echo "No TestProxiedServer*/TestServerMode* functions found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
declare -A ALL_TEST_SET=()
|
||||
while IFS= read -r name; do
|
||||
ALL_TEST_SET["$name"]=1
|
||||
done <<< "$ALL_TESTS"
|
||||
|
||||
declare -A MANIFEST_SHARDS=()
|
||||
if [ -f "$MANIFEST" ]; then
|
||||
while IFS= read -r line || [ -n "$line" ]; do
|
||||
line="${line%%#*}"
|
||||
read -r manifest_total manifest_shard test_name extra <<< "$line"
|
||||
if [ -z "${manifest_total:-}" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ -n "${extra:-}" ] || ! [[ "$manifest_total" =~ ^[0-9]+$ ]] || ! [[ "$manifest_shard" =~ ^[0-9]+$ ]] || ! [[ "$test_name" =~ ^Test(ProxiedServer|ServerMode)[A-Za-z0-9_]+$ ]]; then
|
||||
echo "Invalid shard manifest line: $line" >&2
|
||||
exit 1
|
||||
fi
|
||||
if (( manifest_total != TOTAL_SHARDS )); then
|
||||
continue
|
||||
fi
|
||||
if (( manifest_shard < 1 || manifest_shard > TOTAL_SHARDS )); then
|
||||
echo "Invalid shard ${manifest_shard}/${manifest_total} for $test_name in $MANIFEST" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ -n "${MANIFEST_SHARDS[$test_name]:-}" ]; then
|
||||
echo "Duplicate shard manifest entry for $test_name in $MANIFEST" >&2
|
||||
exit 1
|
||||
fi
|
||||
MANIFEST_SHARDS["$test_name"]="$manifest_shard"
|
||||
done < "$MANIFEST"
|
||||
fi
|
||||
|
||||
for name in "${!MANIFEST_SHARDS[@]}"; do
|
||||
if [ -z "${ALL_TEST_SET[$name]:-}" ]; then
|
||||
echo "Shard manifest entry does not match a discovered test: $name" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
SHARD_TESTS=()
|
||||
MANIFEST_COUNT=0
|
||||
FALLBACK_COUNT=0
|
||||
while IFS= read -r name; do
|
||||
assigned_shard="${MANIFEST_SHARDS[$name]:-}"
|
||||
if [ -n "$assigned_shard" ]; then
|
||||
if (( assigned_shard == SHARD_NUMBER )); then
|
||||
SHARD_TESTS+=("$name")
|
||||
MANIFEST_COUNT=$(( MANIFEST_COUNT + 1 ))
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
# Use cksum for a portable numeric hash fallback for newly-added tests.
|
||||
hash=$(printf %s "$name" | cksum | cut -d ' ' -f 1)
|
||||
if (( hash % TOTAL_SHARDS == SHARD_INDEX )); then
|
||||
SHARD_TESTS+=("$name")
|
||||
FALLBACK_COUNT=$(( FALLBACK_COUNT + 1 ))
|
||||
fi
|
||||
done <<< "$ALL_TESTS"
|
||||
|
||||
if [ ${#SHARD_TESTS[@]} -eq 0 ]; then
|
||||
echo "Shard ${SHARD_NUMBER}/${TOTAL_SHARDS}: no tests assigned (all hashed to other shards)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Build the -run regex: "^(TestA|TestB|TestC)$"
|
||||
RUN_REGEX="^($(IFS='|'; echo "${SHARD_TESTS[*]}"))$"
|
||||
|
||||
echo "Shard ${SHARD_NUMBER}/${TOTAL_SHARDS}: running ${#SHARD_TESTS[@]} test(s)"
|
||||
echo " manifest: ${MANIFEST_COUNT}, fallback: ${FALLBACK_COUNT}"
|
||||
printf " %s\n" "${SHARD_TESTS[@]}"
|
||||
echo ""
|
||||
|
||||
# Use pre-built test binary if available, otherwise fall back to go test.
|
||||
CMD_BINARY="${BEADS_TEST_CMD_BINARY:-/tmp/bd-cmd-test}"
|
||||
if [ "${BEADS_TEST_SHARD_LIST_ONLY:-}" = "1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -x "$CMD_BINARY" ]; then
|
||||
exec "$CMD_BINARY" -test.v -test.count=1 -test.timeout=15m \
|
||||
-test.run "$RUN_REGEX" \
|
||||
"$@"
|
||||
else
|
||||
echo "Warning: pre-built test binary not found at $CMD_BINARY, falling back to go test"
|
||||
exec go test -tags=gms_pure_go -v -count=1 -timeout 15m \
|
||||
-run "$RUN_REGEX" \
|
||||
"$@" \
|
||||
./cmd/bd/
|
||||
fi
|
||||
17
.github/scripts/rrc-lane-commands.txt
vendored
17
.github/scripts/rrc-lane-commands.txt
vendored
|
|
@ -1,17 +0,0 @@
|
|||
# Every bazel.yml lane's loading and analysis, for the remote repo contents
|
||||
# cache: rrc-seed runs each line with --nobuild on a push to main (uploading
|
||||
# the repositories it fetches) and rrc-verify runs each cold every night.
|
||||
# One `bazel` command per line (no shell quoting); # starts a comment.
|
||||
# scripts/bazel_rrc_test.go checks that every --config a reading lane's
|
||||
# bazel command uses appears here.
|
||||
test //... --config=ci
|
||||
test //... --config=embedded
|
||||
test //... --config=integration
|
||||
test //... --config=doltserver
|
||||
test //... --config=doltserver-proxied
|
||||
test //... --config=dolt-race
|
||||
test //... --config=doltserver-integration
|
||||
test //... --config=doltserver-cmd
|
||||
test //... --config=dolt-int
|
||||
build --config=pure //cmd/bd:bd //cmd/bd:bd_test //internal/storage/embeddeddolt:embeddeddolt_test //internal/tracker:tracker_test
|
||||
build --config=js-wasm //internal/hooks:hooks_test
|
||||
51
.github/scripts/rrc-run-lanes.sh
vendored
51
.github/scripts/rrc-run-lanes.sh
vendored
|
|
@ -1,51 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Loading and analysis of every bazel.yml lane, for the remote repo contents
|
||||
# cache (bazel.yml's rrc-seed and rrc-verify jobs).
|
||||
#
|
||||
# Usage: rrc-run-lanes.sh [STARTUP_FLAG...] -- [COMMAND_FLAG...]
|
||||
#
|
||||
# Runs `bazel STARTUP_FLAG... <line> --nobuild COMMAND_FLAG...` for each
|
||||
# command line in .github/scripts/rrc-lane-commands.txt (or RRC_LANE_COMMANDS),
|
||||
# in order, stopping at the first failure. --nobuild: repository rules,
|
||||
# loading and analysis only, never a build or test action.
|
||||
#
|
||||
# Bazel exits 1 after `test --nobuild` even when loading and analysis succeed
|
||||
# ("Couldn't start the build. Unable to run tests"). A command passes when it
|
||||
# exits 0, or exits non-zero having printed "Build completed successfully"
|
||||
# and no ERROR line but that one.
|
||||
set -euo pipefail
|
||||
|
||||
startup=()
|
||||
while [ $# -gt 0 ] && [ "$1" != -- ]; do
|
||||
startup+=("$1")
|
||||
shift
|
||||
done
|
||||
[ $# -gt 0 ] || {
|
||||
echo "usage: rrc-run-lanes.sh [STARTUP_FLAG...] -- [COMMAND_FLAG...]" >&2
|
||||
exit 2
|
||||
}
|
||||
shift
|
||||
flags=("$@")
|
||||
|
||||
file=${RRC_LANE_COMMANDS:-$(dirname "${BASH_SOURCE[0]}")/rrc-lane-commands.txt}
|
||||
mapfile -t cmds < <(sed -e 's/#.*//' -e 's/[[:space:]]*$//' "$file" | grep -v '^[[:space:]]*$' || true)
|
||||
if [ "${#cmds[@]}" -eq 0 ]; then
|
||||
echo "::error::no lane commands in $file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log=$(mktemp)
|
||||
trap 'rm -f "$log"' EXIT
|
||||
summary=${GITHUB_STEP_SUMMARY:-/dev/null}
|
||||
for cmd in "${cmds[@]}"; do
|
||||
read -r -a args <<<"$cmd"
|
||||
start=$(date +%s)
|
||||
rc=0
|
||||
bazel ${startup[@]+"${startup[@]}"} "${args[@]}" --nobuild ${flags[@]+"${flags[@]}"} </dev/null 2>&1 | tee "$log" || rc=$?
|
||||
if [ "$rc" -ne 0 ] && grep -q '^INFO: Build completed successfully' "$log" &&
|
||||
! grep '^ERROR:' "$log" | grep -qv "^ERROR: Couldn't start the build. Unable to run tests$"; then
|
||||
rc=0
|
||||
fi
|
||||
echo "rrc: \`bazel $cmd\`: exit $rc, $(($(date +%s) - start))s" | tee -a "$summary"
|
||||
[ "$rc" -eq 0 ] || exit "$rc"
|
||||
done
|
||||
113
.github/scripts/rrc-writer-credential.sh
vendored
113
.github/scripts/rrc-writer-credential.sh
vendored
|
|
@ -1,113 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# A 30-minute rbe-west client certificate for the remote repo contents cache
|
||||
# writer (bazel.yml's rrc-seed job; engdocs/design/bazel-remote-repo-contents-cache.md).
|
||||
#
|
||||
# The job trades its GitHub Actions OIDC token (audience rbe-rrc-writer) for a
|
||||
# certificate CN=rbe-rrc-writer from rbe-west's mint. The mint signs only for
|
||||
# this repository's bazel.yml on a push to main (repository, ref, event_name
|
||||
# and job_workflow_ref claims); pull_request, fork and Dependabot runs cannot
|
||||
# get one (no OIDC token, or a refs/pull/N/merge one). On rbe-west that
|
||||
# certificate reaches only GetCapabilities, the CAS and an action cache front
|
||||
# (rrc-gate) that admits repo-contents entries and refuses everything else, so
|
||||
# it can never write an execution result or execute anything.
|
||||
#
|
||||
# The key is an EC P-256 key (PKCS#8: Bazel's Netty TLS refuses a SEC1 "EC
|
||||
# PRIVATE KEY") generated here in BAZEL_CI_SECRET_DIR, outside the workspace;
|
||||
# it never leaves the runner. The OIDC token is masked. Outputs (to
|
||||
# $GITHUB_OUTPUT when set, else stdout): cert, key, endpoint, instance; none
|
||||
# when the mint answers 503 or cannot be reached (seeding switched off on
|
||||
# rbe-west: infra nativelink-cas/west/README.md "Client contract"), which
|
||||
# exits 0 with a warning.
|
||||
#
|
||||
# Tests only: RBE_RRC_MINT (a stand-in mint) and RBE_RRC_ENDPOINT_RE.
|
||||
set -euo pipefail
|
||||
MINT=${RBE_RRC_MINT:-https://rbe-mint.ops.gascity.com:8444}
|
||||
ENDPOINT_RE=${RBE_RRC_ENDPOINT_RE:-'^grpcs://rbe-west\.ops\.gascity\.com(:443)?$'}
|
||||
AUDIENCE=rbe-rrc-writer
|
||||
dir=${BAZEL_CI_SECRET_DIR:?BAZEL_CI_SECRET_DIR is required}
|
||||
out=${GITHUB_OUTPUT:-/dev/stdout}
|
||||
|
||||
if [ -z "${ACTIONS_ID_TOKEN_REQUEST_URL:-}" ] || [ -z "${ACTIONS_ID_TOKEN_REQUEST_TOKEN:-}" ]; then
|
||||
echo "::error title=rrc writer::no OIDC token request URL; the job needs permissions: id-token: write" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
install -d -m 0700 "$dir"
|
||||
umask 077
|
||||
|
||||
oidc=$(curl -sS --fail --connect-timeout 5 --max-time 30 --retry 3 --retry-all-errors \
|
||||
-H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
|
||||
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=$AUDIENCE" | jq -r '.value // empty')
|
||||
if [ -z "$oidc" ]; then
|
||||
echo "::error title=rrc writer::GitHub returned no OIDC token" >&2
|
||||
exit 1
|
||||
fi
|
||||
printf '::add-mask::%s\n' "$oidc"
|
||||
|
||||
openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out "$dir/rrc-writer.key" 2>/dev/null
|
||||
csr=$(openssl req -new -key "$dir/rrc-writer.key" -subj "/CN=rbe-rrc-writer-request")
|
||||
body=$(jq -cn --arg csr "$csr" '{csr_pem: $csr}')
|
||||
|
||||
reply="$dir/rrc-mint.json"
|
||||
code=000
|
||||
for attempt in 1 2 3 4; do
|
||||
# --connect-timeout: a closed gate drops the SYN; fail fast, not in 60 s.
|
||||
code=$(curl -sS -o "$reply" -w '%{http_code}' --connect-timeout 5 --max-time 60 \
|
||||
-H "Authorization: Bearer $oidc" -H 'content-type: application/json' \
|
||||
--data "$body" "$MINT/v1/rrc-writer/cert") || code=000
|
||||
# Retry what may pass on its own: a rate limit (429), the mint could not
|
||||
# reach GitHub's JWKS (502), or the network (000). Everything else is an
|
||||
# answer.
|
||||
case "$code" in 429 | 502 | 000) ;; *) break ;; esac
|
||||
[ "$attempt" -eq 4 ] || sleep $((attempt * 10))
|
||||
done
|
||||
case "$code" in
|
||||
200) ;;
|
||||
503 | 000)
|
||||
# The mint's switch is off, its CA is not installed, or rbe-west's fork
|
||||
# edge is closed: seeding is off, not broken. No outputs, so the seed
|
||||
# step skips; the push to main never fails on it.
|
||||
echo "::warning title=rrc writer: seeding off (HTTP $code)::$(jq -r '.error // empty' "$reply" 2>/dev/null || true)"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "::error title=rrc writer mint refused (HTTP $code)::$(jq -r '.error // empty' "$reply" 2>/dev/null || true)"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
endpoint=$(jq -r '.endpoint // empty' "$reply")
|
||||
instance=$(jq -r '.instance // empty' "$reply")
|
||||
[[ $endpoint =~ $ENDPOINT_RE ]] || {
|
||||
echo "::error::rrc writer mint returned endpoint '$endpoint'" >&2
|
||||
exit 1
|
||||
}
|
||||
[ "$instance" = oss ] || {
|
||||
echo "::error::rrc writer mint returned instance '$instance', want oss" >&2
|
||||
exit 1
|
||||
}
|
||||
jq -r '.cert_pem // empty' "$reply" >"$dir/rrc-writer.crt"
|
||||
subject=$(openssl x509 -in "$dir/rrc-writer.crt" -noout -subject -nameopt RFC2253) || {
|
||||
echo "::error::rrc writer mint returned no certificate" >&2
|
||||
exit 1
|
||||
}
|
||||
rdns=$(tr ',' '\n' <<<"${subject#subject=}")
|
||||
cn=$(sed -n 's/^CN=//p' <<<"$rdns")
|
||||
org=$(sed -n 's/^O=//p' <<<"$rdns")
|
||||
if ! [[ $cn =~ ^rbe-rrc-writer(-[a-z0-9]+)?$ ]] || [ "$org" != gascity ]; then
|
||||
echo "::error::rrc writer mint returned a certificate for '$subject'" >&2
|
||||
exit 1
|
||||
fi
|
||||
# The certificate must belong to the key generated above.
|
||||
if [ "$(openssl x509 -in "$dir/rrc-writer.crt" -noout -pubkey | openssl sha256)" != "$(openssl pkey -in "$dir/rrc-writer.key" -pubout | openssl sha256)" ]; then
|
||||
echo "::error::rrc writer mint returned a certificate for another key" >&2
|
||||
exit 1
|
||||
fi
|
||||
openssl x509 -in "$dir/rrc-writer.crt" -noout -subject -enddate
|
||||
rm -f "$reply"
|
||||
{
|
||||
echo "cert=$dir/rrc-writer.crt"
|
||||
echo "key=$dir/rrc-writer.key"
|
||||
echo "endpoint=$endpoint"
|
||||
echo "instance=$instance"
|
||||
} >>"$out"
|
||||
160
.github/scripts/server-storage-test-shard.sh
vendored
160
.github/scripts/server-storage-test-shard.sh
vendored
|
|
@ -1,160 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# server-storage-test-shard.sh — run a shard of server dolt storage tests.
|
||||
#
|
||||
# Usage: server-storage-test-shard.sh <shard_number> <total_shards>
|
||||
#
|
||||
# Discovers all top-level Test* functions from internal/storage/dolt/*_test.go,
|
||||
# excluding TestConformance. That suite runs in the dedicated
|
||||
# test-server-storage job instead, sharded by sub-test path (-test.run
|
||||
# '^TestConformance$'), not by top-level function name; this manifest's
|
||||
# exact-name matching does not cover it. See
|
||||
# engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md for why the two use different
|
||||
# sharding mechanisms.
|
||||
#
|
||||
# Tests listed in server-storage-test-shards.txt for the requested shard count
|
||||
# use that committed assignment; newly-added tests fall back to
|
||||
# hash(name) % total. Runs the matching subset using the pre-built test
|
||||
# binary at BEADS_TEST_SERVER_TEST_BINARY (or /tmp/dolt-conformance-test).
|
||||
#
|
||||
# This package hands 1126 top-level tests to a single job (be-extn): the
|
||||
# sibling embedded lane's test-embedded-storage shards 324 tests over 5 jobs.
|
||||
# Server mode is also slower per-test (real socket round-trips, per-test
|
||||
# CREATE/DROP DATABASE) than embedded. TestCloudAuthCLIRouting alone took 566s
|
||||
# (63% of the old 15m budget) across 16 subtests, each paying a full
|
||||
# CREATE DATABASE + migration chain + dolt init + dolt remote add + DROP
|
||||
# DATABASE (~35s) to test one routing predicate; it uses t.Setenv, so it can
|
||||
# never be parallel. The manifest pins it (and other known-heavy tests) to
|
||||
# distinct shards so they do not cluster.
|
||||
#
|
||||
# Environment:
|
||||
# BEADS_TEST_ENV_RUN_DOLT=1 required (tests skip without it)
|
||||
# BEADS_TEST_SERVER_TEST_BINARY=<path> pre-built storage test binary
|
||||
# (default: /tmp/dolt-conformance-test)
|
||||
# BEADS_TEST_SHARD_LIST_ONLY=1 print selected tests without running them
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SHARD_NUMBER="${1:?usage: $0 <shard_number> <total_shards>}"
|
||||
TOTAL_SHARDS="${2:?usage: $0 <shard_number> <total_shards>}"
|
||||
shift 2
|
||||
|
||||
if ! [[ "$SHARD_NUMBER" =~ ^[0-9]+$ ]] || ! [[ "$TOTAL_SHARDS" =~ ^[0-9]+$ ]]; then
|
||||
echo "Shard number and total shards must be positive integers" >&2
|
||||
exit 1
|
||||
fi
|
||||
if (( TOTAL_SHARDS < 1 || SHARD_NUMBER < 1 || SHARD_NUMBER > TOTAL_SHARDS )); then
|
||||
echo "Invalid shard ${SHARD_NUMBER}/${TOTAL_SHARDS}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SHARD_INDEX=$(( SHARD_NUMBER - 1 ))
|
||||
MANIFEST="${BEADS_TEST_SHARD_MANIFEST:-.github/scripts/server-storage-test-shards.txt}"
|
||||
|
||||
# Discover all top-level Test* functions except TestConformance, which is
|
||||
# sharded separately (test-server-storage job, -test.run '^TestConformance$')
|
||||
# because it is a single top-level function with sub-tests reached via
|
||||
# -test.run path regex, not distinct top-level function names.
|
||||
ALL_TESTS=$(grep -rh '^func Test' internal/storage/dolt/*_test.go \
|
||||
| sed 's/func \(Test[A-Za-z0-9_]*\).*/\1/' \
|
||||
| grep -v '^TestConformance$' \
|
||||
| sort -u)
|
||||
|
||||
if [ -z "$ALL_TESTS" ]; then
|
||||
echo "No Test* functions found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
declare -A ALL_TEST_SET=()
|
||||
while IFS= read -r name; do
|
||||
ALL_TEST_SET["$name"]=1
|
||||
done <<< "$ALL_TESTS"
|
||||
|
||||
declare -A MANIFEST_SHARDS=()
|
||||
if [ -f "$MANIFEST" ]; then
|
||||
while IFS= read -r line || [ -n "$line" ]; do
|
||||
line="${line%%#*}"
|
||||
read -r manifest_total manifest_shard test_name extra <<< "$line"
|
||||
if [ -z "${manifest_total:-}" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ -n "${extra:-}" ] || ! [[ "$manifest_total" =~ ^[0-9]+$ ]] || ! [[ "$manifest_shard" =~ ^[0-9]+$ ]] || ! [[ "$test_name" =~ ^Test[A-Za-z0-9_]+$ ]] || [ "$test_name" = "TestConformance" ]; then
|
||||
echo "Invalid shard manifest line: $line" >&2
|
||||
exit 1
|
||||
fi
|
||||
if (( manifest_total != TOTAL_SHARDS )); then
|
||||
continue
|
||||
fi
|
||||
if (( manifest_shard < 1 || manifest_shard > TOTAL_SHARDS )); then
|
||||
echo "Invalid shard ${manifest_shard}/${manifest_total} for $test_name in $MANIFEST" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ -n "${MANIFEST_SHARDS[$test_name]:-}" ]; then
|
||||
echo "Duplicate shard manifest entry for $test_name in $MANIFEST" >&2
|
||||
exit 1
|
||||
fi
|
||||
MANIFEST_SHARDS["$test_name"]="$manifest_shard"
|
||||
done < "$MANIFEST"
|
||||
fi
|
||||
|
||||
for name in "${!MANIFEST_SHARDS[@]}"; do
|
||||
if [ -z "${ALL_TEST_SET[$name]:-}" ]; then
|
||||
echo "Shard manifest entry does not match a discovered test: $name" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
SHARD_TESTS=()
|
||||
MANIFEST_COUNT=0
|
||||
FALLBACK_COUNT=0
|
||||
while IFS= read -r name; do
|
||||
assigned_shard="${MANIFEST_SHARDS[$name]:-}"
|
||||
if [ -n "$assigned_shard" ]; then
|
||||
if (( assigned_shard == SHARD_NUMBER )); then
|
||||
SHARD_TESTS+=("$name")
|
||||
MANIFEST_COUNT=$(( MANIFEST_COUNT + 1 ))
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
# Use cksum for a portable numeric hash fallback for newly-added tests.
|
||||
hash=$(printf %s "$name" | cksum | cut -d ' ' -f 1)
|
||||
if (( hash % TOTAL_SHARDS == SHARD_INDEX )); then
|
||||
SHARD_TESTS+=("$name")
|
||||
FALLBACK_COUNT=$(( FALLBACK_COUNT + 1 ))
|
||||
fi
|
||||
done <<< "$ALL_TESTS"
|
||||
|
||||
if [ ${#SHARD_TESTS[@]} -eq 0 ]; then
|
||||
echo "Shard ${SHARD_NUMBER}/${TOTAL_SHARDS}: no tests assigned (all hashed to other shards)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Build the -run regex: "^(TestA|TestB|TestC)$"
|
||||
RUN_REGEX="^($(IFS='|'; echo "${SHARD_TESTS[*]}"))$"
|
||||
|
||||
echo "Shard ${SHARD_NUMBER}/${TOTAL_SHARDS}: running ${#SHARD_TESTS[@]} test(s)"
|
||||
echo " manifest: ${MANIFEST_COUNT}, fallback: ${FALLBACK_COUNT}"
|
||||
printf " %s\n" "${SHARD_TESTS[@]}"
|
||||
echo ""
|
||||
|
||||
# Use pre-built test binary if available, otherwise fall back to go test.
|
||||
STORAGE_BINARY="${BEADS_TEST_SERVER_TEST_BINARY:-/tmp/dolt-conformance-test}"
|
||||
if [ "${BEADS_TEST_SHARD_LIST_ONLY:-}" = "1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -x "$STORAGE_BINARY" ]; then
|
||||
# The tests use paths relative to their own package dir (e.g.
|
||||
# ../schema/migrations, ../issueops). `go test` runs them with cwd = the
|
||||
# package dir; a prebuilt binary inherits OUR cwd, so set it explicitly.
|
||||
cd internal/storage/dolt
|
||||
exec "$STORAGE_BINARY" -test.v -test.count=1 -test.timeout=15m \
|
||||
-test.run "$RUN_REGEX" \
|
||||
"$@"
|
||||
else
|
||||
echo "Warning: pre-built test binary not found at $STORAGE_BINARY, falling back to go test"
|
||||
exec go test -tags=integration,gms_pure_go -v -count=1 -timeout 15m \
|
||||
-run "$RUN_REGEX" \
|
||||
"$@" \
|
||||
./internal/storage/dolt/
|
||||
fi
|
||||
38
.github/scripts/server-storage-test-shards.txt
vendored
38
.github/scripts/server-storage-test-shards.txt
vendored
|
|
@ -1,38 +0,0 @@
|
|||
# Server storage test shard manifest.
|
||||
#
|
||||
# Format: <total_shards> <shard_number> <top_level_test_name>
|
||||
#
|
||||
# TestCloudAuthCLIRouting uses one shared outer store (#5841); its
|
||||
# environment-sensitive subtests run serially. #6396 checks that remote
|
||||
# writes use the shared fixture without imposing a machine-speed threshold.
|
||||
# It remains pinned alone on shard 1. The remaining pins below
|
||||
# (TestCloudAuthCLIRoutingStructural, TestCreateGuard_* (9 tests),
|
||||
# TestFederationPeerCredentialLifecycleLazyKeyInit,
|
||||
# TestConcurrentWorkQueueDrain, TestHighContentionStress,
|
||||
# TestSerializationConflictRetry,
|
||||
# TestConcurrentCommentAndCloseWithoutCallerRetry, TestReadWriteMix, and
|
||||
# TestConcurrentIssueCreationWithoutCallerRetry) are each roughly 10-20s and
|
||||
# are spread across the remaining shards so they don't cluster on one.
|
||||
# Every other discovered test (the bulk of the 1126) is not listed here and
|
||||
# falls through to server-storage-test-shard.sh's hash(name) % total
|
||||
# fallback, the same mechanism the embedded manifest uses for its unlisted
|
||||
# tests. TestConformance is deliberately excluded -- it runs in the separate
|
||||
# test-server-storage job (sharded by sub-test path, not by this manifest).
|
||||
16 1 TestCloudAuthCLIRouting
|
||||
16 2 TestCloudAuthCLIRoutingStructural
|
||||
16 2 TestReadWriteMix
|
||||
16 3 TestCreateGuard_ErrorMessage
|
||||
16 3 TestConcurrentIssueCreationWithoutCallerRetry
|
||||
16 4 TestCreateGuard_ExistingDB_DoesNotCreateMissingBeadsDir
|
||||
16 5 TestCreateGuard_ExistingDB_NoFlag
|
||||
16 6 TestCreateGuard_ExistingDB_WithData
|
||||
16 7 TestCreateGuard_MissingDB_CreateIfMissing
|
||||
16 8 TestCreateGuard_MissingDB_DefaultConfig
|
||||
16 9 TestCreateGuard_ReadOnly_MissingDB
|
||||
16 10 TestCreateGuard_UnderscoreBothExist
|
||||
16 11 TestCreateGuard_UnderscoreInName
|
||||
16 12 TestFederationPeerCredentialLifecycleLazyKeyInit
|
||||
16 13 TestConcurrentWorkQueueDrain
|
||||
16 14 TestHighContentionStress
|
||||
16 15 TestSerializationConflictRetry
|
||||
16 16 TestConcurrentCommentAndCloseWithoutCallerRetry
|
||||
160
.github/workflows/bazel-autofix.yml
vendored
160
.github/workflows/bazel-autofix.yml
vendored
|
|
@ -1,160 +0,0 @@
|
|||
# Auto-fix stale Bazel BUILD files on PRs.
|
||||
#
|
||||
# bazel.yml's "BUILD files in sync" step runs `make bazel-sync` (gazelle,
|
||||
# tools/bazel/go_srcs.py, bazel mod tidy) and, when that leaves drift, fails
|
||||
# and uploads the BUILD.bazel / MODULE.bazel / MODULE.bazel.lock part of the
|
||||
# fix as the bazel-sync-patch artifact (scripts/ci/bazel-sync-patch.sh). This
|
||||
# workflow closes the loop, like docs-autofix.yml does for generated CLI docs:
|
||||
# when a PR run fails and left that artifact, it pushes the sync commit to the
|
||||
# PR branch (same-repo PRs) or leaves an idempotent comment with the apply
|
||||
# recipe (fork PRs). Drift elsewhere (third_party/patches, go.mod) is never
|
||||
# patched; the failing run lists it for a human.
|
||||
#
|
||||
# Trigger: only "PR" (pr.yml). bazel.yml has no pull_request trigger of its
|
||||
# own: PRs run it through pr.yml's `bazel` job (workflow_call), so its
|
||||
# bazel-sync-patch upload belongs to the PR run, and a failing sync step
|
||||
# fails that run. The "Bazel" workflow's own runs (push to main, dispatch)
|
||||
# are never pull_request events, so triggering on them would only ever be a
|
||||
# no-op. A PR run without the artifact (it failed for other reasons) is a
|
||||
# no-op too. bazel.yml builds the PR MERGE commit, so the patch also
|
||||
# carries any drift main has; only files in packages the PR itself changed
|
||||
# are pushed (see the script), so main's drift never lands on an unrelated PR.
|
||||
#
|
||||
# CONCURRENCY: job-level (a skipped run - success, or another event - never
|
||||
# takes part), and shared with docs-autofix.yml per head branch without
|
||||
# cancel-in-progress, so the two bots queue instead of racing on one branch
|
||||
# or cancelling a fix that is already running. The second one sees the moved
|
||||
# head and stops; with the PAT its push retriggers CI, which re-derives the
|
||||
# other fix. Both bots now fire on the same PR run's completion, so one runs
|
||||
# while the other waits. GitHub keeps one pending job per group: a later PR
|
||||
# run finishing inside that short window can displace a waiting job, whose
|
||||
# fix the next failing run re-derives.
|
||||
#
|
||||
# SECURITY MODEL: this runs with write permissions via workflow_run, so it
|
||||
# never checks out or executes PR code. It checks out the base default branch
|
||||
# for scripts, and treats the artifact strictly as data: only the two expected
|
||||
# regular files are extracted, every path in the patch must match an anchored
|
||||
# Bazel build-file allowlist (no hidden or `..` segments, nothing under
|
||||
# third_party/), mode/symlink/rename/binary hunks are refused, and
|
||||
# the patch is applied to an index in a bare clone (the PR tree never touches
|
||||
# the disk) and re-checked once staged (scripts/bazel-autofix-push.sh), so a
|
||||
# hostile patch can at most rewrite BUILD.bazel / MODULE.bazel /
|
||||
# MODULE.bazel.lock on its own PR branch. Pushes are leased to the run's head
|
||||
# SHA and skipped for heads that are protected or under a ruleset. The App
|
||||
# private key is a secret of the `autofix` environment, whose deployment-
|
||||
# branch policy allows only `main`, so only a job running on main can read
|
||||
# it; the minted token itself is scoped to this one repo with contents:write
|
||||
# only, so even a hostile patch gains nothing beyond what the job already
|
||||
# had.
|
||||
#
|
||||
# TOKEN NOTE: pushes made with the default GITHUB_TOKEN do not retrigger PR
|
||||
# checks. On same-repo PRs the push step mints a short-lived installation
|
||||
# token for the gastownhall-autofix GitHub App (contents:write, scoped to
|
||||
# this repo only) and uses that instead. Fork PRs always get the apply-recipe
|
||||
# comment - no token we hold can push to a fork, so the mint step is skipped
|
||||
# for them. workflow_run always runs this file from the default branch, so
|
||||
# edits take effect only after they merge.
|
||||
|
||||
name: Bazel Autofix
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["PR"]
|
||||
types: [completed]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
autofix:
|
||||
name: Apply Bazel BUILD sync to PR
|
||||
if: >
|
||||
github.event.workflow_run.event == 'pull_request' &&
|
||||
github.event.workflow_run.conclusion == 'failure'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
# Grants the job read access to this environment's secrets; its
|
||||
# deployment-branch policy restricts that to jobs running on main
|
||||
# (workflow_run always does), not to any PR branch.
|
||||
environment: autofix
|
||||
# Shared with docs-autofix.yml; queue, never cancel (see header).
|
||||
concurrency:
|
||||
group: autofix-${{ github.event.workflow_run.head_repository.full_name }}-${{ github.event.workflow_run.head_branch }}
|
||||
cancel-in-progress: false
|
||||
steps:
|
||||
# Trusted side only: base repo default branch, never the PR head. The
|
||||
# workflow token is not left in .git/config.
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Download BUILD sync patch (if any)
|
||||
id: patch
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
RUN_ID: ${{ github.event.workflow_run.id }}
|
||||
run: |
|
||||
artifact_ids="$(gh api --paginate "repos/${GITHUB_REPOSITORY}/actions/runs/${RUN_ID}/artifacts?per_page=100" \
|
||||
--jq '.artifacts[] | select(.name == "bazel-sync-patch") | .id')"
|
||||
artifact_id="$(printf '%s\n' "$artifact_ids" | head -1)"
|
||||
if [ -z "$artifact_id" ]; then
|
||||
echo "No BUILD sync patch artifact on run ${RUN_ID}; it failed for other reasons."
|
||||
echo "found=false" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
dir="${RUNNER_TEMP}/bazel-patch"
|
||||
mkdir -p "$dir"
|
||||
gh api "repos/${GITHUB_REPOSITORY}/actions/artifacts/${artifact_id}/zip" > "${RUNNER_TEMP}/bazel-patch.zip"
|
||||
# Extract only the two expected names, and only as regular files.
|
||||
unzip -o "${RUNNER_TEMP}/bazel-patch.zip" bazel-sync.patch bazel-sync-meta.txt -d "$dir" || true
|
||||
ls -la "$dir"
|
||||
for f in bazel-sync.patch bazel-sync-meta.txt; do
|
||||
if [ -L "$dir/$f" ] || { [ -e "$dir/$f" ] && [ ! -f "$dir/$f" ]; }; then
|
||||
echo "::error::artifact entry $f is not a regular file"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
if [ ! -f "$dir/bazel-sync.patch" ]; then
|
||||
echo "Artifact has no bazel-sync.patch; nothing to do."
|
||||
echo "found=false" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
echo "found=true" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Same-repo PRs only: no token we hold can push to a fork, and a fork's
|
||||
# head_repository can even be absent (deleted fork), so this mints
|
||||
# nothing for it and the push script falls back to the apply-recipe
|
||||
# comment. app-token outputs are empty (not failed) when the step is
|
||||
# skipped, which is what the fallback below relies on.
|
||||
- name: Mint autofix app token
|
||||
id: app-token
|
||||
if: github.event.workflow_run.head_repository.full_name == github.repository
|
||||
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3
|
||||
with:
|
||||
app-id: ${{ secrets.AUTOFIX_APP_ID }}
|
||||
private-key: ${{ secrets.AUTOFIX_APP_PRIVATE_KEY }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
repositories: ${{ github.event.repository.name }}
|
||||
permission-contents: write
|
||||
|
||||
- name: Push sync commit or leave apply recipe
|
||||
if: steps.patch.outputs.found == 'true'
|
||||
env:
|
||||
BASE_REPO: ${{ github.repository }}
|
||||
HEAD_REPO: ${{ github.event.workflow_run.head_repository.full_name }}
|
||||
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
|
||||
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
|
||||
PATCH_FILE: ${{ runner.temp }}/bazel-patch/bazel-sync.patch
|
||||
META_FILE: ${{ runner.temp }}/bazel-patch/bazel-sync-meta.txt
|
||||
RUN_ID: ${{ github.event.workflow_run.id }}
|
||||
RUN_URL: ${{ github.event.workflow_run.html_url }}
|
||||
# Split tokens: gh api calls (PR lookup, comments) always use the
|
||||
# workflow token, which carries this job's pull-requests:write; the
|
||||
# App token is used ONLY for the git push, so it needs no more
|
||||
# than contents:write.
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
PUSH_TOKEN: ${{ steps.app-token.outputs.token || github.token }}
|
||||
AUTOFIX_TOKEN_KIND: ${{ steps.app-token.outputs.token && 'app' || 'default' }}
|
||||
run: ./scripts/bazel-autofix-push.sh
|
||||
153
.github/workflows/bazel-farm.yml
vendored
153
.github/workflows/bazel-farm.yml
vendored
|
|
@ -1,153 +0,0 @@
|
|||
# Bazel lanes on the remote-execution farm for fork PRs by trusted authors.
|
||||
#
|
||||
# Fork PRs get no Actions secrets, so pr.yml's Bazel call runs them locally
|
||||
# with rbe-west's anonymous read-only cache (mode cache: no embedded,
|
||||
# proxied-server or server-storage tier). This workflow gives the farm to
|
||||
# fork PRs whose
|
||||
# author AND triggering user are on .github/bazel-farm-allowlist.txt (by
|
||||
# numeric user id), by calling bazel.yml from pull_request_target, which has
|
||||
# the secrets.
|
||||
#
|
||||
# ADVISORY. pr.yml is unchanged: every fork PR, listed or not, still runs the
|
||||
# cache-mode Bazel lanes (local execution, read-only cache) inside the
|
||||
# enforced `CI Gate / Required`. This run adds a fast remote signal,
|
||||
# including the remote-only embedded, proxied-server and server-storage
|
||||
# tiers, that no required check and no privileged workflow
|
||||
# reads. Making it authoritative needs a trusted reporter; see
|
||||
# engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md, "Trusted-author fork PRs".
|
||||
#
|
||||
# SECURITY MODEL (policy-tested in scripts/ci_workflow_test.go,
|
||||
# TestBazelFarmWorkflowSecurity; threat model in the engdoc):
|
||||
# - pull_request_target runs THIS file, and bazel.yml (`uses: ./`, resolved
|
||||
# from the same commit), from the base branch: a PR cannot edit either
|
||||
# for its own run.
|
||||
# - authorize runs no PR code: a sparse checkout of the run's own base
|
||||
# commit (github.sha) holding only the allowlist and the decision script,
|
||||
# no token on disk, no secrets, and event facts passed through env, never
|
||||
# interpolated into a script. It requires the PR author and the sender
|
||||
# (the pusher on synchronize) to be listed, so a collaborator on a listed
|
||||
# author's fork, or someone opening a PR from that fork, gets nothing, and
|
||||
# the head repository's owner to be the author (no PR from a third
|
||||
# party's fork).
|
||||
# - farm hands bazel.yml exactly the four RBE secrets and the event's head
|
||||
# SHA, which every lane checks out pinned (a later push is a new event,
|
||||
# judged on its own sender), without persisted credentials. The token is
|
||||
# contents: read everywhere, so PR code holds no write access.
|
||||
# - Accepted: a listed author's PR code runs with the RBE client
|
||||
# certificate, as a same-repo PR's does.
|
||||
# - Caches: this run is in the default branch's cache scope. GitHub's cache
|
||||
# is read-only for pull_request_target, and nothing here may declare a
|
||||
# cache-mode other than read or none (policy-tested). Whether Blacksmith's
|
||||
# colocated cache enforces that is unverified. Either way, trusted runs
|
||||
# verify what they restore: the Bazel binary is never cached, the
|
||||
# repository cache is content-addressed, the repo contents cache is off,
|
||||
# and go mod verify runs after the module cache restore (see the engdoc).
|
||||
# - No artifact from this run is consumed: bazel-autofix.yml reads only
|
||||
# "PR" runs of pull_request events, and bazel.yml skips its sync-patch
|
||||
# upload here.
|
||||
#
|
||||
# Re-runs replay the original event: the same pinned head SHA, and the
|
||||
# allowlist at the original base commit. De-listing a user therefore also
|
||||
# means cancelling/deleting their old farm runs, or rotating the RBE
|
||||
# certificate (engdoc: "Re-runs, Adding and Removing a User").
|
||||
#
|
||||
# Workflow edits take effect only once merged to the default branch.
|
||||
name: Bazel Farm (trusted forks)
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
# Not reopened or ready_for_review: they re-test a head no listed user
|
||||
# necessarily pushed (see the script).
|
||||
types: [ opened, synchronize ]
|
||||
branches: [ main ]
|
||||
|
||||
# One run per PR; a newer event supersedes (its sender is judged afresh).
|
||||
# Differs from bazel.yml's group (bazel-pull_request_target-<n>).
|
||||
concurrency:
|
||||
group: bazel-farm-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
authorize:
|
||||
name: authorize
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
# Cheap prefilter; the script re-checks these and decides on the list.
|
||||
if: >-
|
||||
github.event.pull_request.base.repo.full_name == github.repository &&
|
||||
github.event.pull_request.head.repo.full_name != github.repository
|
||||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
allowed: ${{ steps.decide.outputs.allowed }}
|
||||
steps:
|
||||
# The base commit this run's workflow file came from; never the PR.
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
ref: ${{ github.sha }}
|
||||
persist-credentials: false
|
||||
sparse-checkout: |
|
||||
.github/bazel-farm-allowlist.txt
|
||||
.github/scripts/bazel-farm-authorize.sh
|
||||
sparse-checkout-cone-mode: false
|
||||
|
||||
- name: Check author and sender against the allowlist
|
||||
id: decide
|
||||
env:
|
||||
ALLOWLIST: .github/bazel-farm-allowlist.txt
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
ACTION: ${{ github.event.action }}
|
||||
REPOSITORY: ${{ github.repository }}
|
||||
BASE_REPO: ${{ github.event.pull_request.base.repo.full_name }}
|
||||
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
HEAD_OWNER_ID: ${{ github.event.pull_request.head.repo.owner.id }}
|
||||
BASE_REF: ${{ github.event.pull_request.base.ref }}
|
||||
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
|
||||
PR_AUTHOR_ID: ${{ github.event.pull_request.user.id }}
|
||||
SENDER: ${{ github.event.sender.login }}
|
||||
SENDER_ID: ${{ github.event.sender.id }}
|
||||
run: bash .github/scripts/bazel-farm-authorize.sh
|
||||
|
||||
# Not "Bazel": pr.yml's call is named that, and this run's lane results are
|
||||
# PR-controlled, so its check names ("Bazel Farm / <lane>") must never
|
||||
# collide with ones a ruleset might require.
|
||||
farm:
|
||||
name: Bazel Farm
|
||||
needs: authorize
|
||||
if: ${{ needs.authorize.outputs.allowed == 'true' }}
|
||||
# A called workflow's job gets at most this call's token permissions, and
|
||||
# GitHub checks them when the run starts, even for a job whose if: skips
|
||||
# it (startup_failure otherwise; gascity #7478): bazel.yml's rrc-seed asks
|
||||
# id-token: write (push to main only) and rrc-verify issues: write
|
||||
# (schedule and dispatch only). Neither runs for this event, every other
|
||||
# bazel.yml job keeps contents: read, and rbe-west's mint refuses any OIDC
|
||||
# token but a main-push bazel.yml one
|
||||
# (scripts/bazel_rrc_test.go, TestBazelWorkflowCallersGrantEveryRequestedPermission).
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
issues: write
|
||||
uses: ./.github/workflows/bazel.yml
|
||||
# Exactly the four RBE secrets: never the rbe-prewarm app private key
|
||||
# (B1, security review of bdef342d5). This pull_request_target run is
|
||||
# the one caller whose code under test is an untrusted fork's, so it
|
||||
# must never carry the credential that mints gastownhall/gascity
|
||||
# Actions tokens; pre-warming is accepted as a same-repo-only benefit
|
||||
# (bazel.yml's rbe-prewarm job also gates on mode remote only, which a
|
||||
# fork-authorized farm run never reaches). See "rbe-west Pre-warm",
|
||||
# engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md.
|
||||
secrets:
|
||||
RBE_WEST_EXECUTOR: ${{ secrets.RBE_WEST_EXECUTOR }}
|
||||
RBE_TLS_CERT: ${{ secrets.RBE_TLS_CERT }}
|
||||
RBE_TLS_KEY: ${{ secrets.RBE_TLS_KEY }}
|
||||
RBE_TLS_CA: ${{ secrets.RBE_TLS_CA }}
|
||||
with:
|
||||
checkout-sha: ${{ github.event.pull_request.head.sha }}
|
||||
fork-farm: authorized
|
||||
integration: "on"
|
||||
build-artifact-name: bazel-farm-build-artifacts
|
||||
3242
.github/workflows/bazel.yml
vendored
3242
.github/workflows/bazel.yml
vendored
File diff suppressed because it is too large
Load diff
183
.github/workflows/ci.yml
vendored
Normal file
183
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
# Fast check to ensure all version files are in sync
|
||||
check-version-consistency:
|
||||
name: Check version consistency
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Check all versions match
|
||||
run: ./scripts/check-versions.sh
|
||||
|
||||
# Fast check to catch accidental .beads/issues.jsonl changes from contributors
|
||||
check-no-beads-changes:
|
||||
name: Check for .beads changes
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'pull_request'
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Check for .beads/issues.jsonl changes
|
||||
run: |
|
||||
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "^\.beads/issues\.jsonl$"; then
|
||||
echo "This PR includes changes to .beads/issues.jsonl"
|
||||
echo ""
|
||||
echo "This file is the project's issue database and should not be modified in PRs."
|
||||
echo ""
|
||||
echo "To fix, run:"
|
||||
echo " git checkout origin/main -- .beads/issues.jsonl"
|
||||
echo " git commit --amend"
|
||||
echo " git push --force"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
echo "No .beads/issues.jsonl changes detected"
|
||||
|
||||
# Cross-platform test matrix (Linux/macOS only - Windows uses smoke tests)
|
||||
test:
|
||||
name: Test (${{ matrix.os }})
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
include:
|
||||
# Linux: full test suite with coverage
|
||||
- os: ubuntu-latest
|
||||
coverage: true
|
||||
test-flags: '-v -race -short -coverprofile=coverage.out'
|
||||
# macOS: full test suite, no coverage (faster)
|
||||
- os: macos-latest
|
||||
coverage: false
|
||||
test-flags: '-v -race -short'
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.24'
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@beads.test"
|
||||
|
||||
- name: Build
|
||||
run: go build -v ./cmd/bd
|
||||
|
||||
- name: Test
|
||||
run: go test ${{ matrix.test-flags }} ./...
|
||||
|
||||
- name: Check coverage threshold
|
||||
if: matrix.coverage
|
||||
run: |
|
||||
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
|
||||
MIN_COVERAGE=42
|
||||
WARN_COVERAGE=55
|
||||
echo "Coverage: $COVERAGE%"
|
||||
if (( $(echo "$COVERAGE < $MIN_COVERAGE" | bc -l) )); then
|
||||
echo "Coverage is below ${MIN_COVERAGE}% threshold"
|
||||
exit 1
|
||||
elif (( $(echo "$COVERAGE < $WARN_COVERAGE" | bc -l) )); then
|
||||
echo "Coverage is below ${WARN_COVERAGE}% (warning threshold)"
|
||||
else
|
||||
echo "Coverage meets threshold"
|
||||
fi
|
||||
|
||||
- name: Upload coverage
|
||||
uses: codecov/codecov-action@v4
|
||||
if: matrix.coverage && success()
|
||||
with:
|
||||
file: ./coverage.out
|
||||
fail_ci_if_error: false
|
||||
|
||||
# Windows smoke tests only - full test suite times out (see bd-bmev)
|
||||
# Linux/macOS run comprehensive tests; Windows just verifies binary works
|
||||
test-windows:
|
||||
name: Test (Windows - smoke)
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.24'
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@beads.test"
|
||||
|
||||
- name: Build
|
||||
run: go build -v -o bd.exe ./cmd/bd
|
||||
|
||||
- name: Smoke test - version
|
||||
run: ./bd.exe version
|
||||
|
||||
- name: Smoke test - init and CRUD
|
||||
run: |
|
||||
./bd.exe init --quiet --prefix smoke
|
||||
$output = ./bd.exe create --title "Windows smoke test" --type task
|
||||
$id = ($output | Select-String -Pattern "smoke-\w+").Matches.Value
|
||||
echo "Created issue: $id"
|
||||
./bd.exe list
|
||||
./bd.exe show $id
|
||||
./bd.exe update $id --status in_progress
|
||||
./bd.exe close $id
|
||||
echo "All smoke tests passed!"
|
||||
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.24'
|
||||
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v9
|
||||
with:
|
||||
version: latest
|
||||
args: --timeout=5m
|
||||
|
||||
test-nix:
|
||||
name: Test Nix Flake
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: cachix/install-nix-action@v31
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
- name: Run bd help via Nix
|
||||
run: |
|
||||
export BEADS_DB="$PWD/.ci-beads/beads.db"
|
||||
mkdir -p "$(dirname "$BEADS_DB")"
|
||||
rm -rf .beads
|
||||
nix run .#default -- --db "$BEADS_DB" init --quiet --prefix ci
|
||||
nix run .#default -- --db "$BEADS_DB" > help.txt
|
||||
- name: Verify help text
|
||||
run: |
|
||||
FIRST_LINE=$(head -n 1 help.txt)
|
||||
EXPECTED="Issues chained together like beads. A lightweight issue tracker with first-class dependency support."
|
||||
if [ "$FIRST_LINE" != "$EXPECTED" ]; then
|
||||
echo "First line of help.txt doesn't match expected output"
|
||||
echo "Expected: $EXPECTED"
|
||||
echo "Got: $FIRST_LINE"
|
||||
exit 1
|
||||
fi
|
||||
echo "Help text first line is correct"
|
||||
99
.github/workflows/close-stale-needs.yml
vendored
99
.github/workflows/close-stale-needs.yml
vendored
|
|
@ -1,99 +0,0 @@
|
|||
name: Close stale needs-info / needs-repro issues
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '37 9 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
close-needs-info:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
steps:
|
||||
- name: Close stale needs-info issues (14 days)
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
|
||||
with:
|
||||
script: |
|
||||
const labels = ['status/needs-info', 'status/needs-repro'];
|
||||
const days = 14;
|
||||
const cutoff = new Date(Date.now() - days * 24 * 60 * 60 * 1000);
|
||||
|
||||
for (const label of labels) {
|
||||
const issues = await github.paginate(github.rest.issues.listForRepo, {
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
state: 'open',
|
||||
labels: label,
|
||||
per_page: 100,
|
||||
});
|
||||
|
||||
for (const issue of issues) {
|
||||
if (issue.pull_request) continue;
|
||||
|
||||
const events = await github.paginate(github.rest.issues.listEvents, {
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
per_page: 100,
|
||||
});
|
||||
|
||||
const labelEvents = events
|
||||
.filter(e => e.event === 'labeled' && e.label?.name === label);
|
||||
if (labelEvents.length === 0) continue;
|
||||
|
||||
const labeledAt = new Date(Math.max(
|
||||
...labelEvents.map(e => new Date(e.created_at).getTime())
|
||||
));
|
||||
|
||||
const comments = await github.paginate(github.rest.issues.listComments, {
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
since: labeledAt.toISOString(),
|
||||
per_page: 100,
|
||||
});
|
||||
|
||||
const visibleRequest = comments.find(c => {
|
||||
if (c.user?.login === issue.user?.login) return false;
|
||||
const lower = (c.body || '').toLowerCase();
|
||||
if (lower.includes('closing')) return false;
|
||||
if (!/14\s*-?\s*days?/.test(lower)) return false;
|
||||
if (!lower.includes('reply') && !lower.includes('respond')) return false;
|
||||
if (label === 'status/needs-repro') return lower.includes('repro') || lower.includes('reproduction');
|
||||
return lower.includes('info') || lower.includes('information') || lower.includes('details');
|
||||
});
|
||||
|
||||
if (!visibleRequest) {
|
||||
console.log(`No visible request for #${issue.number} (${label}), skipping.`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const requestAt = new Date(visibleRequest.created_at);
|
||||
if (requestAt > cutoff) continue;
|
||||
|
||||
const authorReplied = comments.some(c =>
|
||||
c.user?.login === issue.user?.login &&
|
||||
new Date(c.created_at) > requestAt
|
||||
);
|
||||
if (authorReplied) continue;
|
||||
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
body: `Closing — this was marked \`${label}\` and a response was requested 14 or more days ago with no reply.\n\nIf this is still relevant, please reply with the requested details and we'll reopen.`,
|
||||
});
|
||||
|
||||
await github.rest.issues.update({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
state: 'closed',
|
||||
state_reason: 'not_planned',
|
||||
});
|
||||
console.log(`Closed #${issue.number} (${label}, requested ${requestAt.toISOString()})`);
|
||||
}
|
||||
}
|
||||
96
.github/workflows/deploy-docs.yml
vendored
Normal file
96
.github/workflows/deploy-docs.yml
vendored
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
name: Deploy Documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'website/**'
|
||||
- 'scripts/generate-llms-full.sh'
|
||||
workflow_dispatch:
|
||||
|
||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
# Allow only one concurrent deployment
|
||||
concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 20
|
||||
cache: 'npm'
|
||||
cache-dependency-path: website/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: website
|
||||
run: npm ci
|
||||
|
||||
- name: Generate llms-full.txt
|
||||
run: ./scripts/generate-llms-full.sh
|
||||
|
||||
- name: Build website
|
||||
working-directory: website
|
||||
run: npm run build
|
||||
|
||||
- name: Check internal links
|
||||
uses: lycheeverse/lychee-action@v2
|
||||
with:
|
||||
args: |
|
||||
--verbose
|
||||
--no-progress
|
||||
--offline
|
||||
--include-fragments
|
||||
--timeout 30
|
||||
--exclude-path 'website/build/search/**'
|
||||
website/build
|
||||
fail: true
|
||||
|
||||
- name: Check external links (non-blocking)
|
||||
uses: lycheeverse/lychee-action@v2
|
||||
continue-on-error: true
|
||||
with:
|
||||
cache: true
|
||||
args: |
|
||||
--verbose
|
||||
--no-progress
|
||||
--timeout 30
|
||||
--scheme https
|
||||
--scheme http
|
||||
--exclude 'localhost'
|
||||
--exclude '127.0.0.1'
|
||||
--exclude 'tree/main'
|
||||
--exclude 'example.com'
|
||||
--exclude 'mailto:'
|
||||
--exclude-path 'website/build/search/**'
|
||||
website/build
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v4
|
||||
with:
|
||||
path: website/build
|
||||
|
||||
deploy:
|
||||
# Guard: deploy should only run in the canonical repository (not in forks)
|
||||
if: ${{ github.repository == 'steveyegge/beads' }}
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
47
.github/workflows/deploy-pages-redirect.yml
vendored
47
.github/workflows/deploy-pages-redirect.yml
vendored
|
|
@ -1,47 +0,0 @@
|
|||
name: Deploy legacy docs redirect
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- '.github/pages-redirect/**'
|
||||
- '.github/workflows/deploy-pages-redirect.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
concurrency:
|
||||
group: pages
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
if: ${{ github.repository == 'gastownhall/beads' }}
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
with:
|
||||
sparse-checkout: .github/pages-redirect
|
||||
|
||||
- name: Build redirect artifact
|
||||
run: |
|
||||
mkdir -p _site
|
||||
cp -f .github/pages-redirect/index.html _site/index.html
|
||||
cp -f .github/pages-redirect/index.html _site/404.html
|
||||
|
||||
- name: Upload redirect artifact
|
||||
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5
|
||||
with:
|
||||
path: _site
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5
|
||||
137
.github/workflows/docs-autofix.yml
vendored
137
.github/workflows/docs-autofix.yml
vendored
|
|
@ -1,137 +0,0 @@
|
|||
# Auto-fix stale generated CLI docs on PRs.
|
||||
#
|
||||
# The PR workflow's check-doc-flags job already computes the exact
|
||||
# regeneration patch with CI's canonical pinned build and uploads it as the
|
||||
# cli-docs-freshness-patch artifact (scripts/check-cli-docs-drift.sh). This
|
||||
# workflow closes the loop: when a PR run fails and left that artifact, it
|
||||
# pushes the regen commit to the PR branch (same-repo PRs) or leaves an
|
||||
# idempotent comment with the one-liner apply recipe (fork PRs).
|
||||
#
|
||||
# SECURITY MODEL: this runs with write permissions via workflow_run, so it
|
||||
# never checks out or executes PR code. It checks out the base default branch
|
||||
# for scripts, and treats the artifact strictly as data: every path in the
|
||||
# patch must match an anchored generated-docs allowlist (single path segment,
|
||||
# no traversal), mode/symlink/rename/copy/binary hunks are refused, and the
|
||||
# patch is applied to an index in a bare clone and re-checked once staged
|
||||
# (scripts/docs-autofix-push.sh), so a hostile patch can at most rewrite
|
||||
# generated doc files on its own PR branch. Pushes are leased to the run's
|
||||
# head SHA and skipped for heads that are protected or under a ruleset. The
|
||||
# App private key is a secret of the `autofix` environment, whose deployment-
|
||||
# branch policy allows only `main`, so only a job running on main can read
|
||||
# it; the minted token itself is scoped to this one repo with contents:write
|
||||
# only, so even a hostile patch gains nothing beyond what the job already
|
||||
# had.
|
||||
#
|
||||
# CONCURRENCY: job-level, shared with bazel-autofix.yml per head branch and
|
||||
# without cancel-in-progress, so the two bots queue instead of racing on one
|
||||
# branch (see bazel-autofix.yml).
|
||||
#
|
||||
# TOKEN NOTE: pushes made with the default GITHUB_TOKEN do not retrigger PR
|
||||
# checks. On same-repo PRs the push step mints a short-lived installation
|
||||
# token for the gastownhall-autofix GitHub App (contents:write, scoped to
|
||||
# this repo only) and uses that instead. Fork PRs always get the apply-recipe
|
||||
# comment - no token we hold can push to a fork, so the mint step is skipped
|
||||
# for them.
|
||||
|
||||
name: Docs Autofix
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["PR"]
|
||||
types: [completed]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
autofix:
|
||||
name: Apply CLI docs regeneration to PR
|
||||
if: >
|
||||
github.event.workflow_run.event == 'pull_request' &&
|
||||
github.event.workflow_run.conclusion == 'failure'
|
||||
runs-on: ubuntu-latest
|
||||
# Bounded: a hung run would hold the shared group for the default 6h.
|
||||
timeout-minutes: 10
|
||||
# Grants the job read access to this environment's secrets; its
|
||||
# deployment-branch policy restricts that to jobs running on main
|
||||
# (workflow_run always does), not to any PR branch.
|
||||
environment: autofix
|
||||
# Shared with bazel-autofix.yml; queue, never cancel.
|
||||
concurrency:
|
||||
group: autofix-${{ github.event.workflow_run.head_repository.full_name }}-${{ github.event.workflow_run.head_branch }}
|
||||
cancel-in-progress: false
|
||||
steps:
|
||||
# Trusted side only: base repo default branch, never the PR head. The
|
||||
# workflow token is not left in .git/config.
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Download docs freshness patch (if any)
|
||||
id: patch
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
RUN_ID: ${{ github.event.workflow_run.id }}
|
||||
run: |
|
||||
artifact_ids="$(gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${RUN_ID}/artifacts" \
|
||||
--jq '.artifacts[] | select(.name == "cli-docs-freshness-patch") | .id')"
|
||||
artifact_id="$(printf '%s\n' "$artifact_ids" | head -1)"
|
||||
if [ -z "$artifact_id" ]; then
|
||||
echo "No docs patch artifact on run ${RUN_ID}; PR failed for other reasons."
|
||||
echo "found=false" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
dir="${RUNNER_TEMP}/docs-patch"
|
||||
mkdir -p "$dir"
|
||||
gh api "repos/${GITHUB_REPOSITORY}/actions/artifacts/${artifact_id}/zip" > "${RUNNER_TEMP}/docs-patch.zip"
|
||||
# Extract only the expected name, and only as a regular file.
|
||||
unzip -o "${RUNNER_TEMP}/docs-patch.zip" cli-docs-freshness.patch -d "$dir" || true
|
||||
ls -la "$dir"
|
||||
f="$dir/cli-docs-freshness.patch"
|
||||
if [ -L "$f" ] || { [ -e "$f" ] && [ ! -f "$f" ]; }; then
|
||||
echo "::error::artifact entry cli-docs-freshness.patch is not a regular file"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f "$f" ]; then
|
||||
echo "Artifact has no cli-docs-freshness.patch; nothing to do."
|
||||
echo "found=false" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
echo "found=true" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Same-repo PRs only: no token we hold can push to a fork, and a fork's
|
||||
# head_repository can even be absent (deleted fork), so this mints
|
||||
# nothing for it and the push script falls back to the apply-recipe
|
||||
# comment. app-token outputs are empty (not failed) when the step is
|
||||
# skipped, which is what the fallback below relies on.
|
||||
- name: Mint autofix app token
|
||||
id: app-token
|
||||
if: github.event.workflow_run.head_repository.full_name == github.repository
|
||||
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3
|
||||
with:
|
||||
app-id: ${{ secrets.AUTOFIX_APP_ID }}
|
||||
private-key: ${{ secrets.AUTOFIX_APP_PRIVATE_KEY }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
repositories: ${{ github.event.repository.name }}
|
||||
permission-contents: write
|
||||
|
||||
- name: Push regen commit or leave apply recipe
|
||||
if: steps.patch.outputs.found == 'true'
|
||||
env:
|
||||
BASE_REPO: ${{ github.repository }}
|
||||
HEAD_REPO: ${{ github.event.workflow_run.head_repository.full_name }}
|
||||
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
|
||||
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
|
||||
PATCH_FILE: ${{ runner.temp }}/docs-patch/cli-docs-freshness.patch
|
||||
RUN_ID: ${{ github.event.workflow_run.id }}
|
||||
RUN_URL: ${{ github.event.workflow_run.html_url }}
|
||||
# Split tokens: gh api calls (PR lookup, comments) always use the
|
||||
# workflow token, which carries this job's pull-requests:write; the
|
||||
# App token is used ONLY for the git push, so it needs no more
|
||||
# than contents:write.
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
PUSH_TOKEN: ${{ steps.app-token.outputs.token || github.token }}
|
||||
AUTOFIX_TOKEN_KIND: ${{ steps.app-token.outputs.token && 'app' || 'default' }}
|
||||
run: ./scripts/docs-autofix-push.sh
|
||||
44
.github/workflows/docs-mintlify.yml
vendored
44
.github/workflows/docs-mintlify.yml
vendored
|
|
@ -1,44 +0,0 @@
|
|||
name: Docs (Mintlify) checks
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
# The Mintlify site and the check itself. The docsync guard (docs nav,
|
||||
# links and agent-instruction routing over docs/, engdocs/ and the root
|
||||
# markdown) is //test/docsync:docsync_test, which bazel.yml's --config=ci
|
||||
# lane runs on every PR; this workflow keeps only Mintlify's own
|
||||
# broken-link check, which needs the network (npx mint) and the base
|
||||
# branch's history.
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- 'mint.sh'
|
||||
- '.github/scripts/docs-render-check.sh'
|
||||
- '.github/workflows/docs-mintlify.yml'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: docs-mintlify-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
broken-links:
|
||||
name: Mintlify broken-links (baseline-aware)
|
||||
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}
|
||||
timeout-minutes: 10
|
||||
if: github.event.pull_request.draft == false
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Run baseline-aware broken-link check
|
||||
env:
|
||||
BASE_REF: origin/${{ github.base_ref }}
|
||||
run: .github/scripts/docs-render-check.sh "$BASE_REF"
|
||||
290
.github/workflows/main.yml
vendored
290
.github/workflows/main.yml
vendored
|
|
@ -1,290 +0,0 @@
|
|||
name: Main
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
BD_DISABLE_METRICS: "1"
|
||||
BD_DISABLE_EVENT_FLUSH: "1"
|
||||
|
||||
jobs:
|
||||
|
||||
# macOS full -race -short suite. Linux runs the same suite under Bazel
|
||||
# (bazel.yml's `test` lane, on every push to main, executed on rbe-west),
|
||||
# and Windows uses smoke tests below; rbe-west has no macOS workers, so this
|
||||
# is the one lane that still runs the suite on a runner. Blacksmith macOS,
|
||||
# the image pr.yml's same-repo macOS legs use; blacksmith-macos-go-build-cache
|
||||
# seeds its module and non-race caches, and this job saves only its own race
|
||||
# cache (keyed per go.sum and UTC day, F7b review fix S7).
|
||||
#
|
||||
# ./cmd/bd has outgrown `go test`'s 10m per-package default (see
|
||||
# scripts/test.sh, scripts/ci/pr-core.sh and #6091), and when it trips the
|
||||
# alarm the panic names whichever test was in flight, so it reads like a
|
||||
# hang. -timeout=30m sits on the invocation and inside one finite job
|
||||
# budget: the go deadline fires first and prints goroutine stacks, so a real
|
||||
# hang is still diagnosable rather than cut off by a bare job kill.
|
||||
test:
|
||||
name: Test (macOS)
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'gastownhall/beads'
|
||||
runs-on: ${{ 'blacksmith-6vcpu-macos-26' }}
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
id: setup-go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
cache: false
|
||||
|
||||
- name: Compute cache date
|
||||
id: cache-date
|
||||
run: echo "today=$(date -u +%Y%m%d)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Restore Go module cache
|
||||
id: restore-go-module-cache
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }}
|
||||
restore-keys: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-
|
||||
|
||||
- name: Restore non-race Go build cache
|
||||
id: restore-non-race-go-build-cache
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ runner.temp }}/go-cache/non-race
|
||||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ hashFiles('go.sum') }}-${{ steps.cache-date.outputs.today }}
|
||||
restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-
|
||||
|
||||
- name: Restore race Go build cache
|
||||
id: restore-race-go-build-cache
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ runner.temp }}/go-cache/race
|
||||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-race-${{ hashFiles('go.sum') }}-${{ steps.cache-date.outputs.today }}
|
||||
restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-race-
|
||||
|
||||
- name: Install Dolt (Linux/macOS)
|
||||
run: ./scripts/ci/install-dolt.sh
|
||||
|
||||
- name: Verify dolt on PATH
|
||||
run: dolt version
|
||||
|
||||
- name: Configure Git and Dolt identity
|
||||
run: |
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@beads.test"
|
||||
dolt config --global --add user.name "CI Bot"
|
||||
dolt config --global --add user.email "ci@beads.test"
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
GOCACHE: ${{ runner.temp }}/go-cache/non-race
|
||||
run: go build -v -tags gms_pure_go ./cmd/bd
|
||||
|
||||
- name: Test
|
||||
env:
|
||||
BEADS_TEST_BD_BINARY: ${{ github.workspace }}/bd
|
||||
GOCACHE: ${{ runner.temp }}/go-cache/race
|
||||
run: go test -tags gms_pure_go -v -race -short -timeout=30m -skip '^TestEmbedded' ./...
|
||||
|
||||
# Restore-only for the module and non-race caches (the macOS saver
|
||||
# owns them); this job is the race cache's only reader and writer.
|
||||
- name: Save race Go build cache
|
||||
if: ${{ !cancelled() && steps.restore-race-go-build-cache.outputs.cache-hit != 'true' }}
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ runner.temp }}/go-cache/race
|
||||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-race-${{ hashFiles('go.sum') }}-${{ steps.cache-date.outputs.today }}
|
||||
|
||||
# Windows smoke tests only - full test suite times out (see bd-bmev)
|
||||
# Linux/macOS run comprehensive tests; Windows just verifies binary works
|
||||
#
|
||||
# Windows uses -tags gms_pure_go to avoid the ICU regex dependency.
|
||||
# go-icu-regex's regex_windows.go also uses Go stdlib regexp (build tag: windows).
|
||||
# CGO is still required for gozstd (bundled C source) and the embedded dolt engine.
|
||||
# pr.yml's Windows jobs (test-windows-liveness, worktree-remove-windows,
|
||||
# etc.) run on Blacksmith Windows for every PR, forks included
|
||||
# (ga-96smfk.22), so this job seeds their module and non-race GOCACHEs on
|
||||
# that one runner selection: Blacksmith runners cannot see caches
|
||||
# `actions/cache` saved from a GitHub-hosted runner, and no GitHub-hosted
|
||||
# Windows consumer is left.
|
||||
test-windows:
|
||||
name: Test (Windows - smoke)
|
||||
# F7b review fix (B2): push-to-main, same-repo only, like every saver
|
||||
# here (the repository check closes the fork gap). Pinned by
|
||||
# TestBlacksmithSaverJobsGuardedAgainstPullRequest.
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'gastownhall/beads'
|
||||
runs-on: ${{ 'blacksmith-4vcpu-windows-2025' }}
|
||||
# F7b review fix (S8): paid Blacksmith Windows (4x billing). 20 matches
|
||||
# test-windows-liveness's timeout (S6) for consistency.
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
id: setup-go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
cache: false
|
||||
|
||||
# F7b review fix (S7/Speed): cache keys are bucketed by go.sum and UTC
|
||||
# day, not per commit, so ordinary push traffic writes at most one
|
||||
# entry per day (TestBlacksmithSaverCacheKeysAreNotPerCommit).
|
||||
- name: Compute cache date
|
||||
id: cache-date
|
||||
shell: bash
|
||||
run: echo "today=$(date -u +%Y%m%d)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# F7b review fix (S9): same Windows toolchain diagnostic as pr.yml's
|
||||
# Windows jobs.
|
||||
- name: Check Windows toolchain diagnostics
|
||||
shell: bash
|
||||
run: go env CGO_ENABLED CC GOOS GOARCH
|
||||
|
||||
- name: Restore Go module cache
|
||||
id: restore-go-module-cache
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }}
|
||||
restore-keys: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-
|
||||
|
||||
- name: Restore non-race Go build cache
|
||||
id: restore-non-race-go-build-cache
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ runner.temp }}/go-cache/non-race
|
||||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ hashFiles('go.sum') }}-${{ steps.cache-date.outputs.today }}
|
||||
restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@beads.test"
|
||||
|
||||
- name: Build (pure Go regex)
|
||||
env:
|
||||
GOCACHE: ${{ runner.temp }}/go-cache/non-race
|
||||
run: go build -v -tags gms_pure_go -o bd.exe ./cmd/bd
|
||||
|
||||
- name: Smoke test - version
|
||||
run: ./bd.exe version
|
||||
|
||||
- name: Smoke test - help
|
||||
run: ./bd.exe help
|
||||
|
||||
# F7b review fix (S2): warms the SAME non-race GOCACHE namespace that
|
||||
# pr-preflight-platforms'/worktree-remove-windows'/test-windows-liveness'
|
||||
# Windows legs restore from, on the exact same runner selection
|
||||
# (blacksmith-4vcpu-windows-2025), so their cold `cmd/bd` test compiles
|
||||
# (the real long pole; see pr-preflight-platforms' S2 comment) get a
|
||||
# true cache hit. Confirmed to run under Git Bash on Windows (reviewer
|
||||
# verification).
|
||||
- name: Warm non-race GOCACHE (Windows preflight/liveness consumers)
|
||||
shell: bash
|
||||
env:
|
||||
GOCACHE: ${{ runner.temp }}/go-cache/non-race
|
||||
run: bash scripts/ci/warm-non-race-cache.sh
|
||||
|
||||
- name: Save Go module cache
|
||||
if: steps.restore-go-module-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }}
|
||||
|
||||
- name: Save non-race Go build cache
|
||||
if: steps.restore-non-race-go-build-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ runner.temp }}/go-cache/non-race
|
||||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ hashFiles('go.sum') }}-${{ steps.cache-date.outputs.today }}
|
||||
|
||||
# macOS saver: pr.yml's pr-preflight-platforms and
|
||||
# check-doc-freshness-platforms macOS legs run on blacksmith-6vcpu-macos-26
|
||||
# for every PR, forks included (ga-96smfk.22). This job is their only
|
||||
# seeder (and also seeds the `test` job's module and non-race caches), and runs only the shared warm-up those legs compile
|
||||
# (warm-non-race-cache.sh, the same script the Windows seeder uses)
|
||||
# plus the non-test ./cmd/bd build -- no tests, so it stays a few minutes of
|
||||
# macOS time per push. Same push-to-main-only job guard (B2) and go.sum +
|
||||
# UTC-day cache keys (S7) as test-windows, so a PR can never
|
||||
# write this namespace and ordinary push traffic writes at most one
|
||||
# non-race entry per day. Pinned by
|
||||
# TestBlacksmithSaverJobsGuardedAgainstPullRequest,
|
||||
# TestBlacksmithSaverCacheKeysAreNotPerCommit and
|
||||
# TestBlacksmithMacOSSaverMatchesPRLegs.
|
||||
blacksmith-macos-go-build-cache:
|
||||
name: Warm macOS Go build cache
|
||||
runs-on: ${{ 'blacksmith-6vcpu-macos-26' }}
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'gastownhall/beads'
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
id: setup-go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
cache: false
|
||||
|
||||
- name: Compute cache date
|
||||
id: cache-date
|
||||
run: echo "today=$(date -u +%Y%m%d)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Restore Go module cache
|
||||
id: restore-go-module-cache
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }}
|
||||
restore-keys: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-
|
||||
|
||||
- name: Restore non-race Go build cache
|
||||
id: restore-non-race-go-build-cache
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ runner.temp }}/go-cache/non-race
|
||||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ hashFiles('go.sum') }}-${{ steps.cache-date.outputs.today }}
|
||||
restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-
|
||||
|
||||
# Records the toolchain in the log so an image drift is visible next
|
||||
# to the cache it seeds.
|
||||
- name: Check macOS toolchain diagnostics
|
||||
run: |
|
||||
sw_vers
|
||||
go env GOOS GOARCH CGO_ENABLED CC
|
||||
bash --version | head -n 1
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
GOCACHE: ${{ runner.temp }}/go-cache/non-race
|
||||
run: go build -tags gms_pure_go -o /dev/null ./cmd/bd
|
||||
|
||||
- name: Warm non-race GOCACHE for macOS preflight/doc-freshness
|
||||
env:
|
||||
GOCACHE: ${{ runner.temp }}/go-cache/non-race
|
||||
run: bash scripts/ci/warm-non-race-cache.sh
|
||||
|
||||
- name: Save Go module cache
|
||||
if: ${{ !cancelled() && steps.restore-go-module-cache.outputs.cache-hit != 'true' }}
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }}
|
||||
|
||||
- name: Save non-race Go build cache
|
||||
if: ${{ !cancelled() && steps.restore-non-race-go-build-cache.outputs.cache-hit != 'true' }}
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ runner.temp }}/go-cache/non-race
|
||||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ hashFiles('go.sum') }}-${{ steps.cache-date.outputs.today }}
|
||||
115
.github/workflows/nightly.yml
vendored
115
.github/workflows/nightly.yml
vendored
|
|
@ -1,91 +1,50 @@
|
|||
name: Nightly
|
||||
name: Nightly Full Tests
|
||||
|
||||
# Every nightly test runs under Bazel on rbe-west: the `bazel` call below is
|
||||
# the full suite with no cached test results. Nothing here runs go test on a
|
||||
# runner (ga-96smfk.22).
|
||||
on:
|
||||
schedule:
|
||||
# Run at 2am UTC daily
|
||||
- cron: '0 2 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
BD_DISABLE_METRICS: "1"
|
||||
BD_DISABLE_EVENT_FLUSH: "1"
|
||||
workflow_dispatch: # Allow manual trigger
|
||||
|
||||
jobs:
|
||||
# Bazel lane with the full equivalence listing (package and test-name sets;
|
||||
# PRs gate on it through pr.yml). Remote execution when the repo secrets
|
||||
# are present; bazel.yml gets the four RBE secrets plus rbe-prewarm's
|
||||
# bazel-allocator app private key (same-repo/scheduled trigger only, so
|
||||
# pre-warming is safe here - see bazel.yml's "rbe-west Pre-warm" header and
|
||||
# engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md).
|
||||
bazel:
|
||||
name: Bazel (fresh, full detail)
|
||||
# A called workflow's job gets at most this call's token permissions, and
|
||||
# GitHub checks them when the run starts, even for a job whose if: skips
|
||||
# it (startup_failure otherwise; gascity #7478): bazel.yml's rrc-seed asks
|
||||
# id-token: write (push to main only) and rrc-verify issues: write
|
||||
# (schedule and dispatch only). rrc-verify runs here (its alert issue);
|
||||
# rrc-seed never does, every other bazel.yml job keeps contents: read,
|
||||
# and rbe-west's mint refuses any OIDC token but a main-push bazel.yml one
|
||||
# (scripts/bazel_rrc_test.go, TestBazelWorkflowCallersGrantEveryRequestedPermission).
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
issues: write
|
||||
uses: ./.github/workflows/bazel.yml
|
||||
secrets:
|
||||
RBE_WEST_EXECUTOR: ${{ secrets.RBE_WEST_EXECUTOR }}
|
||||
RBE_TLS_CERT: ${{ secrets.RBE_TLS_CERT }}
|
||||
RBE_TLS_KEY: ${{ secrets.RBE_TLS_KEY }}
|
||||
RBE_TLS_CA: ${{ secrets.RBE_TLS_CA }}
|
||||
RBE_POOL_APP_PRIVATE_KEY: ${{ secrets.RBE_POOL_APP_PRIVATE_KEY }}
|
||||
with:
|
||||
details: true
|
||||
# The one run that re-executes every test (no cached test results):
|
||||
# PRs, merge groups and pushes to main reuse unchanged tests' PASSes,
|
||||
# so this keeps sampling flaky and -race failures every night.
|
||||
fresh-test-results: true
|
||||
|
||||
# rbe-west's pool workers are gascity's and advertise the sha256 of
|
||||
# gascity's worker-env manifest; beads' tools/rbe/worker-env.txt is a
|
||||
# byte-for-byte copy and platforms/BUILD.bazel carries the same pin. A copy
|
||||
# that falls behind queues every remote action (bazel.yml's rbe job runs
|
||||
# the same check before each remote run and fails it fast), so check every
|
||||
# night and, out of step, open or update a ci/infra issue with the diff and
|
||||
# the pin to commit (tools/rbe/worker-env-sync-issue). The only job here
|
||||
# with issues: write, and only its last step uses the token. gascity
|
||||
# unreachable (exit 2) fails the job without an issue.
|
||||
rbe-worker-env-sync:
|
||||
name: rbe worker-env in step with gascity
|
||||
full-test:
|
||||
name: Full Test Suite
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
go-version: '1.24'
|
||||
|
||||
- name: Compare the worker-env manifest and pin with gascity's main
|
||||
id: sync
|
||||
env:
|
||||
WORKER_ENV_SYNC_REPORT: ${{ runner.temp }}/worker-env-sync.md
|
||||
- name: Configure Git
|
||||
run: |
|
||||
rc=0
|
||||
tools/rbe/worker-env-sync main || rc=$?
|
||||
echo "rc=$rc" >> "$GITHUB_OUTPUT"
|
||||
exit "$rc"
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@beads.test"
|
||||
|
||||
- name: Open or update the out-of-step issue
|
||||
if: ${{ failure() && steps.sync.outputs.rc == '1' }}
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
REPORT: ${{ runner.temp }}/worker-env-sync.md
|
||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
run: tools/rbe/worker-env-sync-issue "$REPORT" "$RUN_URL"
|
||||
- name: Build
|
||||
run: go build -v ./cmd/bd
|
||||
|
||||
- name: Full Test Suite (including integration tests)
|
||||
run: go test -v -race -tags=integration -coverprofile=coverage.out -timeout=30m ./...
|
||||
|
||||
- name: Check coverage threshold
|
||||
run: |
|
||||
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
|
||||
echo "Coverage: $COVERAGE%"
|
||||
if (( $(echo "$COVERAGE < 50" | bc -l) )); then
|
||||
echo "❌ Coverage is below 50% threshold"
|
||||
exit 1
|
||||
elif (( $(echo "$COVERAGE < 55" | bc -l) )); then
|
||||
echo "⚠️ Coverage is below 55% (warning threshold)"
|
||||
else
|
||||
echo "✅ Coverage meets threshold"
|
||||
fi
|
||||
|
||||
- name: Upload coverage
|
||||
uses: codecov/codecov-action@v4
|
||||
if: success()
|
||||
with:
|
||||
file: ./coverage.out
|
||||
fail_ci_if_error: false
|
||||
|
|
|
|||
37
.github/workflows/nix-build.yml
vendored
37
.github/workflows/nix-build.yml
vendored
|
|
@ -1,37 +0,0 @@
|
|||
name: nix build
|
||||
|
||||
on:
|
||||
# No pull_request trigger: pr-risk.yml's required `test-nix` job already
|
||||
# runs `nix run .#default` plus `nix flake check -L` on every PR, a strict
|
||||
# superset of the `nix build .#default` this workflow exercises here. This
|
||||
# workflow still runs on push to main (and workflow_dispatch) so the plain
|
||||
# `nix build` path itself stays covered without duplicating a PR-blocking
|
||||
# job that never adds coverage pr-risk.yml doesn't already have.
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'go.mod'
|
||||
- 'go.sum'
|
||||
- 'default.nix'
|
||||
- 'flake.nix'
|
||||
- 'flake.lock'
|
||||
- 'overlay.nix'
|
||||
- 'packages.nix'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
BD_DISABLE_METRICS: "1"
|
||||
BD_DISABLE_EVENT_FLUSH: "1"
|
||||
|
||||
jobs:
|
||||
nix-build:
|
||||
name: nix build .#default
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/determinate-nix-action@527f17dd63d2d60d3e5552934bc84b9a33a14d11 # v3
|
||||
- name: Build
|
||||
run: nix build .#default --print-build-logs
|
||||
93
.github/workflows/pr-risk.yml
vendored
93
.github/workflows/pr-risk.yml
vendored
|
|
@ -1,93 +0,0 @@
|
|||
name: PR Risk
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main, 'release/**', 'hotfix/**' ]
|
||||
# Merge queue (engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md, "Merge Queue"):
|
||||
# the ruleset's required gate must also report on each queue entry's
|
||||
# merge-group commit, or a queued PR waits until the queue times it out.
|
||||
# checks_requested is the queue asking for those checks; pinned
|
||||
# explicitly (scripts/ci_merge_queue_test.go). The concurrency group
|
||||
# below keys a merge group on its own gh-readonly-queue/* ref, so queue
|
||||
# runs never cancel each other or a PR's own runs.
|
||||
merge_group:
|
||||
types: [ checks_requested ]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
BD_DISABLE_METRICS: "1"
|
||||
BD_DISABLE_EVENT_FLUSH: "1"
|
||||
|
||||
# The legacy Go test tiers this workflow used to run (embedded Dolt storage,
|
||||
# conformance and cmd shards; proxied-server cmd shards; server-Dolt storage
|
||||
# and full suite) are pr.yml's Bazel lanes on rbe-west now: `embedded Dolt
|
||||
# tier`, `proxied-server tier` (`dolt-race`, with the dolt-server lane, in
|
||||
# mode remote) and `server-Dolt storage tier` (bazel.yml), which pr.yml's `CI Gate / Required` requires to have run remotely and
|
||||
# passed on every pull_request and merge group, fork and Dependabot PRs
|
||||
# included (ga-96smfk.22). What remains is the Nix packaging check, which no
|
||||
# Bazel target can stand in for: it builds the package Nix users install.
|
||||
|
||||
jobs:
|
||||
test-nix:
|
||||
name: Test Nix Flake
|
||||
# F7a: cache-free (no GitHub-saved cache restored/saved here) same-repo
|
||||
# job moved onto Blacksmith at 4 vCPU; forks, Dependabot and any other
|
||||
# event stay GitHub-hosted. Must match TestSameRepoBlacksmithRunners.
|
||||
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }}
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
- uses: DeterminateSystems/determinate-nix-action@527f17dd63d2d60d3e5552934bc84b9a33a14d11 # v3
|
||||
- name: Run bd help via Nix
|
||||
id: nix_help
|
||||
run: |
|
||||
nix run .#default -- --help > help.txt
|
||||
# A packaging check, not a test: evaluates every flake output (packages,
|
||||
# apps, devShells, overlay) for every system the flake declares. The
|
||||
# flake has no `checks`: its one check, hook-timeout-backends, runs
|
||||
# under Bazel as //tests/hook_timeout_backends:hook_timeout_backends_test
|
||||
# in bazel.yml's PR-core lane.
|
||||
- name: Run the flake checks
|
||||
run: |
|
||||
nix flake check -L
|
||||
- name: Verify help text
|
||||
if: steps.nix_help.outcome == 'success'
|
||||
run: |
|
||||
FIRST_LINE=$(head -n 1 help.txt)
|
||||
EXPECTED="Issues chained together like beads. A lightweight issue tracker with first-class dependency support."
|
||||
if [ "$FIRST_LINE" != "$EXPECTED" ]; then
|
||||
echo "First line of help.txt doesn't match expected output"
|
||||
echo "Expected: $EXPECTED"
|
||||
echo "Got: $FIRST_LINE"
|
||||
exit 1
|
||||
fi
|
||||
echo "Help text first line is correct"
|
||||
|
||||
ci-gate:
|
||||
name: PR Risk Gate / Required
|
||||
# F3: same-repo PRs and merge_group get the org's Blacksmith pool; forks,
|
||||
# Dependabot and any other event stay GitHub-hosted. This job restores no
|
||||
# GitHub-saved cache. Must match the TestSameRepoBlacksmithRunners pin;
|
||||
# the gate's NAME must never change (ruleset requires exactly "PR Risk
|
||||
# Gate / Required").
|
||||
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}
|
||||
# F3: now on Blacksmith for same-repo PRs; a hang used to burn only the
|
||||
# default 360 minutes of a free GitHub-hosted runner, now Blacksmith
|
||||
# minutes too.
|
||||
timeout-minutes: 10
|
||||
needs:
|
||||
- test-nix
|
||||
if: ${{ always() }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Evaluate CI gate
|
||||
env:
|
||||
CI_GATE_NAME: PR risk gate
|
||||
CI_GATE_REQUIRED: >-
|
||||
TEST_NIX
|
||||
TEST_NIX: ${{ needs.test-nix.result }}
|
||||
run: bash .github/scripts/ci-gate.sh
|
||||
1507
.github/workflows/pr.yml
vendored
1507
.github/workflows/pr.yml
vendored
File diff suppressed because it is too large
Load diff
479
.github/workflows/release.yml
vendored
479
.github/workflows/release.yml
vendored
|
|
@ -4,8 +4,6 @@ on:
|
|||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
# Manual dispatch is only for rerunning a release from a v* tag. Publishing
|
||||
# jobs below are tag-gated and skip branch refs.
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
|
|
@ -14,403 +12,62 @@ concurrency:
|
|||
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
attestations: write
|
||||
|
||||
env:
|
||||
BD_DISABLE_METRICS: "1"
|
||||
BD_DISABLE_EVENT_FLUSH: "1"
|
||||
|
||||
jobs:
|
||||
# Pre-publish gate: refuse to publish a release whose version constants and
|
||||
# Docusaurus docs snapshot disagree. This blocks the failure mode where a tag
|
||||
# ships with version.go bumped but the docs snapshot missing (which otherwise
|
||||
# only surfaces as a red main after the artifacts are already published).
|
||||
verify-version-consistency:
|
||||
if: ${{ github.repository == 'gastownhall/beads' && startsWith(github.ref, 'refs/tags/v') }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
cache: false
|
||||
|
||||
- name: Verify tag and released versions
|
||||
run: ./scripts/check-versions.sh --expect "${GITHUB_REF_NAME#v}"
|
||||
|
||||
release-package-mcp:
|
||||
name: Release Package Gate (MCP)
|
||||
if: ${{ github.repository == 'gastownhall/beads' && startsWith(github.ref, 'refs/tags/v') }}
|
||||
needs: verify-version-consistency
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
# Never restore a cache into release builds: setup-go's key is
|
||||
# predictable and falls back to main's cache, whose module and build
|
||||
# caches are not re-verified before binaries are built and signed.
|
||||
cache: false
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: '3.14'
|
||||
|
||||
- name: Install uv
|
||||
run: python -m pip install uv==0.11.16
|
||||
|
||||
- name: Run MCP package gate
|
||||
run: make ci-package-mcp
|
||||
|
||||
- name: Upload validated MCP dist
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: release-mcp-dist
|
||||
path: integrations/beads-mcp/dist/*
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
|
||||
release-package-npm:
|
||||
name: Release Package Gate (npm)
|
||||
if: ${{ github.repository == 'gastownhall/beads' && startsWith(github.ref, 'refs/tags/v') }}
|
||||
needs: verify-version-consistency
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
# Never restore a cache into release builds: setup-go's key is
|
||||
# predictable and falls back to main's cache, whose module and build
|
||||
# caches are not re-verified before binaries are built and signed.
|
||||
cache: false
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
|
||||
with:
|
||||
node-version: '24'
|
||||
|
||||
- name: Run npm package gate
|
||||
run: make ci-package-npm
|
||||
|
||||
|
||||
goreleaser:
|
||||
# Guard: only run goreleaser in the canonical repository (not in forks)
|
||||
if: ${{ github.repository == 'gastownhall/beads' && startsWith(github.ref, 'refs/tags/v') }}
|
||||
needs:
|
||||
- release-package-mcp
|
||||
- release-package-npm
|
||||
if: ${{ github.repository == 'steveyegge/beads' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
# Never restore a cache into release builds: setup-go's key is
|
||||
# predictable and falls back to main's cache, whose module and build
|
||||
# caches are not re-verified before binaries are built and signed.
|
||||
cache: false
|
||||
go-version: '1.23'
|
||||
|
||||
- name: Install cross-compilation toolchains and signing tools
|
||||
# Backstop for a hang that escapes the inner `timeout` calls, so it has
|
||||
# to sit ABOVE what those calls can legitimately consume: 3 update
|
||||
# attempts x 120s + 2 backoffs x 10s + 300s install = 680s worst case.
|
||||
# 13m leaves ~100s of headroom. This job sets no job-level
|
||||
# timeout-minutes, so this cap is the only bound on a stuck apt.
|
||||
timeout-minutes: 13
|
||||
run: |
|
||||
updated=""
|
||||
for attempt in 1 2 3; do
|
||||
if sudo timeout 120 apt-get \
|
||||
-o Acquire::Retries=3 \
|
||||
-o Acquire::http::Timeout=30 \
|
||||
-o Acquire::https::Timeout=30 \
|
||||
update; then
|
||||
updated=yes
|
||||
break
|
||||
fi
|
||||
echo "::warning::apt-get update attempt $attempt failed or timed out"
|
||||
# No backoff after the final attempt - there is nothing left to wait for.
|
||||
if [ "$attempt" -lt 3 ]; then
|
||||
sleep 10
|
||||
fi
|
||||
done
|
||||
# Deliberate best-effort: a stale index still installs these packages
|
||||
# from the runner image cache far more often than not, and failing the
|
||||
# job here would turn a transient mirror outage into a red build. The
|
||||
# warning is what makes the degraded path visible in the job log.
|
||||
if [ -z "$updated" ]; then
|
||||
echo "::warning::apt-get update failed after 3 attempts; proceeding with cached index"
|
||||
fi
|
||||
sudo timeout 300 apt-get install -y gcc-mingw-w64-x86-64 gcc-aarch64-linux-gnu osslsigncode
|
||||
|
||||
- name: Install go-winres for Windows PE resource embedding
|
||||
run: go install github.com/tc-hib/go-winres@latest
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc-mingw-w64-x86-64 gcc-aarch64-linux-gnu osslsigncode
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: '~> v2'
|
||||
args: >
|
||||
release --clean --parallelism 1
|
||||
${{ github.repository != 'gastownhall/beads' && '--skip=publish --skip=announce' || '' }}
|
||||
release --clean
|
||||
${{ github.repository != 'steveyegge/beads' && '--skip=publish --skip=announce' || '' }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Windows code signing (optional - signing is skipped if not set)
|
||||
WINDOWS_SIGNING_CERT_PFX_BASE64: ${{ secrets.WINDOWS_SIGNING_CERT_PFX_BASE64 }}
|
||||
WINDOWS_SIGNING_CERT_PASSWORD: ${{ secrets.WINDOWS_SIGNING_CERT_PASSWORD }}
|
||||
|
||||
- name: Verify no ICU runtime dependency on Linux binaries
|
||||
run: |
|
||||
for bin in dist/bd-linux-*/bd; do
|
||||
[ -f "$bin" ] || continue
|
||||
if ldd "$bin" 2>/dev/null | grep -qi icu; then
|
||||
echo "ERROR: $bin has unexpected ICU runtime dependency" >&2
|
||||
ldd "$bin" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "OK: $bin has no ICU runtime dependency"
|
||||
done
|
||||
|
||||
- name: Publish the contract corpus as a release artifact
|
||||
# Ships the canonicalized golden corpus (cmd/bd/protocol/testdata/corpus)
|
||||
# with each release and appends its checksum to the release checksums.txt,
|
||||
# so a downstream consumer can anchor its vendored-corpus drift-check to a signed
|
||||
# beads release rather than a self-recomputed manifest. Runs before the
|
||||
# macOS job's serial checksums.txt append (goreleaser-macos needs this
|
||||
# job), so the entry is preserved.
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
tag="${GITHUB_REF_NAME}"
|
||||
version="${tag#v}"
|
||||
archive="beads_${version}_contract_corpus.tar.gz"
|
||||
tar -czf "$archive" -C cmd/bd/protocol/testdata corpus
|
||||
shasum -a 256 "$archive" | tee corpus-checksum.txt
|
||||
gh release upload "$tag" "$archive" --clobber
|
||||
gh release download "$tag" --pattern checksums.txt --dir /tmp/corpus-sums
|
||||
sums=/tmp/corpus-sums/checksums.txt
|
||||
# Idempotent on a job re-run (manual retry or flake): drop any prior
|
||||
# entry for this archive before appending the fresh checksum, so the
|
||||
# re-download+append never leaves a duplicate (or stale) corpus row.
|
||||
if [ -f "$sums" ]; then
|
||||
grep -vF "$archive" "$sums" > "$sums.tmp" || true
|
||||
mv "$sums.tmp" "$sums"
|
||||
fi
|
||||
cat corpus-checksum.txt >> "$sums"
|
||||
gh release upload "$tag" "$sums" --clobber
|
||||
|
||||
goreleaser-macos:
|
||||
# Build macOS binaries with CGO_ENABLED=1 for embedded Dolt support.
|
||||
# Runs on native macOS to avoid zig/osxcross cross-compilation issues.
|
||||
if: ${{ github.repository == 'gastownhall/beads' && startsWith(github.ref, 'refs/tags/v') }}
|
||||
needs: goreleaser
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
# Never restore a cache into release builds: setup-go's key is
|
||||
# predictable and falls back to main's cache, whose module and build
|
||||
# caches are not re-verified before binaries are built and signed.
|
||||
cache: false
|
||||
|
||||
- name: Extract version from tag
|
||||
id: version
|
||||
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build darwin/arm64
|
||||
env:
|
||||
CGO_ENABLED: "1"
|
||||
GOARCH: arm64
|
||||
GOOS: darwin
|
||||
run: |
|
||||
go build -tags "gms_pure_go netgo" \
|
||||
-ldflags "-s -w -X main.Version=${{ steps.version.outputs.version }} -X main.Build=$(git rev-parse --short HEAD) -X main.Commit=$(git rev-parse HEAD) -X main.Branch=$(git branch --show-current)" \
|
||||
-o bd-darwin-arm64 ./cmd/bd
|
||||
./scripts/verify-cgo.sh bd-darwin-arm64
|
||||
# Verify no ICU runtime dependency leaked through
|
||||
if otool -L bd-darwin-arm64 | grep -qi icu; then
|
||||
echo "ERROR: bd-darwin-arm64 has unexpected ICU runtime dependency" >&2
|
||||
otool -L bd-darwin-arm64 >&2
|
||||
exit 1
|
||||
fi
|
||||
codesign -s - -f bd-darwin-arm64
|
||||
|
||||
- name: Build darwin/amd64
|
||||
env:
|
||||
CGO_ENABLED: "1"
|
||||
GOARCH: amd64
|
||||
GOOS: darwin
|
||||
# macos-latest is arm64; cross-compile CGO C code for x86_64
|
||||
CC: clang -arch x86_64
|
||||
CXX: clang++ -arch x86_64
|
||||
run: |
|
||||
go build -tags "gms_pure_go netgo" \
|
||||
-ldflags "-s -w -X main.Version=${{ steps.version.outputs.version }} -X main.Build=$(git rev-parse --short HEAD) -X main.Commit=$(git rev-parse HEAD) -X main.Branch=$(git branch --show-current)" \
|
||||
-o bd-darwin-amd64 ./cmd/bd
|
||||
./scripts/verify-cgo.sh bd-darwin-amd64
|
||||
if otool -L bd-darwin-amd64 | grep -qi icu; then
|
||||
echo "ERROR: bd-darwin-amd64 has unexpected ICU runtime dependency" >&2
|
||||
otool -L bd-darwin-amd64 >&2
|
||||
exit 1
|
||||
fi
|
||||
codesign -s - -f bd-darwin-amd64
|
||||
|
||||
- name: Smoke test embedded dolt (arm64 native)
|
||||
run: |
|
||||
# arm64 binary runs natively on macos-latest
|
||||
bd="$(pwd)/bd-darwin-arm64"
|
||||
tmpdir=$(mktemp -d)
|
||||
projdir="$tmpdir/smoketest"
|
||||
mkdir -p "$projdir"
|
||||
cd "$projdir"
|
||||
git init -b main
|
||||
git config user.name "CI" && git config user.email "ci@test"
|
||||
git commit --allow-empty -m "init"
|
||||
"$bd" init --prefix smoketest
|
||||
"$bd" create "smoke test" --type task
|
||||
"$bd" list | grep -q "smoke test"
|
||||
# Verify embedded mode (no server process)
|
||||
if pgrep -f "dolt sql-server" >/dev/null 2>&1; then
|
||||
echo "ERROR: unexpected dolt sql-server process running" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "OK: embedded dolt smoke test passed"
|
||||
cd - >/dev/null
|
||||
rm -rf "$tmpdir"
|
||||
|
||||
- name: Package archives
|
||||
run: |
|
||||
version="${{ steps.version.outputs.version }}"
|
||||
for arch in arm64 amd64; do
|
||||
staging="beads_${version}_darwin_${arch}"
|
||||
mkdir -p "$staging"
|
||||
cp "bd-darwin-${arch}" "$staging/bd"
|
||||
cp LICENSE README.md CHANGELOG.md "$staging/"
|
||||
tar -czf "${staging}.tar.gz" -C "$staging" .
|
||||
shasum -a 256 "${staging}.tar.gz" >> darwin-checksums.txt
|
||||
done
|
||||
|
||||
- name: Upload to GitHub release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
version="${{ steps.version.outputs.version }}"
|
||||
for arch in arm64 amd64; do
|
||||
gh release upload "v${version}" "beads_${version}_darwin_${arch}.tar.gz" --clobber
|
||||
done
|
||||
|
||||
- name: Append checksums to release checksums.txt
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
version="${{ steps.version.outputs.version }}"
|
||||
# Download existing checksums, append darwin entries, re-upload
|
||||
gh release download "v${version}" --pattern checksums.txt --dir /tmp/checksums
|
||||
cat darwin-checksums.txt >> /tmp/checksums/checksums.txt
|
||||
gh release upload "v${version}" /tmp/checksums/checksums.txt --clobber
|
||||
|
||||
attest-release:
|
||||
# Attest the complete release after GoReleaser assets and the native macOS
|
||||
# archives have both populated checksums.txt.
|
||||
if: ${{ github.repository == 'gastownhall/beads' && startsWith(github.ref, 'refs/tags/v') }}
|
||||
needs: [goreleaser, goreleaser-macos]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Resolve release asset paths
|
||||
id: assets
|
||||
run: |
|
||||
mkdir -p dist
|
||||
echo "checksums=dist/checksums.txt" >> "$GITHUB_OUTPUT"
|
||||
echo "sbom=dist/beads-${GITHUB_REF_NAME}.spdx.json" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Download release checksums
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: gh release download "${GITHUB_REF_NAME}" --pattern checksums.txt --dir dist
|
||||
|
||||
- name: Generate release SBOM
|
||||
uses: anchore/sbom-action@e22c389904149dbc22b58101806040fa8d37a610 # v0
|
||||
with:
|
||||
path: .
|
||||
format: spdx-json
|
||||
output-file: ${{ steps.assets.outputs.sbom }}
|
||||
upload-artifact: false
|
||||
upload-release-assets: false
|
||||
|
||||
- name: Upload release SBOM
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: gh release upload "${GITHUB_REF_NAME}" "${{ steps.assets.outputs.sbom }}" --clobber
|
||||
|
||||
- name: Attest release artifacts
|
||||
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4
|
||||
with:
|
||||
subject-checksums: ${{ steps.assets.outputs.checksums }}
|
||||
|
||||
- name: Attest release SBOM
|
||||
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4
|
||||
with:
|
||||
subject-checksums: ${{ steps.assets.outputs.checksums }}
|
||||
sbom-path: ${{ steps.assets.outputs.sbom }}
|
||||
|
||||
publish-pypi:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [release-package-mcp, goreleaser]
|
||||
if: ${{ github.repository == 'gastownhall/beads' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, '-') }}
|
||||
needs: goreleaser
|
||||
if: ${{ always() && github.repository == 'steveyegge/beads' }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.14'
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install uv
|
||||
run: python -m pip install uv==0.11.16
|
||||
run: pip install uv
|
||||
|
||||
- name: Download validated MCP dist
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
name: release-mcp-dist
|
||||
path: integrations/beads-mcp/dist
|
||||
|
||||
- name: Verify validated MCP dist
|
||||
- name: Build package
|
||||
run: |
|
||||
test -n "$(find integrations/beads-mcp/dist -maxdepth 1 -type f -print -quit)"
|
||||
ls -la integrations/beads-mcp/dist
|
||||
cd integrations/beads-mcp
|
||||
uv build
|
||||
|
||||
- name: Publish to PyPI
|
||||
env:
|
||||
|
|
@ -422,19 +79,19 @@ jobs:
|
|||
|
||||
publish-npm:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [release-package-npm, goreleaser, goreleaser-macos]
|
||||
if: ${{ github.repository == 'gastownhall/beads' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, '-') }}
|
||||
needs: goreleaser
|
||||
if: ${{ github.repository == 'steveyegge/beads' }}
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write # Required for npm provenance/trusted publishing
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: '24'
|
||||
node-version: '22'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Update npm for OIDC trusted publishing
|
||||
|
|
@ -446,3 +103,93 @@ jobs:
|
|||
npm publish --access public
|
||||
# Uses OIDC trusted publishing - no token needed
|
||||
# Provenance attestations are automatic with trusted publishing
|
||||
|
||||
update-homebrew:
|
||||
runs-on: ubuntu-latest
|
||||
needs: goreleaser
|
||||
if: ${{ github.repository == 'steveyegge/beads' }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get release info
|
||||
id: release
|
||||
run: |
|
||||
TAG="${GITHUB_REF#refs/tags/}"
|
||||
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||
echo "version=${TAG#v}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Download checksums
|
||||
run: |
|
||||
curl -sL "https://github.com/steveyegge/beads/releases/download/${{ steps.release.outputs.tag }}/checksums.txt" -o checksums.txt
|
||||
|
||||
- name: Extract checksums
|
||||
id: checksums
|
||||
run: |
|
||||
echo "darwin_amd64=$(grep 'darwin_amd64.tar.gz' checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
|
||||
echo "darwin_arm64=$(grep 'darwin_arm64.tar.gz' checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
|
||||
echo "linux_amd64=$(grep 'linux_amd64.tar.gz' checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
|
||||
echo "linux_arm64=$(grep 'linux_arm64.tar.gz' checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Update Homebrew formula
|
||||
run: |
|
||||
mkdir -p Formula
|
||||
cat > Formula/bd.rb <<'EOF'
|
||||
class Bd < Formula
|
||||
desc "AI-supervised issue tracker for coding workflows"
|
||||
homepage "https://github.com/steveyegge/beads"
|
||||
version "${{ steps.release.outputs.version }}"
|
||||
license "MIT"
|
||||
|
||||
on_macos do
|
||||
if Hardware::CPU.arm?
|
||||
url "https://github.com/steveyegge/beads/releases/download/v#{version}/beads_#{version}_darwin_arm64.tar.gz"
|
||||
sha256 "${{ steps.checksums.outputs.darwin_arm64 }}"
|
||||
else
|
||||
url "https://github.com/steveyegge/beads/releases/download/v#{version}/beads_#{version}_darwin_amd64.tar.gz"
|
||||
sha256 "${{ steps.checksums.outputs.darwin_amd64 }}"
|
||||
end
|
||||
end
|
||||
|
||||
on_linux do
|
||||
if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
|
||||
url "https://github.com/steveyegge/beads/releases/download/v#{version}/beads_#{version}_linux_arm64.tar.gz"
|
||||
sha256 "${{ steps.checksums.outputs.linux_arm64 }}"
|
||||
else
|
||||
url "https://github.com/steveyegge/beads/releases/download/v#{version}/beads_#{version}_linux_amd64.tar.gz"
|
||||
sha256 "${{ steps.checksums.outputs.linux_amd64 }}"
|
||||
end
|
||||
end
|
||||
|
||||
def install
|
||||
bin.install "bd"
|
||||
end
|
||||
|
||||
test do
|
||||
system "#{bin}/bd", "version"
|
||||
end
|
||||
end
|
||||
EOF
|
||||
|
||||
- name: Push to homebrew-beads
|
||||
env:
|
||||
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
|
||||
run: |
|
||||
if [ -z "$HOMEBREW_TAP_TOKEN" ]; then
|
||||
echo "::warning::HOMEBREW_TAP_TOKEN not set - skipping Homebrew update"
|
||||
echo "To enable automatic Homebrew updates:"
|
||||
echo "1. Create a Personal Access Token with 'repo' scope"
|
||||
echo "2. Add it as HOMEBREW_TAP_TOKEN in repository secrets"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git clone "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/steveyegge/homebrew-beads.git" tap
|
||||
cp Formula/bd.rb tap/Formula/bd.rb
|
||||
cd tap
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add Formula/bd.rb
|
||||
git commit -m "Update bd to ${{ steps.release.outputs.version }}"
|
||||
git push
|
||||
|
|
|
|||
65
.github/workflows/remove-needs-info.yml
vendored
65
.github/workflows/remove-needs-info.yml
vendored
|
|
@ -1,65 +0,0 @@
|
|||
name: Remove needs-info on author response
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
pull_request_target:
|
||||
types: [synchronize]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
# pull_request_target is safe here because this job never checks out or runs
|
||||
# pull request code; it only removes labels from the issue/PR metadata.
|
||||
remove-label:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Remove needs-info / needs-repro on author response
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
|
||||
with:
|
||||
script: |
|
||||
const labels = ['status/needs-info', 'status/needs-repro'];
|
||||
|
||||
let number, author;
|
||||
if (context.eventName === 'issue_comment') {
|
||||
number = context.payload.issue.number;
|
||||
author = context.payload.issue.user.login;
|
||||
if (context.payload.comment.user.login !== author) return;
|
||||
} else {
|
||||
number = context.payload.pull_request.number;
|
||||
author = context.payload.pull_request.user.login;
|
||||
if (context.payload.sender.login !== author) return;
|
||||
}
|
||||
|
||||
const current = await github.rest.issues.listLabelsOnIssue({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: number,
|
||||
});
|
||||
const currentNames = current.data.map(l => l.name);
|
||||
|
||||
for (const label of labels) {
|
||||
if (!currentNames.includes(label)) continue;
|
||||
// Idempotent removal: concurrent triggers can race to remove the
|
||||
// same label, leaving the loser with a 404 "Label does not
|
||||
// exist". Treat an already-absent label as success rather than
|
||||
// failing the job.
|
||||
try {
|
||||
await github.rest.issues.removeLabel({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: number,
|
||||
name: label,
|
||||
});
|
||||
console.log(`Removed '${label}' from #${number}`);
|
||||
} catch (err) {
|
||||
if (err.status === 404) {
|
||||
console.log(`'${label}' already absent from #${number} (concurrent removal); nothing to do`);
|
||||
continue;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
61
.github/workflows/remove-needs-triage.yml
vendored
61
.github/workflows/remove-needs-triage.yml
vendored
|
|
@ -1,61 +0,0 @@
|
|||
name: Remove needs-triage when triaged
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [labeled]
|
||||
pull_request_target:
|
||||
types: [labeled]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
# pull_request_target is safe here because this job never checks out or runs
|
||||
# pull request code; it only removes labels from the issue/PR metadata.
|
||||
remove-triage-label:
|
||||
# Olivia owns label, comment, and inbox removal as one recoverable transaction.
|
||||
if: github.event.sender.login != 'gascityinc-sarah[bot]'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Remove needs-triage when a non-status label is added
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
|
||||
with:
|
||||
script: |
|
||||
const added = context.payload.label.name;
|
||||
if (added.startsWith('status/')) return;
|
||||
|
||||
const number = context.issue?.number || context.payload.pull_request?.number;
|
||||
const target = 'status/needs-triage';
|
||||
|
||||
const current = await github.rest.issues.listLabelsOnIssue({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: number,
|
||||
});
|
||||
|
||||
if (!current.data.some(l => l.name === target)) return;
|
||||
|
||||
// The check above narrows a race but cannot close it: adding
|
||||
// several non-status labels at once fires one `labeled` event
|
||||
// (and one job) each, and they run concurrently. Every run sees
|
||||
// the label present here, then all race to remove it. The winner
|
||||
// gets 204; the losers get 404 "Label does not exist". Treat an
|
||||
// already-absent label as success so a benign lost race does not
|
||||
// paint a red X on the PR's checks.
|
||||
try {
|
||||
await github.rest.issues.removeLabel({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: number,
|
||||
name: target,
|
||||
});
|
||||
console.log(`Removed '${target}' from #${number} (triaged with '${added}')`);
|
||||
} catch (err) {
|
||||
if (err.status === 404) {
|
||||
console.log(`'${target}' already absent from #${number} (concurrent removal); nothing to do`);
|
||||
return;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
82
.github/workflows/request-needs-info.yml
vendored
82
.github/workflows/request-needs-info.yml
vendored
|
|
@ -1,82 +0,0 @@
|
|||
name: Request repro or info from reporter
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [labeled]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
post-request:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
steps:
|
||||
- name: Post visible request comment for needs-repro or needs-info
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
|
||||
with:
|
||||
script: |
|
||||
const needsLabels = ['status/needs-info', 'status/needs-repro'];
|
||||
const label = context.payload.label?.name;
|
||||
if (!needsLabels.includes(label)) return;
|
||||
|
||||
const number = context.payload.issue?.number;
|
||||
if (!number) {
|
||||
core.setFailed('Unable to determine issue number');
|
||||
return;
|
||||
}
|
||||
|
||||
const owner = context.repo.owner;
|
||||
const repo = context.repo.repo;
|
||||
const reporter = context.payload.issue?.user?.login;
|
||||
|
||||
const events = await github.paginate(github.rest.issues.listEvents, {
|
||||
owner,
|
||||
repo,
|
||||
issue_number: number,
|
||||
per_page: 100,
|
||||
});
|
||||
const labelEvents = events.filter(e => e.event === 'labeled' && e.label?.name === label);
|
||||
const labeledAt = labelEvents.length
|
||||
? new Date(Math.max(...labelEvents.map(e => new Date(e.created_at).getTime())))
|
||||
: null;
|
||||
|
||||
const existingComments = await github.paginate(github.rest.issues.listComments, {
|
||||
owner,
|
||||
repo,
|
||||
issue_number: number,
|
||||
...(labeledAt ? { since: labeledAt.toISOString() } : {}),
|
||||
per_page: 100,
|
||||
});
|
||||
|
||||
const hasVisibleRequest = existingComments.some(c => {
|
||||
if (reporter && c.user?.login === reporter) return false;
|
||||
const lower = (c.body || '').toLowerCase();
|
||||
if (lower.includes('closing')) return false;
|
||||
if (!/14\s*-?\s*days?/.test(lower)) return false;
|
||||
if (!lower.includes('reply') && !lower.includes('respond')) return false;
|
||||
if (label === 'status/needs-repro') return lower.includes('repro') || lower.includes('reproduction');
|
||||
return lower.includes('info') || lower.includes('information') || lower.includes('details');
|
||||
});
|
||||
|
||||
if (hasVisibleRequest) {
|
||||
console.log(`Visible request already exists for #${number}, skipping.`);
|
||||
return;
|
||||
}
|
||||
|
||||
const requestBodies = {
|
||||
'status/needs-repro':
|
||||
'Thanks for the report! To help us investigate, please reply with a minimal reproduction within 14 days.\n\n' +
|
||||
'If there is no response in that window, this issue may be closed — but you are welcome to respond or reopen it at any time.',
|
||||
'status/needs-info':
|
||||
'Thanks for the report! To help us investigate, please reply with the requested information or details within 14 days.\n\n' +
|
||||
'If there is no response in that window, this issue may be closed — but you are welcome to respond or reopen it at any time.',
|
||||
};
|
||||
|
||||
await github.rest.issues.createComment({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: number,
|
||||
body: requestBodies[label],
|
||||
});
|
||||
console.log(`Posted needs request for #${number} (${label})`);
|
||||
8
.github/workflows/test-pypi.yml
vendored
8
.github/workflows/test-pypi.yml
vendored
|
|
@ -6,16 +6,16 @@ on:
|
|||
jobs:
|
||||
test-publish:
|
||||
# Guard: only allow test PyPI publish runs in the canonical repository
|
||||
if: ${{ github.repository == 'gastownhall/beads' }}
|
||||
if: ${{ github.repository == 'steveyegge/beads' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.14'
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install uv
|
||||
run: pip install uv
|
||||
|
|
|
|||
41
.github/workflows/triage-label.yml
vendored
41
.github/workflows/triage-label.yml
vendored
|
|
@ -1,41 +0,0 @@
|
|||
name: Auto-label new issues and PRs
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened, reopened]
|
||||
pull_request_target:
|
||||
types: [opened, reopened, ready_for_review]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
# pull_request_target is safe here because this job never checks out or runs
|
||||
# pull request code; it only labels the issue/PR from event metadata.
|
||||
add-triage-label:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Add needs-triage label
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
|
||||
with:
|
||||
script: |
|
||||
const pullRequest = context.payload.pull_request;
|
||||
if (pullRequest?.draft) {
|
||||
console.log(`Skipping draft PR #${pullRequest.number}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const number = context.issue?.number || pullRequest?.number;
|
||||
if (!number) {
|
||||
core.setFailed('Unable to determine issue or PR number');
|
||||
return;
|
||||
}
|
||||
|
||||
await github.rest.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: number,
|
||||
labels: ['status/needs-triage']
|
||||
});
|
||||
66
.github/workflows/update-flake-lock.yml
vendored
66
.github/workflows/update-flake-lock.yml
vendored
|
|
@ -1,66 +0,0 @@
|
|||
name: "Update flake.lock"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 0 * * 0' # Weekly on Sunday at midnight UTC
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
update-flake-lock:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Mint flake update token
|
||||
id: flake-token
|
||||
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3
|
||||
with:
|
||||
app-id: ${{ secrets.FLAKE_UPDATE_APP_ID }}
|
||||
private-key: ${{ secrets.FLAKE_UPDATE_APP_PRIVATE_KEY }}
|
||||
owner: gastownhall
|
||||
repositories: beads
|
||||
permission-contents: write
|
||||
permission-pull-requests: write
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
with:
|
||||
ref: main
|
||||
token: ${{ steps.flake-token.outputs.token }}
|
||||
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/determinate-nix-action@527f17dd63d2d60d3e5552934bc84b9a33a14d11 # v3
|
||||
|
||||
- name: Update flake.lock
|
||||
run: nix flake update
|
||||
|
||||
- name: Verify update scope
|
||||
run: |
|
||||
changed_files="$(git diff --name-only)"
|
||||
untracked_files="$(git ls-files --others --exclude-standard)"
|
||||
|
||||
if [ -n "$untracked_files" ]; then
|
||||
echo "Unexpected untracked files:"
|
||||
echo "$untracked_files"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$changed_files" ] && [ "$changed_files" != "flake.lock" ]; then
|
||||
echo "Unexpected changed files:"
|
||||
echo "$changed_files"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Create pull request
|
||||
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
|
||||
with:
|
||||
token: ${{ steps.flake-token.outputs.token }}
|
||||
commit-message: "flake.lock: Update"
|
||||
base: main
|
||||
branch: update_flake_lock_action
|
||||
delete-branch: true
|
||||
add-paths: flake.lock
|
||||
title: "chore(nix): update flake.lock"
|
||||
body: |
|
||||
Automated flake.lock update generated by the scheduled Nix workflow.
|
||||
107
.github/workflows/update-homebrew.yml
vendored
Normal file
107
.github/workflows/update-homebrew.yml
vendored
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
name: Update Homebrew Formula
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Release tag (e.g., v0.22.0)'
|
||||
required: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
update-formula:
|
||||
# Guard: only run homebrew update in the canonical repository (not in forks)
|
||||
if: ${{ github.repository == 'steveyegge/beads' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout beads repo
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get release info
|
||||
id: release
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
TAG="${{ github.event.inputs.tag }}"
|
||||
else
|
||||
TAG="${GITHUB_REF#refs/tags/}"
|
||||
fi
|
||||
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||
echo "version=${TAG#v}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Download checksums
|
||||
run: |
|
||||
curl -sL "https://github.com/steveyegge/beads/releases/download/${{ steps.release.outputs.tag }}/checksums.txt" -o checksums.txt
|
||||
|
||||
- name: Extract checksums
|
||||
id: checksums
|
||||
run: |
|
||||
echo "darwin_amd64=$(grep 'darwin_amd64.tar.gz' checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
|
||||
echo "darwin_arm64=$(grep 'darwin_arm64.tar.gz' checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
|
||||
echo "linux_amd64=$(grep 'linux_amd64.tar.gz' checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
|
||||
echo "linux_arm64=$(grep 'linux_arm64.tar.gz' checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Update Homebrew formula
|
||||
run: |
|
||||
cat > Formula/bd.rb <<'EOF'
|
||||
class Bd < Formula
|
||||
desc "AI-supervised issue tracker for coding workflows"
|
||||
homepage "https://github.com/steveyegge/beads"
|
||||
version "${{ steps.release.outputs.version }}"
|
||||
license "MIT"
|
||||
|
||||
on_macos do
|
||||
if Hardware::CPU.arm?
|
||||
url "https://github.com/steveyegge/beads/releases/download/v#{version}/beads_#{version}_darwin_arm64.tar.gz"
|
||||
sha256 "${{ steps.checksums.outputs.darwin_arm64 }}"
|
||||
else
|
||||
url "https://github.com/steveyegge/beads/releases/download/v#{version}/beads_#{version}_darwin_amd64.tar.gz"
|
||||
sha256 "${{ steps.checksums.outputs.darwin_amd64 }}"
|
||||
end
|
||||
end
|
||||
|
||||
on_linux do
|
||||
if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
|
||||
url "https://github.com/steveyegge/beads/releases/download/v#{version}/beads_#{version}_linux_arm64.tar.gz"
|
||||
sha256 "${{ steps.checksums.outputs.linux_arm64 }}"
|
||||
else
|
||||
url "https://github.com/steveyegge/beads/releases/download/v#{version}/beads_#{version}_linux_amd64.tar.gz"
|
||||
sha256 "${{ steps.checksums.outputs.linux_amd64 }}"
|
||||
end
|
||||
end
|
||||
|
||||
def install
|
||||
bin.install "bd"
|
||||
end
|
||||
|
||||
test do
|
||||
system "#{bin}/bd", "version"
|
||||
end
|
||||
end
|
||||
EOF
|
||||
|
||||
- name: Push to homebrew-beads
|
||||
env:
|
||||
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
|
||||
run: |
|
||||
if [ -z "$HOMEBREW_TAP_TOKEN" ]; then
|
||||
echo "::warning::HOMEBREW_TAP_TOKEN not set - skipping Homebrew update"
|
||||
echo "To enable automatic Homebrew updates:"
|
||||
echo "1. Create a Personal Access Token with 'repo' scope"
|
||||
echo "2. Add it as HOMEBREW_TAP_TOKEN in repository secrets"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git clone "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/steveyegge/homebrew-beads.git" tap
|
||||
cp Formula/bd.rb tap/Formula/bd.rb
|
||||
cd tap
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add Formula/bd.rb
|
||||
git commit -m "Update bd to ${{ steps.release.outputs.version }}"
|
||||
git push
|
||||
118
.github/workflows/update-vendor-hash.yml
vendored
118
.github/workflows/update-vendor-hash.yml
vendored
|
|
@ -1,118 +0,0 @@
|
|||
name: Update vendorHash for dependabot Go bumps
|
||||
|
||||
# Dependabot bumps to go.mod/go.sum invalidate the proxyVendor FOD hash in
|
||||
# default.nix, which fails the required PR Risk `test-nix` gate (F7c,
|
||||
# spec-f7.md §2.4: nix-build.yml itself no longer runs on pull_request, since
|
||||
# test-nix's `nix run .#default` plus `nix flake check -L`, which evaluates
|
||||
# every flake output, is a superset of plain `nix build .#default`). This workflow detects the drift, computes the
|
||||
# new hash via scripts/update-nix-vendorhash.sh, and pushes the update back to
|
||||
# the dependabot branch so the gate goes green without a maintainer
|
||||
# round-trip.
|
||||
#
|
||||
# Tracked under beads-bz5.
|
||||
#
|
||||
# Why pull_request_target (not pull_request):
|
||||
# GitHub gives the GITHUB_TOKEN read-only permissions on `pull_request`
|
||||
# workflows triggered by dependabot, regardless of declared `permissions:`.
|
||||
# `pull_request_target` runs in the trusted context of the base branch with
|
||||
# full token permissions, which is required to push back to the PR branch.
|
||||
#
|
||||
# Safety against pull_request_target abuse:
|
||||
# - The job only runs when github.actor is dependabot[bot] AND the PR head
|
||||
# is on the upstream repo (head.repo.full_name == github.repository).
|
||||
# Dependabot never opens PRs from forks, so this combination is not
|
||||
# reachable from an external contributor.
|
||||
# - We explicitly check out the PR head SHA to operate on dependabot's
|
||||
# bumped go.mod/go.sum. Because dependabot is the only allowed actor and
|
||||
# never modifies scripts/, the trust boundary is the dependabot bot
|
||||
# itself — this is the same trust posture the project already accepts
|
||||
# when merging dependabot PRs.
|
||||
# - No force-push. Single commit with attribution.
|
||||
#
|
||||
# Caveat:
|
||||
# GitHub does not retrigger pull_request workflow runs for commits
|
||||
# authored by GITHUB_TOKEN. After this workflow pushes, the existing PR Risk
|
||||
# `test-nix` check on this PR will remain stuck on the pre-fix commit.
|
||||
# Maintainers either re-run test-nix manually, or this workflow's own
|
||||
# success acts as the green signal that the hash is correct.
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'go.mod'
|
||||
- 'go.sum'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: update-vendor-hash-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
update-vendor-hash:
|
||||
name: Update default.nix vendorHash
|
||||
if: >-
|
||||
github.actor == 'dependabot[bot]' &&
|
||||
github.event.pull_request.user.login == 'dependabot[bot]' &&
|
||||
github.event.pull_request.head.repo.full_name == github.repository
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Checkout PR head
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
with:
|
||||
# pull_request_target defaults to the base ref. Explicitly check
|
||||
# out the PR head so we operate on dependabot's bumped go.mod/sum.
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/determinate-nix-action@527f17dd63d2d60d3e5552934bc84b9a33a14d11 # v3
|
||||
|
||||
- name: Capture pre-update vendorHash
|
||||
id: pre
|
||||
run: |
|
||||
set -euo pipefail
|
||||
OLD_HASH=$(grep 'vendorHash = ' default.nix | sed 's/.*"\(.*\)".*/\1/')
|
||||
echo "old_hash=$OLD_HASH" >>"$GITHUB_OUTPUT"
|
||||
echo "Pre-update vendorHash: $OLD_HASH"
|
||||
|
||||
- name: Update vendorHash
|
||||
run: ./scripts/update-nix-vendorhash.sh
|
||||
|
||||
- name: Verify the build independently of the script's exit status
|
||||
# update-nix-vendorhash.sh's own verification build (its step 5) is
|
||||
# internal to the script; this step re-derives the same signal from
|
||||
# a source the workflow doesn't have to trust: a plain `nix build`
|
||||
# that this job step fails on if it fails, regardless of what the
|
||||
# script itself reported.
|
||||
run: nix build .#default
|
||||
|
||||
- name: Detect whether hash changed
|
||||
id: changed
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if git diff --quiet -- default.nix; then
|
||||
echo "changed=false" >>"$GITHUB_OUTPUT"
|
||||
echo "vendorHash already matched; nothing to commit."
|
||||
else
|
||||
echo "changed=true" >>"$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Commit and push hash update
|
||||
if: steps.changed.outputs.changed == 'true'
|
||||
env:
|
||||
# Push to the PR branch on the upstream repo. dependabot branches
|
||||
# live on the same repo, so the default GITHUB_TOKEN suffices.
|
||||
BRANCH: ${{ github.event.pull_request.head.ref }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add default.nix
|
||||
git commit \
|
||||
-m "chore(nix): update vendorHash for go.sum changes" \
|
||||
-m "Auto-generated by .github/workflows/update-vendor-hash.yml in response to a dependabot Go-module bump (beads-bz5)."
|
||||
git push origin "HEAD:${BRANCH}"
|
||||
196
.github/workflows/worker-env-autosync.yml
vendored
196
.github/workflows/worker-env-autosync.yml
vendored
|
|
@ -1,196 +0,0 @@
|
|||
# Keep beads' rbe worker-env pin in step with gastownhall/gascity main
|
||||
# without the ~100-minute wait #7419 fixed by hand.
|
||||
#
|
||||
# rbe-west's OSS pool is gascity's: its workers advertise the sha256 of the
|
||||
# toolchain manifest gascity's tools/rbe/worker-env measures, and the
|
||||
# schedulers match //platforms:rbe_worker's worker-env exec property
|
||||
# exactly. beads' tools/rbe/worker-env.txt and the platforms/BUILD.bazel pin
|
||||
# are a byte-for-byte copy of gascity main's; when gascity moves the pin (a
|
||||
# Go, dolt, or OS/library bump -- #7387 was a Go security release), every
|
||||
# beads remote-execution run stops in bazel.yml's rbe-job preflight
|
||||
# (tools/rbe/worker-env-sync) until the copy catches up. nightly.yml's
|
||||
# rbe-worker-env-sync job already opens a ci/infra issue for a human to fix;
|
||||
# this instead opens the fix itself, every 15 minutes, so the gap is
|
||||
# minutes, not until someone reads the issue.
|
||||
#
|
||||
# tools/rbe/worker-env-sync only detects the mismatch (exit 1) or that it
|
||||
# could not compare with gascity (exit 2, e.g. GitHub is briefly
|
||||
# unreachable; the next run retries). The write half, tools/rbe/worker-env-
|
||||
# sync-copy, runs only after that exit-1 detection, on a checkout already in
|
||||
# hand -- so a transient gascity outage can turn "in step" into "unknown",
|
||||
# never into an unwanted write.
|
||||
#
|
||||
# TWO TOKENS, ONE JOB EACH: GitHub never runs checks on a PR a plain
|
||||
# GITHUB_TOKEN opens (its loop-prevention rule), so this needs a GitHub App
|
||||
# token to open the PR. The gastownhall-autofix App (contents:write only on
|
||||
# this repo) mints push-token and does the git push of the fixed branch
|
||||
# (bot/worker-env-sync); it cannot open, label or merge a PR. The separate
|
||||
# gascity-autofix App (pull-requests:write only, no contents) mints pr-token
|
||||
# and does everything PR-shaped: create/update, the status/needs-review-auto
|
||||
# label, and arming auto-merge. Splitting them means a bug in the PR-shaped
|
||||
# half can never push a commit, and a bug in the push half can never touch a
|
||||
# PR; neither token can do the other's job even by accident. Both Apps'
|
||||
# credentials are secrets of the same `autofix` environment.
|
||||
#
|
||||
# peter-evans/create-pull-request takes one token for the whole push+PR
|
||||
# flow, so it cannot honor this split; this uses plain git for the push and
|
||||
# gh for the PR instead. Every `${{ }}` is resolved into a step's `env:`,
|
||||
# never written inside a `run:` script, so a value that happened to look
|
||||
# like shell (a title or body containing `` ` `` or `$`) is data to the
|
||||
# shell, not something GitHub's expression syntax or the shell re-parses.
|
||||
#
|
||||
# SECURITY: schedule and workflow_dispatch are never fork events (no
|
||||
# pull_request trigger here at all), so neither App's private key -- secrets
|
||||
# of the `autofix` environment, whose deployment-branch policy allows only
|
||||
# main -- is ever readable by a fork. The guard on github.repository is
|
||||
# defense in depth for a fork of this repo, where the secrets would not
|
||||
# exist anyway. Both mint steps run only once worker-env-sync has already
|
||||
# found a real mismatch, so a run that is in step or can't compare asks
|
||||
# neither App for a token. gh pr merge --auto only arms GitHub's native
|
||||
# auto-merge (it still waits for every required check and the branch
|
||||
# protection rule); it does not merge anything itself.
|
||||
name: rbe worker-env autosync
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "*/15 * * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
autosync:
|
||||
name: Sync worker-env pin with gascity main
|
||||
if: github.repository == 'gastownhall/beads'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
# Grants the job read access to this environment's secrets (both Apps'
|
||||
# id and private key); its deployment-branch policy restricts that to
|
||||
# jobs running on main, which schedule and workflow_dispatch on this
|
||||
# repo always are.
|
||||
environment: autofix
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
# Never fails the step itself: rc is the signal every later step
|
||||
# gates on (1, a real mismatch; 2, gascity unreachable -- the next
|
||||
# scheduled run retries; 0, in step). A run every 15 minutes failing
|
||||
# red for however long a mismatch takes to review and merge would be
|
||||
# noise, not signal.
|
||||
- name: Compare the worker-env manifest and pin with gascity's main
|
||||
id: sync
|
||||
run: |
|
||||
rc=0
|
||||
tools/rbe/worker-env-sync main || rc=$?
|
||||
echo "rc=$rc" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Copy gascity main's worker-env manifest and pin
|
||||
if: steps.sync.outputs.rc == '1'
|
||||
run: tools/rbe/worker-env-sync-copy main
|
||||
|
||||
- name: Confirm only the worker-env files moved
|
||||
if: steps.sync.outputs.rc == '1'
|
||||
run: |
|
||||
changed="$(git diff --name-only)"
|
||||
untracked="$(git ls-files --others --exclude-standard)"
|
||||
want=$'platforms/BUILD.bazel\ntools/rbe/worker-env.txt'
|
||||
if [ -n "$untracked" ] || [ "$(printf '%s\n' "$changed" | sort)" != "$(printf '%s\n' "$want" | sort)" ]; then
|
||||
echo "::error::worker-env-sync-copy touched more than platforms/BUILD.bazel and tools/rbe/worker-env.txt:"
|
||||
printf '%s\n' "$changed" "$untracked"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# contents:write only, on this repo alone: all it can do is push
|
||||
# bot/worker-env-sync. Minted only once a real mismatch needs a push.
|
||||
- name: Mint push token (gastownhall-autofix)
|
||||
id: push-token
|
||||
if: steps.sync.outputs.rc == '1'
|
||||
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3
|
||||
with:
|
||||
app-id: ${{ secrets.AUTOFIX_APP_ID }}
|
||||
private-key: ${{ secrets.AUTOFIX_APP_PRIVATE_KEY }}
|
||||
owner: gastownhall
|
||||
repositories: beads
|
||||
permission-contents: write
|
||||
|
||||
# pull-requests:write only, on this repo alone: all it can do is
|
||||
# open, label and arm auto-merge on a PR -- never push a commit.
|
||||
- name: Mint PR token (gascity-autofix)
|
||||
id: pr-token
|
||||
if: steps.sync.outputs.rc == '1'
|
||||
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3
|
||||
with:
|
||||
app-id: ${{ secrets.GASCITY_AUTOFIX_APP_ID }}
|
||||
private-key: ${{ secrets.GASCITY_AUTOFIX_APP_PRIVATE_KEY }}
|
||||
owner: gastownhall
|
||||
repositories: beads
|
||||
permission-pull-requests: write
|
||||
|
||||
# push-token alone; it cannot see a PR exists, let alone touch one.
|
||||
# Leased to the branch: a force-with-lease scoped to refs/heads/
|
||||
# bot/worker-env-sync only, so a push can never move any other ref.
|
||||
- name: Commit and push the sync branch
|
||||
if: steps.sync.outputs.rc == '1'
|
||||
env:
|
||||
PUSH_TOKEN: ${{ steps.push-token.outputs.token }}
|
||||
REPO: ${{ github.repository }}
|
||||
BRANCH: bot/worker-env-sync
|
||||
COMMIT_SUBJECT: "build(rbe): sync worker-env pin with gascity main"
|
||||
GIT_AUTHOR_NAME: gastownhall-autofix[bot]
|
||||
GIT_AUTHOR_EMAIL: gastownhall-autofix[bot]@users.noreply.github.com
|
||||
GIT_COMMITTER_NAME: gastownhall-autofix[bot]
|
||||
GIT_COMMITTER_EMAIL: gastownhall-autofix[bot]@users.noreply.github.com
|
||||
run: |
|
||||
git checkout -B "$BRANCH"
|
||||
git add platforms/BUILD.bazel tools/rbe/worker-env.txt
|
||||
git commit -m "$COMMIT_SUBJECT"
|
||||
git push "https://x-access-token:${PUSH_TOKEN}@github.com/${REPO}.git" \
|
||||
"HEAD:refs/heads/$BRANCH" "--force-with-lease=refs/heads/$BRANCH"
|
||||
|
||||
# pr-token alone; it cannot push a commit, only act on the PR the
|
||||
# step above already pushed.
|
||||
- name: Open or update the sync PR
|
||||
id: pr
|
||||
if: steps.sync.outputs.rc == '1'
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.pr-token.outputs.token }}
|
||||
REPO: ${{ github.repository }}
|
||||
BRANCH: bot/worker-env-sync
|
||||
TITLE: "build(rbe): sync worker-env pin with gascity main"
|
||||
LABEL: status/needs-review-auto
|
||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
run: |
|
||||
body="$(cat <<BODY
|
||||
rbe-west's pool workers advertise gastownhall/gascity main's worker-env
|
||||
pin; beads' copy (\`tools/rbe/worker-env.txt\` and the
|
||||
\`platforms/BUILD.bazel\` pin) had fallen out of step, so beads' remote
|
||||
actions were queueing on a pin no worker serves
|
||||
(\`tools/rbe/worker-env-sync main\`, run $RUN_URL).
|
||||
|
||||
This copies gascity main's manifest and pin byte for byte, same as
|
||||
#7419. Auto-merge is armed: it lands once the automated review and the
|
||||
rest of the required checks are green.
|
||||
BODY
|
||||
)"
|
||||
number="$(gh pr list --repo "$REPO" --head "$BRANCH" --base main --state open --json number --jq '.[0].number')"
|
||||
if [ -n "$number" ]; then
|
||||
gh pr edit "$number" --repo "$REPO" --title "$TITLE" --body "$body"
|
||||
else
|
||||
gh pr create --repo "$REPO" --base main --head "$BRANCH" --title "$TITLE" --body "$body"
|
||||
number="$(gh pr list --repo "$REPO" --head "$BRANCH" --base main --state open --json number --jq '.[0].number')"
|
||||
fi
|
||||
gh pr edit "$number" --repo "$REPO" --add-label "$LABEL"
|
||||
echo "number=$number" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Enable auto-merge
|
||||
if: steps.sync.outputs.rc == '1' && steps.pr.outputs.number
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.pr-token.outputs.token }}
|
||||
REPO: ${{ github.repository }}
|
||||
PR_NUMBER: ${{ steps.pr.outputs.number }}
|
||||
run: gh pr merge --auto --squash --repo "$REPO" "$PR_NUMBER"
|
||||
189
.gitignore
vendored
189
.gitignore
vendored
|
|
@ -24,58 +24,61 @@ pkg/
|
|||
*.swo
|
||||
*~
|
||||
|
||||
# Agent local state (skills, settings, etc.)
|
||||
.amp/
|
||||
|
||||
# Claude Code - local/runtime state
|
||||
.claude/settings.local.json
|
||||
.claude/worktrees/
|
||||
.claude/*.log
|
||||
.claude/*.lock
|
||||
|
||||
# Codex CLI - local marker
|
||||
.codex
|
||||
|
||||
# Claude Code local state (skills, settings, etc.)
|
||||
.claude/
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Dolt database files
|
||||
.dolt/
|
||||
|
||||
# Legacy SQLite database files
|
||||
# SQLite databases (now using JSONL as source of truth)
|
||||
*.db
|
||||
*.db-journal
|
||||
*.db-wal
|
||||
*.db-shm
|
||||
|
||||
# Runtime files
|
||||
# Daemon runtime files
|
||||
.beads/daemon.log
|
||||
.beads/daemon.pid
|
||||
.beads/daemon.lock
|
||||
.beads/daemon-error
|
||||
.beads/bd.sock
|
||||
.beads/.exclusive-lock
|
||||
|
||||
# .beads directory files
|
||||
# .beads directory files (keep JSONL only)
|
||||
.beads/.gitignore
|
||||
.beads/db.sqlite
|
||||
.beads/bd.db
|
||||
|
||||
# Keep JSONL exports (source of truth for git)
|
||||
!.beads/*.jsonl
|
||||
|
||||
# 3-way merge snapshot files (local-only, for deletion tracking)
|
||||
.beads/beads.base.jsonl
|
||||
.beads/beads.left.jsonl
|
||||
.beads/beads.base.meta.json
|
||||
.beads/beads.left.meta.json
|
||||
|
||||
# Note: .beads/deletions.jsonl is intentionally NOT ignored
|
||||
# It must be tracked in git for cross-clone deletion propagation (bd-imj)
|
||||
|
||||
# Git merge driver temp files (created during conflicts with numbered extensions)
|
||||
.beads/*.json[0-9]
|
||||
.beads/*.jsonl[0-9]
|
||||
|
||||
# Ignore nix result
|
||||
result
|
||||
|
||||
# direnv (machine-specific environment)
|
||||
.direnv
|
||||
.envrc
|
||||
|
||||
# GoReleaser build artifacts
|
||||
dist/
|
||||
Formula/bd.rb
|
||||
.zig-cache/
|
||||
|
||||
# Windows PE resource files (generated by go-winres at build time)
|
||||
*.syso
|
||||
|
||||
# Git worktrees
|
||||
.worktrees/
|
||||
.beads/pollution-backup.jsonl
|
||||
|
||||
# npm package - exclude downloaded binaries and archives
|
||||
npm-package/bin/bd
|
||||
|
|
@ -101,7 +104,7 @@ __pycache__/
|
|||
.Python
|
||||
.envrc
|
||||
|
||||
# Performance profiling files (benchmarks, bd doctor --perf, and bd --cpu-profile)
|
||||
# Performance profiling files (benchmarks, bd doctor --perf, and bd --profile)
|
||||
*.prof
|
||||
*.out
|
||||
beads-perf-*.prof
|
||||
|
|
@ -123,141 +126,3 @@ state.json
|
|||
.agents/
|
||||
output
|
||||
bd_test
|
||||
.beads/export-state/
|
||||
.beads/beads.db
|
||||
|
||||
# Orchestrator (added by gt)
|
||||
.logs/
|
||||
.beads/*
|
||||
!.beads/formulas/
|
||||
!.beads/formulas/**
|
||||
.opencode/
|
||||
|
||||
# Beads / Dolt files (added by bd init)
|
||||
.beads-credential-key
|
||||
|
||||
# Beads / Dolt files (added by bd init)
|
||||
.beads/proxieddb/
|
||||
/build/
|
||||
node_modules/
|
||||
tmp/build/cli-docs/admin.md
|
||||
tmp/build/cli-docs/ado.md
|
||||
tmp/build/cli-docs/assign.md
|
||||
tmp/build/cli-docs/audit.md
|
||||
tmp/build/cli-docs/backup.md
|
||||
tmp/build/cli-docs/batch.md
|
||||
tmp/build/cli-docs/blocked.md
|
||||
tmp/build/cli-docs/bootstrap.md
|
||||
tmp/build/cli-docs/branch.md
|
||||
tmp/build/cli-docs/children.md
|
||||
tmp/build/cli-docs/close.md
|
||||
tmp/build/cli-docs/comment.md
|
||||
tmp/build/cli-docs/comments.md
|
||||
tmp/build/cli-docs/compact.md
|
||||
tmp/build/cli-docs/completion.md
|
||||
tmp/build/cli-docs/config.md
|
||||
tmp/build/cli-docs/context.md
|
||||
tmp/build/cli-docs/cook.md
|
||||
tmp/build/cli-docs/count.md
|
||||
tmp/build/cli-docs/create-form.md
|
||||
tmp/build/cli-docs/create.md
|
||||
tmp/build/cli-docs/defer.md
|
||||
tmp/build/cli-docs/delete.md
|
||||
tmp/build/cli-docs/dep.md
|
||||
tmp/build/cli-docs/diff.md
|
||||
tmp/build/cli-docs/doctor.md
|
||||
tmp/build/cli-docs/dolt.md
|
||||
tmp/build/cli-docs/duplicate.md
|
||||
tmp/build/cli-docs/duplicates.md
|
||||
tmp/build/cli-docs/edit.md
|
||||
tmp/build/cli-docs/epic.md
|
||||
tmp/build/cli-docs/export.md
|
||||
tmp/build/cli-docs/federation.md
|
||||
tmp/build/cli-docs/find-duplicates.md
|
||||
tmp/build/cli-docs/flatten.md
|
||||
tmp/build/cli-docs/forget.md
|
||||
tmp/build/cli-docs/formula.md
|
||||
tmp/build/cli-docs/gate.md
|
||||
tmp/build/cli-docs/gc.md
|
||||
tmp/build/cli-docs/github.md
|
||||
tmp/build/cli-docs/gitlab.md
|
||||
tmp/build/cli-docs/graph.md
|
||||
tmp/build/cli-docs/heartbeat.md
|
||||
tmp/build/cli-docs/history.md
|
||||
tmp/build/cli-docs/hooks.md
|
||||
tmp/build/cli-docs/human.md
|
||||
tmp/build/cli-docs/import.md
|
||||
tmp/build/cli-docs/index.md
|
||||
tmp/build/cli-docs/info.md
|
||||
tmp/build/cli-docs/init-safety.md
|
||||
tmp/build/cli-docs/init.md
|
||||
tmp/build/cli-docs/jira.md
|
||||
tmp/build/cli-docs/kv.md
|
||||
tmp/build/cli-docs/label.md
|
||||
tmp/build/cli-docs/linear.md
|
||||
tmp/build/cli-docs/link.md
|
||||
tmp/build/cli-docs/lint.md
|
||||
tmp/build/cli-docs/list.md
|
||||
tmp/build/cli-docs/mail.md
|
||||
tmp/build/cli-docs/memories.md
|
||||
tmp/build/cli-docs/merge-slot.md
|
||||
tmp/build/cli-docs/metrics.md
|
||||
tmp/build/cli-docs/migrate-personal.md
|
||||
tmp/build/cli-docs/migrate.md
|
||||
tmp/build/cli-docs/mol.md
|
||||
tmp/build/cli-docs/note.md
|
||||
tmp/build/cli-docs/notion.md
|
||||
tmp/build/cli-docs/onboard.md
|
||||
tmp/build/cli-docs/orphans.md
|
||||
tmp/build/cli-docs/ping.md
|
||||
tmp/build/cli-docs/preflight.md
|
||||
tmp/build/cli-docs/prime.md
|
||||
tmp/build/cli-docs/priority.md
|
||||
tmp/build/cli-docs/promote.md
|
||||
tmp/build/cli-docs/prune.md
|
||||
tmp/build/cli-docs/purge.md
|
||||
tmp/build/cli-docs/q.md
|
||||
tmp/build/cli-docs/query.md
|
||||
tmp/build/cli-docs/quickstart.md
|
||||
tmp/build/cli-docs/ready.md
|
||||
tmp/build/cli-docs/recall.md
|
||||
tmp/build/cli-docs/reclaim.md
|
||||
tmp/build/cli-docs/recompute-blocked.md
|
||||
tmp/build/cli-docs/remember.md
|
||||
tmp/build/cli-docs/rename-prefix.md
|
||||
tmp/build/cli-docs/rename.md
|
||||
tmp/build/cli-docs/reopen.md
|
||||
tmp/build/cli-docs/repo.md
|
||||
tmp/build/cli-docs/restore.md
|
||||
tmp/build/cli-docs/rules.md
|
||||
tmp/build/cli-docs/search.md
|
||||
tmp/build/cli-docs/set-state.md
|
||||
tmp/build/cli-docs/setup.md
|
||||
tmp/build/cli-docs/ship.md
|
||||
tmp/build/cli-docs/show.md
|
||||
tmp/build/cli-docs/sql.md
|
||||
tmp/build/cli-docs/stale.md
|
||||
tmp/build/cli-docs/state.md
|
||||
tmp/build/cli-docs/status.md
|
||||
tmp/build/cli-docs/statuses.md
|
||||
tmp/build/cli-docs/supersede.md
|
||||
tmp/build/cli-docs/swarm.md
|
||||
tmp/build/cli-docs/tag.md
|
||||
tmp/build/cli-docs/todo.md
|
||||
tmp/build/cli-docs/types.md
|
||||
tmp/build/cli-docs/unclaim.md
|
||||
tmp/build/cli-docs/undefer.md
|
||||
tmp/build/cli-docs/update.md
|
||||
tmp/build/cli-docs/upgrade.md
|
||||
tmp/build/cli-docs/vc.md
|
||||
tmp/build/cli-docs/version.md
|
||||
tmp/build/cli-docs/where.md
|
||||
tmp/build/cli-docs/worktree.md
|
||||
tmp/docs/CLI_REFERENCE.md
|
||||
*.gate.lock*
|
||||
|
||||
# Bazel: output symlinks and machine-local rc files (remote executor endpoint,
|
||||
# TLS credentials). Never commit these.
|
||||
/bazel-*
|
||||
/.bazelrc.local
|
||||
/user.bazelrc
|
||||
|
|
|
|||
581
.golangci.yml
581
.golangci.yml
|
|
@ -1,9 +1,3 @@
|
|||
# Lint policy for nogo (//tools/nogo), which runs these linters beside every
|
||||
# Bazel Go compile: tools/nogo/internal/golangci embeds this file and applies
|
||||
# it as golangci-lint v2.10.1 would (enabled linters, settings, run.tests,
|
||||
# generated files, exclusion rules). Decoding is strict, so a key the nogo
|
||||
# wrappers do not implement fails the build. golangci-lint itself still reads
|
||||
# it (editors, ad-hoc runs), but CI gates on nogo; see engdocs/LINTING.md.
|
||||
version: "2"
|
||||
|
||||
run:
|
||||
|
|
@ -13,308 +7,13 @@ run:
|
|||
linters:
|
||||
default: 'none'
|
||||
enable:
|
||||
- depguard
|
||||
- errcheck
|
||||
- forbidigo
|
||||
- gosec
|
||||
- misspell
|
||||
- unconvert
|
||||
- unparam
|
||||
- sloglint
|
||||
|
||||
settings:
|
||||
depguard:
|
||||
rules:
|
||||
# Mechanical enforcement of the Storage Boundary in
|
||||
# engdocs/PROJECT_CHARTER.md: only the storage adapter packages may
|
||||
# depend on the Dolt engine directly.
|
||||
dolt-storage-boundary:
|
||||
list-mode: lax
|
||||
files:
|
||||
- "$all"
|
||||
# Storage adapter packages are the intended home for Dolt access.
|
||||
- "!**/internal/storage/**"
|
||||
- "!**/internal/doltserver/**"
|
||||
# Exception: the proxied-server surface needs Dolt server config
|
||||
# (servercfg, filesys) to launch/manage a real `dolt sql-server`
|
||||
# process. Candidate for migration behind the storage adapter.
|
||||
- "!**/cmd/bd/proxied_server.go"
|
||||
# Exception: eventkit is DoltHub's analytics/telemetry client,
|
||||
# not the Dolt storage engine - dropped here so the narrower
|
||||
# dolt-storage-boundary-metrics-exception rule below can allow
|
||||
# eventkit specifically while still denying any other dolthub
|
||||
# import (e.g. the engine itself) in these two files.
|
||||
- "!**/internal/metrics/flusher.go"
|
||||
- "!**/internal/metrics/metrics.go"
|
||||
deny:
|
||||
- pkg: github.com/dolthub
|
||||
desc: "Dolt engine access is restricted to the storage adapter packages (internal/storage, internal/doltserver) - see engdocs/PROJECT_CHARTER.md 'Storage Boundary'"
|
||||
# Companion rule for the two files excluded above: allow only
|
||||
# DoltHub's eventkit telemetry client, still deny the Dolt engine
|
||||
# (or any other dolthub package) so metrics can't become a backdoor
|
||||
# around the storage boundary.
|
||||
dolt-storage-boundary-metrics-exception:
|
||||
list-mode: lax
|
||||
# No "$all" here: this rule's files list is a plain allowlist
|
||||
# (not "!$all" + inclusions) because depguard expands "$all" to
|
||||
# "**/*.go" even when negated, which would match every file
|
||||
# (including these two) and make the rule apply nowhere.
|
||||
files:
|
||||
- "**/internal/metrics/flusher.go"
|
||||
- "**/internal/metrics/metrics.go"
|
||||
allow:
|
||||
- github.com/dolthub/eventkit
|
||||
deny:
|
||||
- pkg: github.com/dolthub
|
||||
desc: "Dolt engine access is restricted to the storage adapter packages (internal/storage, internal/doltserver) - see engdocs/PROJECT_CHARTER.md 'Storage Boundary'"
|
||||
# internal/workapi is the work-query contract shared by every bd
|
||||
# frontend, so it must be callable from a cobra command and from an
|
||||
# HTTP handler alike - which means it can depend on neither. Same
|
||||
# allowlist shape as the metrics exception above: no "$all", because
|
||||
# depguard expands it to "**/*.go" and the rule would apply nowhere.
|
||||
workapi-frontend-boundary:
|
||||
list-mode: lax
|
||||
files:
|
||||
- "**/internal/workapi/**"
|
||||
deny:
|
||||
- pkg: github.com/spf13/cobra
|
||||
desc: "internal/workapi is frontend-independent: the CLI parses flags and passes plain params - see internal/workapi/doc.go"
|
||||
- pkg: net/http
|
||||
desc: "internal/workapi is frontend-independent: the HTTP layer decodes requests and passes plain params - see internal/workapi/doc.go"
|
||||
# The other half of that boundary. internal/httpapi is TRANSPORT: it
|
||||
# decodes parameters, hands the whole request to issueops.Reader, and
|
||||
# shapes the answer onto the wire. "No handler builds a filter or
|
||||
# supplies a ConfigSource" is the Reader slice's acceptance criterion,
|
||||
# and the rule above cannot enforce it - it constrains what workapi
|
||||
# imports, not who imports workapi. Without this, a handler could call
|
||||
# BuildListFilter tomorrow and every gate would stay green, which is
|
||||
# exactly how a hosted viewer once shipped a bare IssueFilter and served
|
||||
# in_progress rows as "ready".
|
||||
#
|
||||
# Tests are exempt: they read the shared default constants
|
||||
# (workapi.DefaultReadyLimit) to prove the handler uses those rather
|
||||
# than literals of its own, which is a guard, not a construction.
|
||||
httpapi-transport-boundary:
|
||||
list-mode: lax
|
||||
files:
|
||||
- "**/internal/httpapi/**"
|
||||
- "!$test"
|
||||
deny:
|
||||
- pkg: github.com/steveyegge/beads/internal/workapi
|
||||
desc: "internal/httpapi is transport only: a read handler asks the provider for issueops.Reader and passes the whole request - it never builds a filter - see internal/httpapi/reads.go"
|
||||
# The OTHER way past the roles, and the one the rule above does not
|
||||
# close. Denying internal/workapi stops a handler BUILDING a filter; it
|
||||
# does nothing about a handler taking uw.IssueUseCase() and calling the
|
||||
# use case straight, which needs no filter and no builder. That is not a
|
||||
# hypothetical shortcut - it is exactly what the proxied CLI did for
|
||||
# years, and unpicking it is what the role accessors exist for. A second
|
||||
# front door that reached the domain directly would be the same two
|
||||
# implementations again, arriving one handler at a time.
|
||||
#
|
||||
# Deny-by-default over the whole package, so a file added here tomorrow
|
||||
# is covered the moment it exists. The two holes below are named, and
|
||||
# each one is a VALUE the caller assembled, never a use case:
|
||||
#
|
||||
# server.go Config.Workspace is domain.ContextInfo, the startup
|
||||
# snapshot the embedder hands in. The package resolves
|
||||
# no workspace state of its own; this is the type of the
|
||||
# thing it is given.
|
||||
# handlers.go contextResponse projects that snapshot with
|
||||
# domain.PublishedContext - the SAME projection `bd
|
||||
# context` publishes, which is where the credential and
|
||||
# host-path exclusions live. Reimplementing it here to
|
||||
# satisfy a lint rule would be the field-by-field copy
|
||||
# that projection exists to prevent.
|
||||
#
|
||||
# Neither file touches a use case, and both are small: the read handlers
|
||||
# (reads.go), the one write (claim.go) and everything added later stay
|
||||
# guarded. Tests are exempt for the reason the rule above exempts them -
|
||||
# they stand up domain fakes to drive the handlers.
|
||||
httpapi-domain-boundary:
|
||||
list-mode: lax
|
||||
files:
|
||||
- "**/internal/httpapi/**"
|
||||
- "!$test"
|
||||
- "!**/internal/httpapi/server.go"
|
||||
- "!**/internal/httpapi/handlers.go"
|
||||
deny:
|
||||
- pkg: github.com/steveyegge/beads/internal/storage/domain
|
||||
desc: "internal/httpapi is transport only: a handler reaches storage through an issueops role accessor on the provider, never through the domain use cases - see internal/httpapi/claim.go"
|
||||
# The same boundary, transposed onto the front door that was last past
|
||||
# it. cmd/bd cannot be closed to the domain wholesale — thirty of its
|
||||
# non-test files import internal/storage/domain today and unpicking
|
||||
# them is a program, not a rule — so this closes it ONE COMMAND AT A
|
||||
# TIME, and `bd label` is the first entry.
|
||||
#
|
||||
# It denies internal/storage/uow as well as internal/storage/domain,
|
||||
# and the second package is the one that does the work here. depguard
|
||||
# matches IMPORTS, and a file can call uw.LabelUseCase().AddLabel(...)
|
||||
# without importing domain at all — the method call needs no import for
|
||||
# the inferred type. That is exactly what cmd/bd/label_proxied_server.go
|
||||
# did, so a domain-only deny would have been a rule that could not see
|
||||
# the bypass it was written for. Reaching a use case requires a unit of
|
||||
# work, opening one requires uow.RunTx, and THAT is an import.
|
||||
#
|
||||
# THIS RULE COVERS THE IMPORT SPELLING AND ONLY THE IMPORT SPELLING, and
|
||||
# by itself it is NOT sufficient. cmd/bd is one package, so
|
||||
# proxiedOpenReadUOW (cmd/bd/show_proxied_server.go) hands any file in
|
||||
# it a uow.UnitOfWork with no import of its own — measured: a label.go
|
||||
# calling proxiedOpenReadUOW(ctx) and then uw.LabelUseCase().AddLabel()
|
||||
# compiles and passes this rule. An import-scoped guard cannot see a
|
||||
# bypass routed through an in-package helper, and pretending otherwise
|
||||
# would be worse than no rule, because the next reader greps for the
|
||||
# guard, finds one, and stops looking.
|
||||
#
|
||||
# What closes that route is the forbidigo `LabelUseCase` rule below,
|
||||
# and since ga-2ltro.12 that rule is PACKAGE-WIDE across cmd/bd while
|
||||
# this one still names one file. The asymmetry is the design, not a
|
||||
# gap: forbidigo denies the CALL, which is what a front door has to
|
||||
# stop doing, and every file may be held to that today. depguard denies
|
||||
# the PACKAGE, which a file cannot stop importing until its whole
|
||||
# command has moved — fifty-eight non-test files in cmd/bd open a unit
|
||||
# of work for verbs no role serves yet. So the pair covers a caller who
|
||||
# reached the domain through some third spelling (a helper returning a
|
||||
# use case directly, say) in the one file that has fully migrated, and
|
||||
# forbidigo alone covers the call everywhere else. Both were verified
|
||||
# by mutation, one bypass each; ga-2ltro.12 re-verified the forbidigo
|
||||
# half from a file the depguard half does not name.
|
||||
#
|
||||
# cmd/bd/label.go holds every label decision now — the arg split, the
|
||||
# reserved-prefix refusal, the patch, the report — and reaches storage
|
||||
# only through issueops.Lifecycle and issueops.Reader.
|
||||
# cmd/bd/label_proxied_server.go is NOT on this list and legitimately
|
||||
# imports uow: it is where the route's capability accessors live, and
|
||||
# it still holds `list-all` and `propagate`, whose questions no role
|
||||
# answers yet. It joins the list when they move.
|
||||
#
|
||||
# The list grows by one file per command whose front doors reach the
|
||||
# roles, the way cmd-bd-role-constructors grows by one package per
|
||||
# shared body. cmd/bd/state.go is the second entry: ga-2ltro.12 moved
|
||||
# `bd state`, `bd state list` and `bd set-state` onto Reader.Get and
|
||||
# Lifecycle, deleted their proxied twin outright, and left the file
|
||||
# importing neither package — so the rule pins a migration that has
|
||||
# happened rather than asking for one that has not.
|
||||
cmd-bd-domain-boundary:
|
||||
list-mode: lax
|
||||
files:
|
||||
- "**/cmd/bd/label.go"
|
||||
- "**/cmd/bd/state.go"
|
||||
- "!$test"
|
||||
deny:
|
||||
- pkg: github.com/steveyegge/beads/internal/storage/domain
|
||||
desc: "bd label and bd state reach storage through an issueops role accessor, never through the domain use cases - see openIssueLifecycle in cmd/bd/label.go"
|
||||
- pkg: github.com/steveyegge/beads/internal/storage/uow
|
||||
desc: "these commands do not open a unit of work: the route fork is the accessor (openIssueLifecycle/openIssueReader), and a unit of work here is how a use-case call gets back in - see cmd/bd/label.go"
|
||||
# store.IssueReader() is the door to the reader role, and a store wears
|
||||
# decorators (telemetry spans, hook firing) that each add their layer in
|
||||
# their OWN accessor. A command holding the storage.DoltStorage
|
||||
# interface that called the shared constructor directly would get a
|
||||
# bare, unspanned reader - and would look like perfectly ordinary code.
|
||||
# That constructor used to live in internal/workapi, which 22 cmd/bd
|
||||
# files already import for the builders, so it was one line away at all
|
||||
# times. It now lives in internal/workapi/storereader and this is what
|
||||
# keeps it there.
|
||||
#
|
||||
# No matching entry for internal/httpapi: depguard matches pkg by
|
||||
# prefix, so httpapi-transport-boundary above already denies the
|
||||
# subpackage along with its parent.
|
||||
#
|
||||
# The list grows by one entry per store-backed role that gets a shared
|
||||
# body of its own. It is a LIST rather than a rule per role so the next
|
||||
# one is a one-line edit here - see
|
||||
# engdocs/ADDING_AN_ISSUEOPS_ROLE.md.
|
||||
cmd-bd-role-constructors:
|
||||
list-mode: lax
|
||||
files:
|
||||
- "**/cmd/bd/**"
|
||||
deny:
|
||||
- pkg: github.com/steveyegge/beads/internal/workapi/storereader
|
||||
desc: "a command reaches the reader role through store.IssueReader(), never through the constructor: the accessor is where each storage decorator adds its layer - see internal/workapi/storereader/reader.go"
|
||||
- pkg: github.com/steveyegge/beads/internal/workapi/storecounter
|
||||
desc: "a command reaches the count role through store.Counter(), never through the constructor: the accessor is where each storage decorator adds its layer - see internal/workapi/storecounter/counter.go"
|
||||
- pkg: github.com/steveyegge/beads/internal/workapi/storeworkspaceconfig
|
||||
desc: "a command reaches the workspace-settings role through store.WorkspaceConfig(), never through the constructor: the accessor is where each storage decorator adds its layer - see internal/workapi/storeworkspaceconfig/workspaceconfig.go"
|
||||
- pkg: github.com/steveyegge/beads/internal/workapi/storeversionreconciler
|
||||
desc: "a command reaches the version-marker role through store.VersionReconciler(), never through the constructor: the accessor is where each storage decorator adds its layer - see internal/workapi/storeversionreconciler/versionreconciler.go"
|
||||
- pkg: github.com/steveyegge/beads/internal/workapi/storestats
|
||||
desc: "a command reaches the summary role through store.StatsReporter(), never through the constructor: the accessor is where each storage decorator adds its layer - see internal/workapi/storestats/reporter.go"
|
||||
- pkg: github.com/steveyegge/beads/internal/workapi/storereadycounter
|
||||
desc: "a command reaches the ready-count role through store.ReadyCounter(), never through the constructor: the accessor is where each storage decorator adds its layer - see internal/workapi/storereadycounter/counter.go"
|
||||
- pkg: github.com/steveyegge/beads/internal/workapi/storequerier
|
||||
desc: "a command reaches the boolean-query role through store.Querier(), never through the constructor: the accessor is where each storage decorator adds its layer - see internal/workapi/storequerier/querier.go"
|
||||
# beadserrors sits BENEATH every role leaf, so whatever it imports is
|
||||
# imported by all of them - which is the reason it exists. The second
|
||||
# leaf reached into issueops for one sentinel and pulled internal/types
|
||||
# along behind it, and that import claimed the memory plane sits
|
||||
# downstream of the issue plane. Stdlib only, and enforced rather than
|
||||
# requested, because the next tempting import is always one shared
|
||||
# constant that "obviously belongs with the errors".
|
||||
#
|
||||
# strict, not lax: this is an allowlist of the whole world, so a rule
|
||||
# that named packages to deny would have to predict them.
|
||||
beadserrors-leaf:
|
||||
list-mode: strict
|
||||
files:
|
||||
- "**/beadserrors/**"
|
||||
allow:
|
||||
- "$gostd"
|
||||
# The CONSTRUCTION half of that same boundary, and the half that actually
|
||||
# matches the failure. The depguard rule above denies a handler IMPORTING
|
||||
# the builders; it does not deny a handler naming the filter types, which
|
||||
# internal/httpapi can already reach (reads.go uses types.CheckFieldLen and
|
||||
# types.IssueWithCounts). A hand-rolled `types.IssueFilter{}` would skip the
|
||||
# builders entirely and still lint clean - which is EXACTLY what the hosted
|
||||
# viewer shipped: a bare IssueFilter that leaked gates, wisps, templates and
|
||||
# closed beads that `bd list` hides.
|
||||
#
|
||||
# analyze-types resolves the selector to the type it actually denotes, so
|
||||
# an aliased import of internal/types is caught and an unrelated package
|
||||
# that happens to be called `types` is not.
|
||||
#
|
||||
# WHAT THE RULE FORBIDS IS NAMING THESE TYPES - a composite literal, a var,
|
||||
# a struct field, a parameter, a return. It does not forbid HOLDING one:
|
||||
# `filter, err := workapi.BuildListFilter(...)` names no type and passes,
|
||||
# which is the point, but so would an inferred assignment from any other
|
||||
# source, including a helper in one of the excepted files below. So the
|
||||
# rule forecloses WRITING a filter in scope - which is what hand-rolling
|
||||
# looks like - and it is not a proof that every filter in scope came from a
|
||||
# builder. That is still the difference that matters: the builder is where
|
||||
# the closed/done exclusions, the template, gate, infra and wisp
|
||||
# suppression and the limit defaulting live.
|
||||
#
|
||||
# SCOPE, set by the exclusion rules near the bottom of this file:
|
||||
#
|
||||
# internal/httpapi/** every file, no exceptions. Each read handler hands
|
||||
# the whole request to issueops.Reader and the
|
||||
# surface has no other job, so a file added here
|
||||
# tomorrow is covered the moment it exists.
|
||||
# cmd/bd/** DENY BY DEFAULT, with the files that legitimately
|
||||
# build a filter named as exceptions below. This is
|
||||
# the way round that survives a rename: `bd list`
|
||||
# split into a new helper, or show.go renamed, stays
|
||||
# guarded. An inclusion list of five filenames -
|
||||
# which is what this was - stops applying the moment
|
||||
# the code moves, silently.
|
||||
#
|
||||
# Nothing else in the tree is in scope, deliberately: there are ~750
|
||||
# legitimate filter literals in storage, the domain, conformance and the
|
||||
# tests, and a tree-wide ban is not the claim.
|
||||
forbidigo:
|
||||
analyze-types: true
|
||||
forbid:
|
||||
- pattern: 'LabelUseCase$'
|
||||
msg: "reach the label plane through issueops.Lifecycle (Patch.Labels) and issueops.Reader, never the domain use case - see openIssueLifecycle in cmd/bd/label.go"
|
||||
- pattern: '^types\.(IssueFilter|WorkFilter)$'
|
||||
pkg: '^github\.com/steveyegge/beads/internal/types$'
|
||||
msg: "do not write a filter here: take one back from a builder in internal/workapi, or pass the whole request to issueops.Reader. internal/httpapi may never name these types; cmd/bd denies them by default and lists the files that legitimately build their own, with the reason for each, in .golangci.yml - see issueops/reader.go"
|
||||
- pattern: '^fmt\.Print(f|ln)?$'
|
||||
pkg: '^fmt$'
|
||||
# Keep the prefix in sync with the list/graph text exclusion below.
|
||||
msg: "do not write list/graph output through process stdout: route format output through the command writer; mark an intentional non-format path locally"
|
||||
- pattern: '^os\.Stdout$'
|
||||
pkg: '^os$'
|
||||
# Keep the prefix in sync with the list/graph text exclusion below.
|
||||
msg: "do not write list/graph output through process stdout: route format output through the command writer; mark an intentional non-format path locally"
|
||||
errcheck:
|
||||
exclude-functions:
|
||||
- (*database/sql.DB).Close
|
||||
|
|
@ -330,207 +29,11 @@ linters:
|
|||
- (os).Chdir
|
||||
- (os).MkdirAll
|
||||
- (fmt).Sscanf
|
||||
- (fmt).Fprint
|
||||
- (fmt).Fprintf
|
||||
- (fmt).Fprintln
|
||||
- fmt.Fprint
|
||||
- fmt.Fprintf
|
||||
- fmt.Fprintln
|
||||
misspell:
|
||||
locale: US
|
||||
|
||||
exclusions:
|
||||
rules:
|
||||
# forbidigo holds four rules: filter construction, label-plane access,
|
||||
# and the two process-stdout forms used by list/graph output. The entries
|
||||
# from here to the test exemption define their scopes. This first one
|
||||
# keeps every rule off the rest of the tree; the settings block says why.
|
||||
#
|
||||
# The previous version of this comment said there was exactly one rule and
|
||||
# that a second "would need this widened or replaced". That came true, and
|
||||
# what it cost is the entry below plus a `text:` on THREE of the per-path
|
||||
# holes. Every hole from here down is written for the FILTER rule and
|
||||
# predates the label one, so a hole that names only a path silently opens
|
||||
# both. That is fine wherever the file never reaches a label use case, and
|
||||
# it is not fine for the files that do - see the three `text:`-scoped
|
||||
# entries below.
|
||||
- path-except: '^(internal/httpapi/|cmd/bd/)'
|
||||
linters:
|
||||
- forbidigo
|
||||
# Process stdout is forbidden only across the list/graph file families.
|
||||
# Existing non-format paths in those families carry local, reviewed
|
||||
# exceptions; a new file or output site is denied by default. Scoping by
|
||||
# the diagnostic text keeps the filter and label rules unchanged.
|
||||
- path-except: '^cmd/bd/(list|graph).*\.go$'
|
||||
# This prefix must match both fmt.Print and os.Stdout messages above.
|
||||
text: 'do not write list/graph output through process stdout'
|
||||
linters:
|
||||
- forbidigo
|
||||
#
|
||||
# THE LABEL-PLANE RULE IS NOW PACKAGE-WIDE ACROSS cmd/bd (ga-2ltro.12).
|
||||
# It used to be narrowed by a `path-except` to cmd/bd/label.go, the one
|
||||
# file ga-26w10 had migrated, on the argument that holding an unmigrated
|
||||
# command to a rule written for a migration it had not had would be a lint
|
||||
# waived on sight. What that reasoning missed is that the waiver was
|
||||
# INVISIBLE: a file outside the exemption got no marker, no reason and no
|
||||
# diff, so the three commands still hand-rolling the four-way
|
||||
# (add|remove) x (wisp|durable) switch the rule exists to delete looked
|
||||
# exactly like the ones that had nothing to declare. There is no
|
||||
# `path-except` here any more. Every remaining caller carries its own
|
||||
# //nolint:forbidigo with the reason that site is not a role's question,
|
||||
# and a reviewer can count them.
|
||||
#
|
||||
# Inside cmd/bd the rule is deny-by-default, so each entry below is a
|
||||
# HOLE in it and carries the reason that hole exists. 59 of the 389
|
||||
# non-test files under cmd/bd are on this list; widening it is an edit
|
||||
# here and a diff a reviewer sees. internal/httpapi has no entry and is
|
||||
# meant not to.
|
||||
#
|
||||
# The modes of `bd list` and `bd show` that consume the filter as a
|
||||
# VALUE: the recursive --parent tree walk (it re-parents a copy at every
|
||||
# level), the --watch poll loop, the proxied route's builder call (it has
|
||||
# to name the type to hand the filter back), and --current (which
|
||||
# resolves an id from a deliberately BARE filter that must not pick up
|
||||
# the default listing's exclusions).
|
||||
#
|
||||
# `bd list`'s PAGE left this hole when issueops.Reader took it on both
|
||||
# routes: cmd/bd/list.go and cmd/bd/list_proxied_server.go were never on
|
||||
# this list and still are not, and the modes above are all that keeps this
|
||||
# file on it. The entry therefore stays and the count is unchanged — a
|
||||
# role commit that could not remove one says so rather than implying it.
|
||||
- path: '^cmd/bd/list_show_filter_modes\.go$'
|
||||
text: 'do not write a filter here'
|
||||
linters:
|
||||
- forbidigo
|
||||
# `bd ready` hands its filter to the plain listing and to --claim, and
|
||||
# readyInput carries it as a field for them. Routing only the listing
|
||||
# through the role would fork the command in two, so the filter stays
|
||||
# nameable here. The other modes take no filter from readyInput: --gated
|
||||
# and --mol answer a different question and short-circuit before the
|
||||
# flags are gathered, and so does --explain, which is a whole-graph
|
||||
# diagnostic and therefore builds its own fixed request through the same
|
||||
# builder (readyExplainFilter, which names the type it returns) rather
|
||||
# than inlining a third copy of the default - bd-3fs.3. The blocked-issue
|
||||
# views in these files name the type directly for an empty filter or one
|
||||
# carrying only a --parent id, which is the absence of a filter rather
|
||||
# than one this command built. `bd ready`'s LISTING is on the shared
|
||||
# BUILDER and, on the proxied route, the shared EPILOGUE; it is not on a
|
||||
# role, and this rule does not pretend otherwise. Its other two questions
|
||||
# are: --claim goes to ReadyClaimer and the published total to
|
||||
# ReadyCounter, both over the request rather than the filter, on both
|
||||
# routes - which is why this hole keeps shrinking rather than growing.
|
||||
- path: '^cmd/bd/ready(_input|_proxied_server)?\.go$'
|
||||
text: 'do not write a filter here'
|
||||
linters:
|
||||
- forbidigo
|
||||
# Everything below this point is a command that is NOT one of the three
|
||||
# shared reads. Each asks storage its own question and builds the filter
|
||||
# that question needs; none is on the reader role or claims to be. They
|
||||
# are grouped by family only so the reasons stay readable - every file is
|
||||
# still named, and a new file in a family is still an edit here.
|
||||
#
|
||||
# Commands with a direct route and a proxied twin that build the same
|
||||
# filter on both.
|
||||
#
|
||||
# `status` LEFT this list when the StatsReporter role took the assignee
|
||||
# filter, the ready-work filter and the status fold off both its routes:
|
||||
# cmd/bd/status.go and cmd/bd/status_proxied_server.go now build an
|
||||
# issueops request and name no filter type, so the hole they needed is
|
||||
# closed rather than merely unused. Removing an entry here is how a role
|
||||
# commit proves its front doors reached the role.
|
||||
#
|
||||
# `purge` left it the same way when the Sweeper role took the candidate
|
||||
# filter off both `bd purge` and `bd prune`: cmd/bd/purge.go now builds an
|
||||
# issueops.SweepRequest, and cmd/bd/purge_proxied_server.go is down to the
|
||||
# provider's capability accessor. `gc` stays — it is a different command
|
||||
# that still selects its own closed beads, and it now shares only the pure
|
||||
# recheck (workapi.FilterSweepCandidates) with the role.
|
||||
# `text:` ON EVERY HOLE IN THIS FAMILY, this one included, and the
|
||||
# completeness is the point rather than the tidiness. A hole naming only a
|
||||
# path opens EVERY forbidigo rule for its files, so an unscoped one is a
|
||||
# standing invitation: move the call into a file the hole already covers
|
||||
# and the label guard never sees it. That is not hypothetical - it is how
|
||||
# the guard spent its first slice unable to see mol_port.go's copy of the
|
||||
# switch it was written for.
|
||||
#
|
||||
# The first version of this pass scoped only the three holes that covered
|
||||
# a file with a LabelUseCase call TODAY, and reasoned that the others
|
||||
# "name no file that reaches a label use case, so widening them now would
|
||||
# be churn asserting nothing". That reasoning is wrong in the one way that
|
||||
# matters for a guard: a rule is not sized by where the violations are, it
|
||||
# is sized by where the next one may be WRITTEN. A review probe put a
|
||||
# neutrally-named helper into the ado/gitlab/jira/linear hole and it
|
||||
# passed. Every hole below is scoped now, and adding a file family to this
|
||||
# list no longer silently costs the label boundary.
|
||||
#
|
||||
# The `_test\.go` exemption further down stays unscoped on purpose: `run:
|
||||
# tests: false` means forbidigo never analyzes a test file at all, so that
|
||||
# entry asserts nothing either way and scoping it would be the churn this
|
||||
# comment just refused to write.
|
||||
#
|
||||
# `search` LEFT this list when all three of its routes moved onto
|
||||
# issueops.Reader.List with issueops.SearchListRequest (cmd/bd/search.go);
|
||||
# it builds no filter any more.
|
||||
#
|
||||
# `gate` LEFT it when `bd gate check` joined `bd gate list` on
|
||||
# issueops.ListGates over the route's Querier: cmd/bd/gate.go and
|
||||
# cmd/bd/gate_proxied_server.go name no filter type any more.
|
||||
# `gate_discover` keeps its own hole below, since findPendingGates still
|
||||
# asks SearchIssues for its gates.
|
||||
- path: '^cmd/bd/(close|duplicates|find_duplicates|gc|graph|info|label|orphans|purge|todo|wisp|human)(_proxied_server)?\.go$'
|
||||
text: 'do not write a filter here'
|
||||
linters:
|
||||
- forbidigo
|
||||
# Molecule reporting: each selects the members of one molecule.
|
||||
#
|
||||
# `mol current` and `mol progress` LEFT this list when their in_progress
|
||||
# and hooked listings moved onto issueops.Reader.List (cmd/bd/mol_roles.go)
|
||||
# so a remote backend answers them. The proxied route's in-transaction
|
||||
# port still searches through the unit of work, and that filter lives in
|
||||
# mol_port.go beside the port.
|
||||
- path: '^cmd/bd/mol_(port|ready_gated|stale)\.go$'
|
||||
text: 'do not write a filter here'
|
||||
linters:
|
||||
- forbidigo
|
||||
# External-tracker sync: each selects the beads to push to its tracker.
|
||||
- path: '^cmd/bd/(ado|gitlab|jira|linear)\.go$'
|
||||
text: 'do not write a filter here'
|
||||
linters:
|
||||
- forbidigo
|
||||
# Bulk movement of issues in, out and across prefixes. export_source is
|
||||
# export's storage seam (classic store vs proxied unit of work): it does
|
||||
# not build a filter, it carries the one export.go builds through to
|
||||
# whichever stack is live.
|
||||
- path: '^cmd/bd/(export|export_auto|export_source|import|migrate|migrate_issues|migrate_personal|rename|rename_prefix)\.go$'
|
||||
text: 'do not write a filter here'
|
||||
linters:
|
||||
- forbidigo
|
||||
# doctor's diagnostics and the fixes that follow them.
|
||||
- path: '^cmd/bd/doctor_(conventions|pollution)\.go$|^cmd/bd/doctor/(maintenance|fix/maintenance|fix/migrate)\.go$'
|
||||
text: 'do not write a filter here'
|
||||
linters:
|
||||
- forbidigo
|
||||
# One command each, no family to join.
|
||||
#
|
||||
# `count` LEFT this list when the Counter role took the filter off both
|
||||
# its routes: cmd/bd/count.go now builds an issueops.CountRequest and
|
||||
# names no filter type, so the hole it needed is closed rather than
|
||||
# merely unused. Removing an entry here is how a role commit proves its
|
||||
# front door reached the role.
|
||||
|
||||
- path: '^cmd/bd/(cleanup|completions|gate_discover|lint|ping|repo|swarm|template)\.go$'
|
||||
text: 'do not write a filter here'
|
||||
linters:
|
||||
- forbidigo
|
||||
# Tests are exempt for the same reason the depguard twin exempts them:
|
||||
# recordingIssues in reads_test.go holds []types.WorkFilter and
|
||||
# []types.IssueFilter to CAPTURE what the reader asked storage for, which
|
||||
# is how the guard is checked, not a construction. `run.tests: false`
|
||||
# already means this never fires - this is here so flipping that switch
|
||||
# does not turn the guard into a landmine on its own oracle.
|
||||
- path: '_test\.go'
|
||||
linters:
|
||||
- forbidigo
|
||||
# G304: File inclusion via variable in tests is safe (test data)
|
||||
- path: '_test\.go'
|
||||
linters:
|
||||
|
|
@ -542,7 +45,7 @@ linters:
|
|||
- gosec
|
||||
text: "G306"
|
||||
# G304: Safe file reads from known JSONL and error paths
|
||||
- path: 'cmd/bd/doctor/fix/sync_branch\.go|cmd/bd/doctor/git\.go|cmd/bd/doctor/sync_branch_jsonl\.go|cmd/bd/dolt\.go|cmd/bd/rename_prefix\.go|internal/beads/beads\.go|internal/syncbranch/worktree\.go'
|
||||
- path: 'cmd/bd/autoflush\.go|cmd/bd/daemon_autostart\.go|cmd/bd/doctor/fix/sync_branch\.go|cmd/bd/doctor/git\.go|cmd/bd/rename_prefix\.go|cmd/bd/sync_merge\.go|internal/beads/beads\.go|internal/daemon/discovery\.go|internal/daemonrunner/sync\.go|internal/syncbranch/worktree\.go'
|
||||
linters:
|
||||
- gosec
|
||||
text: "G304"
|
||||
|
|
@ -551,7 +54,7 @@ linters:
|
|||
- gosec
|
||||
text: "G302.*0700|G301.*0750"
|
||||
# G302/G306: JSONL files and error logs need 0644 for debugging/sharing
|
||||
- path: 'cmd/bd/setup\.go|internal/git/worktree\.go'
|
||||
- path: 'cmd/bd/autoflush\.go|cmd/bd/daemon\.go|cmd/bd/daemon_sync_branch\.go|cmd/bd/resolve_conflicts\.go|cmd/bd/setup\.go|internal/daemon/registry\.go|internal/daemonrunner/daemon\.go|internal/git/worktree\.go'
|
||||
linters:
|
||||
- gosec
|
||||
text: "G306"
|
||||
|
|
@ -560,62 +63,26 @@ linters:
|
|||
linters:
|
||||
- gosec
|
||||
text: "G306.*0700"
|
||||
# G204: Subprocess launched with variable — all subprocess args are from
|
||||
# trusted internal sources (git commands, config values, validated IDs)
|
||||
- linters:
|
||||
# G204: Safe subprocess launches with validated arguments
|
||||
- path: 'cmd/bd/daemon_autostart\.go|cmd/bd/daemon_sync_branch\.go|cmd/bd/doctor\.go|cmd/bd/doctor/fix/sync_branch\.go|cmd/bd/gate\.go|cmd/bd/gate_discover\.go|cmd/bd/jira\.go|cmd/bd/migrate_sync\.go|cmd/bd/show\.go|cmd/bd/sync\.go|internal/git/worktree\.go|internal/syncbranch/worktree\.go'
|
||||
linters:
|
||||
- gosec
|
||||
text: 'G204'
|
||||
# G104: Deferred file/db closes - errors are non-critical
|
||||
- path: 'cmd/bd/show\.go|cmd/bd/doctor/dolt\.go'
|
||||
# G104: Deferred file closes - errors are non-critical
|
||||
- path: 'cmd/bd/show\.go'
|
||||
linters:
|
||||
- gosec
|
||||
text: "G104"
|
||||
# G115: Integer overflow conversion uintptr->int in terminal fd wrappers (safe on 64-bit)
|
||||
- linters:
|
||||
text: "G104.*Close"
|
||||
# G115: Safe integer conversions in backoff calculations
|
||||
- path: 'cmd/bd/daemon_autostart\.go'
|
||||
linters:
|
||||
- gosec
|
||||
text: "G115"
|
||||
# G117: Exported struct fields matching secret patterns are intentional API fields
|
||||
- path: 'internal/compact/compactor\.go|internal/jira/client\.go|internal/linear/types\.go|internal/linear/oauth\.go|internal/storage/versioned\.go'
|
||||
# G201: SQL with fmt.Sprintf using placeholders (IN clause expansion)
|
||||
- path: 'internal/storage/sqlite/(dependencies|batch_ops)\.go'
|
||||
linters:
|
||||
- gosec
|
||||
text: "G117"
|
||||
# G304: Safe file reads from config paths
|
||||
- path: 'internal/config/config\.go'
|
||||
linters:
|
||||
- gosec
|
||||
text: "G304"
|
||||
# G306: Config file permissions 0644 are acceptable
|
||||
- path: 'internal/config/config\.go'
|
||||
linters:
|
||||
- gosec
|
||||
text: "G306"
|
||||
# G703: Path traversal via taint — paths are from config or internal construction
|
||||
- linters:
|
||||
- gosec
|
||||
text: "G703"
|
||||
# G704: SSRF via taint in API clients with user-configured URLs
|
||||
- path: 'cmd/bd/doctor/(claude|version)\.go|internal/github/client\.go|internal/gitlab/client\.go|internal/jira/client\.go|internal/linear/client\.go|internal/linear/oauth\.go'
|
||||
linters:
|
||||
- gosec
|
||||
text: "G704"
|
||||
# G705: XSS via taint in CLI template rendering (no browser context)
|
||||
- path: 'cmd/bd/compact\.go|internal/linear/client\.go'
|
||||
linters:
|
||||
- gosec
|
||||
text: "G705"
|
||||
# G705: XSS via taint in CLI progress/warning/error output — every flagged
|
||||
# sink is fmt.Fprint* to the terminal (os.Stderr or cobra's stdout/stderr
|
||||
# writers), never a browser context (surfaced by the gosec bundled with
|
||||
# golangci-lint v2.10)
|
||||
- path: 'cmd/bd/(ado|doctor|errors|github|gitlab|hooks|jira|linear|main|notion|sync_push_pull)\.go'
|
||||
linters:
|
||||
- gosec
|
||||
text: "G705"
|
||||
# errcheck: fmt.Fprintf errors are noise in CLI help text generation
|
||||
- path: 'cmd/bd/help_all\.go'
|
||||
linters:
|
||||
- errcheck
|
||||
text: "fmt.Fprintf"
|
||||
text: "G201"
|
||||
# errcheck: Ignore unchecked errors in test files for common cleanup patterns
|
||||
- path: '_test\.go'
|
||||
linters:
|
||||
|
|
@ -627,26 +94,6 @@ linters:
|
|||
linters:
|
||||
- unparam
|
||||
text: 'reimportConflicts|resolveConflictsByTimestamp'
|
||||
# unparam: childrenMap return computed for future parent-child display
|
||||
- path: 'cmd/bd/list\.go'
|
||||
linters:
|
||||
- unparam
|
||||
text: 'buildBlockingMaps.*childrenMap'
|
||||
# unparam: truncateID maxLen kept for readability
|
||||
- path: 'cmd/bd/migrate\.go'
|
||||
linters:
|
||||
- unparam
|
||||
text: 'truncateID.*maxLen'
|
||||
# unparam: getConfig error return kept for API consistency with store.GetConfig
|
||||
- path: 'internal/(linear|gitlab|jira)/tracker\.go'
|
||||
linters:
|
||||
- unparam
|
||||
text: 'getConfig'
|
||||
# unparam: ctx kept for context propagation; callers currently all pass rootCtx
|
||||
- path: 'cmd/bd/linear\.go'
|
||||
linters:
|
||||
- unparam
|
||||
text: 'getLinearConfig'
|
||||
# misspell: "cancelled" is intentional - matching GitHub API response values
|
||||
- path: 'cmd/bd/gate\.go'
|
||||
linters:
|
||||
|
|
|
|||
118
.goreleaser.yml
118
.goreleaser.yml
|
|
@ -7,20 +7,13 @@ before:
|
|||
hooks:
|
||||
# Ensure dependencies are up to date
|
||||
- go mod tidy
|
||||
# Generate Windows PE version info resources (.syso files)
|
||||
# Reduces antivirus false positives by embedding legitimate metadata
|
||||
- ./scripts/gen-winres.sh
|
||||
|
||||
builds:
|
||||
- id: bd-linux-amd64
|
||||
main: ./cmd/bd
|
||||
binary: bd
|
||||
env:
|
||||
- CGO_ENABLED=1
|
||||
- CC=gcc
|
||||
- CXX=g++
|
||||
tags:
|
||||
- gms_pure_go
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
|
|
@ -31,18 +24,12 @@ builds:
|
|||
- -X main.Build={{.ShortCommit}}
|
||||
- -X main.Commit={{.Commit}}
|
||||
- -X main.Branch={{.Branch}}
|
||||
hooks:
|
||||
post:
|
||||
- ./scripts/verify-cgo.sh "{{ .Path }}"
|
||||
|
||||
- id: bd-linux-arm64
|
||||
main: ./cmd/bd
|
||||
binary: bd
|
||||
env:
|
||||
- CGO_ENABLED=1
|
||||
- CC=aarch64-linux-gnu-gcc
|
||||
tags:
|
||||
- gms_pure_go
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
|
|
@ -53,17 +40,12 @@ builds:
|
|||
- -X main.Build={{.ShortCommit}}
|
||||
- -X main.Commit={{.Commit}}
|
||||
- -X main.Branch={{.Branch}}
|
||||
hooks:
|
||||
post:
|
||||
- ./scripts/verify-cgo.sh "{{ .Path }}"
|
||||
|
||||
- id: bd-android-arm64
|
||||
main: ./cmd/bd
|
||||
binary: bd
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
tags:
|
||||
- gms_pure_go
|
||||
goos:
|
||||
- android
|
||||
goarch:
|
||||
|
|
@ -75,8 +57,37 @@ builds:
|
|||
- -X main.Commit={{.Commit}}
|
||||
- -X main.Branch={{.Branch}}
|
||||
|
||||
# darwin-amd64 and darwin-arm64 are built by a dedicated macOS CI job
|
||||
# (release.yml: goreleaser-macos) with CGO_ENABLED=1 for embedded Dolt support.
|
||||
- id: bd-darwin-amd64
|
||||
main: ./cmd/bd
|
||||
binary: bd
|
||||
env:
|
||||
- CGO_ENABLED=1
|
||||
goos:
|
||||
- darwin
|
||||
goarch:
|
||||
- amd64
|
||||
ldflags:
|
||||
- -s -w
|
||||
- -X main.Version={{.Version}}
|
||||
- -X main.Build={{.ShortCommit}}
|
||||
- -X main.Commit={{.Commit}}
|
||||
- -X main.Branch={{.Branch}}
|
||||
|
||||
- id: bd-darwin-arm64
|
||||
main: ./cmd/bd
|
||||
binary: bd
|
||||
env:
|
||||
- CGO_ENABLED=1
|
||||
goos:
|
||||
- darwin
|
||||
goarch:
|
||||
- arm64
|
||||
ldflags:
|
||||
- -s -w
|
||||
- -X main.Version={{.Version}}
|
||||
- -X main.Build={{.ShortCommit}}
|
||||
- -X main.Commit={{.Commit}}
|
||||
- -X main.Branch={{.Branch}}
|
||||
|
||||
- id: bd-windows-amd64
|
||||
main: ./cmd/bd
|
||||
|
|
@ -85,8 +96,6 @@ builds:
|
|||
- CGO_ENABLED=1
|
||||
- CC=x86_64-w64-mingw32-gcc
|
||||
- CXX=x86_64-w64-mingw32-g++
|
||||
tags:
|
||||
- gms_pure_go
|
||||
goos:
|
||||
- windows
|
||||
goarch:
|
||||
|
|
@ -100,7 +109,6 @@ builds:
|
|||
- -buildmode=exe
|
||||
hooks:
|
||||
post:
|
||||
- ./scripts/verify-cgo.sh "{{ .Path }}"
|
||||
# Sign Windows executable with Authenticode certificate
|
||||
# Requires WINDOWS_SIGNING_CERT_PFX_BASE64 and WINDOWS_SIGNING_CERT_PASSWORD secrets
|
||||
- ./scripts/sign-windows.sh "{{ .Path }}"
|
||||
|
|
@ -110,8 +118,6 @@ builds:
|
|||
binary: bd
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
tags:
|
||||
- gms_pure_go
|
||||
goos:
|
||||
- windows
|
||||
goarch:
|
||||
|
|
@ -134,8 +140,6 @@ builds:
|
|||
binary: bd
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
tags:
|
||||
- gms_pure_go
|
||||
goos:
|
||||
- freebsd
|
||||
goarch:
|
||||
|
|
@ -187,7 +191,7 @@ changelog:
|
|||
|
||||
release:
|
||||
github:
|
||||
owner: gastownhall
|
||||
owner: steveyegge
|
||||
name: beads
|
||||
draft: false
|
||||
prerelease: auto
|
||||
|
|
@ -196,48 +200,42 @@ release:
|
|||
## beads v{{.Version}}
|
||||
|
||||
Pre-compiled binaries for Linux, macOS (Intel & Apple Silicon), Windows (AMD64 & ARM64), Android/Termux (ARM64), and FreeBSD.
|
||||
{{ if .Prerelease }}
|
||||
### Installation (release candidate)
|
||||
|
||||
> **This is a prerelease for validation.** The stable install channels —
|
||||
> Homebrew, the `install.sh` / `install.ps1` scripts, npm, and PyPI —
|
||||
> intentionally keep serving the latest **stable** release, so they will **not**
|
||||
> install this RC. Use one of the methods below.
|
||||
|
||||
**Manual download (recommended):**
|
||||
Download the archive for your platform from the **Assets** below, extract it,
|
||||
and place `bd` on your PATH.
|
||||
|
||||
**Go install (pinned to this RC):**
|
||||
```bash
|
||||
go install github.com/steveyegge/beads/cmd/bd@v{{ .Version }}
|
||||
# For embedded Dolt support:
|
||||
CGO_ENABLED=1 GOFLAGS=-tags=gms_pure_go go install github.com/steveyegge/beads/cmd/bd@v{{ .Version }}
|
||||
```
|
||||
|
||||
When you are done validating, return to the stable release through your normal
|
||||
channel (e.g. `brew upgrade beads`).
|
||||
{{ else }}
|
||||
|
||||
### Installation
|
||||
|
||||
|
||||
**Homebrew (macOS/Linux):**
|
||||
```bash
|
||||
brew install beads
|
||||
brew install steveyegge/beads/bd
|
||||
```
|
||||
|
||||
|
||||
**Quick Install (macOS/Linux/FreeBSD):**
|
||||
```bash
|
||||
curl -sSL https://raw.githubusercontent.com/gastownhall/beads/main/scripts/install.sh | bash
|
||||
curl -sSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash
|
||||
```
|
||||
|
||||
|
||||
**Windows (PowerShell):**
|
||||
```powershell
|
||||
irm https://raw.githubusercontent.com/gastownhall/beads/main/install.ps1 | iex
|
||||
irm https://raw.githubusercontent.com/steveyegge/beads/main/install.ps1 | iex
|
||||
```
|
||||
|
||||
|
||||
**Manual Install:**
|
||||
Download the appropriate binary for your platform below, extract it, and place it in your PATH.
|
||||
{{ end }}
|
||||
|
||||
# Homebrew tap - disabled, handled by separate workflow
|
||||
# brews:
|
||||
# - name: bd
|
||||
# repository:
|
||||
# owner: steveyegge
|
||||
# name: homebrew-beads
|
||||
# branch: main
|
||||
# directory: Formula
|
||||
# homepage: https://github.com/steveyegge/beads
|
||||
# description: "AI-supervised issue tracker for coding workflows"
|
||||
# license: MIT
|
||||
# test: |
|
||||
# system "#{bin}/bd", "version"
|
||||
# install: |
|
||||
# bin.install "bd"
|
||||
|
||||
# Announce the release
|
||||
announce:
|
||||
|
|
|
|||
|
|
@ -1,15 +1,9 @@
|
|||
repos:
|
||||
# Lint and vet: nogo (//tools/nogo) over the changed files' Bazel packages,
|
||||
# the analyzers CI gates on (go test's vet checks plus the golangci-lint
|
||||
# linters .golangci.yml enables). Needs bazel or bazelisk on PATH.
|
||||
- repo: local
|
||||
- repo: https://github.com/golangci/golangci-lint
|
||||
rev: v2.1.6
|
||||
hooks:
|
||||
- id: nogo
|
||||
name: nogo (bazel)
|
||||
entry: make lint-changed LINT_CHANGED_SCOPE=staged
|
||||
language: system
|
||||
types: [go]
|
||||
pass_filenames: false
|
||||
- id: golangci-lint
|
||||
args: [--timeout=5m]
|
||||
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v6.0.0
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
# Tests to skip due to known issues
|
||||
# Format: one test name per line (regex patterns supported)
|
||||
|
||||
# (no tests currently skipped)
|
||||
|
|
|
|||
251
AGENTS.md
251
AGENTS.md
|
|
@ -1,227 +1,60 @@
|
|||
# Beads — Contributor Agent Instructions
|
||||
# Agent Instructions
|
||||
|
||||
This file is for agents and humans **developing beads** (`bd`). If you are
|
||||
using `bd` to track work in your own project, read the user docs instead:
|
||||
[docs site](https://beads.gascity.com/) and
|
||||
[IDE and agent setup](docs/getting-started/ide-setup.md).
|
||||
See [AGENT_INSTRUCTIONS.md](AGENT_INSTRUCTIONS.md) for full instructions.
|
||||
|
||||
<!-- Contributor-only file. Do not run `bd setup` or `bd init` against this
|
||||
checkout: they would inject the end-user beads integration block here. -->
|
||||
This file exists for compatibility with tools that look for AGENTS.md.
|
||||
|
||||
Nested `AGENTS.md` files hold area-specific rules; the routing table at the
|
||||
end lists them. `CLAUDE.md` files are symlinks to their sibling `AGENTS.md`.
|
||||
## Key Sections
|
||||
|
||||
## How work flows here
|
||||
- **Issue Tracking** - How to use bd for work management
|
||||
- **Development Guidelines** - Code standards and testing
|
||||
- **Visual Design System** - Status icons, colors, and semantic styling for CLI output
|
||||
|
||||
GitHub Issues is the public tracker. Use an issue when it adds context
|
||||
reviewers need: a user-visible bug, a behavior or design change worth
|
||||
discussing, or work that spans several PRs. The issue carries the
|
||||
reproduction, impact, and evidence for a bug, or the motivation, impact, risk,
|
||||
and verification plan for a change. Small, self-explanatory changes (typos,
|
||||
flaky tests, refactors, CI or docs tweaks) can go straight to a PR whose body
|
||||
explains the why.
|
||||
## Visual Design Anti-Patterns
|
||||
|
||||
1. If the change warrants an issue, find or file one with the bug or feature
|
||||
form. It does not need maintainer approval first; file it before or
|
||||
alongside the PR.
|
||||
2. Work on a branch, open a PR against `main` (its body says
|
||||
`Closes #<issue>` when there is one), and let CI and review run.
|
||||
3. Maintainers triage issues with `status/needs-triage`, `status/needs-info`,
|
||||
`status/needs-repro`, `status/needs-design`, and `status/accepted`
|
||||
(confirmed); see [CONTRIBUTING.md](CONTRIBUTING.md).
|
||||
**NEVER use emoji-style icons** (🔴🟠🟡🔵⚪) in CLI output. They cause cognitive overload.
|
||||
|
||||
Maintainers also keep an internal bd ledger. It is optional for contributors
|
||||
and not a substitute for the GitHub issue.
|
||||
**ALWAYS use small Unicode symbols** with semantic colors:
|
||||
- Status: `○ ◐ ● ✓ ❄`
|
||||
- Priority: `● P0` (filled circle with color)
|
||||
|
||||
## Agent contribution policy
|
||||
See [AGENT_INSTRUCTIONS.md](AGENT_INSTRUCTIONS.md) for full development guidelines.
|
||||
|
||||
- File an issue when the change warrants one (see above). When you do, use
|
||||
the bug or feature form fields, fill each from evidence, and answer
|
||||
`NOT_ENOUGH_INFO` where the evidence runs out.
|
||||
- A human reviews and stands behind every issue and PR an agent drafts.
|
||||
Evidence that the change works end-to-end is required; "unit tests pass"
|
||||
alone is not evidence.
|
||||
- Before implementing work, opening a PR, or merging/closing a PR, run the PR
|
||||
preflight:
|
||||
```bash
|
||||
scripts/pr-preflight.sh --search "<topic keywords>" --repo gastownhall/beads
|
||||
scripts/pr-preflight.sh <pr-number> --repo gastownhall/beads
|
||||
```
|
||||
The preflight is the agent gate for PR handling; do not rely on
|
||||
auto-discovery of CONTRIBUTING.md.
|
||||
- Use `gh` for GitHub issues and PRs, not browser tools. Write PR, issue,
|
||||
comment, and review bodies to a file, run `scripts/gh-body-lint <body-file>`,
|
||||
and pass the file with `gh ... --body-file`. Sign agent-written GitHub
|
||||
comments and reviews per [engdocs/AGENT_SIGNING.md](engdocs/AGENT_SIGNING.md).
|
||||
## Agent Warning: Interactive Commands
|
||||
|
||||
## Contributor protection
|
||||
|
||||
External contributor PRs have priority. Read [CONTRIBUTING.md](CONTRIBUTING.md)
|
||||
— it contains promises we've made to contributors — and, before triaging,
|
||||
reviewing, landing, closing, or otherwise maintaining PRs,
|
||||
[PR_MAINTAINER_GUIDELINES.md](PR_MAINTAINER_GUIDELINES.md). The maintainer
|
||||
policy is to maximize community throughput: find useful contributor value,
|
||||
absorb or transform it locally when practical, preserve attribution, and use
|
||||
request-changes only as a last resort.
|
||||
|
||||
Before implementing any feature or fix, check for existing open PRs on the
|
||||
same topic. If one exists:
|
||||
|
||||
1. **Review it first** — read the diff, understand the approach.
|
||||
2. **Build on their work, don't rewrite it** — check out their branch,
|
||||
fix/adapt as needed.
|
||||
3. **Preserve their tests** — keep them unless they're wrong.
|
||||
4. **Attribute properly** — `Co-authored-by:` in commits, reference their PR.
|
||||
5. **Never close or supersede their PR silently.** If a rewrite is
|
||||
unavoidable, explain why on the original PR and credit their design/tests.
|
||||
|
||||
## Scope: where a change belongs
|
||||
|
||||
Read [engdocs/PROJECT_CHARTER.md](engdocs/PROJECT_CHARTER.md) before adding
|
||||
feature surface area. Beads owns issue tracking primitives and should not
|
||||
encode orchestration-layer policy, become a storage engine, or casually expand
|
||||
the database schema when metadata would work. Prefer, in order: issue
|
||||
metadata over new fields, a flag on an existing command over a new command,
|
||||
an integration or plugin over core, and leave orchestration policy to the
|
||||
orchestration layer.
|
||||
|
||||
**Storage boundary.** Beads talks to storage through a driver interface
|
||||
(`dolthub/driver` for Dolt). Do not add beads-side flocks, engine
|
||||
introspection, storage-specific retry or crash-recovery logic, or public SDK
|
||||
return types that leak driver internals. If the boundary is too narrow, widen
|
||||
the interface or route the issue to the driver instead of patching around it
|
||||
in beads. `bd doctor` support for embedded mode is enabled one subcommand at a
|
||||
time, each human-vetted (GH#3794): do not lift the embedded-mode gate in
|
||||
`cmd/bd/doctor.go` wholesale, and keep database-layer checks and fixes
|
||||
server-gated until the driver interface covers them.
|
||||
|
||||
**Layering.** Schema → `internal/storage/issueops` → `cmd/bd`. Add new
|
||||
primitives at the lowest layer first, one layer per PR, stacked when a fix
|
||||
spans layers. See
|
||||
[CONTRIBUTING_PR_GUIDELINES.md](CONTRIBUTING_PR_GUIDELINES.md).
|
||||
|
||||
## Build, test, lint
|
||||
|
||||
Bazel is the build and test system: CI gates on the `bazel test` lanes in
|
||||
`.github/workflows/bazel.yml`, and nogo (lint + vet), gofmt and the repository
|
||||
guards exist only as Bazel targets. Install
|
||||
[Bazelisk](https://github.com/bazelbuild/bazelisk) as `bazel`; the pre-commit
|
||||
and pre-push hooks need it.
|
||||
**DO NOT use `bd edit`** - it opens an interactive editor ($EDITOR) which AI agents cannot use.
|
||||
|
||||
Use `bd update` with flags instead:
|
||||
```bash
|
||||
make test # bazel test //... --config=ci: the CI test lane (nogo, gofmt, guards, unit tests)
|
||||
make check # testing.Short policy + make ci-pr-lint + make test
|
||||
make ci-pr-lint # nogo lint + vet gate, native plus windows/darwin
|
||||
make check-docs # bazel docsync + doc freshness, then the CLI flag check
|
||||
make bazel-sync # after adding/removing/renaming Go files or changing imports/go.mod
|
||||
make install # build and install bd to ~/.local/bin (canonical)
|
||||
bd update <id> --description "new description"
|
||||
bd update <id> --title "new title"
|
||||
bd update <id> --design "design notes"
|
||||
bd update <id> --notes "additional notes"
|
||||
bd update <id> --acceptance "acceptance criteria"
|
||||
```
|
||||
|
||||
- Each other tier has its own lane (`--config=integration`, `doltserver`,
|
||||
`embedded`, ...); [engdocs/TESTING.md](engdocs/TESTING.md) lists the exact
|
||||
command per lane and is the canonical source for test selection, design,
|
||||
and PR-readiness gates.
|
||||
- Where actions run: contributors add `--config=fork-cache` (rbe-west's
|
||||
anonymous read-only cache; nothing is uploaded), maintainers with an rbe-west
|
||||
certificate `--config=remote-exec`, agent hosts whose `~/.bazelrc` names the
|
||||
executor neither. Make yours the default with a `build --config=...` line in
|
||||
the gitignored `.bazelrc.local`, or pass `BAZEL_FLAGS=...` to make.
|
||||
- Agents run tests only with `bazel test`, also while iterating on one
|
||||
behavior:
|
||||
## Landing the Plane (Session Completion)
|
||||
|
||||
```bash
|
||||
bazel test //cmd/bd:bd_test --config=ci --test_filter='^TestName$' --test_output=all
|
||||
```
|
||||
**When ending a work session**, you MUST complete ALL steps below. Work is NOT complete until `git push` succeeds.
|
||||
|
||||
A target also passes when the test never ran (a filter that matches
|
||||
nothing, a skip, a file the configuration does not compile), so count a run
|
||||
only when its log shows `--- PASS: TestName` and no `--- SKIP` for the test
|
||||
or a `TestName/...` subtest: Go prints `--- PASS` for a test whose every
|
||||
subtest skipped. "Check That the Test Ran" in
|
||||
[engdocs/TESTING.md](engdocs/TESTING.md) names the tests `--config=ci` does
|
||||
not run (Dolt-backed, `-short`-gated, integration-tagged, `TestEmbedded*`
|
||||
and embedded-Dolt, files `BUILD.bazel` does not list) and the way into
|
||||
each. An unchanged target returns its cached result, which is the same
|
||||
evidence. Finish with `make test`.
|
||||
- Agents do not run `go test` (`./scripts/test.sh`, `make test-go`): CI does
|
||||
not enforce it, it skips nogo, gofmt and the guards, and agent hosts may
|
||||
refuse it. It stays a convenience for humans working offline. The exception
|
||||
is regenerating golden files (`make corpus-regen`, `make githooks-regen`,
|
||||
`BD_UPDATE_GOLDEN=1`), which Bazel cannot do: see "Regenerating Golden
|
||||
Files" in [engdocs/TESTING.md](engdocs/TESTING.md).
|
||||
- **Do NOT** use `go build -o bd ./cmd/bd`, `go install ./cmd/bd`, or raw
|
||||
`go run ./cmd/bd ...`: they bypass the canonical build path, leave stale
|
||||
binaries, and raw `go run` misses the `gms_pure_go` tag. Use `make install`,
|
||||
`./bd`, or `go run -tags gms_pure_go ./cmd/bd ...`.
|
||||
- All new features need tests.
|
||||
- **Never pollute a production database with test issues.** Use `t.TempDir()`
|
||||
in Go tests and a disposable working directory for manual `bd` experiments.
|
||||
- `make ci-pr-lint` must pass with zero issues; see
|
||||
[engdocs/LINTING.md](engdocs/LINTING.md).
|
||||
- If BUILD files are out of sync and you cannot run `make bazel-sync`, CI
|
||||
syncs them: on same-repo PRs the bazel-autofix workflow pushes the fix to
|
||||
your branch (pull before pushing again); fork PRs get a comment with an
|
||||
apply recipe.
|
||||
- If you changed behavior, update the user docs (`docs/`, via the
|
||||
`beads-docs` skill) or README in the same PR.
|
||||
**MANDATORY WORKFLOW:**
|
||||
|
||||
## Commits and PRs
|
||||
1. **File issues for remaining work** - Create issues for anything that needs follow-up
|
||||
2. **Run quality gates** (if code changed) - Tests, linters, builds
|
||||
3. **Update issue status** - Close finished work, update in-progress items
|
||||
4. **PUSH TO REMOTE** - This is MANDATORY:
|
||||
```bash
|
||||
git pull --rebase
|
||||
bd sync
|
||||
git push
|
||||
git status # MUST show "up to date with origin"
|
||||
```
|
||||
5. **Clean up** - Clear stashes, prune remote branches
|
||||
6. **Verify** - All changes committed AND pushed
|
||||
7. **Hand off** - Provide context for next session
|
||||
|
||||
- Conventional Commits: `type(scope): summary` (`fix`, `feat`, `docs`,
|
||||
`test`, `refactor`, `chore`, `ci`, `perf`).
|
||||
- For agent-prepared commits, include the `Agent-Signature:` trailer described
|
||||
in [engdocs/AGENT_SIGNING.md](engdocs/AGENT_SIGNING.md). Use
|
||||
`unknown-model` or `unknown-reasoning` when reliable runtime metadata is
|
||||
unavailable.
|
||||
- Maintainers working from the internal ledger may also end the subject with
|
||||
the bead ID, e.g. `(bd-abc)`, so `bd doctor` can detect orphaned issues.
|
||||
- Work on a feature branch and open a PR against `main`; direct pushes to
|
||||
`main` are reserved for releases and narrow operational fixes.
|
||||
- When the user asks to bump the version, use `./scripts/bump-version.sh`; the
|
||||
full release process is in [RELEASING.md](RELEASING.md).
|
||||
|
||||
## Ending a session
|
||||
|
||||
Do not push to `main`. Before handing off:
|
||||
|
||||
1. Run the quality gates your change needs (`make test`, `make ci-pr-lint`,
|
||||
and the other Bazel lanes [engdocs/TESTING.md](engdocs/TESTING.md)
|
||||
selects). If gates are broken on `main`, report it as a P0 issue.
|
||||
2. Record follow-up work as GitHub issues (or ledger beads, for maintainers).
|
||||
3. Commit, push, or open a PR only when the person you are working for asked
|
||||
you to. Report changed files, validation run, and anything left open.
|
||||
|
||||
## CLI output
|
||||
|
||||
**NEVER use emoji-style icons** (🔴🟠🟡🔵⚪) in CLI output. **ALWAYS use small
|
||||
Unicode symbols** with semantic colors: status `○ ◐ ● ✓ ❄`; priority as a
|
||||
`P0`–`P4` label with color (no status glyph). The full visual design system
|
||||
and CLI design principles are in
|
||||
[engdocs/UI_PHILOSOPHY.md](engdocs/UI_PHILOSOPHY.md).
|
||||
|
||||
## Non-interactive shell commands
|
||||
|
||||
Agents cannot answer prompts. Use `cp -f`, `mv -f`, `rm -f`, `rm -rf`,
|
||||
`cp -rf` (these may be aliased to `-i`); `scp`/`ssh -o BatchMode=yes`;
|
||||
`apt-get -y`; `HOMEBREW_NO_AUTO_UPDATE=1 brew`. **DO NOT use `bd edit`** — it
|
||||
opens `$EDITOR`; use `bd update <id> --title/--description/--design/--acceptance/--append-notes`
|
||||
(pipe text with special characters via `--description=-`).
|
||||
|
||||
## Routing table
|
||||
|
||||
| When you are touching… | Read first |
|
||||
|---|---|
|
||||
| `cmd/bd/` (commands, output, proxied-server routes) | [cmd/bd/AGENTS.md](cmd/bd/AGENTS.md) |
|
||||
| `engdocs/` (contributor and internals docs) | [engdocs/AGENTS.md](engdocs/AGENTS.md) |
|
||||
| `docs/` (the published user docs) | `.claude/skills/beads-docs/SKILL.md` |
|
||||
| Any Go test | [engdocs/TESTING.md](engdocs/TESTING.md) |
|
||||
| Lint failures or `.golangci.yml` | [engdocs/LINTING.md](engdocs/LINTING.md) |
|
||||
| A new storage operation or issueops role | [engdocs/ADDING_AN_ISSUEOPS_ROLE.md](engdocs/ADDING_AN_ISSUEOPS_ROLE.md) |
|
||||
| Schema migrations | [internal/storage/schema/migrations/README.md](internal/storage/schema/migrations/README.md) |
|
||||
| Dolt concurrency, server vs embedded mode | [engdocs/design/dolt-concurrency.md](engdocs/design/dolt-concurrency.md) |
|
||||
| Errors returned to users | [engdocs/ERROR_HANDLING.md](engdocs/ERROR_HANDLING.md) |
|
||||
| The `bd serve` HTTP surface | [engdocs/SERVE_RUNBOOK.md](engdocs/SERVE_RUNBOOK.md) |
|
||||
| A new example under `examples/` | `examples/README.md` — give the example its own README and link it there |
|
||||
| Releases and version bumps | [RELEASING.md](RELEASING.md) |
|
||||
| Scope questions | [engdocs/PROJECT_CHARTER.md](engdocs/PROJECT_CHARTER.md) |
|
||||
| Planned work and priorities | [ROADMAP.md](ROADMAP.md) |
|
||||
**CRITICAL RULES:**
|
||||
- Work is NOT complete until `git push` succeeds
|
||||
- NEVER stop before pushing - that leaves work stranded locally
|
||||
- NEVER say "ready to push when you are" - YOU must push
|
||||
- If push fails, resolve and retry until it succeeds
|
||||
|
|
|
|||
|
|
@ -1,9 +1,434 @@
|
|||
# Agent Instructions
|
||||
# Detailed Agent Instructions for Beads Development
|
||||
|
||||
Contributor instructions for agents developing beads live in
|
||||
[AGENTS.md](AGENTS.md). Area-specific rules live in nested `AGENTS.md` files
|
||||
listed in its routing table.
|
||||
**For project overview and quick start, see [AGENTS.md](AGENTS.md)**
|
||||
|
||||
If you are using `bd` to track work in your own project, see the user docs:
|
||||
[IDE and agent setup](docs/getting-started/ide-setup.md) and
|
||||
[https://beads.gascity.com/](https://beads.gascity.com/).
|
||||
This document contains detailed operational instructions for AI agents working on beads development, testing, and releases.
|
||||
|
||||
## Development Guidelines
|
||||
|
||||
### Code Standards
|
||||
|
||||
- **Go version**: 1.24+
|
||||
- **Linting**: `golangci-lint run ./...` (baseline warnings documented in [docs/LINTING.md](docs/LINTING.md))
|
||||
- **Testing**: All new features need tests (`go test -short ./...` for local, full tests run in CI)
|
||||
- **Documentation**: Update relevant .md files
|
||||
|
||||
### File Organization
|
||||
|
||||
```
|
||||
beads/
|
||||
├── cmd/bd/ # CLI commands
|
||||
├── internal/
|
||||
│ ├── types/ # Core data types
|
||||
│ └── storage/ # Storage layer
|
||||
│ └── sqlite/ # SQLite implementation
|
||||
├── examples/ # Integration examples
|
||||
└── *.md # Documentation
|
||||
```
|
||||
|
||||
### Testing Workflow
|
||||
|
||||
**IMPORTANT:** Never pollute the production database with test issues!
|
||||
|
||||
**For manual testing**, use the `BEADS_DB` environment variable to point to a temporary database:
|
||||
|
||||
```bash
|
||||
# Create test issues in isolated database
|
||||
BEADS_DB=/tmp/test.db ./bd init --quiet --prefix test
|
||||
BEADS_DB=/tmp/test.db ./bd create "Test issue" -p 1
|
||||
|
||||
# Or for quick testing
|
||||
BEADS_DB=/tmp/test.db ./bd create "Test feature" -p 1
|
||||
```
|
||||
|
||||
**For automated tests**, use `t.TempDir()` in Go tests:
|
||||
|
||||
```go
|
||||
func TestMyFeature(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
testDB := filepath.Join(tmpDir, ".beads", "beads.db")
|
||||
s := newTestStore(t, testDB)
|
||||
// ... test code
|
||||
}
|
||||
```
|
||||
|
||||
**Warning:** bd will warn you when creating issues with "Test" prefix in the production database. Always use `BEADS_DB` for manual testing.
|
||||
|
||||
### Before Committing
|
||||
|
||||
1. **Run tests**: `go test -short ./...` (full tests run in CI)
|
||||
2. **Run linter**: `golangci-lint run ./...` (ignore baseline warnings)
|
||||
3. **Update docs**: If you changed behavior, update README.md or other docs
|
||||
4. **Commit**: Issues auto-sync to `.beads/issues.jsonl` and import after pull
|
||||
|
||||
### Commit Message Convention
|
||||
|
||||
When committing work for an issue, include the issue ID in parentheses at the end:
|
||||
|
||||
```bash
|
||||
git commit -m "Fix auth validation bug (bd-abc)"
|
||||
git commit -m "Add retry logic for database locks (bd-xyz)"
|
||||
```
|
||||
|
||||
This enables `bd doctor` to detect **orphaned issues** - work that was committed but the issue wasn't closed. The doctor check cross-references open issues against git history to find these orphans.
|
||||
|
||||
### Git Workflow
|
||||
|
||||
**Auto-sync provides batching!** bd automatically:
|
||||
|
||||
- **Exports** to JSONL after CRUD operations (30-second debounce for batching)
|
||||
- **Imports** from JSONL when it's newer than DB (e.g., after `git pull`)
|
||||
- **Daemon commits/pushes** every 5 seconds (if `--auto-commit` / `--auto-push` enabled)
|
||||
|
||||
The 30-second debounce provides a **transaction window** for batch operations - multiple issue changes within 30 seconds get flushed together, avoiding commit spam.
|
||||
|
||||
### Git Integration
|
||||
|
||||
**Auto-sync**: bd automatically exports to JSONL (30s debounce), imports after `git pull`, and optionally commits/pushes.
|
||||
|
||||
**Protected branches**: Use `bd init --branch beads-metadata` to commit to separate branch. See [docs/PROTECTED_BRANCHES.md](docs/PROTECTED_BRANCHES.md).
|
||||
|
||||
**Git worktrees**: Enhanced support with shared database architecture. Use `bd --no-daemon` if daemon warnings appear. See [docs/GIT_INTEGRATION.md](docs/GIT_INTEGRATION.md).
|
||||
|
||||
**Merge conflicts**: Rare with hash IDs. If conflicts occur, use `git checkout --theirs/.beads/issues.jsonl` and `bd import`. See [docs/GIT_INTEGRATION.md](docs/GIT_INTEGRATION.md).
|
||||
|
||||
## Landing the Plane
|
||||
|
||||
**When the user says "let's land the plane"**, you MUST complete ALL steps below. The plane is NOT landed until `git push` succeeds. NEVER stop before pushing. NEVER say "ready to push when you are!" - that is a FAILURE.
|
||||
|
||||
**MANDATORY WORKFLOW - COMPLETE ALL STEPS:**
|
||||
|
||||
1. **File beads issues for any remaining work** that needs follow-up
|
||||
2. **Ensure all quality gates pass** (only if code changes were made):
|
||||
- Run `make lint` or `golangci-lint run ./...` (if pre-commit installed: `pre-commit run --all-files`)
|
||||
- Run `make test` or `go test ./...`
|
||||
- File P0 issues if quality gates are broken
|
||||
3. **Update beads issues** - close finished work, update status
|
||||
4. **PUSH TO REMOTE - NON-NEGOTIABLE** - This step is MANDATORY. Execute ALL commands below:
|
||||
```bash
|
||||
# Pull first to catch any remote changes
|
||||
git pull --rebase
|
||||
|
||||
# If conflicts in .beads/issues.jsonl, resolve thoughtfully:
|
||||
# - git checkout --theirs .beads/issues.jsonl (accept remote)
|
||||
# - bd import -i .beads/issues.jsonl (re-import)
|
||||
# - Or manual merge, then import
|
||||
|
||||
# Sync the database (exports to JSONL, commits)
|
||||
bd sync
|
||||
|
||||
# MANDATORY: Push everything to remote
|
||||
# DO NOT STOP BEFORE THIS COMMAND COMPLETES
|
||||
git push
|
||||
|
||||
# MANDATORY: Verify push succeeded
|
||||
git status # MUST show "up to date with origin/main"
|
||||
```
|
||||
|
||||
**CRITICAL RULES:**
|
||||
- The plane has NOT landed until `git push` completes successfully
|
||||
- NEVER stop before `git push` - that leaves work stranded locally
|
||||
- NEVER say "ready to push when you are!" - YOU must push, not the user
|
||||
- If `git push` fails, resolve the issue and retry until it succeeds
|
||||
- The user is managing multiple agents - unpushed work breaks their coordination workflow
|
||||
|
||||
5. **Clean up git state** - Clear old stashes and prune dead remote branches:
|
||||
```bash
|
||||
git stash clear # Remove old stashes
|
||||
git remote prune origin # Clean up deleted remote branches
|
||||
```
|
||||
6. **Verify clean state** - Ensure all changes are committed AND PUSHED, no untracked files remain
|
||||
7. **Choose a follow-up issue for next session**
|
||||
- Provide a prompt for the user to give to you in the next session
|
||||
- Format: "Continue work on bd-X: [issue title]. [Brief context about what's been done and what's next]"
|
||||
|
||||
**REMEMBER: Landing the plane means EVERYTHING is pushed to remote. No exceptions. No "ready when you are". PUSH IT.**
|
||||
|
||||
**Example "land the plane" session:**
|
||||
|
||||
```bash
|
||||
# 1. File remaining work
|
||||
bd create "Add integration tests for sync" -t task -p 2 --json
|
||||
|
||||
# 2. Run quality gates (only if code changes were made)
|
||||
go test -short ./...
|
||||
golangci-lint run ./...
|
||||
|
||||
# 3. Close finished issues
|
||||
bd close bd-42 bd-43 --reason "Completed" --json
|
||||
|
||||
# 4. PUSH TO REMOTE - MANDATORY, NO STOPPING BEFORE THIS IS DONE
|
||||
git pull --rebase
|
||||
# If conflicts in .beads/issues.jsonl, resolve thoughtfully:
|
||||
# - git checkout --theirs .beads/issues.jsonl (accept remote)
|
||||
# - bd import -i .beads/issues.jsonl (re-import)
|
||||
# - Or manual merge, then import
|
||||
bd sync # Export/import/commit
|
||||
git push # MANDATORY - THE PLANE IS STILL IN THE AIR UNTIL THIS SUCCEEDS
|
||||
git status # MUST verify "up to date with origin/main"
|
||||
|
||||
# 5. Clean up git state
|
||||
git stash clear
|
||||
git remote prune origin
|
||||
|
||||
# 6. Verify everything is clean and pushed
|
||||
git status
|
||||
|
||||
# 7. Choose next work
|
||||
bd ready --json
|
||||
bd show bd-44 --json
|
||||
```
|
||||
|
||||
**Then provide the user with:**
|
||||
|
||||
- Summary of what was completed this session
|
||||
- What issues were filed for follow-up
|
||||
- Status of quality gates (all passing / issues filed)
|
||||
- Confirmation that ALL changes have been pushed to remote
|
||||
- Recommended prompt for next session
|
||||
|
||||
**CRITICAL: Never end a "land the plane" session without successfully pushing. The user is coordinating multiple agents and unpushed work causes severe rebase conflicts.**
|
||||
|
||||
## Agent Session Workflow
|
||||
|
||||
**WARNING: DO NOT use `bd edit`** - it opens an interactive editor ($EDITOR) which AI agents cannot use. Use `bd update` with flags instead:
|
||||
```bash
|
||||
bd update <id> --description "new description"
|
||||
bd update <id> --title "new title"
|
||||
bd update <id> --design "design notes"
|
||||
bd update <id> --notes "additional notes"
|
||||
bd update <id> --acceptance "acceptance criteria"
|
||||
```
|
||||
|
||||
**IMPORTANT for AI agents:** When you finish making issue changes, always run:
|
||||
|
||||
```bash
|
||||
bd sync
|
||||
```
|
||||
|
||||
This immediately:
|
||||
|
||||
1. Exports pending changes to JSONL (no 30s wait)
|
||||
2. Commits to git
|
||||
3. Pulls from remote
|
||||
4. Imports any updates
|
||||
5. Pushes to remote
|
||||
|
||||
**Example agent session:**
|
||||
|
||||
```bash
|
||||
# Make multiple changes (batched in 30-second window)
|
||||
bd create "Fix bug" -p 1
|
||||
bd create "Add tests" -p 1
|
||||
bd update bd-42 --status in_progress
|
||||
bd close bd-40 --reason "Completed"
|
||||
|
||||
# Force immediate sync at end of session
|
||||
bd sync
|
||||
|
||||
# Now safe to end session - everything is committed and pushed
|
||||
```
|
||||
|
||||
**Why this matters:**
|
||||
|
||||
- Without `bd sync`, changes sit in 30-second debounce window
|
||||
- User might think you pushed but JSONL is still dirty
|
||||
- `bd sync` forces immediate flush/commit/push
|
||||
|
||||
**STRONGLY RECOMMENDED: Install git hooks for automatic sync** (prevents stale JSONL problems):
|
||||
|
||||
```bash
|
||||
# One-time setup - run this in each beads workspace
|
||||
bd hooks install
|
||||
```
|
||||
|
||||
This installs:
|
||||
|
||||
- **pre-commit** - Flushes pending changes immediately before commit (bypasses 30s debounce)
|
||||
- **post-merge** - Imports updated JSONL after pull/merge (guaranteed sync)
|
||||
- **pre-push** - Exports database to JSONL before push (prevents stale JSONL from reaching remote)
|
||||
- **post-checkout** - Imports JSONL after branch checkout (ensures consistency)
|
||||
|
||||
**Why git hooks matter:**
|
||||
Without the pre-push hook, you can have database changes committed locally but stale JSONL pushed to remote, causing multi-workspace divergence. The hooks guarantee DB ↔ JSONL consistency.
|
||||
|
||||
**Note:** Hooks are embedded in the bd binary and work for all bd users (not just source repo users).
|
||||
|
||||
## Common Development Tasks
|
||||
|
||||
### CLI Design Principles
|
||||
|
||||
**Minimize cognitive overload.** Every new command, flag, or option adds cognitive burden for users. Before adding anything:
|
||||
|
||||
1. **Recovery/fix operations → `bd doctor --fix`**: Don't create separate commands like `bd recover` or `bd repair`. Doctor already detects problems - let `--fix` handle remediation. This keeps all health-related operations in one discoverable place.
|
||||
|
||||
2. **Prefer flags on existing commands**: Before creating a new command, ask: "Can this be a flag on an existing command?" Example: `bd list --stale` instead of `bd stale`.
|
||||
|
||||
3. **Consolidate related operations**: Related operations should live together. Daemon management uses `bd daemons {list,health,killall}`, not separate top-level commands.
|
||||
|
||||
4. **Count the commands**: Run `bd --help` and count. If we're approaching 30+ commands, we have a discoverability problem. Consider subcommand grouping.
|
||||
|
||||
5. **New commands need strong justification**: A new command should represent a fundamentally different operation, not just a convenience wrapper.
|
||||
|
||||
### Adding a New Command
|
||||
|
||||
1. Create file in `cmd/bd/`
|
||||
2. Add to root command in `cmd/bd/main.go`
|
||||
3. Implement with Cobra framework
|
||||
4. Add `--json` flag for agent use
|
||||
5. Add tests in `cmd/bd/*_test.go`
|
||||
6. Document in README.md
|
||||
|
||||
### Adding Storage Features
|
||||
|
||||
1. Update schema in `internal/storage/sqlite/schema.go`
|
||||
2. Add migration if needed
|
||||
3. Update `internal/types/types.go` if new types
|
||||
4. Implement in `internal/storage/sqlite/sqlite.go`
|
||||
5. Add tests
|
||||
6. Update export/import in `cmd/bd/export.go` and `cmd/bd/import.go`
|
||||
|
||||
### Adding Examples
|
||||
|
||||
1. Create directory in `examples/`
|
||||
2. Add README.md explaining the example
|
||||
3. Include working code
|
||||
4. Link from `examples/README.md`
|
||||
5. Mention in main README.md
|
||||
|
||||
## Building and Testing
|
||||
|
||||
```bash
|
||||
# Build
|
||||
go build -o bd ./cmd/bd
|
||||
|
||||
# Test (short - for local development)
|
||||
go test -short ./...
|
||||
|
||||
# Test with coverage (full tests - for CI)
|
||||
go test -coverprofile=coverage.out ./...
|
||||
go tool cover -html=coverage.out
|
||||
|
||||
# Run locally
|
||||
./bd init --prefix test
|
||||
./bd create "Test issue" -p 1
|
||||
./bd ready
|
||||
```
|
||||
|
||||
## Version Management
|
||||
|
||||
**IMPORTANT**: When the user asks to "bump the version" or mentions a new version number (e.g., "bump to 0.9.3"), use the version bump script:
|
||||
|
||||
```bash
|
||||
# Preview changes (shows diff, doesn't commit)
|
||||
./scripts/bump-version.sh 0.9.3
|
||||
|
||||
# Auto-commit the version bump
|
||||
./scripts/bump-version.sh 0.9.3 --commit
|
||||
git push origin main
|
||||
```
|
||||
|
||||
**What it does:**
|
||||
|
||||
- Updates ALL version files (CLI, plugin, MCP server, docs) in one command
|
||||
- Validates semantic versioning format
|
||||
- Shows diff preview
|
||||
- Verifies all versions match after update
|
||||
- Creates standardized commit message
|
||||
|
||||
**User will typically say:**
|
||||
|
||||
- "Bump to 0.9.3"
|
||||
- "Update version to 1.0.0"
|
||||
- "Rev the project to 0.9.4"
|
||||
- "Increment the version"
|
||||
|
||||
**You should:**
|
||||
|
||||
1. Run `./scripts/bump-version.sh <version> --commit`
|
||||
2. Push to GitHub
|
||||
3. Confirm all versions updated correctly
|
||||
|
||||
**Files updated automatically:**
|
||||
|
||||
- `cmd/bd/version.go` - CLI version
|
||||
- `claude-plugin/.claude-plugin/plugin.json` - Plugin version
|
||||
- `.claude-plugin/marketplace.json` - Marketplace version
|
||||
- `integrations/beads-mcp/pyproject.toml` - MCP server version
|
||||
- `README.md` - Documentation version
|
||||
- `PLUGIN.md` - Version requirements
|
||||
|
||||
**Why this matters:** We had version mismatches (bd-66) when only `version.go` was updated. This script prevents that by updating all components atomically.
|
||||
|
||||
See `scripts/README.md` for more details.
|
||||
|
||||
## Release Process (Maintainers)
|
||||
|
||||
**Automated (Recommended):**
|
||||
|
||||
```bash
|
||||
# One command to do everything (version bump, tests, tag, Homebrew update, local install)
|
||||
./scripts/release.sh 0.9.3
|
||||
```
|
||||
|
||||
This handles the entire release workflow automatically, including waiting ~5 minutes for GitHub Actions to build release artifacts. See [scripts/README.md](scripts/README.md) for details.
|
||||
|
||||
**Manual (Step-by-Step):**
|
||||
|
||||
1. Bump version: `./scripts/bump-version.sh <version> --commit`
|
||||
2. Update CHANGELOG.md with release notes
|
||||
3. Run tests: `go test -short ./...` (CI runs full suite)
|
||||
4. Push version bump: `git push origin main`
|
||||
5. Tag release: `git tag v<version> && git push origin v<version>`
|
||||
6. Update Homebrew: `./scripts/update-homebrew.sh <version>` (waits for GitHub Actions)
|
||||
7. Verify: `brew update && brew upgrade bd && bd version`
|
||||
|
||||
See [docs/RELEASING.md](docs/RELEASING.md) for complete manual instructions.
|
||||
|
||||
## Checking GitHub Issues and PRs
|
||||
|
||||
**IMPORTANT**: When asked to check GitHub issues or PRs, use command-line tools like `gh` instead of browser/playwright tools.
|
||||
|
||||
**Preferred approach:**
|
||||
|
||||
```bash
|
||||
# List open issues with details
|
||||
gh issue list --limit 30
|
||||
|
||||
# List open PRs
|
||||
gh pr list --limit 30
|
||||
|
||||
# View specific issue
|
||||
gh issue view 201
|
||||
```
|
||||
|
||||
**Then provide an in-conversation summary** highlighting:
|
||||
|
||||
- Urgent/critical issues (regressions, bugs, broken builds)
|
||||
- Common themes or patterns
|
||||
- Feature requests with high engagement
|
||||
- Items that need immediate attention
|
||||
|
||||
**Why this matters:**
|
||||
|
||||
- Browser tools consume more tokens and are slower
|
||||
- CLI summaries are easier to scan and discuss
|
||||
- Keeps the conversation focused and efficient
|
||||
- Better for quick triage and prioritization
|
||||
|
||||
**Do NOT use:** `browser_navigate`, `browser_snapshot`, or other playwright tools for GitHub PR/issue reviews unless specifically requested by the user.
|
||||
|
||||
## Questions?
|
||||
|
||||
- Check existing issues: `bd list`
|
||||
- Look at recent commits: `git log --oneline -20`
|
||||
- Read the docs: README.md, ADVANCED.md, EXTENDING.md
|
||||
- Create an issue if unsure: `bd create "Question: ..." -t task -p 2`
|
||||
|
||||
## Important Files
|
||||
|
||||
- **README.md** - Main documentation (keep this updated!)
|
||||
- **EXTENDING.md** - Database extension guide
|
||||
- **ADVANCED.md** - JSONL format analysis
|
||||
- **CONTRIBUTING.md** - Contribution guidelines
|
||||
- **SECURITY.md** - Security policy
|
||||
|
|
|
|||
35
ARTICLES.md
35
ARTICLES.md
|
|
@ -1,35 +0,0 @@
|
|||
# Articles & Tutorials
|
||||
|
||||
A curated list of articles and tutorials about Beads.
|
||||
|
||||
## Steve Yegge (Author of Beads)
|
||||
|
||||
- [Introducing Beads: A Coding Agent Memory System](https://steve-yegge.medium.com/introducing-beads-a-coding-agent-memory-system-637d7d92514a) - The original introduction to Beads and how it solves the "50 First Dates" problem for AI agents.
|
||||
|
||||
- [The Beads Revolution](https://steve-yegge.medium.com/the-beads-revolution-how-i-built-the-todo-system-that-ai-agents-actually-want-to-use-228a5f9be2a9) - How Steve built Beads in 6 days using Claude. Covers epics, child issues, and why AIs love it.
|
||||
|
||||
- [Beads Blows Up](https://steve-yegge.medium.com/beads-blows-up-a0a61bb889b4) - Three weeks in: the "land the plane" protocol, session cleanup, and why the core design works.
|
||||
|
||||
- [Beads Best Practices](https://steve-yegge.medium.com/beads-best-practices-2db636b9760c) - Multi-agent coordination, when to file issues, and keeping your working set small.
|
||||
|
||||
- [Beads for Blobfish](https://steve-yegge.medium.com/beads-for-blobfish-80c7a2977ffa) - Why you should take 3 minutes to try Beads.
|
||||
|
||||
- [The Future of Coding Agents](https://steve-yegge.medium.com/the-future-of-coding-agents-e9451a84207c) - Reflections on Beads maturity and how agents use it naturally with no training.
|
||||
|
||||
- [Welcome to Gas Town](https://steve-yegge.medium.com/welcome-to-gas-town-4f25ee16dd04) - Introducing Gas Town, the multi-agent system built on Beads.
|
||||
|
||||
## Community Articles
|
||||
|
||||
_Note: the development pace of Beads is very fast and it's easy for offsite content to become outdated._
|
||||
|
||||
- [An Introduction to Beads](https://ianbull.com/posts/beads) by Ian Bull - A practical introduction to Beads with setup instructions and workflow tips.
|
||||
|
||||
- [Beads: Memory for Your Coding Agents](https://paddo.dev/blog/beads-memory-for-coding-agents/) by Paddo - Deep dive into how Beads stores everything in Git and what it's really for.
|
||||
|
||||
- [From Beads to Tasks: Anthropic Productizes Agent Memory](https://paddo.dev/blog/from-beads-to-tasks/) by Paddo - How Beads influenced broader agent memory approaches.
|
||||
|
||||
- [GasTown and the Two Kinds of Multi-Agent](https://paddo.dev/blog/gastown-two-kinds-of-multi-agent/) by Paddo - Understanding multi-agent patterns with Beads and Gas Town.
|
||||
|
||||
- [Beads: A Git-Friendly Issue Tracker for AI Coding Agents](https://betterstack.com/community/guides/ai/beads-issue-tracker-ai-agents/) by Better Stack - Getting started guide with practical examples.
|
||||
|
||||
- [Introducing nvim-beads: Manage Beads in Neovim](https://joeblu.com/blog/2026_01_introducing-nvim-beads-manage-beads-in-neovim/) by Joe Blubaugh - Neovim plugin for managing Beads directly in your editor.
|
||||
|
|
@ -4,19 +4,19 @@ This document describes the performance benchmarks available in the beads projec
|
|||
|
||||
## Running Benchmarks
|
||||
|
||||
### All Dolt Benchmarks
|
||||
### All SQLite Benchmarks
|
||||
```bash
|
||||
go test -tags=bench -bench=. -benchmem ./internal/storage/dolt/...
|
||||
go test -tags=bench -bench=. -benchmem ./internal/storage/sqlite/...
|
||||
```
|
||||
|
||||
### Specific Benchmark
|
||||
```bash
|
||||
go test -tags=bench -bench=BenchmarkGetReadyWork_Large -benchmem ./internal/storage/dolt/...
|
||||
go test -tags=bench -bench=BenchmarkGetReadyWork_Large -benchmem ./internal/storage/sqlite/...
|
||||
```
|
||||
|
||||
### With CPU Profiling
|
||||
```bash
|
||||
go test -tags=bench -bench=BenchmarkGetReadyWork_Large -cpuprofile=cpu.prof ./internal/storage/dolt/...
|
||||
go test -tags=bench -bench=BenchmarkGetReadyWork_Large -cpuprofile=cpu.prof ./internal/storage/sqlite/...
|
||||
go tool pprof -http=:8080 cpu.prof
|
||||
```
|
||||
|
||||
|
|
@ -36,13 +36,11 @@ Tests on graphs with different topologies (linear chains, trees, dense graphs):
|
|||
### Ready Work / Filtering
|
||||
- **BenchmarkGetReadyWork_Large** - Filter unblocked issues (10K dataset)
|
||||
- **BenchmarkGetReadyWork_XLarge** - Filter unblocked issues (20K dataset)
|
||||
- **BenchmarkGetReadyWork_FromJSONL** - Ready work on imported database
|
||||
- **BenchmarkGetReadyWork_FromJSONL** - Ready work on JSONL-imported database
|
||||
|
||||
### Search Operations
|
||||
- **BenchmarkSearchIssues_Large_NoFilter** - Search all open issues (10K dataset)
|
||||
- **BenchmarkSearchIssues_Large_ComplexFilter** - Search with priority/status filters (10K dataset)
|
||||
- **BenchmarkPerfSearchTypedLabelFilter_5K** - Label/type search over a 5K issue/label catalog
|
||||
- **BenchmarkPerfResolvePartialIDInvalidInput_5K** - Invalid partial-ID rejection without a broad fallback scan
|
||||
|
||||
### CRUD Operations
|
||||
- **BenchmarkCreateIssue_Large** - Create new issue in 10K database
|
||||
|
|
@ -53,54 +51,6 @@ Tests on graphs with different topologies (linear chains, trees, dense graphs):
|
|||
- **BenchmarkLargeDescription** - Handling 100KB+ issue descriptions (NEW)
|
||||
- **BenchmarkSyncMerge** - Simulate sync cycle with create/update operations (NEW)
|
||||
|
||||
### Recent Perf Regression References
|
||||
|
||||
These benchmarks cover the May 2026 Dolt hot-path changes so future perf PRs can run before/after checks against the same fixture shapes:
|
||||
|
||||
| PR / change | Benchmark |
|
||||
|-------------|-----------|
|
||||
| #3966 `perf(deps): narrow recursive cycle checks` | `BenchmarkPerfAddDependencyCycleCheck_DiamondDAG` |
|
||||
| #3967 `perf(search): tighten label and partial-id queries` | `BenchmarkPerfSearchTypedLabelFilter_5K`, `BenchmarkPerfResolvePartialIDInvalidInput_5K` |
|
||||
| #3968 `perf(ready): page blocked checks for limited ready work` | `BenchmarkPerfReadyWorkLimited_LargeBlockedGraph` |
|
||||
| #4001 `perf(ready): narrow deferred-parent child filtering` | `BenchmarkPerfReadyWorkDeferredParentExclusion_5K` |
|
||||
| #4002 `perf(ready): restrict blocked dependency scans to active IDs` | `BenchmarkPerfBlockedIssues_ClosedDependencySkew` |
|
||||
| #4003 `perf(get): query primary issues before wisp fallback` | `BenchmarkPerfGetIssuePrimaryFirst_PermanentWithWisps` |
|
||||
| #4004 `perf(deps): scan one cycle table for same-storage edges` | No standalone executable perf diff in the landed squash; covered by the cycle-check benchmark above |
|
||||
|
||||
Measured with `-benchtime=1x -benchmem -count=1` on the same host, copying this benchmark file onto each before/after ref:
|
||||
|
||||
| PR / path | Benchmark | Before | After | Time gain | Alloc gain |
|
||||
|-----------|-----------|--------|-------|-----------|------------|
|
||||
| #3967 label/type search | `BenchmarkPerfSearchTypedLabelFilter_5K` | 134.8 ms | 51.8 ms | 61.6% | -0.1% |
|
||||
| #3967 invalid partial-ID fallback | `BenchmarkPerfResolvePartialIDInvalidInput_5K` | 124.3 ms | 22.5 ms | 81.9% | 43.6% |
|
||||
| #3966 dependency cycle check | `BenchmarkPerfAddDependencyCycleCheck_DiamondDAG` | 80.0 ms | 25.8 ms | 67.7% | 1.4% |
|
||||
| #3968 limited ready work | `BenchmarkPerfReadyWorkLimited_LargeBlockedGraph` | 1677.4 ms | 341.7 ms | 79.6% | 85.4% |
|
||||
| #4001 deferred parent exclusion | `BenchmarkPerfReadyWorkDeferredParentExclusion_5K` | 3257.3 ms | 130.8 ms | 96.0% | 83.1% |
|
||||
| #4002 active blocked-dep scan | `BenchmarkPerfBlockedIssues_ClosedDependencySkew` | 44.3 ms | 36.2 ms | 18.1% | 96.0% |
|
||||
| #4003 primary issue lookup | `BenchmarkPerfGetIssuePrimaryFirst_PermanentWithWisps` | 9.0 ms | 6.4 ms | 28.7% | 10.7% |
|
||||
|
||||
Run the recent perf reference set with:
|
||||
|
||||
```bash
|
||||
go test -run=^$ -bench='BenchmarkPerf(SearchTypedLabelFilter|ResolvePartialIDInvalidInput|AddDependencyCycleCheck|ReadyWorkLimited|BlockedIssues|ReadyWorkDeferredParentExclusion|GetIssuePrimaryFirst)' -benchtime=1x -benchmem ./internal/storage/dolt
|
||||
```
|
||||
|
||||
For production-shaped CLI timeout and index experiments, use:
|
||||
|
||||
```bash
|
||||
go run ./scripts/repro-dolt-prod-timeouts --bd ./bd --scenario all
|
||||
go run ./scripts/bench-ready-indexes --dsn 'root@tcp(127.0.0.1:33307)/mc?timeout=30s&readTimeout=30s&writeTimeout=30s'
|
||||
```
|
||||
|
||||
When `repro-dolt-prod-timeouts` targets an existing workspace with
|
||||
`--workspace`, fixture seeding defaults to `--seed-mode=none`; pass
|
||||
`--seed-mode=full` or `--seed-mode=dep-only` only when intentionally writing
|
||||
and committing synthetic fixture rows into that workspace.
|
||||
|
||||
`bench-ready-indexes` drops its candidate indexes again before exit by default;
|
||||
pass `--keep-indexes` only when intentionally leaving the final index set
|
||||
installed.
|
||||
|
||||
## Performance Targets
|
||||
|
||||
### Typical Results (M2 Pro)
|
||||
|
|
@ -121,7 +71,7 @@ installed.
|
|||
Benchmark datasets are cached in `/tmp/beads-bench-cache/`:
|
||||
- `large.db` - 10,000 issues (16.6 MB)
|
||||
- `xlarge.db` - 20,000 issues (generated on demand)
|
||||
|
||||
- `large-jsonl.db` - 10K issues via JSONL import
|
||||
|
||||
Cached databases are reused across runs. To regenerate:
|
||||
```bash
|
||||
|
|
@ -181,10 +131,10 @@ This generates a flamegraph showing where time is spent across all benchmarks.
|
|||
Example:
|
||||
```bash
|
||||
# Baseline
|
||||
go test -tags=bench -bench=BenchmarkGetReadyWork_Large -benchmem ./internal/storage/dolt/...
|
||||
go test -tags=bench -bench=BenchmarkGetReadyWork_Large -benchmem ./internal/storage/sqlite/...
|
||||
|
||||
# Make changes...
|
||||
|
||||
# Measure improvement
|
||||
go test -tags=bench -bench=BenchmarkGetReadyWork_Large -benchmem ./internal/storage/dolt/...
|
||||
go test -tags=bench -bench=BenchmarkGetReadyWork_Large -benchmem ./internal/storage/sqlite/...
|
||||
```
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue