beads/.github/workflows
matt wilkie 21834e720d
feat(doltversion): dolt CLI discovery, hardened version probe, and warn-only version policy (contract part 1) (#5092)
* feat(doltversion): own dolt CLI discovery, hardened probe, and version policy in a leaf package

PR-1 of the dolt CLI install/version contract (design:
mybd reports/2026-07-25-psxg4-dolt-cli-contract-design.md). The dolt
executable managed proxied-server mode spawns was discovered by a bare
exec.LookPath with no override, probed nowhere, and version-checked only
by one advisory archive_level probe; a missing binary erred after
.beads/ creation and an incompatible one died opaquely.

internal/doltversion (stdlib-only) now owns:
- resolution order BEADS_DOLT_BIN env > clone-local sidecar (hook point;
  the sidecar itself lands with identity threading in PR-2) > PATH.
  Explicit values are absolutized before validation (a bare name would
  otherwise validate the cwd file but exec a PATH lookup) and an
  explicitly-named broken binary is an error, never a silent
  fall-through;
- a hardened probe: timeout + process kill, 64KiB output caps,
  unconditional symlink resolution recording given and real paths,
  errno-based exec-format diagnostics naming the likely arch mismatch,
  and file identity captured for later change detection;
- version parsing generalized from the archive_level probe, tolerating
  prerelease/dev suffixes;
- policy: NO hard version floor (adversarial review rejected 2.2.0 as
  policy-without-evidence); RecommendedMin 2.0.0 warns only, backed by
  the 2026-07-25 cross-version matrix run (cross-read of module-written
  storage requires >= 2.0.0). An unparseable version string is likewise
  a warning, not a refusal - the only hard failures are a missing,
  non-executable, or probe-failing binary.

Wired at the two entry points: the managed proxied UOW factory replaces
its bare LookPath and derives archive-level support from the probe it
already ran (no second dolt-version fork on the per-command hot path;
warning is printed once, suppressed under --quiet/--json), and bd init's
proxied preflight fails before any .beads/ write when the binary is
missing or broken (external proxied config is exempt - bd never spawns
that server). doltserver.Start's own bare LookPath is deliberately
untouched here; identity threading through every spawn site is PR-2.

Agent-Signature: claude-fable-5-medium on behalf of matt wilkie
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AQHiBWVPSXDCcUSG9EGw9d

* fix(doltversion): fail closed on prerelease archive_level; dedupe dolt advisory

Two review findings on this PR (see reports/2026-07-26-reviewer-dispatch-sweep.md
#5092 for the adversarial-review reasoning):

1. archive_level fail-open regression (major, re gastownhall/beads#4986).
   newManagedProxiedServerUOWProvider derived archiveLevelSupported straight
   from doltID.Version.AtLeast(MinDoltVersionForArchiveLevelConfig), but
   AtLeast deliberately ignores Version.Prerelease (by design, for the
   separate warn-only RecommendedMin check). That meant a prerelease build
   at or above the floor, e.g. "1.52.1-rc1", satisfied the >= 1.52.1 gate
   and had auto_gc_behavior.archive_level written into the YAML — even
   though the old doltVersionAtLeast (gc_config.go) already failed closed
   for any prerelease-suffixed string via strconv.Atoi. If that prerelease
   build predates the field, dolt sql-server's yaml.UnmarshalStrict refuses
   to start: the exact #4986 regression. Extracted the derivation into
   doltArchiveLevelSupported(id) and added a Prerelease == "" gate, plus
   TestDoltArchiveLevelSupported (table test covering above/at/below the
   floor and prerelease-at/-above-floor) and
   TestDoltArchiveLevelSupported_UnparsedVersionFailsClosed.

2. Duplicate dolt-version advisory (major, UX). `bd init --proxied-server`
   probed and printed the version-recommendation warning twice: once in its
   own preflight (init_proxied_server.go) and again ~90 lines later when
   newProxiedServerUOWProvider reaches newManagedProxiedServerUOWProvider,
   which resolved+probed again. The existing doltVersionWarnOnce didn't
   cover init's own Fprintf. Extracted one shared resolveAndProbeDolt(ctx,
   errPrefix) helper (uow_factory.go) that does resolve + probe +
   once-gated warn, called from both sites; init_proxied_server.go no
   longer needs its own copy of the Resolve/ProbeWithPolicy/error-wrapping
   sequence. This also folds the two call sites' warning gates (previously
   !in.quiet vs !quietFlag && !jsonOutput) into one JSON-mode-safe gate.

Verified: CGO_ENABLED=1 go build -tags gms_pure_go ./... clean;
CGO_ENABLED=1 go vet -tags gms_pure_go ./cmd/bd/... clean; gofmt -l on all
changed files empty; targeted tests pass (TestDoltArchiveLevelSupported,
TestDoltArchiveLevelSupported_UnparsedVersionFailsClosed,
TestNewProxiedServerUOWProvider_RoutesExternalConfigToExternalProvider,
TestNewExternalProxiedServerUOWProvider_*, TestBuildProxiedServerClientInfo,
and internal/doltversion's own suite).

Agent-Signature: builder-unknown-model-unknown-reasoning on behalf of maphew

* test(doltversion): resolve symlinks in RealPath expectations (macOS fix)

TestProbeNormalOutput and TestProbeSymlink failed on macOS CI because
t.TempDir lives under /var/folders, itself a symlink to
/private/var/folders. Probe derives RealPath via filepath.EvalSymlinks,
so it correctly returned the /private/var form while the tests compared
against the raw TempDir path.

Map the expected path through the same EvalSymlinks resolution (new
resolveSymlinks test helper). Verified against a symlinked TMPDIR on
Linux, which reproduced the failure before this change.

Agent-Signature: claude-fable-5-high on behalf of maphew

* refactor(cmd/bd): narrow resolveAndProbeDolt to drop the unused identity return

Upstream removed the archive-level gate from proxied-server mode
(68afa3d51), which was the only consumer of the probed identity at these
call sites; returning it now trips unparam on the PR-introduced line.
PR-2's revalidation consumer re-widens the signature when it lands.

Agent-Signature: claude-fable-5-high on behalf of maphew

* fix(doltversion): cross-process probe cache, PATHEXT completion, daily warning dedup

Review fixes (all three MERGE-AFTER-FIXES items from the 2026-08-10 review):

1. The per-command `dolt version` fork on the store-open hot path is gone
   for the steady state: ProbeWithPolicyCached fronts the fork with a JSON
   cache in the user cache dir, keyed by the binary's (real path, size,
   mtime) fingerprint - the exact fields Identity documents for caching.
   A fingerprint hit costs a stat; any change to the binary re-probes.
   Hard probe errors are never cached, and every cache failure direction
   fails open to the uncached behavior.

2. Windows: an explicit BEADS_DOLT_BIN spelled without its extension now
   completes via exec.LookPath's PATHEXT handling (exact spelled path wins
   when both exist), and the behavioral tests run on Windows through .cmd
   stubs instead of skipping wholesale - plus a focused windows-latest CI
   job (test-windows-liveness pattern) so those branches actually execute
   at PR time. skipOnWindows remains only where the subject genuinely
   doesn't exist there (exec-bit check, symlink creation).

