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
25 changes: 17 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,6 @@ jobs:
id-token: write
contents: read
runs-on: ubuntu-latest
# sdk omni runs the mocked suite with omnisdk's document-driven paths opted in, best effort.
continue-on-error: ${{ matrix.sdk == 'omni' }}
strategy:
matrix:
registry:
Expand Down Expand Up @@ -917,30 +915,41 @@ jobs:
run: |
cat ./test/robot/reports/output.xml

# Omni cutover readiness, best effort: the same suite with every stackql run opted in to the
# document-driven (omnisdk) paths. Reports a traffic light; never fails the job.
# Omni cutover readiness: report the full suite result, then fail CI if it fails.
- name: Omni cutover readiness traffic light
if: matrix.sdk == 'omni'
continue-on-error: true
env:
PYTHONPATH: '${{ env.PYTHONPATH }}:${{ github.workspace }}/test/python'
# "omni":"all" routes unprefixed providers through omnisdk; "unstable" alone only exposes stackql_unstable_*.
STACKQL_ROBOT_DEFAULT_PREVIEW: '{"unstable":true,"staging":true,"omni":"all"}'
run: |
pgrep -f flask | xargs kill -9 || true
python cicd/python/build.py --robot-test --config='{ "variables": { "SHOULD_RUN_DOCKER_EXTERNAL_TESTS": "true" } }' || true
if python cicd/python/build.py --robot-test --config='{ "variables": { "SHOULD_RUN_DOCKER_EXTERNAL_TESTS": "true" } }'; then
robot_status=0
else
robot_status=$?
fi
if [ -f test/robot/reports/output.xml ]; then
python test/python/stackql_test_tooling/robot_summary.py \
if python test/python/stackql_test_tooling/robot_summary.py \
--output test/robot/reports/output.xml \
--title "Omni cutover readiness" \
--require-100-percent \
--context "Mocked functional suite, every run opted in with STACKQL_ROBOT_DEFAULT_PREVIEW=${STACKQL_ROBOT_DEFAULT_PREVIEW}" \
>> "${GITHUB_STEP_SUMMARY}"
>> "${GITHUB_STEP_SUMMARY}"; then
summary_status=0
else
summary_status=$?
fi
else
{
echo "# 🔴 Omni cutover readiness"
echo ""
echo "No robot output was produced; the suite did not run."
} >> "${GITHUB_STEP_SUMMARY}"
summary_status=1
fi
if [ "$robot_status" -ne 0 ] || [ "$summary_status" -ne 0 ]; then
exit 1
fi

- name: Output from omni functional tests
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
github.com/spf13/cobra v1.10.2
github.com/spf13/pflag v1.0.10
github.com/spf13/viper v1.10.1
github.com/stackql-labs/omnisdk v0.1.7-alpha01
github.com/stackql-labs/omnisdk v0.1.7-alpha02
github.com/stackql/any-sdk v0.6.1-beta02
github.com/stackql/go-suffix-map v0.0.1-alpha02
github.com/stackql/psql-wire v0.1.2-beta02
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,8 @@ github.com/spf13/viper v1.10.1 h1:nuJZuYpG7gTj/XqiUwg8bA0cp1+M2mC3J4g5luUYBKk=
github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU=
github.com/spiffe/go-spiffe/v2 v2.7.0 h1:uXe1MflJoHw58wAUvxVlcM7WpKtijWG7I1UidcGh6g4=
github.com/spiffe/go-spiffe/v2 v2.7.0/go.mod h1:47Q0Q9/AqGha8QLHp+kxpH4Wca7X7EnOtlIJy3mxZ3U=
github.com/stackql-labs/omnisdk v0.1.7-alpha01 h1:DZ8wLZSZymbeJNxfIM0+bsgm49q0geEhowhKgQ0qp9g=
github.com/stackql-labs/omnisdk v0.1.7-alpha01/go.mod h1:P3pr9kvDTMox+4xCLcFdzOS1wMMe3ho9i6j2Xl+/Yog=
github.com/stackql-labs/omnisdk v0.1.7-alpha02 h1:+V2JYbLe9C6eeiGXXhSC3bIOnKriyt61kAxd2hM8uls=
github.com/stackql-labs/omnisdk v0.1.7-alpha02/go.mod h1:P3pr9kvDTMox+4xCLcFdzOS1wMMe3ho9i6j2Xl+/Yog=
github.com/stackql/any-sdk v0.6.1-beta02 h1:O+PiVsbjMh2165p6ek5vD7xnO+8ji7zxPpT2rEtAHos=
github.com/stackql/any-sdk v0.6.1-beta02/go.mod h1:M9b57jwOLa7afqZE5ZSTzN3YnaRGslJBIAdD5sz83Nw=
github.com/stackql/go-suffix-map v0.0.1-alpha02 h1:JI4aiq/OfHW4a/BiNqK31NbyaR94zlUOhGZof3G/OUo=
Expand Down
5 changes: 5 additions & 0 deletions internal/stackql/datasource/sql_datasource/generic.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package sql_datasource //nolint:revive,stylecheck // package name is helpful

