Skip to content

Commit bc03424

Browse files
committed
Merge main and preserve protected-link guards during user offboarding
2 parents afb12e4 + bcbab2a commit bc03424

466 files changed

Lines changed: 137190 additions & 32409 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/go.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ jobs:
9191
go-version-file: go.mod
9292
cache: true
9393

94+
- name: Set up Node.js
95+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
96+
with:
97+
node-version-file: '.nvmrc'
98+
9499
- name: Verify handler annotations parse and produce valid OpenAPI 3.0
95100
run: make openapi-check
96101
# Fails when swag can't parse an annotation, or when the resulting

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ scripts/*
177177
!scripts/.layering-baseline
178178
!scripts/.handler-db-access-allowlist
179179
!scripts/openapi-convert/
180+
!scripts/openapi-v2-generate/
181+
!scripts/openapi-v2-metadata/
180182
!scripts/openapi-convert/**
181183
!scripts/openapi-v2-check/
182184
!scripts/openapi-v2-check/**

Makefile

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ LDFLAGS=-ldflags="-s -w"
1919
# Directories
2020
FRONTEND_DIR=frontend
2121

22-
.PHONY: all build build-linux build-windows build-windows-arm64 clean deps frontend help hooks lint dev-build release openapi openapi-check openapi-v2-check coding-agent-image dev-tools install-golangci-lint install-govulncheck install-deadcode ci-tools-check ci-go ci-frontend ci
22+
.PHONY: all build build-linux build-windows build-windows-arm64 clean deps frontend help hooks lint dev-build release openapi openapi-v2 openapi-check openapi-v2-check openapi-v2-client-smoke coding-agent-image dev-tools install-golangci-lint install-govulncheck install-deadcode ci-tools-check ci-go ci-frontend ci
2323

2424
# Tooling. swag is a tool dependency tracked in go.mod (see `tool` directive),
2525
# so the version is pinned and CI / dev installs always agree. `go tool swag`
@@ -29,6 +29,8 @@ OPENAPI_DIR = api
2929
GOLANGCI_LINT_VERSION := 2.13.1
3030
GOVULNCHECK_VERSION := 1.3.0
3131
DEADCODE_VERSION := 0.45.0
32+
OAPI_CODEGEN_VERSION := 2.5.0
33+
OAPI_RUNTIME_VERSION := 1.1.1
3234
NODE_VERSION := 24.18.0
3335
NPM_VERSION := 11.16.0
3436

@@ -125,26 +127,30 @@ ci: ci-go ci-frontend
125127

126128
# Regenerate the OpenAPI v1 spec from handler annotations.
127129
# Pipeline: swag emits Swagger 2.0 (JSON) -> openapi-convert produces
128-
# OpenAPI 3.0 yaml/json -> intermediate Swagger 2.0 file is removed.
129-
# Only api/openapi.{yaml,json} is committed.
130+
# OpenAPI 3.0 JSON -> intermediate Swagger 2.0 file is removed.
131+
# Only api/openapi.json is committed.
130132
openapi:
131133
@echo "Regenerating OpenAPI spec..."
132134
@$(SWAG) init -g internal/restapi/v1/doc.go -d ./,internal/restapi --parseInternal -o $(OPENAPI_DIR) --outputTypes json -q
133135
@go run ./scripts/openapi-convert -in $(OPENAPI_DIR)/swagger.json \
134-
-out-yaml $(OPENAPI_DIR)/openapi.yaml \
135136
-out-json $(OPENAPI_DIR)/openapi.json
136137
@rm -f $(OPENAPI_DIR)/swagger.json
137-
@echo "Spec written to $(OPENAPI_DIR)/openapi.{yaml,json}"
138+
@echo "Spec written to $(OPENAPI_DIR)/openapi.json"
139+
140+
# Regenerate the public v2 schemas and shared responses from canonical route
141+
# request, response, media-type, envelope, and success-status metadata.
142+
openapi-v2:
143+
@go run ./scripts/openapi-v2-generate -spec $(OPENAPI_DIR)/openapi-v2.json
138144

139145
# Verify that handler annotations parse cleanly under swag and the generated
140146
# spec is valid OpenAPI 3.0. Does NOT compare against the committed
141-
# api/openapi.{json,yaml} — that byte-equality check was a continuous source
147+
# api/openapi.json — that byte-equality check was a continuous source
142148
# of host-environment-dependent CI noise (swag's output differed between CI
143149
# and local in ways we couldn't isolate over multiple cycles).
144150
#
145151
# The canonical contract test is core-tests/TestAPIOpenAPIContract, which runs
146152
# the actual server and validates response shapes against the spec. The
147-
# committed api/openapi.{json,yaml} is best-effort up-to-date; run
153+
# committed api/openapi.json is best-effort up-to-date; run
148154
# `make openapi` locally to refresh it (e.g., before a release).
149155
#
150156
# This target writes to a tempdir so it doesn't touch the committed spec.
@@ -157,13 +163,24 @@ openapi-check:
157163
@tmpdir=$$(mktemp -d) && trap "rm -rf $$tmpdir" EXIT && \
158164
$(SWAG) init -g internal/restapi/v1/doc.go -d ./,internal/restapi --parseInternal -o $$tmpdir --outputTypes json -q && \
159165
go run ./scripts/openapi-convert -in $$tmpdir/swagger.json \
160-
-out-yaml $$tmpdir/openapi.yaml \
161166
-out-json $$tmpdir/openapi.json && \
162167
echo "OpenAPI spec generates cleanly and validates as OpenAPI 3.0."
163168
@$(MAKE) --no-print-directory openapi-v2-check
164169

165170
openapi-v2-check:
171+
@go run ./scripts/openapi-v2-metadata -check
172+
@go run ./scripts/openapi-v2-generate -spec api/openapi-v2.json -check
166173
@go run ./scripts/openapi-v2-check -spec api/openapi-v2.json
174+
@$(MAKE) --no-print-directory openapi-v2-client-smoke
175+
@node scripts/check-frontend-v2-fields.mjs
176+
177+
openapi-v2-client-smoke:
178+
@tmpdir=$$(mktemp -d /tmp/windshift-v2-client.XXXXXX) && trap 'rm -rf "$$tmpdir"' EXIT && \
179+
go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v$(OAPI_CODEGEN_VERSION) \
180+
-generate types,client -package v2client -o "$$tmpdir/client.gen.go" api/openapi-v2.json && \
181+
cd "$$tmpdir" && go mod init windshift-v2-client-smoke >/dev/null && \
182+
go get github.com/oapi-codegen/runtime@v$(OAPI_RUNTIME_VERSION) >/dev/null && \
183+
go test ./...
167184

168185
# Run static analysis
169186
lint:
@@ -219,7 +236,9 @@ help:
219236
@echo " make clean - Clean build artifacts"
220237
@echo " make dev-tools - Install pinned Go tools used by CI"
221238
@echo " make hooks - Install git pre-commit hook"
222-
@echo " make openapi - Regenerate api/openapi.{yaml,json} from handler annotations"
239+
@echo " make openapi - Regenerate api/openapi.json from handler annotations"
240+
@echo " make openapi-v2 - Regenerate typed v2 schemas from canonical route metadata"
241+
@echo " make openapi-v2-client-smoke - Generate and compile a pinned Go v2 client"
223242
@echo " make openapi-check - Validate v1 generation and v2 route/spec parity (used by hooks/CI)"
224243
@echo " make coding-agent-image - Build the thin ws-carrier image (WS_IMAGE for windshift-agent)"
225244
@echo " make help - Show this help message"

api/agent-studio.openapi.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,9 @@ paths:
363363
properties:
364364
session_id:
365365
type: integer
366+
history_after_message_id:
367+
type: integer
368+
description: Start a fresh General-chat context after this durable transcript message.
366369
message:
367370
type: string
368371
responses:

api/embed.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ import _ "embed"
1010
//go:embed openapi.json
1111
var SpecJSON []byte
1212

13-
// SpecYAML is the OpenAPI 3.0 spec serialized as YAML.
14-
//
15-
//go:embed openapi.yaml
16-
var SpecYAML []byte
17-
1813
// V2SpecJSON is the canonical dual-mount API v2 contract.
1914
//
2015
//go:embed openapi-v2.json

0 commit comments

Comments
 (0)