* test(bazel): add internal/testutil/bazeltest runfiles helpers Repository-path resolution for tests that works identically under plain go test (package cwd, full checkout), bazel test locally, and remote execution (declared runfiles only): - IsBazel, RepoRoot (BEADS_TEST_REPO_ROOT, then the runfiles workspace root, then a go.mod walk), OverrideRoot (drop-in condition for existing helpers; empty under plain go test), CallerDir - Runfile for $(rlocationpath) values, GOROOT for type-checking tests - ShardFreeEnv for helpers that re-exec a test binary Every helper reduces to the pre-Bazel behavior under go test. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(bazel): declare source/data reads for 14 scan-guard targets Source-scanning and repo-file tests read files their Bazel targets never declared, so they failed under `bazel test` (and could not run on remote workers at all). Declare narrow inputs as `data` and resolve paths through bazeltest where the test located the tree via runtime.Caller: - tools/bazel/go_srcs.py (run by `make bazel-sync` after gazelle) keeps a managed `go_srcs` filegroup in the packages whose Go source tests scan, plus `//internal/storage:tree_go_srcs` for the storage-tree walk. Bazel globs stop at package boundaries, so the aggregate needs one filegroup per package; the script keeps it in sync and gazelle-stable. - Hand-written narrow inputs: //internal/storage/schema:migrations, //:docsync_files, //plugins/beads:plugin_files, and exports of .gitattributes, .claude-plugin/marketplace.json, cmd/bd list.go and ready.go, testutil/testdoltcommon.go, scripts README.md and the release catalog, each visible only to its consumer. - runtime.Caller-based roots in backend, backend/conformance, internal/storage, internal/formula and test/docsync now go through bazeltest.CallerDir / OverrideRoot; relative-path tests need data only. - integrations/ leaves .bazelignore (it is still gazelle-excluded) so the docsync link check can declare integrations/beads-mcp/PYPI.md. Under --config=prcore every target reports the same PASS/SKIP/FAIL test set as `go test -race -short` for its package, locally and remotely. Plain `go test` behavior is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(bazel): guard generated go_srcs and harden bazeltest root override - tools/bazel/go_srcs.py: add --check (print diff, exit 1 on stale blocks); new `make bazel-sync-check` target runs it. - scripts/bazel_policy_test.go: under go test, assert every tree_go_srcs (//internal/storage) lists exactly the BUILD.bazel packages below its root, run go_srcs.py --check, and forbid BUILD files under docs/ and engdocs/ (they would cut subtrees out of //:docsync_files). - bazeltest: honor BEADS_TEST_REPO_ROOT only when it holds go.mod (RepoRoot fails loudly otherwise); drop the unused GOROOT() helper, whose compiled-in branch could never fire under rules_go. - scripts/ci/lib/test-env.sh: unset BEADS_TEST_REPO_ROOT. - Document the hand-listed out-of-tree link targets in //:docsync_files. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * build(bazel): re-sync BUILD files with main Regenerated with make bazel-sync after commits that landed while the scaffold PR was in CI (new internal/execenv, gitenv, gitignore packages and new sources/deps). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(bazel): declare init_safety_help.go for docsync TestInitSafetyCLIHelpCoversReCloneGotchas (#6431) reads cmd/bd/init_safety_help.go; export it to //test/docsync only. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
127 lines
3.2 KiB
Python
127 lines
3.2 KiB
Python
load("@rules_go//go:def.bzl", "go_library", "go_test")
|
|
|
|
go_library(
|
|
name = "httpapi",
|
|
srcs = [
|
|
"auth.go",
|
|
"batch_apply.go",
|
|
"batch_close.go",
|
|
"batch_create.go",
|
|
"blocking.go",
|
|
"claim.go",
|
|
"claim_next.go",
|
|
"close.go",
|
|
"comments.go",
|
|
"create.go",
|
|
"cursor.go",
|
|
"cycles.go",
|
|
"delete.go",
|
|
"dependency_edit.go",
|
|
"doc.go",
|
|
"edges.go",
|
|
"events.go",
|
|
"events_watch.go",
|
|
"handlers.go",
|
|
"memories.go",
|
|
"metadata_cas.go",
|
|
"pinning.go",
|
|
"problem.go",
|
|
"query.go",
|
|
"reads.go",
|
|
"related.go",
|
|
"release.go",
|
|
"reopen.go",
|
|
"roles.go",
|
|
"routes.go",
|
|
"server.go",
|
|
"settings.go",
|
|
"stats.go",
|
|
"sweep.go",
|
|
"tree.go",
|
|
"update.go",
|
|
],
|
|
importpath = "github.com/steveyegge/beads/internal/httpapi",
|
|
visibility = ["//:__subpackages__"],
|
|
deps = [
|
|
"//internal/config",
|
|
"//internal/eventsjournal",
|
|
"//internal/httpapi/apigen",
|
|
"//internal/storage",
|
|
"//internal/storage/domain",
|
|
"//internal/storage/uow",
|
|
"//internal/types",
|
|
"//issueops",
|
|
"//memoryops",
|
|
"@com_github_go_sql_driver_mysql//:mysql",
|
|
"@org_golang_x_net//netutil",
|
|
],
|
|
)
|
|
|
|
go_test(
|
|
name = "httpapi_test",
|
|
srcs = [
|
|
"auth_test.go",
|
|
"batch_apply_test.go",
|
|
"batch_close_test.go",
|
|
"batch_create_test.go",
|
|
"blocking_test.go",
|
|
"brief_projection_test.go",
|
|
"claim_next_test.go",
|
|
"claim_test.go",
|
|
"close_test.go",
|
|
"comments_test.go",
|
|
"context_test.go",
|
|
"count_test.go",
|
|
"create_test.go",
|
|
"cycles_test.go",
|
|
"delete_test.go",
|
|
"dependency_edit_test.go",
|
|
"edge_counts_test.go",
|
|
"edges_test.go",
|
|
"events_test.go",
|
|
"events_watch_test.go",
|
|
"get_issue_test.go",
|
|
"list_comments_omitted_test.go",
|
|
"list_sort_test.go",
|
|
"memories_test.go",
|
|
"metadata_cas_test.go",
|
|
"problem_test.go",
|
|
"project_stamp_test.go",
|
|
"reads_test.go",
|
|
"ready_count_test.go",
|
|
"related_test.go",
|
|
"release_test.go",
|
|
"reopen_test.go",
|
|
"roles_test.go",
|
|
"server_test.go",
|
|
"settings_write_test.go",
|
|
"spec_parity_test.go",
|
|
"stats_test.go",
|
|
"sweep_test.go",
|
|
"timed_provider_binding_test.go",
|
|
"tree_test.go",
|
|
"update_test.go",
|
|
"wire_bijection_test.go",
|
|
],
|
|
data = [
|
|
"claim.go",
|
|
"//cmd/bd:list.go",
|
|
"//cmd/bd:ready.go",
|
|
],
|
|
embed = [":httpapi"],
|
|
deps = [
|
|
"//internal/config",
|
|
"//internal/eventsjournal",
|
|
"//internal/httpapi/apigen",
|
|
"//internal/httpapi/spec",
|
|
"//internal/storage",
|
|
"//internal/storage/domain",
|
|
"//internal/storage/uow",
|
|
"//internal/types",
|
|
"//internal/workapi",
|
|
"//issueops",
|
|
"//memoryops",
|
|
"@com_github_go_sql_driver_mysql//:mysql",
|
|
"@in_gopkg_yaml_v3//:yaml_v3",
|
|
],
|
|
)
|