import (
"context"
"database/sql"
"fmt"

Expand Down Expand Up @@ -86,3 +87,7 @@ func (ds *genericSQLDataSource) GetTableMetadata(args ...string) (sqltable.SQLTa
// `
// return nil, fmt.Errorf("could not obtain sql data source table metadata for table = '%s'", tableName)
// }

func (ds *genericSQLDataSource) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error) {
return ds.db.QueryContext(ctx, query, args...)
}
7 changes: 7 additions & 0 deletions internal/stackql/datasource/sql_datasource/sql_datasource.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package sql_datasource //nolint:stylecheck,revive // package name is helpful

import (
"context"
"database/sql"
"fmt"

Expand All @@ -9,6 +10,12 @@ import (
"github.com/stackql/stackql/internal/stackql/datasource/sqltable"
)

// ContextQuerier is the optional cancellation-capable query handle used by read adapters.
// Existing SQLDataSource implementations remain source compatible.
type ContextQuerier interface {
QueryContext(context.Context, string, ...any) (*sql.Rows, error)
}

type SQLDataSource interface {
Begin() (*sql.Tx, error)
Exec(string, ...interface{}) (sql.Result, error)
Expand Down
2 changes: 1 addition & 1 deletion internal/stackql/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ func (hc *standardHandlerContext) GetSupportedProviders(extended bool) (map[stri
}
// Every locally available bundle is also addressable document-first,
// once that has been opted into.
if intrinsic.IsUnstableEnabled() {
if intrinsic.IsExtendedCatalogEnabled() {
unstable := intrinsic.UnstablePrefix + pn
retVal[unstable] = map[string]interface{}{
"name": unstable,
Expand Down
76 changes: 76 additions & 0 deletions internal/stackql/intrinsic/completion_schema.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package intrinsic

import (
"maps"
"slices"

"github.com/stackql-labs/omnisdk/pkg/docparse/stackqldoc"
"github.com/stackql-labs/omnisdk/pkg/omnisdk"
"github.com/stackql-labs/omnisdk/pkg/query"
)

type completionSchemaTable struct {
omnisdk.Table
columns []string
types map[string]omnisdk.ColumnType
}

func withCompletionSchema(target, resource omnisdk.Table) omnisdk.Table {
columns := map[string]bool{}
types := map[string]omnisdk.ColumnType{}
for _, method := range resource.Methods() {
for _, name := range method.Columns() {
columns[name] = true
}
maps.Copy(types, method.ColumnTypes())
}
return &completionSchemaTable{Table: target, columns: slices.Sorted(maps.Keys(columns)), types: types}
}
func (t *completionSchemaTable) Methods() []omnisdk.MethodSignature {
methods := t.Table.Methods()
out := make([]omnisdk.MethodSignature, len(methods))
for i, method := range methods {
out[i] = newCompletedMethod(method, t.columns, t.types)
}
return out
}

type completedMethod struct {
omnisdk.MethodSignature
columns []string
types map[string]omnisdk.ColumnType
}

func newCompletedMethod(
base omnisdk.MethodSignature, columns []string, types map[string]omnisdk.ColumnType,
) omnisdk.MethodSignature {
return &completedMethod{MethodSignature: base, columns: slices.Clone(columns), types: maps.Clone(types)}
}
func (m *completedMethod) Columns() []string { return slices.Clone(m.columns) }
func (m *completedMethod) ColumnTypes() map[string]omnisdk.ColumnType { return maps.Clone(m.types) }
func (m *completedMethod) ServerEnvironmentBindings() map[string]string {
if metadata, ok := m.MethodSignature.(omnisdk.ServerEnvironmentBindings); ok {
return metadata.ServerEnvironmentBindings()
}
return nil
}

func describeMutationTable(
registry string, target query.Target, await bool, opts ...stackqldoc.Option) (omnisdk.Table, error) {
table, err := omnisdk.DescribeMutation(registry, target.Resource().Handle(), target.Verb().String(), opts...)
if err != nil || !await {
return table, err
}
resource, err := omnisdk.DescribeTable(registry, target.Resource().Handle())
if err != nil {
return nil, err
}
return withCompletionSchema(table, resource), nil
}

func (m *completedMethod) ServerTransportDefaults() map[string]string {
if metadata, ok := m.MethodSignature.(omnisdk.ServerTransportDefaults); ok {
return metadata.ServerTransportDefaults()
}
return nil
}
Loading
Loading