Skip to content

chore(ci): remove self-hosted runners from public repo#108

Closed
govindpawa wants to merge 1 commit intomainfrom
chore/remove-self-hosted-runners
Closed

chore(ci): remove self-hosted runners from public repo#108
govindpawa wants to merge 1 commit intomainfrom
chore/remove-self-hosted-runners

Conversation

@govindpawa
Copy link
Copy Markdown
Contributor

@govindpawa govindpawa commented Mar 11, 2026

Summary

Remove self-hosted ARC runners (arc-runner-altimate-code) from all workflows and replace with ubuntu-latest. Self-hosted runners on public repos are a security risk — any fork can submit a PR that runs arbitrary code on our infrastructure.

Files changed:

  • .github/workflows/ci.yml — 3 jobs (typescript, lint, python)
  • .github/workflows/test.yml — 3 jobs (unit, e2e, required)
  • .github/workflows/release.yml — 4 jobs (build, publish-npm, publish-engine, github-release)

Test Plan

  • CI on this PR validates that all jobs pass on ubuntu-latest
  • Next release tag will confirm release workflow works end-to-end

Checklist

  • Tests added/updated
  • Documentation updated (if needed)
  • CHANGELOG updated (if user-facing)

Replace arc-runner-altimate-code with ubuntu-latest across all
workflows. Self-hosted runners on public repos are a security
risk — any fork can trigger workflows on our infrastructure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions
Copy link
Copy Markdown

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot closed this Mar 11, 2026
@govindpawa govindpawa deleted the chore/remove-self-hosted-runners branch March 11, 2026 15:08
anandgupta42 added a commit that referenced this pull request Mar 18, 2026
Change from pinned 0.2.3 to ^0.2.3 so it auto-resolves to 0.2.4+
when the new npm version is published (includes analyze_tags from
altimate-core-internal PR #108, now merged).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
anandgupta42 added a commit that referenced this pull request Mar 18, 2026
…ript (#221)

* feat: [Phase 0] add Dispatcher abstraction layer for Python bridge migration

Introduces a Strangler Fig pattern for incrementally replacing the Python
altimate-engine bridge with native TypeScript implementations.

- Create native/dispatcher.ts with typed register() and call() functions
- Create native/index.ts barrel export
- Update all 66 tool files: Bridge.call() -> Dispatcher.call()
- Add ALTIMATE_NATIVE_ONLY=1 feature flag (CI gate)
- Add ALTIMATE_SHADOW_MODE=1 for parity testing (runs both paths, logs mismatches)
- Zero behavior change -- all calls fall through to Python bridge
- Update altimate/index.ts to export Dispatcher

Closes #215

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address code review findings for dispatcher

Fixes all issues identified in 6-model consensus code review:

- CRITICAL: Shadow mode now fire-and-forget (no double execution, no latency)
  - Native handler returns immediately
  - Bridge comparison runs asynchronously via compareShadow()
- MAJOR: Add telemetry tracking for native handler calls (duration, success/error)
- MAJOR: Type register() parameter as BridgeMethod (prevents typo'd method names)
- MAJOR: Add comprehensive unit tests (10 tests covering all code paths)
- MINOR: Add reset() function for test isolation
- MINOR: Log bridge errors in shadow mode instead of swallowing silently

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: [Phase 1] wire altimate-core napi-rs bindings — 34 native handlers

Replace 34 Python bridge methods with direct calls to @altimateai/altimate-core
npm package (napi-rs Node.js bindings for the Rust SQL engine).

- Add @altimateai/altimate-core@0.2.3 dependency
- Create native/schema-resolver.ts — Schema from file/JSON/DDL with empty fallback
- Create native/altimate-core.ts — 34 registered handlers:
  - All altimate_core.* methods (validate, lint, safety, transpile, explain, check,
    fix, policy, semantics, testgen, equivalence, migration, schema_diff, rewrite,
    correct, grade, classify_pii, query_pii, resolve_term, column_lineage,
    track_lineage, format, metadata, compare, complete, optimize_context,
    optimize_for_query, prune_schema, import_ddl, export_ddl, fingerprint,
    introspection_sql, parse_dbt, is_safe)
  - altimate_core.check is composite (validate + lint + scan_sql)
- Port IFF/QUALIFY transpile transforms from Python guard.py
- Each handler wraps results into AltimateCoreResult format
- Add registerAll() for test isolation
- Add 26 unit tests covering schema, IFF, QUALIFY, registration, wrappers, errors
- Update native/index.ts with side-effect import

Closes #216

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: [Phase 2] connection manager + 10 Node.js database drivers

Replace Python ConnectionRegistry, credential store, SSH tunneling, Docker
discovery, and dbt profiles parser with native TypeScript implementations.

Core infrastructure:
- connections/registry.ts — ConnectionRegistry with lazy driver loading
- connections/credential-store.ts — keytar with graceful fallback
- connections/ssh-tunnel.ts — ssh2-based tunnel with process exit cleanup
- connections/docker-discovery.ts — detect postgres/mysql/mssql containers
- connections/dbt-profiles.ts — parse ~/.dbt/profiles.yml with Jinja env_var()
- connections/types.ts — shared Connector interface
- connections/register.ts — registers 9 dispatcher methods

10 database drivers (all lazy-loaded via dynamic import):
- postgres.ts (pg), redshift.ts (pg), mysql.ts (mysql2)
- snowflake.ts (snowflake-sdk), bigquery.ts (@google-cloud/bigquery)
- databricks.ts (@databricks/sql), sqlserver.ts (mssql)
- oracle.ts (oracledb thin), duckdb.ts (duckdb), sqlite.ts (better-sqlite3)

Dispatcher methods registered:
- sql.execute, sql.explain, warehouse.list, warehouse.test
- warehouse.add, warehouse.remove, warehouse.discover
- schema.inspect, dbt.profiles

Add yaml dependency for dbt profiles parsing.
Add 36 unit tests covering registry, credentials, dbt profiles, docker
discovery, dispatcher integration, and DuckDB driver.

Closes #217

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: [Phase 3+4] schema cache, finops, dbt, and local testing

Complete the native TypeScript replacement for all remaining Python bridge
methods: schema caching, FinOps cost intelligence, dbt operations, and local
testing.

Schema cache (6 methods):
- schema/cache.ts — SQLite-backed (better-sqlite3) with LIKE-based search
- schema/pii-detector.ts — altimate-core classifyPii + cached schema
- schema/tags.ts — Snowflake TAG_REFERENCES queries
- schema/register.ts — schema.index, schema.search, schema.cache_status,
  schema.detect_pii, schema.tags, schema.tags_list

FinOps (8 methods):
- finops/credit-analyzer.ts — Snowflake/BigQuery/Databricks credit SQL
- finops/query-history.ts — multi-warehouse query history templates
- finops/warehouse-advisor.ts — sizing recommendations
- finops/unused-resources.ts — stale table/idle warehouse detection
- finops/role-access.ts — RBAC grants, hierarchy, user roles
- finops/register.ts — all 8 finops.* dispatcher methods

dbt (3 methods):
- dbt/runner.ts — spawn dbt CLI with 300s timeout
- dbt/manifest.ts — parse target/manifest.json
- dbt/lineage.ts — manifest + altimate-core column lineage
- dbt/register.ts — dbt.run, dbt.manifest, dbt.lineage

Local testing (3 methods):
- local/schema-sync.ts — introspect remote, create in DuckDB
- local/test-local.ts — transpile + execute locally
- local/register.ts — local.schema_sync, local.test, ping

Add 50 unit tests covering registration, SQL templates, manifest parsing,
upstream selectors, DuckDB type mapping, and error paths.

Closes #218
Closes #219

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: register composite SQL dispatcher methods — 72/73 native

Register 9 remaining composite SQL methods that combine multiple
altimate-core calls:

- sql.analyze (lint + semantics + safety)
- sql.translate (transpile with IFF/QUALIFY transforms)
- sql.optimize (rewrite + lint)
- sql.format, sql.fix, sql.rewrite
- sql.diff (text diff + equivalence check)
- sql.schema_diff (schema comparison)
- lineage.check (column-level lineage)

Only sql.autocomplete remains on bridge (complex cursor logic).

72 of 73 bridge methods now have native TypeScript handlers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: [Phase 5] remove Python bridge fallback — all 73 methods native

Complete the Python bridge elimination:

- Remove Bridge.call() fallback from dispatcher — now throws if no handler
- Remove shadow mode (migration complete, no longer needed)
- Remove Bridge/ensureEngine exports from altimate/index.ts
- Register sql.autocomplete native handler (keyword + altimate-core completion)
- Register 9 composite SQL methods (analyze, translate, optimize, format,
  fix, diff, rewrite, schema_diff, lineage.check)
- Update tool error messages to remove Python bridge references
- Update dispatcher tests to match new behavior (no fallback)

73 of 73 bridge methods now have native TypeScript handlers.
Zero Python dependency for all tool operations.

Closes #220

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: [Phase 5 final] delete Python bridge + engine, move types, update docs

Complete the Python elimination — close all remaining gaps from the plan:

1. Move protocol types: bridge/protocol.ts -> native/types.ts
   Update all 42 imports across src/ to use native/types
2. Delete packages/altimate-engine/ (entire Python package)
3. Delete packages/opencode/src/altimate/bridge/ (client, engine, protocol)
4. Delete test/bridge/ (bridge-specific tests)
5. Fix credential store: no plaintext fallback — strip sensitive fields
   and warn users to use ALTIMATE_CODE_CONN_* env vars instead
6. Update CLI engine command: reports native TypeScript mode
7. Update README.md: remove Python references, update architecture diagram,
   replace PyPI badge with npm, simplify dev setup (no pip/venv)
8. Update troubleshooting.md: replace Python bridge section with native
   TypeScript troubleshooting
9. Remove bridge mocks from test files (no longer needed)

73/73 methods native. Zero Python dependency. Bridge deleted.

Closes #220
Closes #210

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address all code review findings — security, correctness, robustness

Fix all 13 issues from 4-model consensus code review:

CRITICAL:
- SQL injection in finops queries: add escapeSqlString() utility, apply to
  all user-supplied params in query-history, role-access, credit-analyzer, tags
- SQL injection in driver introspection: parameterize postgres ($1), redshift ($1),
  oracle (:1), duckdb/sqlite (escape utility) for listTables/describeTable
- Missing try-catch in sql.execute and schema.inspect handlers

MAJOR:
- LIMIT appending: only for SELECT/WITH/VALUES queries (not INSERT/UPDATE/DELETE)
- sql.diff/sql.schema_diff: accept both old and new param field names
- Credential store: saveConnection returns { sanitized, warnings } for visibility
- dbt manifest: async file read (fs.promises.readFile) to avoid blocking event loop

MINOR:
- Snowflake: validate private key file exists before reading
- SSH tunnel: use process.once for cleanup handlers
- SSH tunnel: close tunnel if driver connect fails after tunnel starts

Cross-repo:
- altimate-core-internal: add sqlserver dialect alias
- altimate-mcp-engine: escape Redshift schema, configurable SQL Server TLS

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: extract @altimateai/drivers shared workspace package

Move the 10 database drivers, types, and SQL escape utilities from
packages/opencode/src/altimate/native/connections/drivers/ into a new
shared workspace package at packages/drivers/.

This enables altimate-mcp-engine (and any future consumer) to import
the same driver code instead of maintaining separate implementations.

New package: packages/drivers/
- src/types.ts — Connector, ConnectorResult, SchemaColumn, ConnectionConfig
- src/sql-escape.ts — escapeSqlString, escapeSqlIdentifier
- src/{postgres,snowflake,bigquery,databricks,redshift,mysql,sqlserver,
  oracle,duckdb,sqlite}.ts — 10 database drivers
- src/index.ts — barrel exports

Updated packages/opencode/:
- package.json — added @altimateai/drivers: workspace:*
- 13 files updated to import from @altimateai/drivers instead of local

Deleted from packages/opencode/:
- src/altimate/native/connections/drivers/ (10 files)
- src/altimate/native/connections/types.ts
- src/altimate/native/sql-escape.ts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: fix review NITs + protect new files in upstream merge config

- Add packages/drivers/** and packages/opencode/test/altimate/** to
  keepOurs in script/upstream/utils/config.ts to prevent upstream
  merges from overwriting our custom code
- Remove stray .diff files from repo
- Keep telemetry type as "bridge_call" (enum constraint in telemetry module)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: rename telemetry type bridge_call -> native_call

The Python bridge no longer exists — rename the telemetry event type
to accurately reflect that calls now go through native TypeScript handlers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: add E2E driver tests + driver docs + discover integration

E2E tests for 8 of 10 database drivers:
- test/altimate/drivers-e2e.test.ts — DuckDB (in-memory + file),
  SQLite (file-based), PostgreSQL (Docker, skipped if unavailable)
  28 passing tests covering connect, execute, DDL/DML, listSchemas,
  listTables, describeTable, LIMIT truncation, error handling
- test/altimate/drivers-docker-e2e.test.ts — MySQL (Docker),
  SQL Server (Docker azure-sql-edge), Redshift (Docker PG wire-compat)
  8 passing tests with container lifecycle management

Driver documentation:
- docs/docs/drivers.md — support matrix, auth methods, connection
  config examples, SSH tunneling, auto-discovery, untested features

Discover integration updates:
- connections/docker-discovery.ts — added Oracle container detection
- tools/project-scan.ts — added env var detection for SQL Server,
  Oracle, DuckDB, SQLite

Cleanup:
- Remove unused @ts-expect-error directives (deps now installed)
- Fix SQL Server Docker timeout (60s -> 90s)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ci: add driver-e2e CI job + env var support for CI services

Add a dedicated driver-e2e CI job that runs automatically when driver
files or connection infrastructure changes. Uses GitHub Actions services
(PostgreSQL, MySQL, SQL Server, Redshift/PG) instead of Docker-in-Docker.

CI changes (.github/workflows/ci.yml):
- Add drivers path filter for packages/drivers/src/**, connections/**, tests
- Add driver-e2e job with 4 service containers (PG, MySQL, MSSQL, Redshift)
- Pass TEST_*_HOST/PORT/PASSWORD env vars to tests
- Remove dead Python/lint jobs (altimate-engine deleted)

Test changes:
- drivers-e2e.test.ts: read PG config from TEST_PG_* env vars, skip Docker
  when CI service is available
- drivers-docker-e2e.test.ts: read MySQL/MSSQL/Redshift config from
  TEST_*_HOST env vars, skip Docker container startup in CI

The tests now work in 3 modes:
1. Local with Docker: starts containers automatically
2. CI with services: uses pre-started GitHub Actions services
3. No Docker: skips Docker-dependent tests, runs DuckDB/SQLite only

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: Snowflake E2E tests + encrypted key-pair auth fix

37 E2E tests against a live Snowflake account covering:

Auth methods tested:
- Password authentication (primary user)
- Key-pair with unencrypted PEM file
- Key-pair with encrypted PEM + passphrase decryption
- Invalid credentials rejection
- Non-existent key file rejection
- Wrong passphrase rejection

Query tests:
- Basic queries (SELECT, math, strings, timestamps)
- LIMIT truncation (explicit + parameter)
- DDL (CREATE/DROP TEMPORARY TABLE)
- DML (INSERT, UPDATE, DELETE)
- Snowflake types (VARIANT, ARRAY, OBJECT, BOOLEAN, DATE, NULL, Unicode)
- Adversarial inputs (SQL injection, empty query, invalid SQL, long queries)
- Warehouse operations (SHOW WAREHOUSES/DATABASES/SCHEMAS)
- Schema introspection (listSchemas, listTables, describeTable)

Driver fix (packages/drivers/src/snowflake.ts):
- Fix encrypted key-pair auth: decrypt PKCS8 encrypted PEM using Node
  crypto.createPrivateKey() before passing to snowflake-sdk
- snowflake-sdk requires unencrypted PEM — we handle decryption

Updated docs/docs/drivers.md: Snowflake now marked as E2E tested with
full auth method coverage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: Databricks E2E tests — 24 tests against live account

24 E2E tests against a live Databricks SQL warehouse covering:
- PAT authentication (connect, verify catalog/schema, reject invalid token)
- Query execution (SELECT, math, strings, timestamps, multi-column)
- LIMIT handling (explicit + parameter truncation)
- Schema introspection (listSchemas, listTables, describeTable via Unity Catalog)
- DDL (CREATE TEMPORARY VIEW)
- Databricks-specific (SHOW CATALOGS, SHOW SCHEMAS, SHOW TABLES)
- Adversarial inputs (SQL injection, empty query, invalid SQL, non-existent table)
- Type handling (Unicode, NULL, Boolean)

Updated docs/docs/drivers.md: Databricks now marked as E2E tested.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: add warehouse telemetry — connect, query, introspection, discovery, census

Add 5 telemetry event types for data moat insights:

warehouse_connect — every connection attempt:
  - warehouse_type, auth_method (password/key_pair/token/file/connection_string)
  - success/failure, duration_ms
  - error_category (auth_failed/network_error/driver_missing/config_error/timeout)

warehouse_query — every SQL execution:
  - warehouse_type, query_type (SELECT/INSERT/UPDATE/DELETE/DDL/SHOW)
  - success/failure, duration_ms, row_count, truncated
  - error_category (syntax_error/permission_denied/timeout/connection_lost)

warehouse_introspection — schema discovery operations:
  - operation (index_warehouse), result_count

warehouse_discovery — auto-discovery runs:
  - source (docker/dbt_profiles/env), connections_found, warehouse_types

warehouse_census — one-time per session:
  - total_connections, warehouse_types[], connection_sources[]
  - has_ssh_tunnel, has_keychain

Safety: every Telemetry.track() wrapped in try/catch — telemetry
failures never break user operations.

Data moat value:
- Popular connectors (warehouse_type frequency)
- Auth method adoption (password vs key-pair vs token)
- Failure patterns (error_category distribution)
- Query patterns (SELECT vs DDL vs DML ratios)
- Schema usage (introspection frequency per warehouse)
- Connection sources (config vs env vs dbt)

41 new tests covering auth detection, error categorization, census
deduplication, query type detection, and safety guarantees.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: adversarial telemetry safety tests + defensive helper fixes

14 adversarial tests that mock Telemetry.track to ALWAYS THROW,
then verify every driver operation still succeeds:
- warehouse.list with throwing census telemetry
- warehouse.test with throwing connect telemetry
- warehouse.add with throwing telemetry
- warehouse.discover with throwing telemetry
- 10 sequential operations with throwing telemetry
- Telemetry.getContext() throwing
- Helper functions with null/undefined/bizarre input

Defensive fixes to helper functions:
- detectAuthMethod: handles null, undefined, non-object input
- detectQueryType: handles null, undefined, non-string input
- Both return safe defaults instead of crashing

These tests guarantee the previous incident (bad telemetry breaking
drivers) cannot happen again.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: BigQuery E2E tests — 25 tests against live account

25 E2E tests against a live BigQuery project (diesel-command-384802):
- Service Account auth (connect, verify project, reject invalid creds)
- Query execution (SELECT, math, strings, timestamps, multi-column)
- LIMIT handling (explicit + parameter truncation)
- Schema introspection (listSchemas=datasets, listTables, describeTable)
- BigQuery-specific (UNNEST, STRUCT, DATE/DATETIME/TIMESTAMP, STRING_AGG,
  GENERATE_ARRAY)
- Adversarial inputs (multi-statement, empty, invalid SQL, non-existent
  dataset, Unicode, NULL, long column list)

Updated docs/docs/drivers.md: BigQuery now marked as E2E tested.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ci: fix test isolation — cloud tests skip without credentials, driver E2E only on code change

CI structure:
- typescript job: runs ALL tests via bun test. Cloud driver tests
  (Snowflake, BigQuery, Databricks) auto-skip when ALTIMATE_CODE_CONN_*
  env vars are absent. Docker E2E tests auto-skip when Docker unavailable.
  No manual exclusion needed — skipIf() handles everything.
- driver-e2e job: only triggers when packages/drivers/src/** or
  connection infrastructure code changes. Does NOT run on every PR.
  Uses GitHub Actions services (PG, MySQL, MSSQL, Redshift) — no
  Docker-in-Docker.
- Cloud credential tests (Snowflake/BigQuery/Databricks) are local-only.
  Never run in CI. Always skip cleanly (0 pass, 0 fail, all skip).

Test timing impact:
- Cloud tests: ~200ms to import+skip 90 tests (negligible)
- Docker tests: skip instantly when Docker unavailable
- driver-e2e job: separate workflow, doesn't block the main test job

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: bump @altimateai/altimate-core to ^0.2.3 (semver range)

Change from pinned 0.2.3 to ^0.2.3 so it auto-resolves to 0.2.4+
when the new npm version is published (includes analyze_tags from
altimate-core-internal PR #108, now merged).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address all 17 Sentry bot review comments on PR #221

CRITICAL (4):
- Redshift describeTable: external_type -> data_type in svv_columns query
- sql.fix handler: return correct SqlFixResult shape (error_message,
  suggestions, suggestion_count)
- sql.schema_diff: use Schema.fromDdl() not fromJson() for DDL strings,
  return flat SchemaDiffResult (not wrapped in data)
- DuckDB connect: verified correct (db.connect() is sync, no fix needed)

HIGH (5):
- analyzeMigration: removed unused combinedDdl, clarified comment
- Dynamic import: replaced import(variable) with static switch statement
  for bundler compatibility (10 cases)
- Race condition: added pending Map for in-flight connector creation,
  concurrent callers await the same Promise
- registry.add: cache sanitized config (not unsanitized with plaintext creds)
- detectPiiLive: return success:false on error (not success:true)

MEDIUM (6):
- Dispatcher error path: wrap Telemetry.track in try/catch to not mask errors
- SSH tunnel: add process.exit(0) after SIGINT/SIGTERM cleanup
- PII detector: add listColumns() to SchemaCache, use instead of search("")
- sql.autocomplete: pass prefix.length as cursor position (not hardcoded 0)
- SQL Server describeTable: query sys.objects (tables+views) not just sys.tables
- Databricks INTERVAL syntax: DATE_SUB takes integer, not INTERVAL expression
  (fixed in unused-resources.ts and credit-analyzer.ts)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: remove stray pr221.diff file

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: 30 adversarial tests + optionalDependencies for drivers package

Adversarial tests covering edge cases, malicious inputs, resource
exhaustion, concurrent access, and error recovery. Plus
optionalDependencies in drivers package.json per plan consensus.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: dbt-first SQL execution — use dbt adapter before falling back to native driver

When working in a dbt project, sql.execute now tries the dbt adapter first
(which connects using profiles.yml) before falling back to native drivers.
This means users in dbt projects don't need to separately configure warehouse
connections — dbt already knows how to connect.

Flow:
1. If no explicit warehouse specified, try dbt adapter
2. dbt adapter uses profiles.yml connection (no separate config needed)
3. If dbt not configured or fails, fall back to native driver
4. If native driver also not configured, return clear error

The dbt adapter is lazy-loaded and cached — only created on first use.
If dbt config doesn't exist (~/.altimate-code/dbt.json), it's skipped
permanently for the session (no retry overhead).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: E2E tests for dbt-first SQL execution

10 E2E tests verifying the dbt-first execution strategy:

dbt profiles auto-discovery:
- parseDbtProfiles finds connections from ~/.dbt/profiles.yml
- dbt.profiles dispatcher returns connections
- warehouse.discover includes dbt profiles

dbt-first SQL execution:
- dbt adapter can be created from config
- sql.execute without explicit warehouse tries dbt first
  (verified: "sql.execute via dbt: 1 rows, columns: n")

Direct dbt adapter execution:
- SELECT 1 via adapter
- Query against dbt model
- Invalid SQL handled gracefully

Fallback behavior:
- When dbt not configured, falls back to native driver silently
- Explicit warehouse param bypasses dbt entirely

All tests auto-skip when dbt project not available.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: update all documentation for Python elimination + dbt-first execution

README.md:
- Add "dbt-first" one-liner about automatic profiles.yml usage
- Add packages/drivers/ to monorepo structure

docs/docs/drivers.md:
- Add dbt-first execution strategy documentation with flow diagram
- Add architecture section (execution flow, dispatcher, shared drivers)
- Add credential security section (3-tier: keytar → env vars → refuse)
- Add telemetry section (5 event types, opt-out instructions)
- Update dbt profiles section to explain dbt-first strategy

docs/docs/troubleshooting.md:
- Update connection troubleshooting with dbt-first guidance
- Add altimate-dbt init as first suggestion for dbt users

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: resolve remaining Sentry review comments

1. Dispatcher success-path telemetry: wrap Telemetry.track in try/catch
   so telemetry failure never turns a successful operation into an error
2. Databricks warehouse-advisor: fix INTERVAL syntax in DATE_SUB
   (Databricks takes integer, not INTERVAL expression)
3. SSH tunnel leak: close tunnel if connector.connect() fails after
   createConnector() successfully started the tunnel

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: remove all Python engine infrastructure from CI and build

- Delete .github/workflows/publish-engine.yml (PyPI publish workflow)
- Remove publish-engine job from .github/workflows/release.yml
- Remove ALTIMATE_ENGINE_VERSION from build.ts esbuild defines
- Remove pyproject.toml reading from build.ts
- Replace bump-version.ts engine bumping with deprecation message
- Mark engine_started/engine_error telemetry types as deprecated
- Rewrite docs/RELEASING.md — remove all Python/PyPI steps

Zero remaining live references to Python engine in CI, build, or release.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: CI Redshift database, DuckDB race condition, schema-sync SQL escape

CI fixes:
- Add POSTGRES_DB=dev to Redshift service so test database exists
- Fix Redshift "database dev does not exist" failure in Driver E2E

Sentry fixes:
- DuckDB: guard against race between callback and timeout using
  resolved flag (prevents masked initialization errors)
- schema-sync: escape warehouse name in INSERT with escapeSqlString()
  and Number() coerce for integer values

Verified locally: bun test = 2905 pass / 320 fail (identical to main baseline)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* perf: lazy handler registration — load napi binary on first call

Handler modules loaded on first Dispatcher.call() instead of at import.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: eliminate all mock.module usage — tests now match main baseline

Root cause of 320 CI failures: bun's mock.module leaks across test files.

Fixes:
- Rewrite 7 test files to use env var (ALTIMATE_TELEMETRY_DISABLED=true)
  and spyOn() instead of mock.module
- Make handler registration lazy (async import on first Dispatcher.call)
  instead of side-effect imports at module load time
- Update upstream guard tests: altimate-engine deleted, drivers added
- Reduce Docker detection timeout from 5s to 3s
- Fast-path skip for Docker tests when CI services not configured

Results:
- Before: 2905 pass, 320 fail (mock.module pollution)
- After:  3310 pass, 3 fail (all pre-existing on main: pty, tool.registry, tool.skill)
- Main:   3091 pass, 13 fail

Our branch now has FEWER failures than main because we eliminated the
mock.module cross-contamination that caused some of main's failures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: resolve remaining Sentry comments — Databricks DATE_SUB + SqlExecuteResult type

- Databricks finops: change DATE_SUB(CURRENT_TIMESTAMP(), N) to
  DATE_SUB(CURRENT_DATE(), N) — Databricks DATE_SUB requires DATE type
  (fixed in credit-analyzer, query-history, unused-resources, warehouse-advisor)
- Add optional error field to SqlExecuteResult type to match actual returns

All other Sentry comments were already fixed in previous commits (verified
each against current code). The 30 Sentry comments on this PR map to ~20
unique issues, all now resolved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant