diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 0a50b06ad..64af598d5 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -9,7 +9,7 @@ "name": "beads", "source": "./plugins/beads", "description": "AI-supervised issue tracker for coding workflows", - "version": "1.3.1" + "version": "1.3.2-rc.1" } ] } diff --git a/.githooks/post-checkout b/.githooks/post-checkout index 797c1199c..864cb33b3 100755 --- a/.githooks/post-checkout +++ b/.githooks/post-checkout @@ -1,5 +1,5 @@ #!/usr/bin/env sh -# --- BEGIN BEADS INTEGRATION v1.3.1 --- +# --- BEGIN BEADS INTEGRATION v1.3.2-rc.1 --- # 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 @@ -56,4 +56,4 @@ if command -v bd >/dev/null 2>&1; then fi if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi fi -# --- END BEADS INTEGRATION v1.3.1 --- +# --- END BEADS INTEGRATION v1.3.2-rc.1 --- diff --git a/.githooks/post-merge b/.githooks/post-merge index 07a8f632f..147a8d0a3 100755 --- a/.githooks/post-merge +++ b/.githooks/post-merge @@ -1,5 +1,5 @@ #!/usr/bin/env sh -# --- BEGIN BEADS INTEGRATION v1.3.1 --- +# --- BEGIN BEADS INTEGRATION v1.3.2-rc.1 --- # 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 @@ -56,4 +56,4 @@ if command -v bd >/dev/null 2>&1; then fi if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi fi -# --- END BEADS INTEGRATION v1.3.1 --- +# --- END BEADS INTEGRATION v1.3.2-rc.1 --- diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 850121d71..921f27383 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -40,7 +40,7 @@ if [ -n "$staged_go_files" ]; then echo "$staged_go_files" | xargs git add fi -# --- BEGIN BEADS INTEGRATION v1.3.1 --- +# --- BEGIN BEADS INTEGRATION v1.3.2-rc.1 --- # 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 @@ -97,4 +97,4 @@ if command -v bd >/dev/null 2>&1; then fi if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi fi -# --- END BEADS INTEGRATION v1.3.1 --- +# --- END BEADS INTEGRATION v1.3.2-rc.1 --- diff --git a/.githooks/pre-push b/.githooks/pre-push index 675d4edce..27b5b3d71 100755 --- a/.githooks/pre-push +++ b/.githooks/pre-push @@ -39,7 +39,7 @@ fi exec < <(printf '%s\n' "$push_refs") -# --- BEGIN BEADS INTEGRATION v1.3.1 --- +# --- BEGIN BEADS INTEGRATION v1.3.2-rc.1 --- # 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 @@ -96,4 +96,4 @@ if command -v bd >/dev/null 2>&1; then fi if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi fi -# --- END BEADS INTEGRATION v1.3.1 --- +# --- END BEADS INTEGRATION v1.3.2-rc.1 --- diff --git a/.githooks/prepare-commit-msg b/.githooks/prepare-commit-msg index 333f71b51..c5a1f0869 100755 --- a/.githooks/prepare-commit-msg +++ b/.githooks/prepare-commit-msg @@ -1,5 +1,5 @@ #!/usr/bin/env sh -# --- BEGIN BEADS INTEGRATION v1.3.1 --- +# --- BEGIN BEADS INTEGRATION v1.3.2-rc.1 --- # 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 @@ -56,4 +56,4 @@ if command -v bd >/dev/null 2>&1; then fi if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi fi -# --- END BEADS INTEGRATION v1.3.1 --- +# --- END BEADS INTEGRATION v1.3.2-rc.1 --- diff --git a/.github/workflows/conformance.yml b/.github/workflows/conformance.yml index e981539db..b79c71bbb 100644 --- a/.github/workflows/conformance.yml +++ b/.github/workflows/conformance.yml @@ -5,7 +5,7 @@ name: Conformance on: pull_request: - branches: [ main, 'release/**' ] + branches: [ main, 'release/**', 'hotfix/**' ] merge_group: concurrency: diff --git a/.github/workflows/cross-version-smoke.yml b/.github/workflows/cross-version-smoke.yml index d9f5c7a71..5f165fca7 100644 --- a/.github/workflows/cross-version-smoke.yml +++ b/.github/workflows/cross-version-smoke.yml @@ -10,7 +10,7 @@ on: # feedback. Release-targeted PRs are exactly the ones where cross-version # upgrade breakage is most expensive to discover at tag time. pull_request: - branches: [ main, 'release/**' ] + branches: [ main, 'release/**', 'hotfix/**' ] # Allow manual trigger with custom version count workflow_dispatch: diff --git a/.github/workflows/pr-risk.yml b/.github/workflows/pr-risk.yml index 60ba8ca75..e667d691e 100644 --- a/.github/workflows/pr-risk.yml +++ b/.github/workflows/pr-risk.yml @@ -2,7 +2,7 @@ name: PR Risk on: pull_request: - branches: [ main, 'release/**' ] + branches: [ main, 'release/**', 'hotfix/**' ] merge_group: concurrency: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2215173da..65cd53f80 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -5,7 +5,7 @@ on: # release/** is here because release-prep and release-fix PRs are based on # the release branch, not on main. Without it they run almost no CI and the # first full signal is the tag build, where a failure burns the tag. - branches: [ main, 'release/**' ] + branches: [ main, 'release/**', 'hotfix/**' ] merge_group: concurrency: @@ -1014,14 +1014,20 @@ jobs: go-version-file: 'go.mod' cache: false + # golangci/golangci-lint-action is not on this repository's allowed-actions + # list, so a workflow that names it fails at startup. Install the pinned + # release binary (the same script main uses) and report only issues new + # relative to the PR base, as only-new-issues did. + - name: Install golangci-lint + run: ./scripts/ci/install-golangci-lint.sh + - name: golangci-lint - uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9 env: GOWORK: "off" - with: - version: v2.10.1 - only-new-issues: true - args: --config=.golangci.yml --modules-download-mode=readonly --timeout=5m --build-tags=gms_pure_go + NEW_FROM_REV: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }} + run: >- + golangci-lint run --config=.golangci.yml --modules-download-mode=readonly + --timeout=5m --build-tags=gms_pure_go --new-from-rev="$NEW_FROM_REV" windows-make-shell: name: Windows Make shell (${{ matrix.host }}) diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 46237752b..c3eec84bb 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -5,7 +5,7 @@ on: push: branches: [main] pull_request: - branches: [main, 'release/**'] + branches: [main, 'release/**', 'hotfix/**'] # Allow manual trigger workflow_dispatch: diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a7c48743..75cc8cbbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,68 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 after it commits; a failed trailing commit is counted as `post_tx_commit_dropped` instead of surfacing as a recheck failure. +## [1.3.2-rc.1] - 2026-10-05 + +First release candidate for 1.3.2, a patch on top of 1.3.1 with **no schema +migration**: upgrading from 1.3.1 is a binary swap. It fixes `bd purge` +deleting the closed root of a chain that still has live work under it, and an +auto-backup watermark that could claim a commit the snapshot does not contain. +It also carries an upgrade note for stores migrated by 1.3.0 or 1.3.1 +([#7037](https://github.com/gastownhall/beads/issues/7037)). + +### Upgrade notes + +- **After upgrading from bd ≤1.3.0, run `bd recompute-blocked` once per + workspace** ([#7037](https://github.com/gastownhall/beads/issues/7037)). + Migration 0059, first shipped in 1.3.0, recomputes the denormalized + `is_blocked` flag with a recursive query. On Dolt servers older than 2.4.0, + and on the embedded engine, a query-planner bug + ([dolthub/dolt#11886](https://github.com/dolthub/dolt/issues/11886), fixed + in Dolt 2.4.0) drops the query's `parent-child` edge filter. Blockedness then + spreads across every dependency type, including `relates-to`, + `discovered-from` and `tracks`. Beads that are not actually blocked are + marked blocked and silently disappear from `bd ready` and `bd list --ready`. + The flag is stored, so the damage persists until it is recomputed: nothing in + 1.3.2 repairs it automatically. + + `bd recompute-blocked` rebuilds the flag from the dependency graph. It is + idempotent and reports `rows_corrected`. It applies to every workspace whose + store crossed migration 0059 under bd 1.3.0 or later, which includes a + workspace now on 1.3.1 that was originally created by 1.2.x or earlier. + Running it on a workspace that was not affected changes nothing. + +### Fixed + +- **`bd purge` keeps the whole closed chain above a live bead, not just its + direct parent** ([#7041](https://github.com/gastownhall/beads/pull/7041), + fixes [#7031](https://github.com/gastownhall/beads/issues/7031)). The + live-dependent protection added in 1.3.1 only protected a closed candidate + that a not-done bead pointed at directly. Take a closed root R, a closed child + S1 and an open grandchild S2. S1 was protected because S2 is live, but R was + not, because its only dependent S1 is closed. Purge deleted R, which orphaned + S1 and S2, and `--dry-run` reported the same deletion. Protection now + propagates through closed candidates until nothing changes, on every backend + (dolt server, embedded, proxied/uow). An orchestrator retention sweep + (`bd purge --wisps-plane --older-than ...`) is the common way to hit this. +- **The backup watermark no longer runs ahead of the snapshot** + ([#7044](https://github.com/gastownhall/beads/pull/7044), fixes + [#7032](https://github.com/gastownhall/beads/issues/7032)). Auto-backup read + Dolt HEAD *after* the sync and recorded that as the newest commit backed up. + A commit that landed during the sync was therefore recorded as backed up even + though the snapshot did not contain it, and auto-backup reported "no changes + since last backup" until HEAD moved again. HEAD is now read before the sync, + so such a commit stays pending for the next backup. Only opted-in auto-backup + (`backup.enabled: true`) was affected; `bd backup sync` does not record a + commit watermark. + +### CI + +- PRs into `hotfix/**` branches now run full CI, including the required + `CI Gate / Required` check + ([#7198](https://github.com/gastownhall/beads/pull/7198), fixes + [#7148](https://github.com/gastownhall/beads/issues/7148); ported to this + branch in [#7217](https://github.com/gastownhall/beads/pull/7217)). + ## [1.3.1] - 2026-09-30 First stable release of the 1.3.1 patch line. It ships the same code as diff --git a/backend/conformance/role_bundle_cases.go b/backend/conformance/role_bundle_cases.go index e2dee40d8..769eb1c14 100644 --- a/backend/conformance/role_bundle_cases.go +++ b/backend/conformance/role_bundle_cases.go @@ -640,6 +640,7 @@ var roleContractCases = []roleContract{ RunSweeperWispsPlaneClearsTheWholeWispsTable, RunSweeperWispsPlaneRequiresAFilter, RunSweeperProtectsLiveDependents, + RunSweeperProtectsTransitiveLiveDependents, RunSweeperProtectsLiveDependentsAcrossPlanes, RunSweeperLimitTakesTheOldestClosedFirst, ), diff --git a/backend/conformance/sweeper_contract.go b/backend/conformance/sweeper_contract.go index bae89c58d..8cbf6225a 100644 --- a/backend/conformance/sweeper_contract.go +++ b/backend/conformance/sweeper_contract.go @@ -747,6 +747,49 @@ func RunSweeperProtectsLiveDependents(t *testing.T, ctx context.Context, fixture sweeperAssertWispRows(t, ctx, fixture, 4, openChild, convoy, hooked, relater) } +// RunSweeperProtectsTransitiveLiveDependents pins that protection propagates +// through closed candidates: an open grandchild keeps both its closed parent +// and closed grandparent. Otherwise sweeping the grandparent orphans a live +// hierarchy even though the direct parent was correctly retained. +func RunSweeperProtectsTransitiveLiveDependents(t *testing.T, ctx context.Context, fixture SweeperFixture) { + t.Helper() + if fixture.AddDependencies == nil { + t.Skip("fixture has no AddDependencies hook; cannot wire the hierarchy this case needs") + } + root := sweeperSeed(t, ctx, fixture, sweeperIssue(fixture, "transitive", "root", true), nil) + middle := sweeperSeed(t, ctx, fixture, sweeperIssue(fixture, "transitive", "middle", true), nil) + leafIssue := sweeperIssue(fixture, "transitive", "leaf", true) + leafIssue.Status = types.StatusOpen + leafIssue.ClosedAt = nil + leaf := sweeperSeed(t, ctx, fixture, leafIssue, nil) + + if err := fixture.AddDependencies(ctx, publicops.AddDependenciesRequest{ + Actor: "sweeper-seed", + Edges: []publicops.DependencyEdge{ + {IssueID: middle, DependsOnID: root, Type: publicops.DepParentChild}, + {IssueID: leaf, DependsOnID: middle, Type: publicops.DepParentChild}, + }, + }); err != nil { + t.Fatalf("wiring transitive hierarchy: %v", err) + } + + request := publicops.SweepRequest{ + Tier: publicops.SweepWispsPlane, + IDPattern: sweeperPattern(fixture, "transitive"), + ClosedBefore: &sweeperCutoff, + ProtectLiveDependents: true, + } + preview := sweeperSweep(t, ctx, fixture, sweeperAsDryRun(request)) + if preview.Swept != 0 || preview.Skipped.LiveDependent != 2 { + t.Fatalf("dry run: Swept = %d, LiveDependent = %d; want 0 and 2", preview.Swept, preview.Skipped.LiveDependent) + } + result := sweeperSweep(t, ctx, fixture, request) + if result.Swept != 0 || result.Skipped.LiveDependent != 2 { + t.Fatalf("sweep: Swept = %d, LiveDependent = %d; want 0 and 2", result.Swept, result.Skipped.LiveDependent) + } + sweeperAssertWispRows(t, ctx, fixture, 3, root, middle, leaf) +} + // RunSweeperProtectsLiveDependentsAcrossPlanes pins that the live-dependent // protection reads BOTH dependency tables: a closed wisp that a live DURABLE // (issues-table) bead depends on through parent-child, tracks or blocks is diff --git a/cmd/bd/backup_export.go b/cmd/bd/backup_export.go index 654ba7c47..4b3d7ed38 100644 --- a/cmd/bd/backup_export.go +++ b/cmd/bd/backup_export.go @@ -161,12 +161,16 @@ func runBackupExport(ctx context.Context, backend localBackupBackend, force bool return nil, err } + // Read the watermark before the sync. A concurrent commit may land while + // BackupToDir is running; recording a later HEAD would claim that commit is + // present in a snapshot that started before it existed. + currentCommit, err := backend.CurrentCommit(ctx) + if err != nil { + return nil, fmt.Errorf("failed to get current commit: %w", err) + } + // Change detection: skip if nothing changed (unless forced) if !force { - currentCommit, err := backend.CurrentCommit(ctx) - if err != nil { - return nil, fmt.Errorf("failed to get current commit: %w", err) - } if currentCommit == state.LastDoltCommit && state.LastDoltCommit != "" { debug.Logf("backup: no changes since last backup (commit %s)\n", truncateHash(currentCommit)) return state, nil @@ -190,11 +194,8 @@ func runBackupExport(ctx context.Context, backend localBackupBackend, force bool return nil, err } - // Update watermarks - currentCommit, err := backend.CurrentCommit(ctx) - if err != nil { - return nil, fmt.Errorf("failed to get current commit for state: %w", err) - } + // The pre-sync commit is the newest commit this backup is guaranteed to + // contain. If HEAD moved during the sync, the next backup must see it. state.LastDoltCommit = currentCommit state.Timestamp = time.Now().UTC() diff --git a/cmd/bd/backup_export_watermark_test.go b/cmd/bd/backup_export_watermark_test.go new file mode 100644 index 000000000..06d0fd2a5 --- /dev/null +++ b/cmd/bd/backup_export_watermark_test.go @@ -0,0 +1,55 @@ +package main + +import ( + "context" + "os" + "path/filepath" + "testing" + + "github.com/steveyegge/beads/internal/config" +) + +type advancingBackupBackend struct { + commit string + backupCommit string + commitAfterSync string +} + +func (b *advancingBackupBackend) CurrentCommit(context.Context) (string, error) { + return b.commit, nil +} + +func (b *advancingBackupBackend) BackupToDir(context.Context, string) error { + b.backupCommit = b.commit + b.commit = b.commitAfterSync + return nil +} + +func TestRunBackupExportWatermarkDoesNotAdvancePastSnapshot(t *testing.T) { + for _, force := range []bool{false, true} { + t.Run(map[bool]string{false: "changed", true: "forced"}[force], func(t *testing.T) { + repo := t.TempDir() + if err := os.MkdirAll(filepath.Join(repo, ".git"), 0o755); err != nil { + t.Fatal(err) + } + t.Setenv("BD_BACKUP_GIT_REPO", repo) + config.ResetForTesting() + t.Cleanup(config.ResetForTesting) + if err := config.Initialize(); err != nil { + t.Fatalf("config.Initialize: %v", err) + } + + backend := &advancingBackupBackend{commit: "head-before-sync", commitAfterSync: "head-after-sync"} + state, err := runBackupExport(context.Background(), backend, force) + if err != nil { + t.Fatalf("runBackupExport: %v", err) + } + if backend.backupCommit != "head-before-sync" { + t.Fatalf("backup captured %q, want head-before-sync", backend.backupCommit) + } + if state.LastDoltCommit != backend.backupCommit { + t.Fatalf("watermark = %q, backup captured %q; a commit that landed during sync must remain pending", state.LastDoltCommit, backend.backupCommit) + } + }) + } +} diff --git a/cmd/bd/info.go b/cmd/bd/info.go index 30e1a13f9..fe7d1753d 100644 --- a/cmd/bd/info.go +++ b/cmd/bd/info.go @@ -220,6 +220,16 @@ type VersionChange struct { // versionChanges contains agent-actionable changes for recent versions var versionChanges = []VersionChange{ + { + Version: "1.3.2-rc.1", + Date: "2026-10-05", + Changes: []string{ + "RC: first candidate for 1.3.2, a patch on top of 1.3.1 with no schema migration, so upgrading from 1.3.1 is a binary swap.", + "UPGRADE: after upgrading from bd <=1.3.0, run 'bd recompute-blocked' once per workspace (#7037). Migration 0059 (first shipped in 1.3.0) recomputes is_blocked with a recursive query whose parent-child filter is dropped by a Dolt query-planner bug on Dolt servers older than 2.4.0 and on the embedded engine (dolthub/dolt#11886). Blockedness then spreads across relates-to, discovered-from, tracks and other edges, and unblocked beads silently vanish from 'bd ready'. The flag is stored, so the damage persists until recomputed. This includes a workspace now on 1.3.1 that was first created by 1.2.x or earlier. The command is idempotent and reports rows_corrected.", + "FIX: 'bd purge' keeps every closed bead in a chain above a live bead, not just the one a live bead points at directly (#7031). A closed root over a closed child over an open grandchild used to lose its root, orphaning the rest; --wisps-plane retention sweeps hit this.", + "FIX: auto-backup records the Dolt commit read before the sync as its watermark (#7032). A commit landing during the sync used to be recorded as backed up although the snapshot lacked it, and auto-backup then reported 'no changes' until HEAD moved again.", + }, + }, { Version: "1.3.1", Date: "2026-09-30", diff --git a/cmd/bd/version.go b/cmd/bd/version.go index 34efb4af8..3120e048f 100644 --- a/cmd/bd/version.go +++ b/cmd/bd/version.go @@ -16,7 +16,7 @@ import ( var ( // Version is the current version of bd (overridden by ldflags at build time) - Version = "1.3.1" + Version = "1.3.2-rc.1" // Build can be set via ldflags at compile time Build = "dev" // Commit and branch the git revision the binary was built from (optional ldflag) diff --git a/cmd/bd/winres/manifest.xml b/cmd/bd/winres/manifest.xml index aae5b5d6b..a710519f0 100644 --- a/cmd/bd/winres/manifest.xml +++ b/cmd/bd/winres/manifest.xml @@ -3,7 +3,7 @@ beads - AI-supervised issue tracker diff --git a/cmd/bd/winres/winres.json b/cmd/bd/winres/winres.json index 226a357a8..7da38b692 100644 --- a/cmd/bd/winres/winres.json +++ b/cmd/bd/winres/winres.json @@ -9,8 +9,8 @@ "#1": { "0000": { "fixed": { - "file_version": "1.3.1", - "product_version": "1.3.1", + "file_version": "1.3.2", + "product_version": "1.3.2", "type": "App" }, "info": { @@ -18,12 +18,12 @@ "Comments": "AI-supervised issue tracker for coding workflows", "CompanyName": "Steve Yegge", "FileDescription": "beads - AI-supervised issue tracker", - "FileVersion": "1.3.1", + "FileVersion": "1.3.2-rc.1", "InternalName": "bd", "LegalCopyright": "Copyright (c) 2024-2026 Steve Yegge. MIT License.", "OriginalFilename": "bd.exe", "ProductName": "beads", - "ProductVersion": "1.3.1" + "ProductVersion": "1.3.2-rc.1" } } } diff --git a/default.nix b/default.nix index 64dadbfa7..9e58d034b 100644 --- a/default.nix +++ b/default.nix @@ -7,7 +7,7 @@ }: buildGoModule { pname = "beads"; - version = "1.3.1"; + version = "1.3.2-rc.1"; src = self; diff --git a/integrations/beads-mcp/pyproject.toml b/integrations/beads-mcp/pyproject.toml index e908d2f57..2090923fb 100644 --- a/integrations/beads-mcp/pyproject.toml +++ b/integrations/beads-mcp/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "beads-mcp" -version = "1.3.1" +version = "1.3.2-rc.1" description = "MCP server for beads issue tracker." readme = "README.md" requires-python = ">=3.10" diff --git a/integrations/beads-mcp/src/beads_mcp/__init__.py b/integrations/beads-mcp/src/beads_mcp/__init__.py index d3e4dd84e..4032264c9 100644 --- a/integrations/beads-mcp/src/beads_mcp/__init__.py +++ b/integrations/beads-mcp/src/beads_mcp/__init__.py @@ -4,4 +4,4 @@ This package provides an MCP (Model Context Protocol) server that exposes beads (bd) issue tracker functionality to MCP Clients. """ -__version__ = "1.3.1" +__version__ = "1.3.2-rc.1" diff --git a/integrations/beads-mcp/uv.lock b/integrations/beads-mcp/uv.lock index eee08ed62..761afc223 100644 --- a/integrations/beads-mcp/uv.lock +++ b/integrations/beads-mcp/uv.lock @@ -175,7 +175,7 @@ wheels = [ [[package]] name = "beads-mcp" -version = "1.3.1" +version = "1.3.2rc1" source = { editable = "." } dependencies = [ { name = "fastmcp" }, diff --git a/internal/storage/dolt/sweeper_contract_test.go b/internal/storage/dolt/sweeper_contract_test.go index d01d2e96b..23afaebbb 100644 --- a/internal/storage/dolt/sweeper_contract_test.go +++ b/internal/storage/dolt/sweeper_contract_test.go @@ -44,6 +44,9 @@ func TestSweeperContract(t *testing.T) { t.Run("ProtectsLiveDependents", func(t *testing.T) { conformance.RunSweeperProtectsLiveDependents(t, ctx, fixture) }) + t.Run("ProtectsTransitiveLiveDependents", func(t *testing.T) { + conformance.RunSweeperProtectsTransitiveLiveDependents(t, ctx, fixture) + }) t.Run("ProtectsLiveDependentsAcrossPlanes", func(t *testing.T) { conformance.RunSweeperProtectsLiveDependentsAcrossPlanes(t, ctx, fixture) }) diff --git a/internal/storage/embeddeddolt/sweeper_contract_test.go b/internal/storage/embeddeddolt/sweeper_contract_test.go index 7a2e550e0..7d1694e64 100644 --- a/internal/storage/embeddeddolt/sweeper_contract_test.go +++ b/internal/storage/embeddeddolt/sweeper_contract_test.go @@ -49,6 +49,9 @@ func TestSweeperContract(t *testing.T) { t.Run("ProtectsLiveDependents", func(t *testing.T) { conformance.RunSweeperProtectsLiveDependents(t, ctx, fixture) }) + t.Run("ProtectsTransitiveLiveDependents", func(t *testing.T) { + conformance.RunSweeperProtectsTransitiveLiveDependents(t, ctx, fixture) + }) t.Run("ProtectsLiveDependentsAcrossPlanes", func(t *testing.T) { conformance.RunSweeperProtectsLiveDependentsAcrossPlanes(t, ctx, fixture) }) diff --git a/internal/storage/uow/sweeper_contract_test.go b/internal/storage/uow/sweeper_contract_test.go index e054b5226..1f43b50eb 100644 --- a/internal/storage/uow/sweeper_contract_test.go +++ b/internal/storage/uow/sweeper_contract_test.go @@ -44,6 +44,9 @@ func TestSweeperContract(t *testing.T) { t.Run("ProtectsLiveDependents", func(t *testing.T) { conformance.RunSweeperProtectsLiveDependents(t, ctx, fixture) }) + t.Run("ProtectsTransitiveLiveDependents", func(t *testing.T) { + conformance.RunSweeperProtectsTransitiveLiveDependents(t, ctx, fixture) + }) t.Run("ProtectsLiveDependentsAcrossPlanes", func(t *testing.T) { conformance.RunSweeperProtectsLiveDependentsAcrossPlanes(t, ctx, fixture) }) diff --git a/internal/workapi/sweep.go b/internal/workapi/sweep.go index 24af4ec50..b8a028c57 100644 --- a/internal/workapi/sweep.go +++ b/internal/workapi/sweep.go @@ -332,18 +332,37 @@ func SweepLiveDependentSources(incoming map[string][]*types.Dependency) []string return ids } -// SweepLiveDependentTargets returns the candidates a live row depends on: the -// targets of protecting edges whose source is in live. +// SweepLiveDependentTargets returns the candidates a live row depends on, +// directly or through other candidates. A protected closed candidate must act +// as live for the next edge up the chain; otherwise an open grandchild keeps +// its closed parent while the same sweep deletes the closed grandparent. func SweepLiveDependentTargets(incoming map[string][]*types.Dependency, live map[string]bool) map[string]bool { - protected := make(map[string]bool) + targetsBySource := make(map[string][]string) for target, deps := range incoming { for _, dep := range deps { - if dep != nil && isSweepProtectingEdge(dep.Type) && live[dep.IssueID] { - protected[target] = true - break + if dep != nil && isSweepProtectingEdge(dep.Type) { + targetsBySource[dep.IssueID] = append(targetsBySource[dep.IssueID], target) } } } + + protected := make(map[string]bool) + queue := make([]string, 0, len(live)) + for id, isLive := range live { + if isLive { + queue = append(queue, id) + } + } + for next := 0; next < len(queue); next++ { + source := queue[next] + for _, target := range targetsBySource[source] { + if protected[target] { + continue + } + protected[target] = true + queue = append(queue, target) + } + } return protected } diff --git a/internal/workapi/sweep_test.go b/internal/workapi/sweep_test.go index af26fd9fb..046da4595 100644 --- a/internal/workapi/sweep_test.go +++ b/internal/workapi/sweep_test.go @@ -430,6 +430,30 @@ func TestSweepLiveDependentsCountOnlyProtectingEdgesFromLiveSources(t *testing.T } } +func TestSweepLiveDependentTargetsPropagatesThroughProtectedCandidates(t *testing.T) { + dep := func(source, target string) *types.Dependency { + return &types.Dependency{IssueID: source, DependsOnID: target, Type: types.DepParentChild} + } + incoming := map[string][]*types.Dependency{ + "root": {dep("middle", "root")}, + "middle": {dep("leaf", "middle")}, + "cycle-a": {dep("cycle-b", "cycle-a")}, + "cycle-b": {dep("cycle-a", "cycle-b")}, + } + + protected := SweepLiveDependentTargets(incoming, map[string]bool{"leaf": true}) + for _, id := range []string{"middle", "root"} { + if !protected[id] { + t.Errorf("%s not protected; it is transitively depended on by a live source", id) + } + } + for _, id := range []string{"cycle-a", "cycle-b"} { + if protected[id] { + t.Errorf("%s protected without a live path into its closed cycle", id) + } + } +} + func TestValidateSweepRequestRefusesANegativeLimit(t *testing.T) { err := ValidateSweepRequest(issueops.SweepRequest{Tier: issueops.SweepEphemeral, Limit: -1}) if !errors.Is(err, issueops.ErrValidation) { diff --git a/npm-package/package.json b/npm-package/package.json index 65257d62f..f0b862a66 100644 --- a/npm-package/package.json +++ b/npm-package/package.json @@ -1,6 +1,6 @@ { "name": "@beads/bd", - "version": "1.3.1", + "version": "1.3.2-rc.1", "description": "Beads issue tracker - lightweight memory system for coding agents with native binary support", "main": "bin/bd.js", "bin": { diff --git a/plugins/beads/.claude-plugin/plugin.json b/plugins/beads/.claude-plugin/plugin.json index 6ca3bc1a1..ec1cca3af 100644 --- a/plugins/beads/.claude-plugin/plugin.json +++ b/plugins/beads/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "beads", "description": "AI-supervised issue tracker for coding workflows. Manage tasks, discover work, and maintain context with simple CLI commands.", - "version": "1.3.1", + "version": "1.3.2-rc.1", "author": { "name": "Steve Yegge", "url": "https://github.com/steveyegge" diff --git a/plugins/beads/.codex-plugin/plugin.json b/plugins/beads/.codex-plugin/plugin.json index 2428a46e1..eba4a392e 100644 --- a/plugins/beads/.codex-plugin/plugin.json +++ b/plugins/beads/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "beads", - "version": "1.3.1", + "version": "1.3.2-rc.1", "description": "AI-supervised issue tracking for coding workflows with agent skills.", "author": { "name": "Steve Yegge", diff --git a/plugins/beads/.copilot-plugin/plugin.json b/plugins/beads/.copilot-plugin/plugin.json index 3ebeccd59..9215cd82a 100644 --- a/plugins/beads/.copilot-plugin/plugin.json +++ b/plugins/beads/.copilot-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "beads", "description": "AI-supervised issue tracker for coding workflows. Manage tasks, discover work, and maintain context with simple CLI commands.", - "version": "1.3.1", + "version": "1.3.2-rc.1", "author": { "name": "Steve Yegge", "url": "https://github.com/steveyegge" diff --git a/scripts/ci/install-golangci-lint.sh b/scripts/ci/install-golangci-lint.sh new file mode 100755 index 000000000..f9c0182ce --- /dev/null +++ b/scripts/ci/install-golangci-lint.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Install the pinned golangci-lint release binary instead of `go install` +# (F5.2): the release tarball drops the install step from about 58s to about +# 3s, because it is a straight download-and-verify rather than a compile. +# CI-only: this script requires $RUNNER_TEMP and $GITHUB_PATH, so the local +# `.githooks/pre-commit` hook keeps using +# `go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.10.1`, +# which needs no change here. `make ci-pr-lint` (scripts/pr-lint) looks up +# whatever `golangci-lint` binary is on PATH; it does not use `go run`. +# +# Keep this version and the sha256 values in sync with CONTRIBUTING.md, +# engdocs/LINTING.md, .github/workflows/pr.yml, .github/workflows/main.yml, +# .github/workflows/ci-measurements.yml and .githooks/pre-commit. Verified +# locally against the release's own golangci-lint-2.10.1-checksums.txt. +readonly version="2.10.1" +readonly max_attempts=3 +readonly retry_delay_seconds=5 + +# A case function rather than `declare -A`: associative arrays need bash 4, +# and macOS's /bin/bash 3.2 silently parses `declare -A` as an indexed array, +# so `[amd64]=` becomes an arithmetic lookup that dies under `set -u` before +# the Linux-only guard below can print its message. +sha256_for_arch() { + case "$1" in + amd64) printf '%s' "dfa775874cf0561b404a02a8f4481fc69b28091da95aa697259820d429b09c99" ;; + arm64) printf '%s' "6652b42ae02915eb2f9cb2a2e0cac99514c8eded8388d88ae3e06e1a52c00de8" ;; + esac +} + +: "${RUNNER_TEMP:?RUNNER_TEMP is required; this script is CI-only}" +: "${GITHUB_PATH:?GITHUB_PATH is required; this script is CI-only}" + +os="$(uname -s | tr '[:upper:]' '[:lower:]')" +if [[ "$os" != "linux" ]]; then + printf 'install-golangci-lint.sh only supports Linux runners, got: %s\n' "$os" >&2 + exit 1 +fi + +arch="$(uname -m)" +case "$arch" in + x86_64 | amd64) arch="amd64" ;; + aarch64 | arm64) arch="arm64" ;; + *) + printf 'Unsupported architecture for pinned golangci-lint install: %s\n' "$arch" >&2 + exit 1 + ;; +esac + +expected_sha256="$(sha256_for_arch "$arch")" +: "${expected_sha256:?no pinned sha256 for arch: $arch}" +readonly asset="golangci-lint-${version}-${os}-${arch}.tar.gz" +readonly url="https://github.com/golangci/golangci-lint/releases/download/v${version}/${asset}" + +workdir="$(mktemp -d)" +trap 'rm -rf "$workdir"' EXIT + +for ((attempt = 1; attempt <= max_attempts; attempt++)); do + # See install-dolt.sh for why the status capture can't live in the `if`. + status=0 + curl -fsSL -o "$workdir/$asset" "$url" || status=$? + if ((status == 0)); then + break + fi + if ((attempt == max_attempts)); then + printf 'Failed to download %s after %d attempts (curl exit %d).\n' "$url" "$max_attempts" "$status" >&2 + exit "$status" + fi + printf 'Failed to download %s (attempt %d/%d); retrying in %d seconds.\n' \ + "$url" "$attempt" "$max_attempts" "$retry_delay_seconds" >&2 + sleep "$retry_delay_seconds" +done + +actual_sha256="$(sha256sum "$workdir/$asset" | awk '{print $1}')" +if [[ "$actual_sha256" != "$expected_sha256" ]]; then + printf '%s sha256 mismatch: got %s, want %s\n' "$asset" "$actual_sha256" "$expected_sha256" >&2 + exit 1 +fi + +tar -xzf "$workdir/$asset" -C "$workdir" + +install_dir="$RUNNER_TEMP/golangci-lint" +mkdir -p "$install_dir" +install -m 0755 "$workdir/golangci-lint-${version}-${os}-${arch}/golangci-lint" "$install_dir/golangci-lint" + +echo "$install_dir" >> "$GITHUB_PATH" + +# Fail loudly if the extracted binary does not report the pinned version: a +# bad tarball layout would otherwise silently put a stale or wrong binary on +# PATH. Compare the version token exactly, as install-dolt.sh does. +installed="$("$install_dir/golangci-lint" version)" +if [[ "$installed" != *"version $version"* ]]; then + printf 'golangci-lint reports "%s", want version %s\n' "$installed" "$version" >&2 + exit 1 +fi +printf 'Installed pinned golangci-lint %s to %s (sha256 %s)\n' "$version" "$install_dir" "$actual_sha256" diff --git a/scripts/ci_workflow_test.go b/scripts/ci_workflow_test.go index b92665797..c7839da49 100644 --- a/scripts/ci_workflow_test.go +++ b/scripts/ci_workflow_test.go @@ -6,6 +6,7 @@ import ( "path/filepath" "reflect" "regexp" + "slices" "strings" "testing" @@ -35,6 +36,46 @@ func TestCIWorkflowArtifactOwnership(t *testing.T) { } } +// TestPullRequestWorkflowsTriggerOnHotfixBranches is the #7148 regression. +// pr.yml's own comment states why release/** is in the pull_request +// trigger: "release-prep and release-fix PRs are based on the release +// branch, not on main. Without it they run almost no CI and the first +// full signal is the tag build, where a failure burns the tag." A hotfix +// backport PR (hotfix/1.3.1 and its siblings) is in exactly that position +// — based on a branch other than main — so it needs the same trigger, +// alongside release/**, not instead of it. +func TestPullRequestWorkflowsTriggerOnHotfixBranches(t *testing.T) { + type triggers struct { + On struct { + PullRequest struct { + Branches []string `yaml:"branches"` + } `yaml:"pull_request"` + } `yaml:"on"` + } + root := sourceRepoRoot(t) + for _, name := range []string{ + "pr.yml", "pr-risk.yml", "conformance.yml", "cross-version-smoke.yml", "regression.yml", + } { + t.Run(name, func(t *testing.T) { + data, err := os.ReadFile(filepath.Join(root, ".github", "workflows", name)) + if err != nil { + t.Fatalf("read %s: %v", name, err) + } + var doc triggers + if err := yaml.Unmarshal(data, &doc); err != nil { + t.Fatal(err) + } + branches := doc.On.PullRequest.Branches + if !slices.Contains(branches, "release/**") { + t.Fatalf("%s pull_request.branches = %v, want release/** present (this test asserts the baseline it extends)", name, branches) + } + if !slices.Contains(branches, "hotfix/**") { + t.Errorf("%s pull_request.branches = %v, want hotfix/** alongside release/** — a hotfix backport PR is based on a branch other than main, same as a release-prep PR", name, branches) + } + }) + } +} + func TestPRCIGateRequiresPolicyAndLintWrappers(t *testing.T) { gate := readCIWorkflow(t, "pr.yml").job(t, "ci-gate") gateEnv := gate.step(t, "Evaluate CI gate").Env