feat: v2 — config redesign, schema checks, and tooling modernization#39
Open
mwisner wants to merge 11 commits intowundergraph:mainfrom
Open
feat: v2 — config redesign, schema checks, and tooling modernization#39mwisner wants to merge 11 commits intowundergraph:mainfrom
mwisner wants to merge 11 commits intowundergraph:mainfrom
Conversation
- Switch from npm to pnpm 10.32 - Replace ncc with tsdown (ESM bundle-all) - Replace eslint/prettier with oxlint + oxfmt + lefthook - Replace jest with vitest - Upgrade to Node 24, ES2024, bundler module resolution - Add GHA quality workflow (build, types, lint, test, format) - Bump all deps: @actions/core v3, @actions/github v9, @actions/exec v3, @octokit/rest v22, wgc v0.112, pathe v2, @types/node v25 - Fix DeploymentError.featureFlag removal in wgc v0.112 - Fix Context import for @actions/github v9 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add Zod v4 schema validation replacing unsafe `as Config` casts - Restructure cosmo.yaml: top-level `subgraphs` (with type: standard|edfs|grpc), `previews` (namespace, labels, subgraph routing URLs), and `check` (namespaces) - Refactor action inputs from boolean flags to action/stage string system - Reorganize code into src/actions/preview.ts and src/actions/schema.ts - Preview subgraphs reference top-level subgraphs by name with routing URL templates - Cross-validate preview references against existing standard subgraphs - Feature flags are now an implementation detail abstracted behind previews Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Run `wgc subgraph check` with JSON output for each changed subgraph against all namespaces defined in check.namespaces - Post upsertable PR comment with summary table (namespace, subgraph, status, lint error/warning counts, Studio link) - Fail the action if any check has non-success status - Add schema_check_results output for downstream workflow steps Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Basic tests for configSchema and actionInputSchema covering: - Minimal valid config, subgraph type defaults, edfs/grpc types - Full config with previews and check sections - Cross-validation: reject preview referencing non-existent or non-standard subgraphs - Action/stage discriminated union validation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The action shells out to `wgc` via exec but the bundled code doesn't put it in PATH. Install it globally at the start of each run so consumers don't need to handle it in their workflows. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Schema checks should always report on all subgraphs, not just ones with changed files in the PR. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove runtime wgc install (consumers provide it in their workflow) - Use `--out` flag to write check results to a temp file instead of parsing stdout, which outputs JS object notation rather than JSON Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When lint warnings/errors, breaking changes, composition issues, or graph pruning issues are found, a collapsible details section is added below the summary table for each affected namespace/subgraph combo. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tests for hasIssues and buildDetailsSection covering lint warnings, breaking changes, composition errors, graph pruning, multi-result rendering, and edge cases like missing line numbers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The summary table now shows total errors (breaking changes, composition errors, lint errors, graph prune errors) and total warnings across all issue types, so the counts align with the status column. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <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.
Summary
This is a major rework of the Cosmo Previews action, focused on three areas:
1. Config schema redesign
The
cosmo.yamlformat has been restructured for clarity and flexibility:subgraphswith typed support (standard,edfs,grpc) — onlystandardsubgraphs can be previewed, but all types can be checkedpreviewssection replaces the flatfeature_flags/subgraphspairing — each preview has its ownname,namespace,labels, and subgraph references withrouting_urltemplateschecksection for multi-namespace schema checks.refine()ensures preview subgraph references point to existingstandardsubgraphsBefore (v1):
After (v2):
2. Schema check support
New
action: schema/stage: checkmode that:wgc subgraph checkagainst all configured subgraphs across all namespaces in thechecksection<details>section per namespace/subgraph with full tables for:--outflag for reliable JSON parsing (stdout fromwgc -joutputs JS object notation, not valid JSON)3. Tooling modernization
using: node24in action.yml)4. Action input changes
The boolean
create/update/destroyinputs are replaced with explicitaction+stage:previewcreatepreviewupdatepreviewdeleteschemacheckBreaking Changes
cosmo.yaml) is completely different — see migration example abovecreate/update/destroybooleans toaction/stagestringscosmo_api_keyandgithub_tokenare now required inputsdist/index.js) to ESM (dist/index.mjs)wgcCLI is no longer bundled — must be installed in the workflow (npm i -g wgc@latest)Test Plan
AI Disclosure
This pull request was developed with assistance from Claude Code (Claude Opus 4.6, Anthropic's AI coding assistant). Claude helped with:
All code was reviewed, tested, and validated by a human contributor. The architectural decisions (config schema design, preview abstraction, schema check behavior) were directed by the human author through iterative feedback.
🤖 Generated with Claude Code