Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .agents/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Project memory

- [Context](context.md): repository map and sources of truth.
- [Decisions](decisions.md): durable choices and their rationale.
- [AGENTS.md](../AGENTS.md): editing and verification rules.

Keep these notes small. Update existing entries when a decision changes; do not
append a transcript of each task. Implementation details, commands and user-facing
behavior belong in the linked code and documentation. Recheck live repository,
dependency and CI state rather than recording it here as a lasting fact.
41 changes: 41 additions & 0 deletions .agents/context.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Context

sqlc-ydb generates typed application code from YQL for YDB in a standalone Go
binary. It follows the familiar sqlc workflow while maintaining its own source
and release cycle. It is a development implementation with explicit coverage
limits; successful parsing alone does not establish semantic support.

## Code map

| Area | Responsibility |
| --- | --- |
| `cmd/sqlc-ydb`, `internal/cli` | Commands, pipeline orchestration, output validation and file IO |
| `internal/config` | Strict config parsing, supported options and defaults |
| `internal/source` | Input ordering and migration Up sections |
| `internal/analyzer` | Direct YQL parse contexts, catalog evolution, name/type resolution and diagnostics |
| `internal/model` | Resolved query/catalog data shared by generators; not an AST |
| `internal/codegen/{golang,python,cpp,csharp,java}` | Language naming and SDK-specific bindings, decoding and source rendering |
| `internal/endtoend` | CLI fixtures, expected diagnostics and generated golden files |
| `examples/authors` | Shared schema/config with language-specific dependencies and executable examples |
| `.github/workflows` | Offline verification and sequential acceptance steps per host |

## Sources of truth

