beads/internal/configfile
Julian Knutsen f3c47390e7
fix(storage): refuse graph_mode workspaces on library opens (#7721)
#7671 fences graph workspaces in cmd/bd: command admission, the store
factories and the other CLI paths refuse one, and #7722 extends that
fence to a .beads holding the graph-preview-format marker whatever its
metadata says. But the public library opens (beads.OpenBestAvailable,
OpenBestAvailableWith, OpenFromConfig, OpenGated) and the Dolt store's
metadata-driven constructors (NewFromConfig, NewFromConfigWithOptions,
NewFromConfigWithCLIOptions) still opened either kind of graph workspace
as an Issue store and ran Issue schema migrations into the graph
database (or, with no metadata beside the marker, created an Issue
database inside the graph workspace).

- Move the typed refusal into internal/configfile
  (UnsupportedWorkspaceFormatError with BeadsDir, GraphMode and
  FormatMarker; CheckWorkspaceFormat; GraphFormatMarkerFile;
  HasGraphFormatMarker) with byte-identical text and hints for both the
  graph_mode and the marker refusal, and move cmd/bd's discovery
  pre-checks there as LoadAndCheckWorkspaceFormat and
  CheckDiscoveredWorkspaceFormat (LoadForDiscovery, which never migrates
  a legacy config.json; unreadable metadata beside the marker is refused
  as the marker's format). cmd/bd's checkWorkspaceFormat,
  loadAndCheckWorkspaceFormat, hasGraphFormatMarker and
  checkDiscoveredWorkspaceFormat become thin delegates, so the CLI keeps
  its behaviour (exit 16 with the same hints) and every caller of them is
  unchanged; bootstrap's ancestor walk builds the configfile type.
- Every public metadata-driven open runs CheckDiscoveredWorkspaceFormat
  as its first statement: before OpenGated takes its gates and before
  OpenBestAvailableWith's Load can migrate config.json. A refused open
  leaves the workspace byte-identical. The type is exported as
  beads.UnsupportedWorkspaceFormatError.
- The Dolt constructors run CheckDiscoveredWorkspaceFormat before
  configfile.Load, so a graph workspace marked only by a legacy
  config.json, or by the marker beside stripped, missing or unparseable
  metadata, is refused before Load can migrate it into metadata.json
  (and drop graph_* keys this build does not know). requireDoltBackend
  re-checks the loaded config as a backstop, so they also refuse before
  resolving a server or writing a port file or Dolt root.

Tests: configfile unit tests for both refusals (exact marker text and
hint, graph_mode winning over the marker, unparseable metadata with and
without the marker); the public opens and the three Dolt constructors
against graph_mode workspaces and against marker-only, stripped
(metadata.json and legacy config.json), server, explicit dependency and
unparseable-metadata marker workspaces, each refused with the typed
error and the workspace left unchanged.

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>
2026-10-20 09:29:54 +00:00
..
backend_messages.go fix(storage): truthful legacy-backend tombstone rejection — detect present Dolt data, give the exact heal (D-8) (#6044) 2026-08-28 23:27:39 -07:00
backend_messages_test.go fix(storage): truthful legacy-backend tombstone rejection — detect present Dolt data, give the exact heal (D-8) (#6044) 2026-08-28 23:27:39 -07:00
BUILD.bazel fix(storage): refuse graph_mode workspaces on library opens (#7721) 2026-10-20 09:29:54 +00:00
central_config.go feat(config): add central server config library (#3258) 2026-04-27 12:54:11 -07:00
central_config_test.go feat(config): add central server config library (#3258) 2026-04-27 12:54:11 -07:00
configfile.go fix(cli): refuse graph_mode workspaces and keep their metadata marker on save (#7671) 2026-10-20 00:05:39 +00:00
configfile_test.go Fix ResolveServerMode ambient port-var handling and the KillStaleServers regression it introduced (#5934) 2026-09-30 07:13:57 -07:00
credentials.go Add credentials file support for Dolt server passwords (#2854) 2026-04-02 20:35:56 -07:00
credentials_test.go test: clear BEADS_DOLT_SERVER_PORT in server-mode isolation tests (#4100) 2026-07-06 22:02:19 -07:00
credentials_unix.go Add credentials file support for Dolt server passwords (#2854) 2026-04-02 20:35:56 -07:00
credentials_windows.go Add credentials file support for Dolt server passwords (#2854) 2026-04-02 20:35:56 -07:00
external_dolt_config.go fix(proxy): guard external TLS misconfig and suppress G402 for skip-verify 2026-07-16 16:44:26 -07:00
external_dolt_config_test.go fix(proxy): guard external TLS misconfig and suppress G402 for skip-verify 2026-07-16 16:44:26 -07:00
graph_mode.go fix(cli): refuse graph_mode workspaces and keep their metadata marker on save (#7671) 2026-10-20 00:05:39 +00:00
graph_mode_test.go fix(cli): refuse graph_mode workspaces and keep their metadata marker on save (#7671) 2026-10-20 00:05:39 +00:00
proxied_server_client_info.go fix(configfile): persist effective proxy idle timeout (#6657) (#6673) 2026-09-26 07:36:14 -07:00
workspace_format.go fix(storage): refuse graph_mode workspaces on library opens (#7721) 2026-10-20 09:29:54 +00:00
workspace_format_test.go fix(storage): refuse graph_mode workspaces on library opens (#7721) 2026-10-20 09:29:54 +00:00