ci(embedded): run every BEADS_TEST_EMBEDDED_DOLT-gated cmd/bd test in the embedded lane (#7708)

* test(cmd/bd): repair the embedded-gated tests that rotted while no lane ran them

These tests skip unless BEADS_TEST_EMBEDDED_DOLT=1 but no CI lane selected
them, so they rotted unseen. Running them shows:

- TestEventsTailFollowReportsTruncationOnTheStream raced on a plain
  bytes.Buffer that os/exec's copy goroutine writes while the test polls it.
  Use the package's syncBuffer.
- TestCorruptMetadataDiagnosticsRunAndDataFailsLoud still asserted that
  doctor and init run on a corrupt metadata.json. #4857 deliberately made
  every workspace command refuse instead (pinned for doctor by
  TestDoctorRejectsCorruptMetadataBeforeSharedServerChecks). Rewrite it to
  the shipped contract as TestEmbeddedCorruptMetadataFailsLoudUntilRestored:
  version warns, doctor/list/init refuse naming the file without touching
  it, and restoring the file brings the data back.
- dolt_remote_origin_guard_embedded_test.go was tagged
  `embeddeddolt && cgo`, a tag no lane sets, so it never compiled in CI
  (gazelle left it out of bd_test srcs). Retag it `cgo`, as #4153 did for
  its dolt_local_only sibling, and add it to srcs. Drop its four bd doctor
  git-origin tests: bd doctor runs no checks on an embedded workspace
  (GH#3794), so two could never pass and two passed vacuously on empty
  output. Rename the surviving tests into the TestEmbedded* prefix.

Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(embedded): run every BEADS_TEST_EMBEDDED_DOLT-gated cmd/bd test in the embedded lane

The embedded-Dolt cmd lane selected tests with
grep '^func TestEmbedded' cmd/bd/*_embedded_test.go, and only its two
Bazel targets set BEADS_TEST_EMBEDDED_DOLT. A test that skips without the
variable but missed the name prefix or the file suffix skipped in every
lane and reported green: 92 of them, including #7203's --if-revision CLI
coverage (TestIfRevisionMatchAndMismatch, TestReassignFenceCLI, ...).

- embedded-test-shard.sh and gen_embedded_cmd_shard_manifest.py select
  TestEmbedded* by name across cmd/bd/*_test.go, as proxied-test-shard.sh
  does, leaving authors one rule.
- Rename the gated tests into the TestEmbedded* prefix
  (TestDoctorEmbedded<X> -> TestEmbeddedDoctor<X>) and update every
  reference.
- Place the new names with gen_embedded_cmd_shard_manifest.py 100
  --weights=duration --write (incremental).
- Add TestEmbeddedGatedTestsRunInTheEmbeddedLane: it walks cmd/bd's tests
  for any that reach os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" and fails
  if a shard of the lane never lists one. The proxied guard's helpers now
  take the variable and the script; a fixture test pins the walk.

Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Julian Knutsen 2026-10-19 22:02:22 +00:00 • committed by GitHub
commit 8988340994
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
44 changed files with 455 additions and 366 deletions

View file

@ -11,7 +11,7 @@
# 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/*_embedded_test.go. --write is
# 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
@ -59,80 +59,141 @@
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
@ -141,40 +202,62 @@
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
@ -239,6 +322,7 @@
100 71 TestEmbeddedCloseJSONReportsMoleculeAutoClose
100 71 TestEmbeddedInitRoleRoutingExplicitDefault
100 71 TestEmbeddedPrimeChangeDirRedirectNoticeFollowsTarget
100 71 TestEmbeddedRoutedCreateHonorsTheEnvOverrideOverTheTargetsConfig
100 71 TestEmbeddedSearchRoutesAgree
100 72 TestEmbeddedContributorCreateMultiple
@ -349,8 +433,10 @@
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
@ -359,8 +445,10 @@
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

View file

@ -3,7 +3,7 @@
#
# Usage: embedded-test-shard.sh <shard_number> <total_shards>
#
# Discovers all TestEmbedded* top-level functions from cmd/bd/*_embedded_test.go.
# 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
@ -33,8 +33,12 @@ fi
SHARD_INDEX=$(( SHARD_NUMBER - 1 ))
MANIFEST="${BEADS_TEST_SHARD_MANIFEST:-.github/scripts/embedded-cmd-test-shards.txt}"
# Discover all top-level TestEmbedded* functions.
ALL_TESTS=$(grep -rh '^func TestEmbedded' cmd/bd/*_embedded_test.go \
# 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)

View file

@ -760,6 +760,7 @@ go_test(
"dolt_remote_add_test.go",
"dolt_remote_adopt_test.go",
"dolt_remote_json_test.go",
"dolt_remote_origin_guard_embedded_test.go",
"dolt_remote_origin_guard_test.go",
"dolt_remote_remove_proxied_integration_test.go",
"dolt_remote_reset_data_embedded_test.go",
@ -1486,7 +1487,7 @@ go_test(
)
# bd_embedded_test and bd_embedded_part2_test run the TestEmbedded* functions
# of *_embedded_test.go between them: the manifest's 100-shard block
# of cmd/bd's _test.go files between them: the manifest's 100-shard block
# (duration-balanced; see scripts/ci/embedded_cmd_test_durations.json) is
# more than Bazel's 50-shard cap per rule, so bd_embedded_test runs its
# shards 1-50 and bd_embedded_part2_test its shards 51-100

View file

@ -43,7 +43,7 @@ func bdRunOK(t *testing.T, bd, dir string, args ...string) string {
return string(out)
}
// TestReassignFenceCLI drives the bd-98s5c live-claim reassign fence
// TestEmbeddedReassignFenceCLI drives the bd-98s5c live-claim reassign fence
// end-to-end: plain `bd update -a` and `bd assign` were the last unfenced
// cross-actor takeover path (--claim, unclaim, and close all refuse without
// --force). The fence must refuse ONLY the silent steamroll — a different
@ -51,7 +51,7 @@ func bdRunOK(t *testing.T, bd, dir string, args ...string) string {
// leave routine dispatch untouched: open-bead reassigns, self-edits,
// idempotent re-asserts, pool-alias takes, and holder-aware --if-assignee
// transfers all proceed without --force.
func TestReassignFenceCLI(t *testing.T) {
func TestEmbeddedReassignFenceCLI(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -10,7 +10,7 @@ import (
"github.com/steveyegge/beads/internal/types"
)
// TestIfRevisionCloseReplaysMoleculeAutoClose pins mc-zndi7.75 item 1 on the
// TestEmbeddedIfRevisionCloseReplaysMoleculeAutoClose pins mc-zndi7.75 item 1 on the
// embedded/direct --if-revision close route: runCloseDirectIfRevision bypasses
// `bd close`'s batch architecture entirely (A8, beads#4682 — BatchCloseItem
// carries no per-item ExpectedVersion), so it must re-drive molecule auto-close
@ -22,7 +22,7 @@ import (
// state a crash between the final step's close and its root auto-close would
// leave), then re-close the final step — this time guarded — and require the
// stranded-open root to heal.
func TestIfRevisionCloseReplaysMoleculeAutoClose(t *testing.T) {
func TestEmbeddedIfRevisionCloseReplaysMoleculeAutoClose(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -60,12 +60,12 @@ func TestIfRevisionCloseReplaysMoleculeAutoClose(t *testing.T) {
}
}
// TestIfRevisionCloseWarnsOnForcedOpenChildren pins mc-zndi7.75 item 3: the
// TestEmbeddedIfRevisionCloseWarnsOnForcedOpenChildren pins mc-zndi7.75 item 3: the
// "warning: closing X with N open child issue(s) still active" line
// (close.go:194-196) must still print on the guarded direct close route when
// --force waives the engine's open-children refusal, exactly as it does on
// the unguarded batch path.
func TestIfRevisionCloseWarnsOnForcedOpenChildren(t *testing.T) {
func TestEmbeddedIfRevisionCloseWarnsOnForcedOpenChildren(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -10,7 +10,7 @@ import (
)
// TestProxiedServerIfRevisionCloseReplaysMoleculeAutoClose is
// TestIfRevisionCloseReplaysMoleculeAutoClose's proxied-server twin, pinning
// TestEmbeddedIfRevisionCloseReplaysMoleculeAutoClose's proxied-server twin, pinning
// mc-zndi7.75 item 1 on the route `bd serve` actually runs:
// runCloseProxiedIfRevision bypasses the batch entirely (A8, beads#4682), so
// it must re-drive molecule auto-close itself via its own post-close unit of
@ -53,7 +53,7 @@ func TestProxiedServerIfRevisionCloseReplaysMoleculeAutoClose(t *testing.T) {
}
// TestProxiedServerIfRevisionCloseWarnsOnForcedOpenChildren is
// TestIfRevisionCloseWarnsOnForcedOpenChildren's proxied-server twin, pinning
// TestEmbeddedIfRevisionCloseWarnsOnForcedOpenChildren's proxied-server twin, pinning
// mc-zndi7.75 item 3 on the proxied route.
func TestProxiedServerIfRevisionCloseWarnsOnForcedOpenChildren(t *testing.T) {
requireSharedProxiedServer(t)

View file

@ -43,10 +43,10 @@ func runBDSplit(t *testing.T, bd, dir string, args ...string) (stdout, stderr st
return stdoutBuf.String(), stderrBuf.String(), err
}
// TestDoctorEmbeddedSupportedChecks verifies that --check=artifacts,
// TestEmbeddedDoctorSupportedChecks verifies that --check=artifacts,
// --check=conventions, and --check=pollution run in embedded mode rather
// than hitting the "not yet supported" stub (GH#3597).
func TestDoctorEmbeddedSupportedChecks(t *testing.T) {
func TestEmbeddedDoctorSupportedChecks(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -83,11 +83,11 @@ func TestDoctorEmbeddedSupportedChecks(t *testing.T) {
}
}
// TestDoctorEmbeddedUnsupportedJSON verifies that variants which still require
// TestEmbeddedDoctorUnsupportedJSON verifies that variants which still require
// server mode (bare doctor, --check=validate) emit a structured JSON payload
// when --json or --agent --json is set, rather than the prose stub. Tooling
// can detect "unsupported" without text-matching (GH#3597).
func TestDoctorEmbeddedUnsupportedJSON(t *testing.T) {
func TestEmbeddedDoctorUnsupportedJSON(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -150,10 +150,10 @@ func TestDoctorEmbeddedUnsupportedJSON(t *testing.T) {
}
}
// TestDoctorEmbeddedUnsupportedProse verifies that bare bd doctor (without
// TestEmbeddedDoctorUnsupportedProse verifies that bare bd doctor (without
// --json) still emits the human-readable prose stub for terminal users,
// pointing at the supported --check=* variants (GH#3597).
func TestDoctorEmbeddedUnsupportedProse(t *testing.T) {
func TestEmbeddedDoctorUnsupportedProse(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -41,7 +41,7 @@ func bdDoltSeparate(t *testing.T, bd, dir string, args ...string) (string, strin
// -- push --
func TestDoltLocalOnly_Push_ExitsZeroWithMessage(t *testing.T) {
func TestEmbeddedDoltLocalOnly_Push_ExitsZeroWithMessage(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run dolt.local-only embedded tests")
}
@ -62,7 +62,7 @@ func TestDoltLocalOnly_Push_ExitsZeroWithMessage(t *testing.T) {
}
}
func TestDoltLocalOnly_Push_LocalStoreCopy(t *testing.T) {
func TestEmbeddedDoltLocalOnly_Push_LocalStoreCopy(t *testing.T) {
// The push no-op message must include the "Your issues are stored locally" line.
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run dolt.local-only embedded tests")
@ -77,7 +77,7 @@ func TestDoltLocalOnly_Push_LocalStoreCopy(t *testing.T) {
}
}
func TestDoltLocalOnly_Push_JSON_DisabledStatus(t *testing.T) {
func TestEmbeddedDoltLocalOnly_Push_JSON_DisabledStatus(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run dolt.local-only embedded tests")
}
@ -101,7 +101,7 @@ func TestDoltLocalOnly_Push_JSON_DisabledStatus(t *testing.T) {
// -- pull --
func TestDoltLocalOnly_Pull_ExitsZeroWithMessage(t *testing.T) {
func TestEmbeddedDoltLocalOnly_Pull_ExitsZeroWithMessage(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run dolt.local-only embedded tests")
}
@ -122,7 +122,7 @@ func TestDoltLocalOnly_Pull_ExitsZeroWithMessage(t *testing.T) {
}
}
func TestDoltLocalOnly_Pull_JSON_DisabledStatus(t *testing.T) {
func TestEmbeddedDoltLocalOnly_Pull_JSON_DisabledStatus(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run dolt.local-only embedded tests")
}
@ -146,7 +146,7 @@ func TestDoltLocalOnly_Pull_JSON_DisabledStatus(t *testing.T) {
// -- remote add --
func TestDoltLocalOnly_RemoteAdd_RefusesExitOne(t *testing.T) {
func TestEmbeddedDoltLocalOnly_RemoteAdd_RefusesExitOne(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run dolt.local-only embedded tests")
}
@ -169,7 +169,7 @@ func TestDoltLocalOnly_RemoteAdd_RefusesExitOne(t *testing.T) {
}
}
func TestDoltLocalOnly_RemoteAdd_ErrorOnStderr(t *testing.T) {
func TestEmbeddedDoltLocalOnly_RemoteAdd_ErrorOnStderr(t *testing.T) {
// The refusal must go to stderr (not stdout) so agents can distinguish errors.
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run dolt.local-only embedded tests")
@ -189,7 +189,7 @@ func TestDoltLocalOnly_RemoteAdd_ErrorOnStderr(t *testing.T) {
// -- config round-trip --
func TestDoltLocalOnly_ConfigRoundTrip(t *testing.T) {
func TestEmbeddedDoltLocalOnly_ConfigRoundTrip(t *testing.T) {
// bd config set dolt.local-only true / unset must persist via config.yaml.
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run dolt.local-only embedded tests")
@ -215,7 +215,7 @@ func TestDoltLocalOnly_ConfigRoundTrip(t *testing.T) {
// -- bd dolt status --
func TestDoltLocalOnly_DoltStatus_ShowsDisabled(t *testing.T) {
func TestEmbeddedDoltLocalOnly_DoltStatus_ShowsDisabled(t *testing.T) {
// When dolt.local-only=true, bd dolt status must include the indicator line.
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run dolt.local-only embedded tests")

View file

@ -1,21 +1,19 @@
//go:build embeddeddolt && cgo
//go:build cgo
package main
import (
"bytes"
"encoding/json"
"os"
"os/exec"
"strings"
"testing"
)
// Integration tests for be-7eu1d: git-origin collision guard in bd dolt remote
// add and bd doctor (FR-06 to FR-09).
//
// TDD gate tests — these fail before the implementation exists. Run with
// BEADS_TEST_EMBEDDED_DOLT=1.
// Integration tests for be-7eu1d's git-origin collision guard in bd dolt
// remote add (FR-06, FR-07). Its bd doctor half (FR-08, FR-09:
// doctor.CheckDoltRemoteGitOrigin) is server-mode only: bd doctor runs none of
// its checks on an embedded workspace (GH#3794), so it cannot be driven here.
// remoteAdd runs "bd dolt remote add <args>" returning (stdout, stderr, error)
// with separate buffers. Delegates to bdDoltSeparate (dolt_local_only_embedded_test.go).
@ -34,25 +32,11 @@ func setGitOrigin(t *testing.T, dir, url string) {
}
}
// bdDoctorSeparate runs "bd doctor <args>" returning (stdout, stderr, error).
func bdDoctorSeparate(t *testing.T, bd, dir string, args ...string) (string, string, error) {
t.Helper()
fullArgs := append([]string{"doctor"}, args...)
cmd := exec.Command(bd, fullArgs...)
cmd.Dir = dir
cmd.Env = bdEnv(dir)
var stdout, stderr bytes.Buffer
cmd.Stdout = &stdout
cmd.Stderr = &stderr
err := cmd.Run()
return stdout.String(), stderr.String(), err
}
// -- bd dolt remote add: collision with git origin --
// TestDoltRemoteAdd_GitOriginCollision_Exits1 asserts that adding a Dolt remote
// TestEmbeddedDoltRemoteAdd_GitOriginCollision_Exits1 asserts that adding a Dolt remote
// whose URL matches the git origin exits non-zero and prints the refusal message.
func TestDoltRemoteAdd_GitOriginCollision_Exits1(t *testing.T) {
func TestEmbeddedDoltRemoteAdd_GitOriginCollision_Exits1(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded integration tests")
}
@ -75,9 +59,9 @@ func TestDoltRemoteAdd_GitOriginCollision_Exits1(t *testing.T) {
}
}
// TestDoltRemoteAdd_GitOriginCollision_RefusalMessageCopy verifies exact phrases
// TestEmbeddedDoltRemoteAdd_GitOriginCollision_RefusalMessageCopy verifies exact phrases
// from the UX spec (be-fxwbm §2.1) appear in the refusal output.
func TestDoltRemoteAdd_GitOriginCollision_RefusalMessageCopy(t *testing.T) {
func TestEmbeddedDoltRemoteAdd_GitOriginCollision_RefusalMessageCopy(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded integration tests")
}
@ -103,9 +87,9 @@ func TestDoltRemoteAdd_GitOriginCollision_RefusalMessageCopy(t *testing.T) {
}
}
// TestDoltRemoteAdd_AllowGitOrigin_Exits0 asserts that --allow-git-origin
// TestEmbeddedDoltRemoteAdd_AllowGitOrigin_Exits0 asserts that --allow-git-origin
// bypasses the collision guard and exits 0.
func TestDoltRemoteAdd_AllowGitOrigin_Exits0(t *testing.T) {
func TestEmbeddedDoltRemoteAdd_AllowGitOrigin_Exits0(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded integration tests")
}
@ -122,9 +106,9 @@ func TestDoltRemoteAdd_AllowGitOrigin_Exits0(t *testing.T) {
}
}
// TestDoltRemoteAdd_AllowGitOrigin_WarningOnStderr asserts the one-liner warning
// TestEmbeddedDoltRemoteAdd_AllowGitOrigin_WarningOnStderr asserts the one-liner warning
// from be-fxwbm §2.2 appears on stderr when --allow-git-origin is set.
func TestDoltRemoteAdd_AllowGitOrigin_WarningOnStderr(t *testing.T) {
func TestEmbeddedDoltRemoteAdd_AllowGitOrigin_WarningOnStderr(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded integration tests")
}
@ -146,9 +130,9 @@ func TestDoltRemoteAdd_AllowGitOrigin_WarningOnStderr(t *testing.T) {
}
}
// TestDoltRemoteAdd_NoGitOrigin_ProceedsNormally asserts no refusal fires when
// TestEmbeddedDoltRemoteAdd_NoGitOrigin_ProceedsNormally asserts no refusal fires when
// the git repo has no 'origin' remote.
func TestDoltRemoteAdd_NoGitOrigin_ProceedsNormally(t *testing.T) {
func TestEmbeddedDoltRemoteAdd_NoGitOrigin_ProceedsNormally(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded integration tests")
}
@ -167,9 +151,9 @@ func TestDoltRemoteAdd_NoGitOrigin_ProceedsNormally(t *testing.T) {
}
}
// TestDoltRemoteAdd_DifferentURL_ProceedsNormally asserts the guard does not
// TestEmbeddedDoltRemoteAdd_DifferentURL_ProceedsNormally asserts the guard does not
// fire when the Dolt remote URL is different from the git origin.
func TestDoltRemoteAdd_DifferentURL_ProceedsNormally(t *testing.T) {
func TestEmbeddedDoltRemoteAdd_DifferentURL_ProceedsNormally(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded integration tests")
}
@ -190,10 +174,10 @@ func TestDoltRemoteAdd_DifferentURL_ProceedsNormally(t *testing.T) {
}
}
// TestDoltRemoteAdd_LocalOnly_FiresBeforeGuard verifies that when
// TestEmbeddedDoltRemoteAdd_LocalOnly_FiresBeforeGuard verifies that when
// dolt.local-only=true is set, the local-only refusal fires before the
// git-origin guard — the local-only guard takes priority (be-3v2ou ordering).
func TestDoltRemoteAdd_LocalOnly_FiresBeforeGuard(t *testing.T) {
func TestEmbeddedDoltRemoteAdd_LocalOnly_FiresBeforeGuard(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded integration tests")
}
@ -218,130 +202,9 @@ func TestDoltRemoteAdd_LocalOnly_FiresBeforeGuard(t *testing.T) {
}
}
// -- bd doctor: Dolt remote matches git origin --
// TestDoctor_DoltRemoteMatchesGitOrigin_Warning verifies that bd doctor emits a
// warning when a Dolt remote URL matches the git origin.
func TestDoctor_DoltRemoteMatchesGitOrigin_Warning(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded integration tests")
}
t.Parallel()
bd := buildEmbeddedBD(t)
dir, _, _ := bdInit(t, bd, "--prefix", "dw")
originURL := "file:///tmp/origin-collision-for-doctor"
setGitOrigin(t, dir, originURL)
// Add a Dolt remote that matches the git origin (using --allow-git-origin to bypass the guard).
bdDolt(t, bd, dir, "remote", "add", "--allow-git-origin", "origin", originURL)
stdout, _, _ := bdDoctorSeparate(t, bd, dir)
combined := stdout
// Doctor must surface the warning check.
if !strings.Contains(combined, "warning") && !strings.Contains(combined, "Warning") {
t.Errorf("bd doctor: expected warning when Dolt remote matches git origin\noutput:\n%s", combined)
}
if !strings.Contains(combined, "git origin") {
t.Errorf("bd doctor: expected 'git origin' in warning output\noutput:\n%s", combined)
}
}
// TestDoctor_DoltRemoteNoMatch_OK verifies that bd doctor does NOT emit a
// git-origin warning when the Dolt remote URL differs from the git origin.
func TestDoctor_DoltRemoteNoMatch_OK(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded integration tests")
}
t.Parallel()
bd := buildEmbeddedBD(t)
dir, _, _ := bdInit(t, bd, "--prefix", "dn")
setGitOrigin(t, dir, "https://github.com/org/repo.git")
remoteDir := t.TempDir()
bdDolt(t, bd, dir, "remote", "add", "dolt-origin", "file://"+remoteDir)
stdout, _, _ := bdDoctorSeparate(t, bd, dir)
if strings.Contains(stdout, "Dolt remote matches git origin") {
t.Errorf("bd doctor: unexpected git-origin warning when URLs differ\noutput:\n%s", stdout)
}
}
// TestDoctor_NoGitOrigin_OK verifies that bd doctor shows OK for the git-origin
// check when no git origin is configured.
func TestDoctor_NoGitOrigin_OK(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded integration tests")
}
t.Parallel()
bd := buildEmbeddedBD(t)
dir, _, _ := bdInit(t, bd, "--prefix", "ng")
// bdInit creates a git repo but no origin.
remoteDir := t.TempDir()
bdDolt(t, bd, dir, "remote", "add", "dolt-origin", "file://"+remoteDir)
stdout, _, _ := bdDoctorSeparate(t, bd, dir)
// Should not emit a warning for the git-origin check.
if strings.Contains(stdout, "Dolt remote matches git origin") {
t.Errorf("bd doctor: unexpected git-origin warning when no git origin\noutput:\n%s", stdout)
}
}
// TestDoctor_JSON_DoltRemoteMatchesGitOrigin_Warning verifies that
// bd doctor --json exposes the git-origin warning check with "status":"warning".
func TestDoctor_JSON_DoltRemoteMatchesGitOrigin_Warning(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded integration tests")
}
t.Parallel()
bd := buildEmbeddedBD(t)
dir, _, _ := bdInit(t, bd, "--prefix", "dj")
originURL := "file:///tmp/origin-collision-for-json"
setGitOrigin(t, dir, originURL)
bdDolt(t, bd, dir, "remote", "add", "--allow-git-origin", "origin", originURL)
stdout, _, _ := bdDoctorSeparate(t, bd, dir, "--json")
// Output should be JSON array of checks.
var checks []map[string]interface{}
if err := json.Unmarshal([]byte(strings.TrimSpace(stdout)), &checks); err != nil {
// May be wrapped in an outer object — try extracting the checks array.
var outer map[string]interface{}
if jsonErr := json.Unmarshal([]byte(strings.TrimSpace(stdout)), &outer); jsonErr != nil {
t.Fatalf("bd doctor --json: not valid JSON: %v\noutput:\n%s", err, stdout)
}
if arr, ok := outer["checks"].([]interface{}); ok {
data, _ := json.Marshal(arr)
_ = json.Unmarshal(data, &checks)
}
}
found := false
for _, check := range checks {
name, _ := check["name"].(string)
if strings.Contains(name, "git origin") || strings.Contains(name, "Dolt remote") {
found = true
status, _ := check["status"].(string)
if status != "warning" {
t.Errorf("doctor JSON check %q: status = %q, want \"warning\"", name, status)
}
if _, hasFix := check["fix"]; !hasFix {
t.Errorf("doctor JSON check %q: missing \"fix\" field", name)
}
break
}
}
if !found {
t.Errorf("bd doctor --json: no git-origin check found in output\noutput:\n%s", stdout)
}
}
// TestDoltRemoteAdd_JSON_AllowGitOrigin_WarningOnStderr asserts that even in
// TestEmbeddedDoltRemoteAdd_JSON_AllowGitOrigin_WarningOnStderr asserts that even in
// --json mode, the override warning still appears on stderr (not stdout).
func TestDoltRemoteAdd_JSON_AllowGitOrigin_WarningOnStderr(t *testing.T) {
func TestEmbeddedDoltRemoteAdd_JSON_AllowGitOrigin_WarningOnStderr(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded integration tests")
}

View file

@ -56,7 +56,7 @@ func lsRemoteRef(t *testing.T, remoteDir, ref string) string {
return fields[0]
}
func TestDoltRemoteResetData_GitBacked(t *testing.T) {
func TestEmbeddedDoltRemoteResetData_GitBacked(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded integration tests")
}
@ -112,7 +112,7 @@ func TestDoltRemoteResetData_GitBacked(t *testing.T) {
}
}
func TestDoltRemoteResetData_UnknownRemote(t *testing.T) {
func TestEmbeddedDoltRemoteResetData_UnknownRemote(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded integration tests")
}
@ -129,7 +129,7 @@ func TestDoltRemoteResetData_UnknownRemote(t *testing.T) {
}
}
func TestDoltRemoteResetData_CloudRemoteRefused(t *testing.T) {
func TestEmbeddedDoltRemoteResetData_CloudRemoteRefused(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded integration tests")
}

View file

@ -13,7 +13,7 @@ import (
"github.com/steveyegge/beads/internal/storage"
)
// TestAutoPruneBoundsTheJournalAfterAMutatingCommand is the feature as a user
// TestEmbeddedAutoPruneBoundsTheJournalAfterAMutatingCommand is the feature as a user
// meets it: enable the journal, write, and the journal stays inside its floors
// without anyone running `bd events prune`.
//
@ -30,7 +30,7 @@ import (
// because the throttle's persisted watermark is never stamped while auto-prune
// is off, so the next command with it on is the first pass this workspace has
// ever run.
func TestAutoPruneBoundsTheJournalAfterAMutatingCommand(t *testing.T) {
func TestEmbeddedAutoPruneBoundsTheJournalAfterAMutatingCommand(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -117,12 +117,12 @@ func TestAutoPruneBoundsTheJournalAfterAMutatingCommand(t *testing.T) {
}
}
// TestAutoPruneLeavesAnUnboundedJournalAlone. Both floors at 0 is the documented
// TestEmbeddedAutoPruneLeavesAnUnboundedJournalAlone. Both floors at 0 is the documented
// way to keep every record, and it is also the configuration the truncation
// tests run under — so a maintenance pass that ignored it would quietly delete
// the history those tests (and any consumer that chose an unbounded ledger)
// depend on.
func TestAutoPruneLeavesAnUnboundedJournalAlone(t *testing.T) {
func TestEmbeddedAutoPruneLeavesAnUnboundedJournalAlone(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -158,7 +158,7 @@ func TestAutoPruneLeavesAnUnboundedJournalAlone(t *testing.T) {
}
}
// TestAutoPruneRespectsBdConfigSet drives the whole retention story through
// TestEmbeddedAutoPruneRespectsBdConfigSet drives the whole retention story through
// `bd config set` rather than the environment.
//
// The four events-journal keys are startup settings read through viper before
@ -167,7 +167,7 @@ func TestAutoPruneLeavesAnUnboundedJournalAlone(t *testing.T) {
// `bd config set events-journal true` reported success and changed nothing.
// A new key is one YamlOnlyKeys entry away from repeating it, and the symptom
// is invisible: retention that silently keeps whatever the default was.
func TestAutoPruneRespectsBdConfigSet(t *testing.T) {
func TestEmbeddedAutoPruneRespectsBdConfigSet(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -221,7 +221,7 @@ func TestAutoPruneRespectsBdConfigSet(t *testing.T) {
}
}
// TestAutoPruneDoesNotRunForReadOnlyCommands. The trigger is writer-pays, and
// TestEmbeddedAutoPruneDoesNotRunForReadOnlyCommands. The trigger is writer-pays, and
// three separate gates keep it that way — each one covered here by a command
// that would prune the journal without it:
//
@ -236,7 +236,7 @@ func TestAutoPruneRespectsBdConfigSet(t *testing.T) {
// - `bd migrate --dry-run` is a PREVIEW. It promised not to mutate and holds
// a write-refusing store; maintenance must not be the one write it
// performs.
func TestAutoPruneDoesNotRunForReadOnlyCommands(t *testing.T) {
func TestEmbeddedAutoPruneDoesNotRunForReadOnlyCommands(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -34,7 +34,7 @@ func runBDOut(t *testing.T, bd, dir string, env []string, args ...string) (strin
return stdout.String(), stderr.String()
}
// TestDeleteJournalsTheRequestingActor is #5985's repro, verbatim: create two
// TestEmbeddedDeleteJournalsTheRequestingActor is #5985's repro, verbatim: create two
// beads with an edge between them, delete the blocker with an explicit --actor,
// and read the journal back. Both the delete record and the cascade dep_remove
// record must name that actor.
@ -42,7 +42,7 @@ func runBDOut(t *testing.T, bd, dir string, env []string, args ...string) (strin
// The whole route is exercised — cobra flag to journal column — because the
// actor is resolved, threaded through the role, and written by the storage
// seam, and a unit test at any one of those cannot see the drop at the next.
func TestDeleteJournalsTheRequestingActor(t *testing.T) {
func TestEmbeddedDeleteJournalsTheRequestingActor(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -92,13 +92,13 @@ func TestDeleteJournalsTheRequestingActor(t *testing.T) {
}
}
// TestEventsReadNoticesADisabledJournal pins the "nothing to read and no way to
// TestEmbeddedEventsReadNoticesADisabledJournal pins the "nothing to read and no way to
// tell why" fix. A workspace that never enabled the journal serves an empty
// export forever, which a consumer cannot distinguish from being caught up, so
// the read says so on stderr — and keeps stdout clean and the exit status zero,
// because exporting a historical ledger from a now-disabled workspace is
// legitimate.
func TestEventsReadNoticesADisabledJournal(t *testing.T) {
func TestEmbeddedEventsReadNoticesADisabledJournal(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -118,7 +118,7 @@ func eventsJournalMaintenanceRunnerFor(plumbing any) issueops.EventsMaintenanceR
// with OpenForReadOnlyCommand, which is "otherwise a normal writable
// store", so nothing underneath refuses a maintenance delete. Drop this
// check and `bd list` prunes the journal — which
// TestAutoPruneDoesNotRunForReadOnlyCommands catches.
// TestEmbeddedAutoPruneDoesNotRunForReadOnlyCommands catches.
//
// Two more gates are specific to this trigger:
//

View file

@ -57,7 +57,7 @@ func TestProxiedServerServeActivatesTheEventsJournal(t *testing.T) {
}
}
// TestRoutedCreateJournalsIntoTheTargetWorkspace covers the cross-workspace
// TestEmbeddedRoutedCreateJournalsIntoTheTargetWorkspace covers the cross-workspace
// store: `bd create --repo <other>` opens a SECOND store for another workspace
// and writes the bead there.
//
@ -65,7 +65,7 @@ func TestProxiedServerServeActivatesTheEventsJournal(t *testing.T) {
// TARGET's own config.yaml, so a workspace that enabled the journal gets its
// mutations recorded no matter which directory bd was launched from — and the
// launching workspace, which enabled nothing, records nothing of its own.
func TestRoutedCreateJournalsIntoTheTargetWorkspace(t *testing.T) {
func TestEmbeddedRoutedCreateJournalsIntoTheTargetWorkspace(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -120,13 +120,13 @@ func TestRoutedCreateJournalsIntoTheTargetWorkspace(t *testing.T) {
}
}
// TestRoutedCreateHonorsTheEnvOverrideOverTheTargetsConfig is the precedence
// TestEmbeddedRoutedCreateHonorsTheEnvOverrideOverTheTargetsConfig is the precedence
// half. BD_EVENTS_JOURNAL is the documented way to turn the journal on for a
// process without editing a workspace, and a routed write is exactly where an
// operator reaches for it — so a target whose config.yaml says false must not
// be able to veto it. Getting this backwards makes the env var a suggestion,
// and the operator finds out by discovering an empty journal later.
func TestRoutedCreateHonorsTheEnvOverrideOverTheTargetsConfig(t *testing.T) {
func TestEmbeddedRoutedCreateHonorsTheEnvOverrideOverTheTargetsConfig(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -3,7 +3,6 @@
package main
import (
"bytes"
"encoding/json"
"fmt"
"os"
@ -16,7 +15,7 @@ import (
"github.com/steveyegge/beads/internal/storage"
)
// TestEventsTailReportsTruncationToTheCLI is the end-to-end guard for the
// TestEmbeddedEventsTailReportsTruncationToTheCLI is the end-to-end guard for the
// retention boundary as a consumer actually meets it: through the binary, not
// through the store API.
//
@ -27,7 +26,7 @@ import (
// that; this one fails if either path regresses. It also proves the whole
// config chain end to end: BD_EVENTS_JOURNAL turns the journal on, and the two
// BD_EVENTS_JOURNAL_RETAIN_* floors reach the prune.
func TestEventsTailReportsTruncationToTheCLI(t *testing.T) {
func TestEmbeddedEventsTailReportsTruncationToTheCLI(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -109,7 +108,7 @@ func TestEventsTailReportsTruncationToTheCLI(t *testing.T) {
}
}
// TestEventsTailFollowReportsTruncationOnTheStream covers the OTHER read call
// TestEmbeddedEventsTailFollowReportsTruncationOnTheStream covers the OTHER read call
// site: the --follow poll, which the one-shot test above cannot reach.
//
// A follower is the consumer most exposed to a prune — it is the one sitting
@ -120,7 +119,7 @@ func TestEventsTailReportsTruncationToTheCLI(t *testing.T) {
// it interrupts. The consumer on the other end is a line reader; a
// pretty-printed multi-line object in the middle of its input is unparseable,
// and it would see the stream stop with garbage after the last good record.
func TestEventsTailFollowReportsTruncationOnTheStream(t *testing.T) {
func TestEmbeddedEventsTailFollowReportsTruncationOnTheStream(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -163,7 +162,7 @@ func TestEventsTailFollowReportsTruncationOnTheStream(t *testing.T) {
follow := exec.Command(bd, "events", "tail", "--since", "0", "--limit", "1", "--follow", "--json")
follow.Dir = dir
follow.Env = env
var stdout, stderr bytes.Buffer
var stdout, stderr syncBuffer
follow.Stdout = &stdout
follow.Stderr = &stderr
if err := follow.Start(); err != nil {
@ -226,11 +225,11 @@ func TestEventsTailFollowReportsTruncationOnTheStream(t *testing.T) {
}
}
// TestEventsPruneHonorsRetainRowsFloorFromConfig proves the shipped defaults
// TestEmbeddedEventsPruneHonorsRetainRowsFloorFromConfig proves the shipped defaults
// reach the CLI: a `prune --before <huge>` on a workspace that configured no
// floors of its own must be stopped by the built-in retain-rows floor rather
// than deleting the whole journal and stranding its consumer.
func TestEventsPruneHonorsRetainRowsFloorFromConfig(t *testing.T) {
func TestEmbeddedEventsPruneHonorsRetainRowsFloorFromConfig(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -47,9 +47,9 @@ func parseExportedIssues(t *testing.T, jsonl string) []*types.Issue {
return issues
}
// TestExportExcludeOwner_flag verifies that bd export --exclude-owner=<name>
// TestEmbeddedExportExcludeOwner_flag verifies that bd export --exclude-owner=<name>
// filters out issues created_by that identity from the export.
func TestExportExcludeOwner_flag(t *testing.T) {
func TestEmbeddedExportExcludeOwner_flag(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -86,9 +86,9 @@ func TestExportExcludeOwner_flag(t *testing.T) {
}
}
// TestExportExcludeOwner_config verifies that export.exclude_owners config
// TestEmbeddedExportExcludeOwner_config verifies that export.exclude_owners config
// filters issues without a command-line flag.
func TestExportExcludeOwner_config(t *testing.T) {
func TestEmbeddedExportExcludeOwner_config(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -115,8 +115,8 @@ func TestExportExcludeOwner_config(t *testing.T) {
}
}
// TestExportExcludeOwner_verbose verifies that --verbose emits a filtered count message.
func TestExportExcludeOwner_verbose(t *testing.T) {
// TestEmbeddedExportExcludeOwner_verbose verifies that --verbose emits a filtered count message.
func TestEmbeddedExportExcludeOwner_verbose(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -151,12 +151,12 @@ func TestExportExcludeOwner_verbose(t *testing.T) {
}
}
// TestAutoExportExcludeOwner_config is a regression test for the maphew review
// TestEmbeddedAutoExportExcludeOwner_config is a regression test for the maphew review
// of PR #4023 (be-e2nb): the export.exclude_owners safety net must also apply to
// the git-committed auto-export (.beads/issues.jsonl), not only to manual
// `bd export`. Before the fix, contributor/personal issues that the manual path
// excludes could still leak into git history and PRs via auto-export.
func TestAutoExportExcludeOwner_config(t *testing.T) {
func TestEmbeddedAutoExportExcludeOwner_config(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -21,7 +21,7 @@ import (
"github.com/steveyegge/beads/internal/storage/schema"
)
// TestPersistentPreRunLogsAndSkipsIdentityCheckForFreshEmbeddedWorkspace is
// TestEmbeddedPersistentPreRunLogsAndSkipsIdentityCheckForFreshEmbeddedWorkspace is
// the MINOR-criterion regression test for be-0gfcs round 2 (be-3bt2e): a
// brand-new workspace -- metadata.json present, but no embedded database on
// disk yet -- is the one previewErr case the identity check has always
@ -32,7 +32,7 @@ import (
// This exercises a real embedded-Dolt bootstrap (schema init on first open),
// so it is opt-in like the other embedded-dolt integration tests in this
// package: set BEADS_TEST_EMBEDDED_DOLT=1 to run it.
func TestPersistentPreRunLogsAndSkipsIdentityCheckForFreshEmbeddedWorkspace(t *testing.T) {
func TestEmbeddedPersistentPreRunLogsAndSkipsIdentityCheckForFreshEmbeddedWorkspace(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -120,7 +120,7 @@ func TestPersistentPreRunLogsAndSkipsIdentityCheckForFreshEmbeddedWorkspace(t *t
}
}
// TestIdentityGateRendersSchemaSkewFromForwardDriftedWorkspace pins the
// TestEmbeddedIdentityGateRendersSchemaSkewFromForwardDriftedWorkspace pins the
// preview→skew WIRE, which TestRefuseUnverifiablePreviewOpenRendersTypedErrors
// deliberately does not: that test hands refuseUnverifiablePreviewOpen a
// hand-built *schema.SchemaSkewError, so it pins the renderer in isolation.
@ -136,7 +136,7 @@ func TestPersistentPreRunLogsAndSkipsIdentityCheckForFreshEmbeddedWorkspace(t *t
//
// This bootstraps a real embedded-Dolt database, so it is opt-in on the same
// tier as the sibling above: set BEADS_TEST_EMBEDDED_DOLT=1 to run it.
func TestIdentityGateRendersSchemaSkewFromForwardDriftedWorkspace(t *testing.T) {
func TestEmbeddedIdentityGateRendersSchemaSkewFromForwardDriftedWorkspace(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -55,10 +55,10 @@ func bdShowRevision(t *testing.T, bd, dir, id string) int64 {
func revStr(rev int64) string { return strconv.FormatInt(rev, 10) }
// TestIfRevisionAdvertisedOnFourVerbs pins T4.1: --if-revision is a real,
// TestEmbeddedIfRevisionAdvertisedOnFourVerbs pins T4.1: --if-revision is a real,
// documented flag on all four verbs A8 adds it to, not an undocumented side
// channel a caller has to discover by reading source.
func TestIfRevisionAdvertisedOnFourVerbs(t *testing.T) {
func TestEmbeddedIfRevisionAdvertisedOnFourVerbs(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -77,11 +77,11 @@ func TestIfRevisionAdvertisedOnFourVerbs(t *testing.T) {
}
}
// TestIfRevisionMatchAndMismatch pins T4.2 across all four verbs: a stale
// TestEmbeddedIfRevisionMatchAndMismatch pins T4.2 across all four verbs: a stale
// --if-revision token exits ExitGuardMismatch (13) and writes nothing at all
// (not the field, not the revision itself); the same token, once it is the
// issue's CURRENT revision, applies the write and the revision moves again.
func TestIfRevisionMatchAndMismatch(t *testing.T) {
func TestEmbeddedIfRevisionMatchAndMismatch(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -196,7 +196,7 @@ func TestIfRevisionMatchAndMismatch(t *testing.T) {
})
}
// TestIfRevisionDeletePreflightGoneIsPreconditionFailed pins mc-zndi7.81: `bd
// TestEmbeddedIfRevisionDeletePreflightGoneIsPreconditionFailed pins mc-zndi7.81: `bd
// delete`'s single-id path resolves the row with resolveAndGetIssueForMutation
// BEFORE calling deleter.Delete() and the per-id lock fence #7244 added. On a
// real Dolt sql-server, a same-token --if-revision racer that loses that fence
@ -211,7 +211,7 @@ func TestIfRevisionMatchAndMismatch(t *testing.T) {
// winning racer's delete would), then present that now-stale token. The
// pre-flight existence check must fail exactly the same way a mid-guard
// version mismatch does.
func TestIfRevisionDeletePreflightGoneIsPreconditionFailed(t *testing.T) {
func TestEmbeddedIfRevisionDeletePreflightGoneIsPreconditionFailed(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -392,7 +392,7 @@ func TestEmbeddedIfRevisionPreflightGoneIsPreconditionFailedOnEveryVerb(t *testi
})
}
// TestIfRevisionCascadeDelete pins mc-zndi7.76 (gap 4): a single named id with
// TestEmbeddedIfRevisionCascadeDelete pins mc-zndi7.76 (gap 4): a single named id with
// --cascade takes the SAME deleteBatch path a multi-id delete does
// (cmd/bd/delete.go:105, "len(issueIDs) > 1 || cascade"), which is the only
// way a single-id --if-revision request ever reaches deleteBatch's own
@ -405,7 +405,7 @@ func TestEmbeddedIfRevisionPreflightGoneIsPreconditionFailedOnEveryVerb(t *testi
// concurrent delete removed before deleteBatch resolves it is
// TestEmbeddedIfRevisionPreflightGoneIsPreconditionFailedOnEveryVerb's
// delete_cascade row.
func TestIfRevisionCascadeDelete(t *testing.T) {
func TestEmbeddedIfRevisionCascadeDelete(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -459,11 +459,11 @@ func TestIfRevisionCascadeDelete(t *testing.T) {
bdShowFail(t, bd, dir, child.ID)
}
// TestIfRevisionComposesWithIfAssigneeIfStatus pins T4.5: on `bd update`,
// TestEmbeddedIfRevisionComposesWithIfAssigneeIfStatus pins T4.5: on `bd update`,
// --if-revision composes with --if-assignee/--if-status as a conjunction —
// every guard present must hold, not just one of them, regardless of which
// guard happens to be the stale one.
func TestIfRevisionComposesWithIfAssigneeIfStatus(t *testing.T) {
func TestEmbeddedIfRevisionComposesWithIfAssigneeIfStatus(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -516,13 +516,13 @@ func TestIfRevisionComposesWithIfAssigneeIfStatus(t *testing.T) {
})
}
// TestIfRevisionRejectsLabelAndParentEdits pins T4.6: `bd update --if-revision`
// TestEmbeddedIfRevisionRejectsLabelAndParentEdits pins T4.6: `bd update --if-revision`
// (alone or composed with --if-assignee/--if-status) refuses when the ONLY
// edit riding with it is a label or parent change, because those edits do not
// run inside the guarded issues-row write. Refused before any write, exit 1
// (a flag-validation refusal, never 13 — 13 is reserved for an actual stale
// guard).
func TestIfRevisionRejectsLabelAndParentEdits(t *testing.T) {
func TestEmbeddedIfRevisionRejectsLabelAndParentEdits(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -562,12 +562,12 @@ func TestIfRevisionRejectsLabelAndParentEdits(t *testing.T) {
})
}
// TestIfRevisionMultiIDRejected pins T4.8 on the three verbs that accept more
// TestEmbeddedIfRevisionMultiIDRejected pins T4.8 on the three verbs that accept more
// than one id (assign is cobra.ExactArgs(2): id + assignee, so it can never
// carry a second id). A single --if-revision token names one row's version;
// refused before any write rather than applying it to only the first id a
// batch happens to resolve.
func TestIfRevisionMultiIDRejected(t *testing.T) {
func TestEmbeddedIfRevisionMultiIDRejected(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -633,14 +633,14 @@ func TestIfRevisionMultiIDRejected(t *testing.T) {
})
}
// TestRevisionRemintMatrix pins T4.10: the revision is a token over the
// TestEmbeddedRevisionRemintMatrix pins T4.10: the revision is a token over the
// issues-row write, not over "anything happened to this id". A field update,
// a metadata edit, a close and a reopen must each mint a fresh revision (so a
// caller who read one of those as "no-op" cannot keep replaying a now-stale
// --if-revision); a label edit, a dependency edit and the derived is_blocked
// flag must NOT, because none of those touch the issues-row write the token
// guards.
func TestRevisionRemintMatrix(t *testing.T) {
func TestEmbeddedRevisionRemintMatrix(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -112,9 +112,9 @@ func gcClassifyAsPrecondition(out []byte, errText string) (ok bool, expected, cu
// cover, pinning the 2026-10 Opus-review BLOCKER fix end-to-end: gc's own
// classifier logic, not just bd's JSON shape in isolation, must recognize the
// refusal as a precondition with the caller's expected revision and bd's
// current one. The TestEmbedded name in an *_embedded_test.go file is what
// puts it in a CI lane: .github/scripts/embedded-test-shard.sh discovers
// tests by exactly that pair, and under any other name it skips everywhere.
// current one. The TestEmbedded name is what puts it in a CI lane:
// .github/scripts/embedded-test-shard.sh discovers tests by that prefix, and
// under any other name it skips everywhere.
func TestEmbeddedGCConditionalMatcherDecode(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")

View file

@ -8,7 +8,7 @@ import (
"testing"
)
// TestIfRevisionOutranksReassignFenceCLI pins mc-zndi7.74 on the direct
// TestEmbeddedIfRevisionOutranksReassignFenceCLI pins mc-zndi7.74 on the direct
// (embedded) route: a stale --if-revision guard on an assignee edit must
// report precondition_failed/ExitGuardMismatch, never fall through to the
// bd-98s5c live-claim reassign fence's "already claimed" policy refusal --
@ -22,7 +22,7 @@ import (
// the now-live foreign claim and reports the plain policy refusal (exit 1)
// before the guarded write underneath ever gets a chance to report the
// correctly-ordered precondition failure (exit 13).
func TestIfRevisionOutranksReassignFenceCLI(t *testing.T) {
func TestEmbeddedIfRevisionOutranksReassignFenceCLI(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -48,7 +48,7 @@ func proxiedRevStr(rev int64) string { return strconv.FormatInt(rev, 10) }
// TestProxiedServerIfRevisionOutranksReassignFence pins mc-zndi7.74 on the
// proxied-server route, the topology where this race actually happens: every
// shared-dolt-server clone writes through it. See
// TestIfRevisionOutranksReassignFenceCLI's doc for the full race shape —
// TestEmbeddedIfRevisionOutranksReassignFenceCLI's doc for the full race shape —
// this is the same scenario, proved against the real shared Dolt server
// instead of embedded Dolt.
func TestProxiedServerIfRevisionOutranksReassignFence(t *testing.T) {

View file

@ -84,7 +84,7 @@ func provisionChunkStore(t *testing.T) storage.DoltStorage {
// End-to-end against the real engine: a mid-import failure leaves a committed,
// queryable prefix, and re-running the same import converges — every row
// present, cross-chunk dependencies wired, no duplicated events.
func TestImportChunkedRealStoreResumeConverges(t *testing.T) {
func TestEmbeddedImportChunkedRealStoreResumeConverges(t *testing.T) {
requireEmbeddedDolt(t)
setImportChunkSize(t, 5)
recordImportPauses(t)
@ -179,7 +179,7 @@ func TestImportChunkedRealStoreResumeConverges(t *testing.T) {
// edges its import file declares must be visible too. This is the red-team
// ready-window finding: the previous two-phase layout committed every row
// dep-less first, so `bd ready` mid-import offered blocked work for dispatch.
func TestImportChunkedNoReadyWindowAtAnyFreezePoint(t *testing.T) {
func TestEmbeddedImportChunkedNoReadyWindowAtAnyFreezePoint(t *testing.T) {
requireEmbeddedDolt(t)
setImportChunkSize(t, 5)
recordImportPauses(t)
@ -251,7 +251,7 @@ func TestImportChunkedNoReadyWindowAtAnyFreezePoint(t *testing.T) {
// but the no-ready-window invariant must hold there too — otherwise the
// dependent commits ready-without-blocker for the rest of the import. Regression
// for the attempt-1 review finding.
func TestImportChunkedNoReadyWindowWithReadinessEdgeIntoCycle(t *testing.T) {
func TestEmbeddedImportChunkedNoReadyWindowWithReadinessEdgeIntoCycle(t *testing.T) {
requireEmbeddedDolt(t)
setImportChunkSize(t, 5)
recordImportPauses(t)
@ -339,7 +339,7 @@ func TestImportChunkedNoReadyWindowWithReadinessEdgeIntoCycle(t *testing.T) {
// Ordering the spawner inline with the waiter is not enough; every in-batch
// child of a waited spawner must be emitted no later than the waiter. Regression
// for the attempt-2 review blocker.
func TestImportChunkedWaitsForChildImportedLaterStaysBlocked(t *testing.T) {
func TestEmbeddedImportChunkedWaitsForChildImportedLaterStaysBlocked(t *testing.T) {
requireEmbeddedDolt(t)
setImportChunkSize(t, 5)
recordImportPauses(t)
@ -421,7 +421,7 @@ func (r *raceInjectingStore) CreateIssuesWithFullOptions(ctx context.Context, is
// the row away). The dependency pass must wire edges for every row phase 1
// accepted, regardless of later row-level updates, and must not clobber the
// concurrent write.
func TestImportChunkedConcurrentUpdateKeepsDeferredDeps(t *testing.T) {
func TestEmbeddedImportChunkedConcurrentUpdateKeepsDeferredDeps(t *testing.T) {
requireEmbeddedDolt(t)
setImportChunkSize(t, 5)
recordImportPauses(t)
@ -483,7 +483,7 @@ func TestImportChunkedConcurrentUpdateKeepsDeferredDeps(t *testing.T) {
// update racing the import must leave the blocking edge intact. With ordered
// inline wiring the row and its edge commit atomically, so no interleaving of
// row-level updates can separate them.
func TestImportChunkedConcurrentUpdateKeepsBlockingDeps(t *testing.T) {
func TestEmbeddedImportChunkedConcurrentUpdateKeepsBlockingDeps(t *testing.T) {
requireEmbeddedDolt(t)
setImportChunkSize(t, 5)
recordImportPauses(t)
@ -532,7 +532,7 @@ func TestImportChunkedConcurrentUpdateKeepsBlockingDeps(t *testing.T) {
// the pre-filter read and the row's chunk), the snapshot's deferred deps must
// stay out too. This is why the dependency pass cannot simply run everything
// with ConflictSkip: it must be restricted to rows phase 1 accepted.
func TestImportChunkedStaleRejectedRowKeepsDeferredDepsOut(t *testing.T) {
func TestEmbeddedImportChunkedStaleRejectedRowKeepsDeferredDepsOut(t *testing.T) {
requireEmbeddedDolt(t)
setImportChunkSize(t, 5)
recordImportPauses(t)
@ -593,7 +593,7 @@ func TestImportChunkedStaleRejectedRowKeepsDeferredDepsOut(t *testing.T) {
// straddling a chunk boundary must be wired, not skip-reported, and a
// same-bucket wisp -> wisp edge straddling the same boundary must survive as
// before. Every export→import used to lose such edges for good.
func TestImportChunkedMixedRegularWispCrossBucketEdgesWired(t *testing.T) {
func TestEmbeddedImportChunkedMixedRegularWispCrossBucketEdgesWired(t *testing.T) {
requireEmbeddedDolt(t)
setImportChunkSize(t, 5)
recordImportPauses(t)
@ -696,7 +696,7 @@ func TestImportChunkedMixedRegularWispCrossBucketEdgesWired(t *testing.T) {
// durable and the deferred one is not yet; re-running the same import must
// backfill it with nothing skip-reported, and a further run must be a no-op
// for the edges.
func TestImportChunkedCrossBucketBlocksEdgesResumeBackfills(t *testing.T) {
func TestEmbeddedImportChunkedCrossBucketBlocksEdgesResumeBackfills(t *testing.T) {
requireEmbeddedDolt(t)
setImportChunkSize(t, 4)
recordImportPauses(t)

View file

@ -2783,7 +2783,7 @@ func isBootstrapPreviewErr(err error) bool {
// Extracted from the gate's default arm so both halves are directly testable
// without standing up a forward-drifted workspace; the wire itself is pinned on
// the embedded tier by
// TestIdentityGateRendersSchemaSkewFromForwardDriftedWorkspace.
// TestEmbeddedIdentityGateRendersSchemaSkewFromForwardDriftedWorkspace.
func refuseUnverifiablePreviewOpen(previewErr error) error {
if handleFreshCloneError(previewErr) {
return SilentExit()

View file

@ -46,9 +46,9 @@ func setupContributorRouting(t *testing.T, bd, dir string) string {
return planningDir
}
// TestMigratePersonal_noopWhenEmpty verifies that migrate-personal with no
// TestEmbeddedMigratePersonal_noopWhenEmpty verifies that migrate-personal with no
// matching issues exits 0 and reports nothing to migrate.
func TestMigratePersonal_noopWhenEmpty(t *testing.T) {
func TestEmbeddedMigratePersonal_noopWhenEmpty(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -71,9 +71,9 @@ func TestMigratePersonal_noopWhenEmpty(t *testing.T) {
}
}
// TestMigratePersonal_movesIssues verifies that migrate-personal moves issues
// TestEmbeddedMigratePersonal_movesIssues verifies that migrate-personal moves issues
// matching the current git identity to the planning repo.
func TestMigratePersonal_movesIssues(t *testing.T) {
func TestEmbeddedMigratePersonal_movesIssues(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -119,9 +119,9 @@ func TestMigratePersonal_movesIssues(t *testing.T) {
_ = planningDir
}
// TestMigratePersonal_abortOnNoConfirm verifies that without --yes, the command
// TestEmbeddedMigratePersonal_abortOnNoConfirm verifies that without --yes, the command
// prompts and aborts when stdin signals no confirmation (EOF).
func TestMigratePersonal_abortOnNoConfirm(t *testing.T) {
func TestEmbeddedMigratePersonal_abortOnNoConfirm(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -162,13 +162,13 @@ func TestMigratePersonal_abortOnNoConfirm(t *testing.T) {
}
}
// TestMigratePersonal_preservesComments is a regression test for the maphew
// TestEmbeddedMigratePersonal_preservesComments is a regression test for the maphew
// review of PR #4023 (be-e2nb): migrate-personal must copy comments as
// structured rows (ImportIssueComment) so they survive in the planning repo.
// The pre-fix code used AddComment, which records an event-style entry that
// GetIssueComments never returns — silently dropping the migrated issue's
// comments.
func TestMigratePersonal_preservesComments(t *testing.T) {
func TestEmbeddedMigratePersonal_preservesComments(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -211,14 +211,14 @@ func TestMigratePersonal_preservesComments(t *testing.T) {
}
}
// TestCopyIssueRelations_preservesCommentWithTimestamp is the in-process proof
// TestEmbeddedCopyIssueRelations_preservesCommentWithTimestamp is the in-process proof
// for the maphew review of PR #4023 (be-e2nb). The full migrate-personal command
// can't run in the embedded harness because its planning store uses the
// server-based Dolt store, so this drives the helper directly against two
// embedded stores: a comment must land in the destination as a structured row
// (returned by GetIssueComments) preserving its original timestamp, not be lost
// as an event-style AddComment entry.
func TestCopyIssueRelations_preservesCommentWithTimestamp(t *testing.T) {
func TestEmbeddedCopyIssueRelations_preservesCommentWithTimestamp(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -13,7 +13,7 @@ import (
"github.com/steveyegge/beads/internal/storage/schema"
)
// TestMigrateSchema_IdentityMismatchRefusesBeforeApplying reproduces be-0gfcs:
// TestEmbeddedMigrateSchema_IdentityMismatchRefusesBeforeApplying reproduces be-0gfcs:
// bd migrate schema's workspace-identity guard (validateWorkspaceIdentity)
// runs AFTER the shared pre-run has already opened the store and let the
// smart gate auto-apply a pending schema migration as a side effect. The
@ -22,7 +22,7 @@ import (
// schema_migrations. The fix must make the identity check run before (or
// otherwise gate) that auto-apply, so a refused migrate leaves the schema
// cursor untouched.
func TestMigrateSchema_IdentityMismatchRefusesBeforeApplying(t *testing.T) {
func TestEmbeddedMigrateSchema_IdentityMismatchRefusesBeforeApplying(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -13,11 +13,11 @@ import (
"github.com/steveyegge/beads/internal/validation"
)
// TestSpawnMolecule_PreservesStepLabels verifies that a cooked formula with
// TestEmbeddedSpawnMolecule_PreservesStepLabels verifies that a cooked formula with
// per-step labels results in spawned issues whose labels are persisted to the
// database. Regression for labels being silently dropped by cloneSubgraph in
// the same shape as the metadata bug fixed by gastownhall/beads#3341.
func TestSpawnMolecule_PreservesStepLabels(t *testing.T) {
func TestEmbeddedSpawnMolecule_PreservesStepLabels(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -74,9 +74,9 @@ func TestSpawnMolecule_PreservesStepLabels(t *testing.T) {
}
}
// TestSpawnMolecule_SubstitutesTemplatedStepFields is the cook -> pour
// TestEmbeddedSpawnMolecule_SubstitutesTemplatedStepFields is the cook -> pour
// regression test for GH#5110 (labels, metadata) and GH#5754 (assignee).
// TestSpawnMolecule_PreservesStepLabels above fixed labels being dropped
// TestEmbeddedSpawnMolecule_PreservesStepLabels above fixed labels being dropped
// entirely, but its labels carry no {{vars}}, so the missing substitution went
// unnoticed: the labels ARE carried through - just literal, which silently
// stops matching every label query downstream.
@ -85,7 +85,7 @@ func TestSpawnMolecule_PreservesStepLabels(t *testing.T) {
// spawned bead unclosable by the actor that poured it, so the molecule can
// never advance - which is what the AssigneeMatches assertion pins, not just
// the string value.
func TestSpawnMolecule_SubstitutesTemplatedStepFields(t *testing.T) {
func TestEmbeddedSpawnMolecule_SubstitutesTemplatedStepFields(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -281,12 +281,12 @@ func primeFirstDiff(got, want string) string {
// subprocess parity tests. The TestEmbedded prefix is deliberate and
// load-bearing in both directions: the fast `./...` lanes run
// -skip '^TestEmbedded' (pr.yml, main.yml), and .github/scripts/embedded-test-shard.sh
// discovers shard members by grepping ^func TestEmbedded in *_embedded_test.go.
// discovers shard members by grepping ^func TestEmbedded in cmd/bd/*_test.go.
// So they run in the full embedded tier, which ci-embedded-tier.sh enables
// unconditionally for merge_group and pushes to main — i.e. in the merge queue
// before this can land, not on every PR push. Renaming them out of the prefix
// moves ~30s of subprocess work into every short lane; renaming the file out of
// *_embedded_test.go drops them from the shard runner entirely.
// moves ~30s of subprocess work into every short lane and drops them from the
// shard runner entirely.
//
// TestEmbeddedPrimeChangeDirPrimesTarget is the issue's repro end to end
// (#5509): from repo-a, `bd -C repo-b prime` must emit repo-b's PRIME.md,

View file

@ -238,12 +238,12 @@ func TestEmbeddedPruneDryRunAndFilters(t *testing.T) {
})
}
// TestPrune_protectsBeadCitedByCustomStatusBead is a regression test for the
// TestEmbeddedPrune_protectsBeadCitedByCustomStatusBead is a regression test for the
// maphew review of PR #4023 (be-e2nb): reference-aware prune must scan beads in
// active *custom* statuses, not only the built-in non-closed statuses. A closed
// bead cited by a bead in an active custom status must be protected from prune,
// exactly like one cited by a built-in open bead.
func TestPrune_protectsBeadCitedByCustomStatusBead(t *testing.T) {
func TestEmbeddedPrune_protectsBeadCitedByCustomStatusBead(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -107,13 +107,13 @@ func runBDExpectingRejection(t *testing.T, bd, dir string, args ...string) strin
return string(out)
}
// TestRemovedBackendHealRoundTrip is the headline D-8 test: a workspace whose
// TestEmbeddedRemovedBackendHealRoundTrip is the headline D-8 test: a workspace whose
// metadata.json picked up a stale legacy "backend" value still holds its Dolt
// database, so the rejection must name the exact edit that heals it — and
// following that edit verbatim must make the workspace open again with its
// issues intact. Before D-8 the message sent this user to export the data with
// an old bd release and reinitialize, destroying a live database.
func TestRemovedBackendHealRoundTrip(t *testing.T) {
func TestEmbeddedRemovedBackendHealRoundTrip(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -185,10 +185,10 @@ func TestRemovedBackendHealRoundTrip(t *testing.T) {
}
}
// TestRemovedBackendHealRejectionPerBackend proves every removed-backend
// TestEmbeddedRemovedBackendHealRejectionPerBackend proves every removed-backend
// tombstone — not just sqlite — reaches the heal message when Dolt data is
// present. Only sqlite runs the full round-trip above; here we pin the rejection.
func TestRemovedBackendHealRejectionPerBackend(t *testing.T) {
func TestEmbeddedRemovedBackendHealRejectionPerBackend(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -11,8 +11,8 @@ import (
// Route tests for `bd show --comments-tail N` (#6618 follow-up, bd-6gl9h7):
// the shared fixtures and the proxied routes live here; the direct routes
// are in show_comments_tail_embedded_test.go, which the embedded cmd shard
// manifest discovers by its *_embedded_test.go name.
// are in show_comments_tail_embedded_test.go, whose TestEmbedded* names put
// them in the embedded cmd shard manifest.
//
// show_comments_tail_test.go pins printComments and renderWatchComments by
// calling them directly, so a regression that passed 0 at any of the three

View file

@ -18,10 +18,10 @@ import (
"github.com/steveyegge/beads/internal/storage/dolt"
)
// TestNewDoltStoreFromConfig_NoMetadata verifies that newDoltStoreFromConfig
// TestEmbeddedNewDoltStoreFromConfig_NoMetadata verifies that newDoltStoreFromConfig
// succeeds when the beads directory has no metadata.json (fresh project).
// Regression test for GH#2988: "no database selected" error.
func TestNewDoltStoreFromConfig_NoMetadata(t *testing.T) {
func TestEmbeddedNewDoltStoreFromConfig_NoMetadata(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt tests")
}
@ -307,11 +307,11 @@ func TestOpenNonMutatingStoreHonorsSharedServerConfig(t *testing.T) {
// a correct implementation.
const readOnlySharedServerPort = "19998"
// TestNewDoltStoreFromConfig_HyphenatedDBName verifies that
// TestEmbeddedNewDoltStoreFromConfig_HyphenatedDBName verifies that
// newDoltStoreFromConfig auto-sanitizes hyphenated database names for embedded
// mode and persists the fix to metadata.json.
// Regression test for GH#3231: pre-#2142 projects break on embedded upgrade.
func TestNewDoltStoreFromConfig_HyphenatedDBName(t *testing.T) {
func TestEmbeddedNewDoltStoreFromConfig_HyphenatedDBName(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt tests")
}
@ -465,9 +465,9 @@ func TestMigrateHyphenatedDB_NoOldDir(t *testing.T) {
}
}
// TestNewDoltStoreFromConfig_DottedDBName verifies that dots are also
// TestEmbeddedNewDoltStoreFromConfig_DottedDBName verifies that dots are also
// auto-sanitized, not just hyphens (GH#3231).
func TestNewDoltStoreFromConfig_DottedDBName(t *testing.T) {
func TestEmbeddedNewDoltStoreFromConfig_DottedDBName(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt tests")
}
@ -498,7 +498,7 @@ func TestNewDoltStoreFromConfig_DottedDBName(t *testing.T) {
}
}
// TestNewDoltStore_StrictReadOnlyRefusesWritesOnFreshDatabase covers Blocker 2
// TestEmbeddedNewDoltStore_StrictReadOnlyRefusesWritesOnFreshDatabase covers Blocker 2
// of the 2026-07-23 maintainer review on gastownhall/beads#4930: cfg.ReadOnly
// alone (an ordinary classified-read command) must route through
// OpenForReadOnlyCommand, which creates the embedded data directory on first
@ -506,7 +506,7 @@ func TestNewDoltStoreFromConfig_DottedDBName(t *testing.T) {
// --readonly signal) must route through the genuinely write-refusing
// OpenReadOnly instead, which fails rather than create anything for a fresh
// database.
func TestNewDoltStore_StrictReadOnlyRefusesWritesOnFreshDatabase(t *testing.T) {
func TestEmbeddedNewDoltStore_StrictReadOnlyRefusesWritesOnFreshDatabase(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt tests")
}

View file

@ -65,12 +65,14 @@ func TestLoadServerModeFromBeadsDirCorruptMetadataReturnsError(t *testing.T) {
}
// End-to-end contract for a corrupt metadata.json, exercised through the
// real binary: diagnostic and repair commands still run (warn-and-continue),
// data commands fail loud instead of answering false-empty from the embedded
// fallback, and bd init can rewrite the file — after which data commands work
// again. Guards the scoping of the fail-loud behavior: fatal only where a
// store is actually selected, never on the repair path itself.
func TestCorruptMetadataDiagnosticsRunAndDataFailsLoud(t *testing.T) {
// real binary on an embedded workspace. Since #4857 a metadata.json that
// exists but cannot be parsed fails safe wherever a workspace is selected,
// doctor and init included (TestDoctorRejectsCorruptMetadataBeforeSharedServerChecks
// pins doctor's shared-server half): bd version still runs and warns, every
// workspace command fails loud naming the file instead of answering
// false-empty from the embedded fallback, nothing rewrites the file, and
// restoring it brings the data back.
func TestEmbeddedCorruptMetadataFailsLoudUntilRestored(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt tests")
}
@ -78,8 +80,15 @@ func TestCorruptMetadataDiagnosticsRunAndDataFailsLoud(t *testing.T) {
bd := buildEmbeddedBD(t)
dir, beadsDir, _ := bdInit(t, bd, "--prefix", "cm")
bdCreate(t, bd, dir, "survives the corruption")
if err := os.WriteFile(filepath.Join(beadsDir, "metadata.json"), []byte(`{"dolt_mode":"serv`), 0o600); err != nil {
metadataPath := filepath.Join(beadsDir, "metadata.json")
original, err := os.ReadFile(metadataPath)
if err != nil {
t.Fatalf("read metadata.json: %v", err)
}
corrupt := []byte(`{"dolt_mode":"serv`)
if err := os.WriteFile(metadataPath, corrupt, 0o600); err != nil {
t.Fatalf("corrupt metadata.json: %v", err)
}
@ -91,27 +100,43 @@ func TestCorruptMetadataDiagnosticsRunAndDataFailsLoud(t *testing.T) {
return string(out), err
}
// Diagnostic / repair-path commands must keep working.
for _, args := range [][]string{{"version"}, {"doctor"}} {
if out, err := run(args...); err != nil {
t.Errorf("bd %s with corrupt metadata.json: want success, got %v\n%s", strings.Join(args, " "), err, out)
// bd version needs no workspace: it warns and runs.
if out, err := run("version"); err != nil || !strings.Contains(out, "metadata.json") {
t.Errorf("bd version with corrupt metadata.json: want success with a warning naming the file, got %v\n%s", err, out)
}
// Every command that selects the workspace refuses before opening or
// modifying storage, naming the file.
for _, args := range [][]string{
{"doctor"},
{"list", "--json"},
{"init", "--prefix", "cm", "--quiet", "--skip-hooks", "--skip-agents"},
} {
out, err := run(args...)
if err == nil {
t.Errorf("bd %s with corrupt metadata.json: want a loud failure, got success:\n%s", strings.Join(args, " "), out)
continue
}
for _, want := range []string{"metadata.json", "parsing config", "no storage database was opened or modified"} {
if !strings.Contains(out, want) {
t.Errorf("bd %s with corrupt metadata.json: output missing %q:\n%s", strings.Join(args, " "), want, out)
}
}
}
if after, err := os.ReadFile(metadataPath); err != nil || string(after) != string(corrupt) {
t.Fatalf("a refused command rewrote metadata.json (err %v):\nbefore: %q\nafter: %q", err, corrupt, after)
}
// Data commands must fail loud, naming the file — not answer false-empty.
// Restoring the file is the repair, and the data was never touched.
if err := os.WriteFile(metadataPath, original, 0o600); err != nil {
t.Fatalf("restore metadata.json: %v", err)
}
out, err := run("list", "--json")
if err == nil {
t.Fatalf("bd list with corrupt metadata.json: want loud failure, got success:\n%s", out)
if err != nil {
t.Fatalf("bd list after restoring metadata.json: %v\n%s", err, out)
}
if !strings.Contains(out, "metadata.json") {
t.Fatalf("bd list error should name metadata.json:\n%s", out)
}
// bd init is the documented repair path: it must run, rewrite the file,
// and restore data commands.
runBDInit(t, bd, dir, "--prefix", "cm")
if out, err := run("list", "--json"); err != nil {
t.Fatalf("bd list after bd init repair: %v\n%s", err, out)
if !strings.Contains(out, "survives the corruption") {
t.Fatalf("bd list after restoring metadata.json lost the issue created before the corruption:\n%s", out)
}
}

View file

@ -10,14 +10,14 @@ import (
"github.com/steveyegge/beads/internal/types"
)
// TestUnclaimIfAssigneeCLI drives `bd unclaim --if-assignee` end-to-end against
// TestEmbeddedUnclaimIfAssigneeCLI drives `bd unclaim --if-assignee` end-to-end against
// the embedded Dolt backend: the conditional release must be a compare-and-swap,
// not a read-then-clobber. A stale expectation exits nonzero, names the current
// holder, and leaves the claim untouched; the matching expectation releases the
// claim; and releasing an already-released issue is a distinct failure, not a
// silent success (the exactly-once property a release-if-current supervisor
// depends on).
func TestUnclaimIfAssigneeCLI(t *testing.T) {
func TestEmbeddedUnclaimIfAssigneeCLI(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -57,7 +57,7 @@ func TestUnclaimIfAssigneeCLI(t *testing.T) {
_ = bdUnclaimFail(t, bd, dir, issue.ID, "--if-assignee", "alice")
}
// TestUnclaimIfAssigneeCLIDifferentSpelling drives `bd unclaim --if-assignee`
// TestEmbeddedUnclaimIfAssigneeCLIDifferentSpelling drives `bd unclaim --if-assignee`
// with an expectation that names the current holder under a different Gas
// Town identity spelling than the stored assignee (dot vs underscore
// separator — ga-5ksp5). This must count as a match, not a stale-expectation
@ -65,7 +65,7 @@ func TestUnclaimIfAssigneeCLI(t *testing.T) {
// replaced the old verbatim `assignee = ?` SQL predicate need to agree it is
// the same identity, or the release silently affects zero rows even though
// the precheck said the CAS should succeed.
func TestUnclaimIfAssigneeCLIDifferentSpelling(t *testing.T) {
func TestEmbeddedUnclaimIfAssigneeCLIDifferentSpelling(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -87,7 +87,7 @@ func TestUnclaimIfAssigneeCLIDifferentSpelling(t *testing.T) {
}
}
// TestUnclaimIfAssigneeFlagValidation drives the CLI guards that keep the
// TestEmbeddedUnclaimIfAssigneeFlagValidation drives the CLI guards that keep the
// conditional-release contract unambiguous. A conditional unclaim is selected by
// the *presence* of --if-assignee, so an explicitly empty --if-assignee "" (an
// unset variable that expanded into the flag) must be rejected rather than
@ -96,7 +96,7 @@ func TestUnclaimIfAssigneeCLIDifferentSpelling(t *testing.T) {
// the claim untouched. Each subtest runs as the holder so the pre-fix behavior
// (fall through to UnclaimIssue / let one flag win) would actually have released
// the claim, making these true regression guards.
func TestUnclaimIfAssigneeFlagValidation(t *testing.T) {
func TestEmbeddedUnclaimIfAssigneeFlagValidation(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -32,7 +32,7 @@ func bdUpdateFailCode(t *testing.T, bd, dir string, args ...string) (string, int
return string(out), ee.ExitCode()
}
// TestUpdateIfGuardsCLI drives the bd-wsqvw conditional-update guards
// TestEmbeddedUpdateIfGuardsCLI drives the bd-wsqvw conditional-update guards
// (`bd update --if-assignee/--if-status`) end-to-end against the embedded Dolt
// backend. The guarded update must be a compare-and-set, not a
// read-then-clobber: a stale guard exits nonzero naming the actual state and
@ -40,7 +40,7 @@ func bdUpdateFailCode(t *testing.T, bd, dir string, args ...string) (string, int
// "expected unassigned" guard, not "no guard". Covers the two wheelhouse
// transitions no other verb expresses: reassign X→Y (park) and claim-on-behalf
// with a status guard (restore).
func TestUpdateIfGuardsCLI(t *testing.T) {
func TestEmbeddedUpdateIfGuardsCLI(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -138,13 +138,13 @@ func TestUpdateIfGuardsCLI(t *testing.T) {
})
}
// TestUpdateIfGuardsFlagValidation drives the CLI-surface rules that keep the
// TestEmbeddedUpdateIfGuardsFlagValidation drives the CLI-surface rules that keep the
// guard contract unambiguous: guards cannot combine with --claim (which is its
// own compare-and-set), guards require a field update to ride on (label-only
// edits run outside the guarded transaction), and an --if-status typo is
// rejected up front instead of mismatching forever. Every rejection must write
// nothing.
func TestUpdateIfGuardsFlagValidation(t *testing.T) {
func TestEmbeddedUpdateIfGuardsFlagValidation(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -136,12 +136,12 @@ func vhRow(t *testing.T, w vhWorkspace) (value string, present bool) {
return got.value, got.present
}
// TestVersionedHistoryConfigSetWritesTheStoreRow is the front door, and D5's
// TestEmbeddedVersionedHistoryConfigSetWritesTheStoreRow is the front door, and D5's
// regression pin for the plane #6661 chose. `bd config set` has to write the
// database row the stores read, and must not write config.yaml: the key is not a
// yaml-only key, and making it one would move the switch off the store and back
// to the per-process plane this feature was moved away from.
func TestVersionedHistoryConfigSetWritesTheStoreRow(t *testing.T) {
func TestEmbeddedVersionedHistoryConfigSetWritesTheStoreRow(t *testing.T) {
vhRequireEmbeddedLane(t)
bd := buildEmbeddedBD(t)
w := vhNewWorkspace(t, bd, filepath.Join(t.TempDir(), "ws"), "vhc")
@ -258,7 +258,7 @@ func newVHMatrix(t *testing.T) vhMatrix {
return m
}
// TestVersionedHistoryFollowsTheStoreItWritesInto is the routed-write matrix, with
// TestEmbeddedVersionedHistoryFollowsTheStoreItWritesInto is the routed-write matrix, with
// a count of issue_versions rows in every workspace after every write.
//
// D1: with the TARGET's row on and the launching workspace's row absent, a routed
@ -269,7 +269,7 @@ func newVHMatrix(t *testing.T) vhMatrix {
// D2: the reverse. The launching workspace's row on and the target's off (or
// absent), env unset: the routed write adds none. A store answers for itself, so
// the town's answer cannot leak into a store it opened for someone else.
func TestVersionedHistoryFollowsTheStoreItWritesInto(t *testing.T) {
func TestEmbeddedVersionedHistoryFollowsTheStoreItWritesInto(t *testing.T) {
vhRequireEmbeddedLane(t)
m := newVHMatrix(t)
@ -331,12 +331,12 @@ func TestVersionedHistoryFollowsTheStoreItWritesInto(t *testing.T) {
})
}
// TestVersionedHistoryEnvIsProcessWideAndOnlyTurnsRecordingOn is D3. The
// TestEmbeddedVersionedHistoryEnvIsProcessWideAndOnlyTurnsRecordingOn is D3. The
// environment applies to every store the process opens, routed targets included;
// it can turn recording on for a store that never asked, and it can never turn it
// off for a store whose row says on. Both planes are OR'd, never ranked: the
// hazard is a write that fails to record, never one that records when it needn't.
func TestVersionedHistoryEnvIsProcessWideAndOnlyTurnsRecordingOn(t *testing.T) {
func TestEmbeddedVersionedHistoryEnvIsProcessWideAndOnlyTurnsRecordingOn(t *testing.T) {
vhRequireEmbeddedLane(t)
m := newVHMatrix(t)
idA, idB := m.create(t, m.rigA, "seed a"), m.create(t, m.rigB, "seed b")

View file

@ -19,8 +19,8 @@ import (
// THE NAME IS LOAD-BEARING for the same reason TestEmbeddedVersionedHistorySwitchRoundTrip's is:
// .github/scripts/embedded-test-shard.sh selects the tests the embedded job runs by
// `grep -rh '^func TestEmbedded' cmd/bd/*_embedded_test.go`, so a test that keeps this prefix
// and this file suffix runs in the one job that sets BEADS_TEST_EMBEDDED_DOLT=1.
// `grep -rh '^func TestEmbedded' cmd/bd/*_test.go`, so a test that keeps this prefix runs in
// the one job that sets BEADS_TEST_EMBEDDED_DOLT=1.
//
// TestEmbeddedVersionedHistorySwitchRefusesUnversionableMetadata drives the REAL
// `bd config set versioned-history.enabled true` against a real store that already holds rows

View file

@ -10,7 +10,7 @@ import (
// THE NAME IS LOAD-BEARING: it must keep the TestEmbedded prefix, because
// .github/scripts/embedded-test-shard.sh selects what runs with
// `grep -rh '^func TestEmbedded' cmd/bd/*_embedded_test.go` and validates each
// `grep -rh '^func TestEmbedded' cmd/bd/*_test.go` and validates each
// manifest entry against `^TestEmbedded[A-Za-z0-9_]+$`. As
// TestVersionedHistorySwitchRoundTrip_Embedded this test matched neither, so
// the only job that sets BEADS_TEST_EMBEDDED_DOLT=1 for cmd/bd never selected

View file

@ -9,13 +9,13 @@ import (
"testing"
)
// TestWispGCProtectsActiveWisps is the regression test for GH#4394:
// TestEmbeddedWispGCProtectsActiveWisps is the regression test for GH#4394:
// `bd mol wisp gc --age` deleted active (blocked/in-progress) molecule
// steps. is_blocked is derived state and a recompute deliberately does NOT bump
// updated_at, so a step that has been waiting (blocked) longer than --age looks
// stale and was reclaimed mid-execution, self-destructing the molecule. Active
// wisps must never be reclaimed by age, no matter how old their updated_at is.
func TestWispGCProtectsActiveWisps(t *testing.T) {
func TestEmbeddedWispGCProtectsActiveWisps(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -25,7 +25,7 @@ func bdShowSucceeds(t *testing.T, bd, dir, id string) bool {
return true
}
// TestWispGCPurgeClosedDoesNotCascadeIntoLiveSteps is the regression test for
// TestEmbeddedWispGCPurgeClosedDoesNotCascadeIntoLiveSteps is the regression test for
// the patrol self-destruct bug: `bd mol wisp gc --closed --force` on a
// molecule that has closed its first step deleted the ENTIRE molecule.
//
@ -39,7 +39,7 @@ func bdShowSucceeds(t *testing.T, bd, dir, id string) bool {
// The closed set is complete: every closed, non-pinned, non-infra wisp is
// already a GC candidate. Cascade can only ever add NON-closed dependents to
// the batch — exactly the live steps it must not touch.
func TestWispGCPurgeClosedDoesNotCascadeIntoLiveSteps(t *testing.T) {
func TestEmbeddedWispGCPurgeClosedDoesNotCascadeIntoLiveSteps(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}
@ -91,10 +91,10 @@ func TestWispGCPurgeClosedDoesNotCascadeIntoLiveSteps(t *testing.T) {
t.Error("open molecule root was deleted by purgeClosed")
}
// TestWispGCPurgeClosedStillPurgesFullyClosedMolecules guards the other side
// TestEmbeddedWispGCPurgeClosedStillPurgesFullyClosedMolecules guards the other side
// of the fix: when EVERY step is closed, gc --closed --force must still remove
// the whole molecule. Restricting cascade must not break complete cleanup.
func TestWispGCPurgeClosedStillPurgesFullyClosedMolecules(t *testing.T) {
func TestEmbeddedWispGCPurgeClosedStillPurgesFullyClosedMolecules(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("set BEADS_TEST_EMBEDDED_DOLT=1 to run embedded dolt integration tests")
}

View file

@ -178,6 +178,7 @@ go_test(
name = "go_test_sources_test",
srcs = [
"bazel_skip_allowlist_test.go",
"embedded_lane_coverage_test.go",
"embedded_shard_count_test.go",
"host_tools_test.go",
"managed_local_lane_test.go",

View file

@ -2,7 +2,7 @@
"""Regenerate .github/scripts/embedded-cmd-test-shards.txt by cost-balancing.
Discovery must stay in step with embedded-test-shard.sh: both select every
top-level TestEmbedded* function from cmd/bd/*_embedded_test.go.
top-level TestEmbedded* function in cmd/bd/*_test.go.
Two cost models, selected by --weights (default: duration, matching
gen_proxied_shard_manifest.py's convention — see that script's module
@ -70,7 +70,7 @@ func_re = re.compile(r'^func (TestEmbedded[A-Za-z0-9_]+)\(')
def discover_inits_cost():
"""Return {test_name: subtest count}, floored at 1."""
costs = {}
for path in glob.glob('cmd/bd/*_embedded_test.go'):
for path in glob.glob('cmd/bd/*_test.go'):
with open(path) as fh:
lines = fh.readlines()
cur = None
@ -94,7 +94,7 @@ def discover_serial():
ones (a test that reaches t.Parallel only through a helper counts as
serial, which overestimates its shard)."""
serial = set()
for path in glob.glob('cmd/bd/*_embedded_test.go'):
for path in glob.glob('cmd/bd/*_test.go'):
with open(path) as fh:
lines = fh.readlines()
cur, parallel = None, False
@ -121,7 +121,7 @@ def duration_cost(inits):
if stale:
sys.stderr.write(
f'warning: {durations_filename} has {len(stale)} capture(s) for '
'tests that no longer exist in cmd/bd/*_embedded_test.go (renamed, split or '
'tests that no longer exist in cmd/bd/*_test.go (renamed, split or '
f'deleted since the last capture): {", ".join(stale)}\n')
costs = {}
for name, cost in inits.items():
@ -145,7 +145,7 @@ def render(total, shards, weights):
out.append(f'# t.Parallel) add up, parallel ones share -test.parallel={test_parallelism}.')
out.append(f'# Regenerate with scripts/ci/gen_embedded_cmd_shard_manifest.py {total}')
out.append('# --weights=duration --write after adding, splitting or removing')
out.append('# TestEmbedded* functions in cmd/bd/*_embedded_test.go. --write is')
out.append('# TestEmbedded* functions in cmd/bd/*_test.go. --write is')
out.append('# incremental: it keeps every already-assigned test on its current shard')
out.append('# and only places newly-discovered names, onto whichever shard is')
out.append('# currently lightest, so two unrelated PRs that each add one test do not')

View file

@ -0,0 +1,108 @@
package scripts_test
import (
"os"
"path/filepath"
"strings"
"testing"
)
// embeddedDoltEnv is the variable only //cmd/bd:bd_embedded_test and
// //cmd/bd:bd_embedded_part2_test set for cmd/bd: a cmd/bd test that skips
// without it runs in that lane or in none.
const embeddedDoltEnv = "BEADS_TEST_EMBEDDED_DOLT"
// TestEmbeddedGatedTestsRunInTheEmbeddedLane is
// TestProxiedGatedTestsRunInTheProxiedLane for the embedded-Dolt lane: every
// top-level cmd/bd test that skips unless BEADS_TEST_EMBEDDED_DOLT=1 —
// directly or through any chain of helpers — must be selected by
// .github/scripts/embedded-test-shard.sh, the lane's only test selection. The
// script selects by the TestEmbedded* name prefix alone, so a gated test named
// otherwise skips in every CI lane and its pass means nothing: 92 did,
// including #7203's --if-revision CLI coverage, until they were renamed into
// the prefix.
func TestEmbeddedGatedTestsRunInTheEmbeddedLane(t *testing.T) {
requireAutofixBash(t)
root := sourceRepoRoot(t)
gated, err := gatedTests(filepath.Join(root, "cmd/bd"), embeddedDoltEnv)
if err != nil {
t.Fatal(err)
}
if len(gated) < 300 {
t.Fatalf("found only %d cmd/bd tests gated on %s; did the gate helpers change shape?", len(gated), embeddedDoltEnv)
}
listed := laneListedTests(t, root, ".github/scripts/embedded-test-shard.sh", bazelEmbeddedCmdShardCount(t))
var missing []string
for _, name := range gated {
if !listed[name] {
missing = append(missing, name)
}
}
if len(missing) > 0 {
t.Errorf("%d cmd/bd test(s) skip unless %s=1 but .github/scripts/embedded-test-shard.sh never selects them, so no CI lane runs them; rename them into the TestEmbedded* prefix and place them with scripts/ci/gen_embedded_cmd_shard_manifest.py --write:\n %s",
len(missing), embeddedDoltEnv, strings.Join(missing, "\n "))
}
}
// TestEmbeddedGatedTestsDetector pins gatedTests for the embedded variable
// against a fixture, so a regression in the walk cannot silently turn the
// guard above into a no-op, and a test gated on another lane's variable is not
// demanded here.
func TestEmbeddedGatedTestsDetector(t *testing.T) {
dir := t.TempDir()
// Every fixture line is indented one tab, so repo scanners that find
// tests by a line-anchored `^func TestX(t *testing.T)` (equivalence.py)
// do not mistake the fixture's functions for this package's tests.
const src = `package main
import (
"os"
"testing"
)
func requireEmbedded(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("gated")
}
}
func requireProxied(t *testing.T) {
if os.Getenv("BEADS_TEST_PROXIED_SERVER") != "1" {
t.Skip("another lane")
}
}
func buildBD(t *testing.T) string { requireEmbedded(t); return "bd" }
type harness struct{}
func (harness) start(t *testing.T) { buildBD(t) }
func TestDirect(t *testing.T) { requireEmbedded(t) }
func TestTransitive(t *testing.T) { _ = buildBD(t) }
func TestMethod(t *testing.T) { harness{}.start(t) }
func TestInSubtest(t *testing.T) {
t.Run("x", func(t *testing.T) { _ = buildBD(t) })
}
func TestInline(t *testing.T) {
if os.Getenv("BEADS_TEST_EMBEDDED_DOLT") != "1" {
t.Skip("gated")
}
}
func TestOtherLane(t *testing.T) { requireProxied(t) }
func TestUngated(t *testing.T) {}
`
if err := os.WriteFile(filepath.Join(dir, "fixture_test.go"), []byte(src), 0o644); err != nil {
t.Fatal(err)
}
got, err := gatedTests(dir, embeddedDoltEnv)
if err != nil {
t.Fatal(err)
}
want := []string{"TestDirect", "TestInSubtest", "TestInline", "TestMethod", "TestTransitive"}
if strings.Join(got, ",") != strings.Join(want, ",") {
t.Errorf("gatedTests(%s) = %v, want %v", embeddedDoltEnv, got, want)
}
}

View file

@ -37,7 +37,7 @@ func TestProxiedGatedTestsRunInTheProxiedLane(t *testing.T) {
requireAutofixBash(t)
root := sourceRepoRoot(t)
gated, err := proxiedGatedTests(filepath.Join(root, "cmd/bd"))
gated, err := gatedTests(filepath.Join(root, "cmd/bd"), proxiedServerEnv)
if err != nil {
t.Fatal(err)
}
@ -45,7 +45,7 @@ func TestProxiedGatedTestsRunInTheProxiedLane(t *testing.T) {
t.Fatalf("found only %d cmd/bd tests gated on %s; did the gate helpers change shape?", len(gated), proxiedServerEnv)
}
listed := proxiedLaneListedTests(t, root, bazelProxiedShardCount(t))
listed := laneListedTests(t, root, ".github/scripts/proxied-test-shard.sh", bazelProxiedShardCount(t))
var missing []string
for _, name := range gated {
if !listed[name] {
@ -108,22 +108,22 @@ func TestProxiedGatedTestsDetector(t *testing.T) {
if err := os.WriteFile(filepath.Join(dir, "fixture_test.go"), []byte(src), 0o644); err != nil {
t.Fatal(err)
}
got, err := proxiedGatedTests(dir)
got, err := gatedTests(dir, proxiedServerEnv)
if err != nil {
t.Fatal(err)
}
want := []string{"TestDirect", "TestInSubtest", "TestInline", "TestMethod", "TestTransitive"}
if strings.Join(got, ",") != strings.Join(want, ",") {
t.Errorf("proxiedGatedTests = %v, want %v", got, want)
t.Errorf("gatedTests = %v, want %v", got, want)
}
}
// proxiedGatedTests returns, sorted, the top-level `func TestX(t *testing.T)`
// declarations in dir's _test.go files that reach a proxied-only gate through
// calls (functions and methods alike, by name, closures included). Matching
// gatedTests returns, sorted, the top-level `func TestX(t *testing.T)`
// declarations in dir's _test.go files that reach an env-only gate (see
// isOnlyGate) through calls (functions and methods alike, by name, closures included). Matching
// callees by bare name over-approximates, which errs toward demanding the
// lane run a test rather than missing one.
func proxiedGatedTests(dir string) ([]string, error) {
func gatedTests(dir, env string) ([]string, error) {
files, err := filepath.Glob(filepath.Join(dir, "*_test.go"))
if err != nil {
return nil, err
@ -152,7 +152,7 @@ func proxiedGatedTests(dir string) ([]string, error) {
ast.Inspect(fn.Body, func(n ast.Node) bool {
switch n := n.(type) {
case *ast.IfStmt:
if isProxiedOnlyGate(n.Cond) {
if isOnlyGate(n.Cond, env) {
gated[name] = true
}
case *ast.CallExpr:
@ -192,9 +192,9 @@ func proxiedGatedTests(dir string) ([]string, error) {
return out, nil
}
// isProxiedOnlyGate reports whether cond is exactly
// os.Getenv("BEADS_TEST_PROXIED_SERVER") != "1".
func isProxiedOnlyGate(cond ast.Expr) bool {
// isOnlyGate reports whether cond is exactly os.Getenv(env) != "1", where env
// is a lane's variable (BEADS_TEST_PROXIED_SERVER, BEADS_TEST_EMBEDDED_DOLT).
func isOnlyGate(cond ast.Expr, env string) bool {
be, ok := cond.(*ast.BinaryExpr)
if !ok || be.Op != token.NEQ {
return false
@ -211,12 +211,12 @@ func isProxiedOnlyGate(cond ast.Expr) bool {
return false
}
arg, ok := call.Args[0].(*ast.BasicLit)
return ok && arg.Value == strconv.Quote(proxiedServerEnv)
return ok && arg.Value == strconv.Quote(env)
}
// proxiedLaneListedTests runs proxied-test-shard.sh list-only for every shard
// of the Bazel lane's split and returns every test name any shard selects.
func proxiedLaneListedTests(t *testing.T, root string, shards int) map[string]bool {
// laneListedTests runs a lane's shard script list-only for every shard of the
// Bazel lane's split and returns every test name any shard selects.
func laneListedTests(t *testing.T, root, script string, shards int) map[string]bool {
t.Helper()
outs, errs := make([][]byte, shards+1), make([]error, shards+1)
var wg sync.WaitGroup
@ -224,7 +224,7 @@ func proxiedLaneListedTests(t *testing.T, root string, shards int) map[string]bo
wg.Add(1)
go func(k int) {
defer wg.Done()
cmd := exec.Command("bash", ".github/scripts/proxied-test-shard.sh", strconv.Itoa(k), strconv.Itoa(shards))
cmd := exec.Command("bash", script, strconv.Itoa(k), strconv.Itoa(shards))
cmd.Dir = root
cmd.Env = append(os.Environ(), "BEADS_TEST_SHARD_LIST_ONLY=1")
outs[k], errs[k] = cmd.Output()
@ -234,7 +234,7 @@ func proxiedLaneListedTests(t *testing.T, root string, shards int) map[string]bo
listed := map[string]bool{}
for k := 1; k <= shards; k++ {
if errs[k] != nil {
t.Fatalf("proxied-test-shard.sh %d %d: %v\n%s", k, shards, errs[k], outs[k])
t.Fatalf("%s %d %d: %v\n%s", script, k, shards, errs[k], outs[k])
}
for _, line := range strings.Split(string(outs[k]), "\n") {
name, ok := strings.CutPrefix(line, " ")

View file

@ -12,7 +12,7 @@
# <shard script> <binary env var> <binary> [binary args...]
# <shard script>, <binary>: runfiles paths ($(rootpath ...)), relative to
# the workspace runfiles directory, which is the test's working directory
# and where the script's source globs (cmd/bd/*_embedded_test.go, ...)
# and where the script's source globs (cmd/bd/*_test.go, ...)
# resolve.
# <binary env var>: the variable the script reads the binary path from
# (BEADS_TEST_CMD_BINARY, BEADS_TEST_EMBEDDED_TEST_BINARY or