- [README](../README.md): build and first generation.
- [Compatibility](../docs/compatibility.md): supported config, queries, schema
migrations, intentional exclusions and output ownership.
- [Architecture](../docs/architecture.md): current stages and responsibilities.
- [Targets](../docs/targets.md), [C++](../docs/cpp.md), [C#](../docs/csharp.md),
[Java](../docs/java.md): generated API and runtime contracts.
- [Development](../docs/development.md): commands and validation requirements.
- [Roadmap](../docs/roadmap.md): shared macros and deferred database-assisted analysis.
- [Release plan](../docs/release-plan.md): release gates, ydb.tech documentation,
external query corpus, and user-owned SDK reviews/consumer pilots.
- [Releasing](../docs/releasing.md): packaging, dry runs and publication workflow.
- [Changelog](../CHANGELOG.md): pending Unreleased entries and published stable versions.
- [Provenance](../docs/provenance.md): upstream references and inspected SDK sources.

The Go module name is authoritative in `go.mod`; the executable is `sqlc-ydb`.
Historical repository/module names can differ. Do not infer a rename or restore
the old engine-plugin dependencies from an archive branch. Check the current
Git branch, remote and worktree before any publication.
23 changes: 23 additions & 0 deletions .agents/decisions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Decisions

These choices constrain maintenance; implementation details remain in the linked
documents. Revisit a decision explicitly rather than letting a local workaround
change the architecture.

| Decision | Reason and reference |
| --- | --- |
| Independent YDB-only implementation | Compatibility concerns user workflow, not upstream internal code or Git history. See [compatibility](../docs/compatibility.md). |
| Keep semantic analysis; no intermediate AST | Direct ANTLR contexts avoid a second syntax representation while resolved types remain necessary for code generation. See [architecture](../docs/architecture.md). |
| Built-in generators only | New language support belongs in this repository; external engine/codegen/WASM/process plugins are deliberately excluded. See [compatibility](../docs/compatibility.md). |
| One modern C# ADO.NET target | The official SDK exposes ADO.NET already; a second nominally native profile would duplicate it. See [C#](../docs/csharp.md). |
| SQL-first Java framework adapters | Typed query methods and projection records fit JdbcTemplate and Hibernate JDBC callbacks. Do not infer ORM entities from arbitrary SQL. See [Java](../docs/java.md). |
| Shared macro processing before generators | Language count must not multiply SQL semantic work. A separate compiler package is optional; macros are still planned. See [roadmap](../docs/roadmap.md). |
| Offline generation by default | Database-assisted analysis is deferred until a concrete need defines the API and semantics. See [roadmap](../docs/roadmap.md). |
| Sequential local-ydb validation per host | Concurrent images, runtime suites and container builds have exceeded available memory. See [development](../docs/development.md). |
| User guide on ydb.tech near release | Keep technical references and examples here; publish the consumer journey with verified upstream recipes and explicit limits on the YDB site. See [release plan](../docs/release-plan.md). |
| Consumer acceptance in 0.x before 1.0.0 | The user arranges SDK reviews, production-query corpus access and real-project pilots; implementation work addresses the resulting findings. See [release plan](../docs/release-plan.md). |
| Manual publication from accumulated changelog entries | The maintainer chooses the version part in the Actions form. The workflow assigns the version and checks all artifacts before pushing the release commit/tag; RCs preserve pending notes. See [releasing](../docs/releasing.md). |

SDK-specific behavior should be reviewed with the SDK maintainers when its public
contract is unclear. They are available within the product team; invented fallback
behavior is not a substitute for establishing that contract.
69 changes: 67 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,25 @@ jobs:
with:
go-version-file: go.mod
cache: true
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
cache: maven
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Build and test standalone generator
run: |
go test ./...
make test-release
go test -p 1 ./...
make build
- name: Compile all generated scalar bindings against published SDKs
env:
SQLC_YDB_CSHARP_DOTNET: dotnet
SQLC_YDB_TEST_MAVEN: mvn
DOTNET_CLI_TELEMETRY_OPTOUT: '1'
run: go test -p 1 -count=1 ./internal/codegen/csharp ./internal/codegen/java
- name: Verify generated examples
run: |
./bin/sqlc-ydb compile -f examples/authors/sqlc.yaml
Expand All @@ -29,7 +44,7 @@ jobs:

ydb-acceptance:
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 30
services:
ydb:
image: ydbplatform/local-ydb:26.3.1.8
Expand All @@ -54,6 +69,14 @@ jobs:
with:
go-version-file: go.mod
cache: true
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
cache: maven
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Install tested Python runtimes
run: python3 -m pip install -r examples/authors/python/requirements.txt
# Keep local-ydb acceptance sequential: concurrent tests/compilers can
Expand All @@ -70,3 +93,45 @@ jobs:
go test -p 1 -count=1 -timeout=90s ./... -v
cd ..
python3 -m python.smoke
- name: Run C# ADO.NET example
working-directory: examples/authors
env:
SQLC_YDB_TEST_DSN: Host=localhost;Port=2136;Database=/local
DOTNET_CLI_TELEMETRY_OPTOUT: '1'
run: dotnet run --project csharp/adonet/Authors.AdoNet.csproj
- name: Run Java native, JDBC, Spring and Hibernate examples sequentially
run: sh examples/authors/java/run-smoke.sh

cpp-acceptance:
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
# Finish SDK compilation before starting YDB on this host.
- name: Build C++ native and userver examples with the pinned SDK image
run: |
docker build -t sqlc-ydb-cpp-tests -f examples/authors/cpp/Dockerfile examples/authors/cpp
docker run --rm -v "$PWD:/workspace" -w /workspace sqlc-ydb-cpp-tests \
bash -lc 'cmake -S examples/authors/cpp -B examples/authors/cpp/build -GNinja -DCMAKE_PREFIX_PATH=/usr/share/yandex && cmake --build examples/authors/cpp/build --target authors_native authors_userver -j1 -- -k 0'
- name: Start one disposable YDB service
run: |
docker run -d --name sqlc-ydb-cpp-server --hostname localhost \
-p 2136:2136 -e GRPC_PORT=2136 \
-e YDB_USE_IN_MEMORY_PDISKS=true -e YDB_DEFAULT_LOG_LEVEL=ERROR \
ydbplatform/local-ydb:26.3.1.8
for attempt in {1..60}; do
if timeout 10 docker exec sqlc-ydb-cpp-server /health_check; then
exit 0
fi
sleep 2
done
docker logs --tail 100 sqlc-ydb-cpp-server
exit 1
- name: Run C++ native and userver examples sequentially
run: |
docker run --rm --network host -v "$PWD:/workspace" -w /workspace \
-e SQLC_YDB_TEST_DSN=grpc://localhost:2136/local \
sqlc-ydb-cpp-tests bash examples/authors/cpp/run-smoke.sh
- name: Stop the disposable YDB service
if: always()
run: docker rm -f sqlc-ydb-cpp-server || true
Loading
Loading