3. The old/unverifiable-version advisory now repeats at most once per day
   (warn stamp in the same cache file) instead of on every bd invocation;
   troubleshooting docs state the cadence.

Nits from the same review: Ctrl-C during the probe no longer prints the
misleading install hint (call site branches on context.Canceled); Probe's
stat branch now uses validateExplicitPath's not-found/not-executable
taxonomy split; ParseVersion documents its trailing-integer laxity and the
tightening required before part-2 enforcement.

Agent-Signature: claude-fable-5-high on behalf of maphew

* fix(doltversion): honor init's local --quiet for the advisory; defer sidecar claim in docs

Cross-vendor review follow-ups: bd init defines a local --quiet that
shadows the persistent flag, so resolveAndProbeDolt now takes quiet as a
parameter (init passes in.quiet || quietFlag) instead of reading the
global; and the troubleshooting entry no longer advertises the clone-local
sidecar resolution source, which is a part-2 hook not yet wired
(SidecarValue is always empty in this PR).

Agent-Signature: claude-fable-5-high on behalf of maphew

* test: stop the Windows counting stub double-counting forks

cmd.exe includes the space before a mid-line '>>' in the written text,
so the batch stub's 'set /p =x >> file' appended two bytes ('x ') per
invocation and forkCount — which counts bytes — read every fork as two.
All four Windows failures were exactly doubled expectations; the cache
itself hit and skipped forks correctly. Lead with the redirection so
exactly one byte lands per invocation.

Agent-Signature: claude-fable-5-high on behalf of maphew
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019CwiLhLbAGZdJtKYT76CPp

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-12 21:18:24 -07:00
..
ci-measurements.yml chore(deps): bump the actions group with 5 updates 2026-08-07 20:49:50 +00:00
conformance.yml ci: give conformance explicit timeout budgets (#5073) 2026-07-28 09:01:39 -07:00
cross-version-smoke.yml build(deps): bump the actions group across 1 directory with 3 updates (#5059) 2026-07-25 19:05:02 -07:00
deploy-pages-redirect.yml build(deps): bump actions/checkout from 7.0.0 to 7.0.1 (#5016) 2026-07-25 08:52:22 -07:00
docs-autofix.yml build(deps): bump actions/checkout from 7.0.0 to 7.0.1 (#5016) 2026-07-25 08:52:22 -07:00
docs-mintlify.yml build(deps): bump the actions group across 1 directory with 3 updates (#5059) 2026-07-25 19:05:02 -07:00
main.yml Make the pre-commit lint gate trustworthy, and stop one main-side lint word from reddening every PR (#5538) 2026-08-10 04:55:55 -07:00
migration-test.yml Guard and qualify historical upgrades to v1.2 (#4907) 2026-08-06 18:45:04 -07:00
nightly.yml build(deps): bump the actions group across 1 directory with 3 updates (#5059) 2026-07-25 19:05:02 -07:00
nix-build.yml chore(deps): bump the actions group with 5 updates 2026-08-07 20:49:50 +00:00
pr-risk.yml chore(deps): bump the actions group with 5 updates 2026-08-07 20:49:50 +00:00
pr.yml feat(doltversion): dolt CLI discovery, hardened version probe, and warn-only version policy (contract part 1) (#5092) 2026-08-12 21:18:24 -07:00
proxied-local-smoke.yml fix(dbproxy): verified identity for the managed proxied-server lifecycle (adoption, cleanup, kills) (#5013) 2026-07-26 12:52:51 -07:00
regression.yml ci: retry Dolt image pulls (bd-m0o1z) (#5228) 2026-08-01 08:18:41 -07:00
release.yml chore(deps): bump the actions group with 5 updates 2026-08-07 20:49:50 +00:00
test-pypi.yml build(deps): bump the actions group across 1 directory with 3 updates (#5059) 2026-07-25 19:05:02 -07:00
update-flake-lock.yml chore(deps): bump the actions group with 5 updates 2026-08-07 20:49:50 +00:00
update-vendor-hash.yml chore(deps): bump the actions group with 5 updates 2026-08-07 20:49:50 +00:00