Skip to content

docs: sqlanvil docs site sourcing & build plan - #8

Closed
ihistand wants to merge 20 commits into
restore-postgres-adapterfrom
docs/site-plan
Closed

docs: sqlanvil docs site sourcing & build plan#8
ihistand wants to merge 20 commits into
restore-postgres-adapterfrom
docs/site-plan

Conversation

@ihistand

Copy link
Copy Markdown
Collaborator

Summary

Captures the legal + structural plan for sqlanvil's documentation site at `docs/docs_site_plan.md`.

Source hierarchy

Tier Source License Use
1 `upstream/main:docs/` (already inherited via fork) Apache 2.0 Foundation — reference pages
2 `docs.cloud.google.com/dataform/docs/*` CC BY 4.0 Quickstart, CLI ref, troubleshooting
3 `cloud.google.com/dataform/*`, console screenshots, logged-in content Not permissive Do not pull

License footer on Tier 2 confirmed verbatim: "Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License."

Phased roadmap

Phase What Source
D1 Pull Tier 1 + rebrand Apache 2.0
D2 Rewrite reference pages Postgres-first Mix
D3 Net-new Supabase action type pages (rls, realtime, wrapper, vector) Original
D4 Quickstart + CLI ref adapted from Google CC BY 4.0
D5 Architecture & concept pages Original

Each phase aligned to a code phase from `postgres_first_class_design.md`.

