feat(opal): port opal validation from Go CLI#12
Draft
beengud wants to merge 2 commits into
Draft
Conversation
Port the opal validation/inspection commands from the deprecated Go Observe CLI: check, verbs, functions, and validate-ingest. Output contracts (ERROR row:col, WARN kind, OK + schema fields, exit codes) mirror the Go behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Type-verified against the published Observe GraphQL schema (from observeinc/terraform-provider-observe): StageQueryInput's field is `id` (server binds it to StageID); `stageId` is deprecated. The prior `stageID` literal failed type-checking against the real schema. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4
Summary
Ports the
opalvalidation/inspection commands from the deprecated Go Observe CLI into the TypeScript CLI, preserving the original output contracts and exit codes.New command surface (
observe opal …):check <pipeline>/check --file <path>(-f) — validate an OPAL pipeline via thecheckQueriesAPI. Prints each error asERROR row:col: messageand exits 1; prints warnings-only asWARN kind row:coland exits 0; on success printsOKfollowed by the indented result-schema field names. Errors with emptytext(which the API returns when compilation requires an input dataset) are suppressed, matching the Go behavior.verbs— list all OPAL verbs (name, comma-joined categories, description), sorted by name, tab-separated. Adds--format json|csv.functions— list all OPAL functions (name, categories, return type, description), sorted by name, tab-separated. Adds--format json|csv.validate-ingest --dataset <id> <pipeline>— validate an ingest filter expression viavalidateIngestFilterExpression. Null/empty result →OK; diagnostics →ERROR: messageper entry and exit 1.GraphQL operations reproduced from the Go source (
cmd_opal.go,cmd_opal_validate.go,ot_opal.go) undersrc/gql/opal/:CheckQueries($queries: MultiStageQueryInput!)VerbsAndFunctionsValidateIngestFilter($pipeline: String!, $sourceDatasetID: ObjectId!)Registered the
opalroute insrc/app.ts(beforecli), and updated the README Commands table and the AGENTS.md Project Structure.Verification status
bun run codegencannot generatesrc/gql/generated/graphql.ts. As a resulttsc/bun run typecheck/bun build/ the fullbun run testpipeline are expected to fail on the missing generated types. Nothing undersrc/gql/generated/was hand-written or committed.mock.modulebefore import, so the generated-types import is never executed at runtime):src/commands/opal/check.test.tssrc/commands/opal/verbs.test.tssrc/commands/opal/functions.test.tssrc/commands/opal/validate-ingest.test.tsAssumptions / risks (could not verify against a live schema)
MultiStageQueryInputwithoutputStage+stages[{stageID, pipeline, input}];checkQueriesreturning a list withparsedPipeline.errors{col,row,text}andparsedPipeline.warnings{kind, symbol{col,row}}andresultSchema.fieldList{name};verbsAndFunctionsusingcategories(array) andreturnType; andvalidateIngestFilterExpressionreturning a list of{ message }. The generated TS type names (CheckQueriesDocument, etc.) follow the codegen convention and will resolve once codegen is run.🤖 Generated with Claude Code