Site stack recommendation

  • Generator: Astro Starlight (alternatives: Docusaurus, VitePress, mdBook, plain Vercel + remark)
  • Host: Vercel project `docs-sqlanvil-com`, domain `docs.sqlanvil.com`
  • Repo: Sibling repo `../sqlanvil-docs/` (kept separate from `sqlanvil/` so docs deploys don't trigger code CI)
  • Search: Algolia DocSearch (free OSS) or Pagefind (Starlight default)

License compliance

  • Apache 2.0 content: extend existing root `NOTICE` (one-paragraph add)
  • CC BY 4.0 content: per-page footer attribution + `docs/ATTRIBUTIONS.md` line items
  • Trademark scrubbing (dataform → sqlanvil) treated as separate concern from copyright — same playbook as code rename PR refactor: rename dataform → sqlanvil #1

Independent of code stack

This is a planning doc only. No code changes. Can merge anytime; doesn't block the postgres-first-class PR stack.

Test plan

  • Doc renders as markdown
  • Link check on referenced docs/* files (deferred to D1)

🤖 Generated with Claude Code

ihistand and others added 20 commits May 26, 2026 21:36
Add three planning docs for the dataform → sqlanvil work:
- CLAUDE.md: project guidance for Claude Code sessions
- docs/postgres_first_class_design.md: spec for Postgres + Supabase
  adapters (replaces antigravity assessment's Phase 3+ framing)
- docs/rename_checklist.md: exhaustive rename surface map

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- All 8 .proto files: package dataform → package sqlanvil
- Java options: com.dataform.protos → com.sqlanvil.protos
- Go options: github.com/dataform-co/dataform → github.com/ihistand/sqlanvil
- Field rename (wire-breaking): dataform_core_version → sqlanvil_core_version
  (in configs.proto + core.proto)
- WORKSPACE name: df → sa
- Bazel target //protos:dataform_proto → //protos:sqlanvil_proto

cloud.google.com/dataform/docs/... URL comments retained — factually
correct references to BigQuery partitioning docs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…te dead infra

- git mv packages/@dataform → packages/@SQLAnvil (3 subdirs: cli, core,
  package.layer.json; all symbol-pinned package_name fields updated)
- Sed @dataform/ → @sqlanvil/ across all BUILD files, .bzl, scripts,
  .ts/.js/.sqlx test fixtures (40+ files)
- Root BUILD: gazelle:prefix → github.com/ihistand/sqlanvil
- .github/CODEOWNERS: dataform-co/dataform-reviewers → ihistand
- scripts/run: build target → //packages/@sqlanvil/cli:bin
- Test fixture emails: allusers@dataform.co → allusers@example.com
  (consistent across constants.js, .sqlx fixtures, and matching assertions
  in tests/api/projects.spec.ts)

Deletions (dead infra targeting upstream's GCP project):
- cloudbuild-publish.yaml, cloudbuild-test.yaml, cloudbuild-version.yaml
  (Google Cloud Build configs for dataform-co's project)
- scripts/publish, scripts/update_test_credentials (publishing to upstream
  npm + KMS key access against dataform-co's project)
- test_credentials/{BUILD,bigquery.json.enc} + all
  //test_credentials:bigquery.json refs from 4 BUILD files
  (integration tests against BQ will need fresh credential wiring)

NOT renamed (preserved historical/upstream references):
- contributing.md upstream issue tracker links
- readme.md links to Google Cloud Dataform docs
- .bazelrc commented-out remote cache (already disabled)
- cli/credentials.ts docs link (TODO: update once sqlanvil docs exist)
- All `dataform.*` proto namespace usages in TS — deferred to phase C

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…efaults

Path mapping:
- tsconfig.json paths: df/* → sa/*
- All `from "df/..."` / require("df/...") / import("df/...") → sa/* (450+)
- Runtime path strings in jit_loader.js + webpack configs + cli/index_test_base.ts

Proto namespace cascade (proto package dataform → sqlanvil triggers TS
generation under `sqlanvil` namespace):
- import { dataform, google } → import { sqlanvil, google } (and reverse)
- dataform.IFoo / dataform.JFoo / dataform.DbAdapter / etc. → sqlanvil.*
- camelCase field name dataformCoreVersion → sqlanvilCoreVersion
- Internal function name dataformCompile → sqlanvilCompile

Framework runtime defaults:
- globalAny.dataform → globalAny.sqlanvil (the user-facing sqlx namespace)
- __dataform_current_file → __sqlanvil_current_file (private global)
- "_dataform" table folder root default → "_sqlanvil"
- "dataform_assertions" assertion schema default → "sqlanvil_assertions"
- defaultSchema/defaultDatabase/defaultProject "dataform" → "sqlanvil"
- BigQuery job ID prefix "dataform-" → "sqlanvil-" (for BQ telemetry attribution)
- Test fixture labels team:"dataform" → team:"sqlanvil"

Doc comment anchors: configs#dataform-ActionConfig-* → configs#sqlanvil-*
(reference the docs site anchor IDs which derive from proto package name)

Test fixture strings: dataform-iceberg-test/-partial, dataform-database,
dataform-conn_id, dataform-integration-tests, dataform-test-schema-suffix
all renamed for consistency.

Preserved (will address in later phases or kept as upstream attribution):
- dataform.json strings (Phase D deletes the code path)
- dataform-co/dataform URLs (legitimate upstream attribution)
- dataform-open-source GCP project (test_credentials already deleted;
  these integration tests are broken regardless)
- CLI help text "dataform [command]" (Phase E renames yargs scriptName)
- "invalid dataform json throws error" test name (Phase D deletes test)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Upstream Dataform marked dataform.json deprecated in favor of
workflow_settings.yaml. sqlanvil completes the cleanup — no
sqlanvil.json parallel, no back-compat fallback.

Removed code:
- core/workflow_settings.ts: readWorkflowSettings() dataform.json fallback
  and "deprecated alongside" error path (workflow_settings.yaml is the
  only source of truth now)
- cli/index.ts: dataformJsonPath presence check in projectDirMustExistOption
  ("does not appear to be a dataform directory" → "sqlanvil directory")
- cli/vm/compile.ts: global.dataformJson VM-time require
- cli/api/commands/init.ts: dataform.json existence check + init error
  message ("Cannot init dataform project" → "Cannot init sqlanvil project")
- testing/run_core.ts: VM dataformJson global injection +
  VALID_DATAFORM_JSON constant
- core/main_test.ts: 5 test blocks exercising the legacy path
  ("a valid dataform.json", "fails when both...", "invalid json file",
  "contains unknown fields", "variables must be strings")
- tests/api/projects.spec.ts: "invalid dataform json throws error" test
- cli/index_compile_test.ts: replaced dataform.json fixture write with
  equivalent workflow_settings.yaml

Removed fixtures:
- tests/api/projects/invalid_dataform_json/ (entire directory)
- tests/api/BUILD: invalid_dataform_json deps

Migrated fixtures dataform.json → workflow_settings.yaml:
- tests/integration/postgres_project/
- tests/api/projects/never_finishes_compiling/
- tests/api/projects/common_v2/

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… sqlanvil

CLI (cli/index.ts):
- yargs scriptName: dataform → sqlanvil (sets program name in --help)
- All command descriptions: "Compile the dataform project" → "sqlanvil"
- Error messages: "dataform encountered an error" → "sqlanvil"
- "for Dataform to use" → "for sqlanvil to use"
- projectDirOption describe: "Dataform project directory" → "sqlanvil"
- jobPrefix template: dataform-${...}- → sqlanvil-${...}-

Help test (cli/index_help_test.ts): assertion strings match new help output.
Init test (cli/index_init_test.ts): defaultAssertionDataset literal + error
messages.

cli/credentials.ts: replaced broken docs link
(docs.sqlanvil.co/dataform-cli — which didn't exist on either domain) with
Google Cloud's official iam.docs.google.com link to service-account-key
creation.

VSCode extension (vscode/):
- extension.ts: language server ID + display name, command IDs
  (dataform.compile → sqlanvil.compile), getConfiguration("sqlanvil")
- server.ts: spawn("sqlanvil"), all error message text
- package.json: rewrote manifest — name/publisher/displayName/repository/
  icon/configuration namespace/command IDs all switch to sqlanvil. Version
  reset 0.0.16 → 0.0.1 (fresh extension).
- Renamed vscode/dataform_logo.png → vscode/sqlanvil_logo.png (placeholder;
  actual icon needs design before publishing)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- IDataformExtension → ISqlanvilExtension (and all imports/implementations:
  core/extension.ts, core/index.ts, core/main.ts, packages/sample-extension,
  packages/@sqlanvil/core)

Docs:
- readme.md: complete rewrite for sqlanvil positioning (was upstream
  Dataform copy referencing GCP-managed Dataform)
- contributing.md: rewrite for sqlanvil — removed dataform-co/dataform
  upstream links, dropped GCP-credentials-team section (no longer accessible),
  added Postgres integration test prerequisite (Docker)
- docs/configs-reference.md: placeholder until new proto schemas merge
- docs/packages.md: light update (cloned base repo + framework name)
- docs/postgres_reintegration_assessment.md: marked SUPERSEDED with pointer
  to postgres_first_class_design.md

NOTICE: Apache 2.0 attribution file. Required by §4 of the license when
distributing derivative works. Credits Dataform Co + Google LLC as
upstream authors.

Preserved upstream references (legitimate attribution / external packages):
- readme/docs links to cloud.google.com/dataform (Google's product docs)
- docs/packages.md sample package URLs (external community packages
  authored against upstream Dataform; not maintained by sqlanvil)
- LICENSE (Apache 2.0 text, unchanged)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… dead infra

Comprehensive `Dataform` (capital D) → `sqlanvil` across all remaining
source code via brute-force sed on TS/proto files (BSD sed's word-boundary
regex didn't fire on first pass; explicit pattern caught the rest).

Auto-generated docs (docs/reference/*.md):
- Anchor IDs: <a name="dataform-..."> → <a name="sqlanvil-...">
- Cross-ref links: configs#dataform-ActionConfig-* → configs#sqlanvil-*
- Body text describing framework concepts: "Dataform" → "sqlanvil"

CLI test fixtures (cli/util_test.ts, cli/index_run_e2e_test.ts):
- jobId prefix "dataform-915a03fe1" → "sqlanvil-..."
- schema "dataform_test_schema_suffix" → "sqlanvil_test_schema_suffix"
- --job-labels team=dataform → team=sqlanvil
- uniqueDataset prefix dataform_e2e_osc_ → sqlanvil_e2e_osc_

cli/api/dbadapters/execution_sql.ts + matching goldens (*.sql):
- Generated DECLARE/SET variable name dataform_columns → sqlanvil_columns
  (BQ on-schema-change synchronize/extend/fail paths)

cli/api/commands/init.ts: workflow_settings.yaml init writes
"defaultDataset: sqlanvil" (was "dataform")

cli/index_test_base.ts:
- DEFAULT_DATABASE: dataform-open-source → your-bigquery-project
- DEFAULT_RESERVATION reservation name dataform-test → sqlanvil-test

cli/vm/compile.ts + cli/vm/jit_worker.ts: node_modules/@dataform/core
bundle.js lookup → @sqlanvil/core (CLI tells users to run
`sqlanvil install`, not `dataform install`)

common/protos/index.ts: error messages now point at
github.com/ihistand/sqlanvil docs + issues, not dataform-co.

protos/configs.proto: "dataformCoreVersion" doc string + comments
updated.

tests/integration/bigquery_project + bigquery.spec.ts + examples/:
- defaultProject: dataform-open-source → your-bigquery-project
- 3-part BQ names rewritten with the placeholder
- Integration tests will need fresh credentials configured before they
  can run (already noted in contributing.md)
- examples/.../snowy_repository_creation.ipynb: dataform_examples dataset
  reference → your_examples_dataset

VSCode (vscode/{README.md,workflow_settings_yaml.schema.json,package-lock.json}):
- Deprecation notice referencing upstream extension removed
- JSON schema field dataformCoreVersion → sqlanvilCoreVersion
- package-lock.json name field

Deletions (dead infra):
- scripts/decrypt_secret (KMS keyring access to dataform-co's GCP project)
- scripts/create_gh_pr (sets origin URL to dataform-co/dataform.git)

Preserved legitimate references:
- protos/configs.proto: cloud.google.com/dataform/docs/partitions-clusters
  URL comments (factual BigQuery partition/cluster reference docs)
- core/main.ts, core/main_test.ts, api/utils/postgres.ts: TODO comments
  and upstream issue/PR links for historical context
- .bazelrc: commented-out remote cache configuration (already disabled)
- NOTICE: Apache 2.0 attribution to Dataform Co + Google LLC
- readme.md, CLAUDE.md, docs/*: attribution phrases like "upstream Dataform",
  "Dataform OSS by Dataform Co"
- docs/reference/configs.md table rows referencing partition-clusters docs

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The pinned Bazel 5.4 + 2022-era protobuf chain inherited from upstream
does not build on macOS Tahoe + Apple Silicon:
- Bazel 5.4 ships wrapped_clang without LC_UUID load commands; rejected
  by current dyld.
- Bumping to Bazel 6.x triggers @bazel_tools//platforms removal failures
  in the WORKSPACE.
- Bypassing wrapped_clang via system clang gets further but hits Apple
  SDK <-> old protobuf preprocessor conflicts (_stdio.h sprintf
  redefinition).

Linux is unaffected. Until a future Bazel-7 + Bzlmod modernization PR
lands, macOS contributors should build inside the dev container:

  ./scripts/docker-bazel build //protos:sqlanvil_proto
  ./scripts/docker-bazel test //core/...
  ./scripts/docker-bazel              # interactive shell

Dockerfile.dev:
- Base: node:20-bookworm (gives node + npm)
- Adds JDK 17, python 3, build-essential, zlib1g-dev, git, zip/unzip
- Installs Bazelisk globally via npm
- Mounts /root/.cache/bazel + /root/.cache/bazel-disk as named volumes
  for persistent Bazel cache across runs

scripts/docker-bazel:
- Lazy-builds the sqlanvil-dev image on first run
- Mounts the repo at /workspace
- Mounts named volumes sqlanvil-bazel-cache and sqlanvil-bazel-disk
- Auto-attaches a TTY when stdin is a terminal (CI-safe otherwise)
- No args → drops into bash inside the container

contributing.md: documents the macOS compatibility caveat and the Docker
workflow.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
When running bazel build //protos:sqlanvil_proto directly on the
proto_library target (rather than going through ts_proto_library which
wraps protoc with different flags), two pre-existing upstream bugs
surface:

1. protos/configs.proto and core.proto import "extension.proto" without
   the protos/ prefix. Without strip_import_prefix on the proto_library,
   protoc passes -Iprotos/extension.proto=protos/extension.proto and the
   bare-name import fails. Adding strip_import_prefix = "/protos" removes
   the protos/ prefix so file references match.

2. jit.proto imports google/protobuf/timestamp.proto but the
   proto_library only declared deps on empty_proto and struct_proto.
   Added timestamp_proto.

Both are upstream Dataform bugs (same content in upstream/main); they
weren't caught because the upstream CI path went through ts_proto_library
which has its own protoc invocation. Direct proto_library builds always
would have failed.

Verified working via:
  ./scripts/docker-bazel build //protos:sqlanvil_proto
  → Build completed successfully, 4 total actions

This proves the dataform → sqlanvil rename is structurally sound at the
proto layer (workspace name `sa`, package `sqlanvil`, target
`sqlanvil_proto`, java/go options all resolve and protoc accepts them).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Captures branch state, verification results, known pre-existing
issues blocking fuller verification, and the recommended sequence of
follow-up work (refresh node pin, then Postgres adapter PR, then
Bazel modernization later).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Rename sweep missed these 4 BUILD files that referenced the old `@df`
workspace name in load() statements and dep labels. Without this fix,
//core/... fails to analyze with:

  error loading package 'common/errors': Unable to find package for
  @df//testing:index.bzl: The repository '@df' could not be resolved

Found while verifying //core/... in Docker.
Rename sweep missed:
- packages/@sqlanvil/core/webpack.config.js — webpack resolve.alias
- packages/sample-extension/webpack.config.js — webpack resolve.alias
- packages/rollup.config.js — importsToBundle pattern
- BUILD — ts_library `modules-fix` module_name

Without these, //core/... fails to bundle:

  Module not found: Error: Can't resolve 'sa/core' in '...'

Webpack alias still pointed `df` → RUNFILES/df, so any import of
`sa/core` (post-rename TS path mapping) couldn't be resolved.

Found while verifying //core/... in Docker.
The pinned Node v24.13.0 in WORKSPACE had stale SHA256 hashes that no
longer matched nodejs.org's served binaries:

  Expected: e798599612f4bb71333a3397ab0d095fd62214e115aea45aa858a145fc72d67e
  Actual:   aa881151bd0f9f154a0424dd60a72e9ce10672619121658c278a24327ef46831

Bumped to Node v20.20.2 LTS (matches the node:20-bookworm base in
Dockerfile.dev). Fresh SHA256 hashes pulled from
nodejs.org/dist/v20.20.2/SHASUMS256.txt for all 5 platforms.

This was a stale-pin issue (not a Node 24 problem) — nodejs.org appears
to have re-published the v24.13.0 archives at some point. Pinning to an
LTS line is more stable.

Verified in Docker:
  ./scripts/docker-bazel build //protos:ts          → success
  ./scripts/docker-bazel build //core/...           → success
  ./scripts/docker-bazel test  //core/...           → 16/16 pass

Full tree (//...) still blocked by a separate pre-existing upstream
issue: tools/postgres/BUILD references @io_bazel_rules_docker which is
not declared in WORKSPACE.
…age directly

Upstream Dataform removed @io_bazel_rules_docker from WORKSPACE in commit
8be595a (Mar 2024), but the restored Postgres adapter files in
tools/postgres/BUILD still loaded `container_image` from it, breaking
`bazel build //...`:

  error loading package 'tools/postgres': Unable to find package for
  @io_bazel_rules_docker//container:image.bzl: The repository
  '@io_bazel_rules_docker' could not be resolved

Two paths considered:
  1. Restore @io_bazel_rules_docker decl in WORKSPACE (~67 lines of
     deprecated bazel infra to maintain).
  2. Refactor the fixture to use docker run directly.

Chose (2). Modern Postgres LTS, no deprecated bazel rules, simpler dev
flow. PostgresFixture now starts `postgres:15-alpine` via `docker run`
on the local daemon — no Bazel image staging needed.

Also rename DOCKER_CONTAINER_NAME from "postgres-df-integration-testing"
to "postgres-sa-integration-testing" (rename sweep miss).

Verified in Docker:
  ./scripts/docker-bazel build -- //... -//tools/postgres/...
  → 332 actions, Build completed successfully

tools/postgres/... itself still needs `pg` + `pg-query-stream` added
to package.json — that's Phase 1 of docs/postgres_reintegration_assessment.md
(separate PR).
Phase 1 of `adapter/postgres-first-class` per docs/postgres_first_class_design.md §6.
Adds the npm packages the restored Postgres adapter needs:

- pg ^8.11.3                   — node-postgres client
- pg-query-stream ^4.5.3       — streaming query results
- uuid ^9.0.0                  — used by tools/postgres fixture
- @types/pg ^8.11.0            — types for pg
- @types/uuid ^9.0.0           — types for uuid

Also removed @types/pg-query-stream from tools/postgres/BUILD; that
package is a stub (pg-query-stream 4.x bundles its own types) and yarn
warns when it's installed. Dropped from package.json too.

yarn.lock regenerated against the new Node 20.20.2 LTS pin (PR #2).

Verified in Docker:
  ./scripts/docker-bazel build //tools/postgres/...     → success
  ./scripts/docker-bazel build //...                    → success (139 targets)
  ./scripts/docker-bazel test  //...                    → 38/41 pass

Remaining failures (not caused by this PR):
  - //cli:index_run_e2e_test          — needs BigQuery test creds
  - //tests/integration:bigquery.spec — needs BigQuery test creds
  - //tests/api:projects.spec         — pre-existing schema mismatch on
    `warehouse` property in workflow_settings validation

Next phase (separate PR): relocate `api/dbadapters/postgres.ts` →
`cli/api/dbadapters/postgres.ts` and fix imports.
… (Phase 2)

Phase 2 of `adapter/postgres-first-class` per docs/postgres_first_class_design.md
(Phases 1-2 inherited verbatim from docs/postgres_reintegration_assessment.md).

Moves the restored Postgres adapter files into the modern Dataform/sqlanvil
CLI layout:

  api/dbadapters/postgres.ts → cli/api/dbadapters/postgres.ts
  api/utils/postgres.ts      → cli/api/utils/postgres.ts

Updated imports (mechanical) to point at the current `cli/api/...`
modules:

  sa/api/commands/credentials       → sa/cli/api/commands/credentials
  sa/api/dbadapters/index           → sa/cli/api/dbadapters/index
  sa/api/utils/postgres             → sa/cli/api/utils/postgres
  sa/api/utils/results              → sa/cli/api/utils/results
  sa/core/adapters                  → sa/cli/api/dbadapters/execution_sql

Also dropped the (now-broken) imports for symbols that were deleted
upstream when non-BQ warehouses were removed:

  sa/api/ssh_tunnel_proxy           — gone, deleted via commit b4d2b2f
  sa/api/utils/error_parsing        — gone (parseRedshiftEvalError)

The file still references `SSHTunnelProxy` and `parseRedshiftEvalError`
in the body; that's fine — file is **excluded from the BUILD glob** in
both `cli/api/BUILD` and `cli/api/utils/BUILD` until Phase 3 does the
proper interface alignment (executeRaw, deleteTable, schemas signature,
sqlanvil.IJDBC → new PostgresConnection proto, SSH removal, error
formatter swap).

Verified:
  ./scripts/docker-bazel build //...   → 139 targets, success

Empty root-level api/ directory removed.

Next: Phase 3a — implement IDbAdapter against the relocated file.
Adds the proto messages that the Postgres-first-class adapter needs,
per docs/postgres_first_class_design.md §3 + §8.2:

Action-level option blocks:
- PostgresOptions       — tablespace, fillfactor, unlogged, native
                          declarative partitioning, btree/gin/gist/hash/
                          brin indexes, materialized view refresh policy
- SupabaseOptions       — Realtime publication, RLS enable, owner role,
                          pgvector convenience config; nests PostgresOptions

Top-level connection config:
- BigQueryConnection    — project, location, default_dataset
- PostgresConnection    — host, port, database, user, password, ssl_mode,
                          default_schema (libpq-style)
- SupabaseConnection    — project_ref, service_role_key, default_schema,
                          optional direct connection_string override
- WarehouseConfig       — discriminated union over the three connection
                          variants via `oneof connection`

This PR is **additive only**. Nothing references these messages yet —
wiring into ActionConfig sub-messages (TableConfig, IncrementalTableConfig,
etc.) and WorkflowSettings happens in subsequent phases:

- Phase 3a   PostgresDbAdapter consumes PostgresConnection
- Phase 4    WorkflowSettings gets a `warehouse: WarehouseConfig` field;
             CLI dispatches on warehouse.kind
- Phase 5    SupabaseDbAdapter + rlsPolicy/realtimePublication/wrapper/
             vectorIndex action types consume SupabaseOptions

Verified:
  ./scripts/docker-bazel build //protos:ts   → success
  ./scripts/docker-bazel build //...         → success (139 targets)
Rewrites cli/api/dbadapters/postgres.ts so it compiles against the
modern IDbAdapter interface, and wires the BUILD targets so the file
is part of the //cli/api library again (drops the Phase 2 excludes).

Interface alignment per docs/postgres_first_class_design.md §6 +
docs/postgres_reintegration_assessment.md §Phase 3:

- credentials              sqlanvil.IJDBC → sqlanvil.IPostgresConnection
                           (new proto from Phase 3c)
- execute()                returns IExecutionResult { rows, metadata }
                           — was raw any[]
- executeRaw()             new, returns IExecutionResultRaw { rows,
                           schema, metadata } — schema kept empty (we
                           lean on the catalog query path for shape)
- withClientLock()         callback receives an IDbClient with both
                           execute() and executeRaw() shimmed over the
                           underlying pg pool client
- schemas(database)        now takes the database arg (ignored, since
                           Postgres is database-scoped), and filters
                           pg_catalog / pg_toast / pg_internal /
                           information_schema
- tables(database, schema) returns ITableMetadata[] (was ITarget[]) —
                           hydrates full metadata per row. Optional
                           schema filter is supported.
- deleteTable(target)      new — transactional `drop table|view if exists
                           ... cascade` keyed on the actual catalog type
- setMetadata()            guards against null actualMetadata (table
                           doesn't exist yet) instead of crashing

Modernization (assessment doc §Phase 5):

- Drop SSHTunnelProxy block — Supabase + most managed Postgres serve
  TLS on a public TCP port; SSH tunnel is no longer needed. The
  SSHTunnelProxy class was deleted upstream in commit b4d2b2f.
- Drop parseRedshiftEvalError — replaced with parsePostgresEvalError in
  cli/api/utils/error_parsing.ts. pg errors carry `.position` (byte
  offset) but not line/column, so we preserve the message only.
- Drop preview() — wasn't in IDbAdapter.

SSL handling tightened:
  ssl_mode = "disable"         → no TLS
  ssl_mode = "verify-ca"|"verify-full" → strict cert verification
  ssl_mode = "" | "require" | "prefer" | "allow"
                               → TLS with rejectUnauthorized=false
                               (matches default Supabase / RDS UX)

BUILD wiring:
- cli/api/BUILD: drop `dbadapters/postgres.ts` exclude; add `@npm//pg`
  and `@npm//@types/pg` deps.
- cli/api/utils/BUILD: drop `postgres.ts` exclude; add `@npm//pg`,
  `@npm//@types/pg`, `@npm//pg-query-stream` deps.

Verified:
  ./scripts/docker-bazel build //cli/api/...   → 8 targets, success
  ./scripts/docker-bazel build //...           → 139 targets, success
  ./scripts/docker-bazel test  //...           → 38/41 pass (same 3
    pre-existing failures: 2× missing BQ creds, 1× projects.spec
    `warehouse` validation issue — none regressed by this PR)

Next phase (Phase 3b): Postgres SQL generator under
core/compilation_sql/postgres/ — one generator per action type with
golden-output tests.
Captures the legal + structural plan for sqlanvil's documentation site:

- Tier 1 source: upstream/main:docs/ — Apache 2.0, already inherited
- Tier 2 source: docs.cloud.google.com/dataform — CC BY 4.0
- Tier 3: do-not-pull list (cloud.google.com marketing, screenshots, etc.)

License compliance worked out for both tiers — Apache 2.0 covered by
extending the existing NOTICE; CC BY 4.0 needs per-page attribution +
ATTRIBUTIONS.md.

Phased doc roadmap aligned to code phases:
- D1: pull Tier 1 source as-is, rebrand
- D2: rewrite reference pages Postgres-first
- D3: net-new Supabase action type pages
- D4: quickstart + CLI ref adapted from Tier 2
- D5: architecture & concept pages (mostly original)

Site stack recommendation: Astro Starlight on Vercel
(docs.sqlanvil.com), sibling repo ../sqlanvil-docs/ so doc deploys
don't trigger code CI.

Trademark scrubbing (dataform → sqlanvil) treated as separate concern
from copyright — same playbook as the code rename PR (#1).
@ihistand

ihistand commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded: the Postgres reintegration + Dataform→SQLAnvil rename landed on main directly, and the docs moved to the SQLAnvil/docs repo. Closing as part of #12 (stale-branch prune). The one un-migrated draft, gcp_test_project_setup.md, was migrated to SQLAnvil/docs.

@ihistand ihistand closed this Jun 7, 2026
@ihistand
ihistand deleted the docs/site-plan branch June 7, 2026 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant