feat(api): automate Cloud and OSS v2 spec sync - #7697
Conversation
|
CI status on That failure is the workflow doing its job, not a defect. I'm not pushing a fix, because the only fix is deleting the PR's entire contents — a call for a maintainer, not something to do automatically. Two ways forward:
I'd lean toward 1, since the branch and runbook are only useful until #655 lands. Happy to do either. Generated by Claude Code |
|
What changed
git ls-remote --exit-code https://github.com/influxdata/openapi.git refs/heads/masterthen passes it as b)
baseUrl=$OPTARG
baseUrlOSS=$OPTARG
;;and the Why it matters right now
The next OSS sync — Monday 07:00 UTC, or any This also drops the Is this intended?The commit message ( Two options:
I'd go with 1 — it keeps the invariant enforced by the pipeline rather than by whoever reviews the sync PR at 7am Monday. Happy to push either. Generated by Claude Code |
There was a problem hiding this comment.
Pull request overview
Adds independent weekly workflows to synchronize Cloud v2 and OSS v2 OpenAPI specifications while preserving human review gates.
Changes:
- Pins upstream contracts to resolved OpenAPI commit SHAs.
- Creates product-specific pull requests with review guidance and labels.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
.github/workflows/sync-openapi-oss-v2-spec.yml |
Adds OSS v2 specification synchronization. |
.github/workflows/sync-openapi-cloud-v2-spec.yml |
Adds Cloud v2 specification synchronization. |
Suppressed comments (4)
.github/workflows/sync-openapi-oss-v2-spec.yml:47
- Resolving the contract to an exact SHA does not make this generation reproducible:
getswagger.sh:123-131runs the unversionednpx @redocly/cli, so a new CLI release can rewrite or break the spec even when the OpenAPI SHA is unchanged. Issue #7668 already identifies this generator dependency as unpinned. Pin it in the API-docs dependencies/lockfile and have the script use that local version before scheduling automated syncs.
bash getswagger.sh v2 \
-b "https://raw.githubusercontent.com/influxdata/openapi/$OPENAPI_SHA"
.github/workflows/sync-openapi-oss-v2-spec.yml:50
- With no
tokeninput, this action usesGITHUB_TOKEN; the action documents that PRs created or updated with that token do not triggerpushorpull_requestworkflows. Consequently the generated API-spec PR will not automatically run this repository's PR Preview (which includesapi-docs/**) or the other PR validation jobs. Use a GitHub App/PAT token intended for automation, or explicitly dispatch the required checks after creating/updating the PR.
- name: Create or update pull request
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8
.github/workflows/sync-openapi-cloud-v2-spec.yml:47
- Resolving the contract to an exact SHA does not make this generation reproducible:
getswagger.sh:123-131runs the unversionednpx @redocly/cli, so a new CLI release can rewrite or break the spec even when the OpenAPI SHA is unchanged. Issue #7668 already identifies this generator dependency as unpinned. Pin it in the API-docs dependencies/lockfile and have the script use that local version before scheduling automated syncs.
bash getswagger.sh cloud-v2 \
-b "https://raw.githubusercontent.com/influxdata/openapi/$OPENAPI_SHA"
.github/workflows/sync-openapi-cloud-v2-spec.yml:50
- With no
tokeninput, this action usesGITHUB_TOKEN; the action documents that PRs created or updated with that token do not triggerpushorpull_requestworkflows. Consequently the generated API-spec PR will not automatically run this repository's PR Preview (which includesapi-docs/**) or the other PR validation jobs. Use a GitHub App/PAT token intended for automation, or explicitly dispatch the required checks after creating/updating the PR.
- name: Create or update pull request
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Checked all three Copilot findings against the repo. All are technically correct, but two of them describe pre-existing repo-wide patterns rather than anything these workflows introduce — worth knowing before deciding where to fix them. 1. No CI on the generated sync PRs — the most consequential, and Copilot suppressed it
So a weekly sync PR arrives with zero checks — no link check, no Vale, no render check, no preview — which is a real gap for a PR whose entire purpose is reviewing generated output. Pre-existing, though: 2.
|
Track influxdata/openapi#655 (onConflict query param on PostRestoreBucketMetadata) and influxdata/influxdb#27578. Both are still open, and the change is not on the docs-release/influxdb-oss branch that getswagger.sh fetches for OSS v2, so regenerating now is a no-op. Records the runbook, the release-timing constraint, and the unrelated Redocly 2.x bundling churn that a regeneration would otherwise pull in. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TtucxMocnB79YDiU2obyAJ
The earlier note blamed the unpinned @redocly/cli 2.46.0 bump. Verified against the sources, that is wrong: - info/servers/tags reset is intentional — docs-plugin.cjs dropped the set-info/set-servers decorators and post-process-specs.ts reapplies the overlays into _build/. The _build info block matches the committed spec. - The removed components.parameters and QuerystringAuthentication are absent from current contracts/ref/oss.yml and from influxdb-oss-v2.7.0, so they are stale snapshot leftovers, not bundler drops. Dereferenced parameter sets match on 206 of 233 operations; the rest differ only in ordering or the After/Offset description. Also records two real defects found while verifying: the QuerystringAuthentication anchor in tags.yml is already dead, and upstream now hardcodes /influxdb/latest/ pagination links that the shortcode decorator cannot rewrite. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TtucxMocnB79YDiU2obyAJ
Files #7666 (upstream INFLUXDB_DOCS_URL substitution), #7667 (dead QuerystringAuthentication anchor in tags.yml), and #7668 (stale committed specs, redocly pin, plugin migration). Also corrects item 4: the After/Offset sources still use the shortcode. The expansion to /influxdb/latest happens during openapi contract generation, per influxdata/openapi#603, not in the authored source. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TtucxMocnB79YDiU2obyAJ
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
What changed: - Pin @redocly/cli to 2.47.0 (exact) in api-docs/package.json - getswagger.sh calls the local pinned binary instead of npx @redocly/cli - Add yarn install --frozen-lockfile step to both new sync workflows - Re-baseline the two in-scope specs (cloud-v2, oss-v2) against the pin Why: Copilot review on #7697 flagged unpinned @redocly/cli as the root cause of non-reproducible syncs: npx resolves whatever is latest, so a Redocly release can change bundled output with the OpenAPI source SHA unchanged, producing a sync PR that looks like an upstream change but isn't. Impact: Sync PRs are now reproducible against a known Redocly version. Verified 1.34.19 and 2.47.0 bundle identical input the same way (only cosmetic YAML quoting differs on two scalars), so pinning to the current major is safe. persist-credentials: false was already present on both workflows from an earlier commit in this PR; no change needed there. Verification: - yarn install --frozen-lockfile succeeds from a clean node_modules - getswagger.sh cloud-v2 and getswagger.sh v2 regenerate cleanly and idempotently with the pinned binary - Confirmed the resulting spec diff is real upstream content drift from influxdata/openapi, not a CLI-version artifact
8b703fc to
49d8669
Compare
|
Verified the pin commit ( Pin verification — all claims confirmed
I'd expected the lockfile entry to be incomplete, since it adds What the first OSS sync PR will actually containSame worktree, same pinned binary, only the source differs: # defaults → docs-release/influxdb-oss
bash getswagger.sh v2
# → 0 lines changed, no onConflict
# what the workflow runs → master @ d90ba20
bash getswagger.sh v2 -b "https://raw.githubusercontent.com/influxdata/openapi/d90ba20…"
# → +9 lines, onConflict presentSo the first sync PR is a clean 9-line diff adding I'd flagged this earlier as a possible regression. Having now seen One thing left
Generated by Claude Code |
What changed Adds a `docs/mirror` redocly config (empty decorators, minimal lint) and switches influxdb/v2 and influxdb/cloud .config.yml to it. getswagger.sh now commits a raw upstream mirror for these two products instead of a bundle with docs-plugin.cjs decorators baked in. Ports the five retired decorators (delete-servers, remove-private-paths, strip-version-prefix, strip-trailing-slash, replace-docs-url-shortcode) into post-process-specs.ts as plain TS, gated to MIRROR_PRODUCT_PATHS, applied at build time into _build/. The link-rewrite also now walks every string in the spec, not just .description, so externalDocs.url gets fixed too. Why The committed OSS v2 spec carried 229 `/influxdb/latest/` doc links that should read `/influxdb/v2/` — a one-time hand patch (4403dd9) that every scheduled regen silently reverted, since no transform reproduced it. Baking decorators into the committed file also meant every regen diff mixed real influxdata/openapi changes with decorator churn, defeating clean review (#7668). Moving decorators to build time makes the commit a pristine mirror and fixes the link rewrite as a repeatable transform instead of a hand patch. Impact Only influxdb/v2 and influxdb/cloud are affected; other products keep `docs/all` and decorate at commit time as before. Publish output is unaffected in kind — generate-openapi-articles.ts already reads only from _build/ — but now has zero `/influxdb/latest/` links instead of 229/5. Verification - api-docs/scripts: `tsc -p tsconfig.json` compiles clean. - `node dist/test-post-process-specs.js`: 52/52 passing, including 2 new tests for the ported transforms and for non-mirror products being unaffected. - Regenerated both specs via `getswagger.sh v2` / `cloud-v2`: committed source now carries raw `docs.influxdata.com` links (245/262), confirming it mirrors upstream. - Ran post-process-specs.js for both products: `_build/` output has zero `/influxdb/latest/` links remaining. - Ran `generate-openapi-articles.js --skip-fetch oss-v2 cloud-v2` end to end: succeeded, all generated output lands in gitignored paths.
|
Verified Published output changes
Nice detail: the Everything else in the built output is identical — same paths, same tags, no components added or removed. The 44 differing paths and the TestsAll 52 pass, including the 7 new mirror-transform cases ( Net effect on the original goalThe committed v2 specs are now clean mirrors of upstream, so a sync diff shows upstream content drift and nothing else. Combined with the Redocly pin, the first OSS sync PR should be exactly the 9-line I'll add a note to #7666 narrowing its scope: with this merged, the remaining upstream defects (doubled Generated by Claude Code |
What changed Adds a README section explaining that influxdb/v2 and influxdb/cloud's committed spec is now a raw upstream mirror, not close to what publishes, and gives the two-command sequence to reconstruct the resolved spec into _build/ without a full Hugo build. Why Grepping the committed file directly no longer shows what's published for these two products, unlike every other product. An agent or contributor working in this repo needs a documented way to reach the same ground truth a human would get from the live site. Verification - Ran the documented commands (`getswagger.sh v2 -B` then post-process-specs.js influxdb/v2`) against a clean tree; produced _build/influxdb/v2/influxdb-oss-v2-openapi.yaml as described.
|
Steps to prevent publishing the unimplemented param until the
|
What changed: - Pin @redocly/cli to 2.47.0 (exact) in api-docs/package.json - getswagger.sh calls the local pinned binary instead of npx @redocly/cli - Add yarn install --frozen-lockfile step to both new sync workflows - Re-baseline the two in-scope specs (cloud-v2, oss-v2) against the pin Why: Copilot review on #7697 flagged unpinned @redocly/cli as the root cause of non-reproducible syncs: npx resolves whatever is latest, so a Redocly release can change bundled output with the OpenAPI source SHA unchanged, producing a sync PR that looks like an upstream change but isn't. Impact: Sync PRs are now reproducible against a known Redocly version. Verified 1.34.19 and 2.47.0 bundle identical input the same way (only cosmetic YAML quoting differs on two scalars), so pinning to the current major is safe. persist-credentials: false was already present on both workflows from an earlier commit in this PR; no change needed there. Verification: - yarn install --frozen-lockfile succeeds from a clean node_modules - getswagger.sh cloud-v2 and getswagger.sh v2 regenerate cleanly and idempotently with the pinned binary - Confirmed the resulting spec diff is real upstream content drift from influxdata/openapi, not a CLI-version artifact
|
That plan works — I measured step 2's output earlier and it's a clean 9-line diff adding Two things about holding that generated PR open for a long stretch, since 1. The generated PR won't have CI. 2. The held PR's diff will grow silently. Each Monday run pushes to the same fixed Suggestion for step 4's comment: state the SHA the PR was reviewed at, so whoever merges it knows to re-check the diff rather than trusting the original review. Alternatively, dispatch on demand once Generated by Claude Code |
Closes # — none. Related: #7666, #7667, #7668, influxdata/openapi#655, and influxdata/influxdb#27585.
What changed
Adds two independent scheduled sync workflows:
contracts/ref/cloud.ymlsync/openapi-cloud-v2-speccontracts/ref/oss.ymlsync/openapi-oss-v2-specEach workflow:
influxdata/openapi/mastercommit;source:syncand product labels;Clean regeneration (resolves #7668)
Moves OSS v2 and Cloud v2 to a raw-mirror pipeline so a scheduled sync diffs
cleanly against
influxdata/openapiinstead of mixing upstream changes withdecorator churn:
docs/mirrorredocly config (api-docs/openapi/plugins/docs-plugin.cjs)with no decorators, used only by
influxdb/v2/.config.ymlandinfluxdb/cloud/.config.yml.getswagger.shnow commits these two specs asa plain upstream bundle —
$ref-resolved, unmodified otherwise. Every otherproduct keeps
docs/alland decorates at commit time as before.strip-version-prefix, strip-trailing-slash, replace-docs-url-shortcode) into
api-docs/scripts/post-process-specs.tsas plain TypeScript, gated toMIRROR_PRODUCT_PATHS, applied at build time into the gitignored_build/that
generate-openapi-articles.tsalready reads exclusively — so publishedoutput is unaffected in kind.
spec, not just
descriptionfields, soexternalDocs.urlgets correctedtoo. The committed OSS v2 spec carried 229
/influxdb/latest/links thatshould read
/influxdb/v2/— a one-time hand patch from years ago(
4403dd9a1) that every regen silently reverted because no transformreproduced it. This re-baseline regen fixes all of them as a repeatable
transform instead.
the first scheduled sync after merge is a real, small diff — not another
wholesale rewrite.
Why
Cloud v2 and OSS v2 ship independently.
A combined generated PR could mix API changes with different release timing and
prevent reviewers from merging one product safely.
Releases are infrequent enough that separate weekly docs-v2 checks provide a
simpler solution than cross-repository release integration.
The generated PRs preserve the docs-v2 human approval gate.
The
onConflictchange shows why this gate is necessary:influxdata/openapi#655merged on August 8, 2026, but the corresponding serverimplementation in
influxdata/influxdb#27585remains an open draft againstmain-2.x.A merged OpenAPI change is therefore a change proposal, not evidence that the
behavior is implemented or released.
The OSS workflow uses the current OpenAPI
mastercontract as a changeproposal instead of relying on the manually maintained
docs-release/influxdb-ossbranch.Its PR instructs reviewers to verify that every API change has shipped before
merge and to regenerate from an exact tag or commit if only part of the proposed
contract is released.
Baking decorators into the committed spec meant every regen diff mixed real
influxdata/openapichanges with decorator output, defeating clean review —the exact problem #7668 reported. Moving decorators to build time makes the
commit a pristine mirror, so a scheduled sync PR shows reviewers only what
actually changed upstream.
Impact
The workflows update only these generated files:
api-docs/influxdb/cloud/influxdb-cloud-v2-openapi.yamlapi-docs/influxdb/v2/influxdb-oss-v2-openapi.yamlThis PR's own commit already re-baselines both files against the new
pipeline, so reviewers should expect a large diff here once, converting the
committed specs from decorated output to a raw upstream mirror. After merge,
each scheduled sync PR should be a small, real diff.
Reviewers must confirm that each API change is available in the corresponding
product before merging.
Only
influxdb/v2andinfluxdb/cloudare affected by the pipeline change.Other products (
influxdb3/*,influxdb/v1,enterprise_influxdb/v1) keepdocs/alland decorate at commit time, unchanged.The scheduled workflows do not run until they reach the default branch.
Verification
an implemented and released server change.
data/labels.ymland product labelsagainst
data/products.yml.records reviewers should link.
getswagger.sh -b.create-pull-requeststep.getswagger.shproduct names:cloud-v2andv2..github/workflows/sync-client-library-release-notes.yml.workflows run from the default branch.
tsc -p api-docs/scripts/tsconfig.jsoncompiles clean.node api-docs/scripts/dist/test-post-process-specs.js: 52/52 passing,including 2 new tests for the ported mirror transforms and for non-mirror
products being unaffected.
getswagger.sh v2/cloud-v2: committedsource now carries raw
docs.influxdata.comlinks, confirming it mirrorsupstream instead of decorated output.
post-process-specs.jsfor both products:_build/output has zero/influxdb/latest/links remaining (was 229 for OSS v2, 5 for Cloud v2).generate-openapi-articles.js --skip-fetch oss-v2 cloud-v2end to end:succeeded, all generated output lands in gitignored paths.
yarn build:api-docsandyarn hugo serve. Visually inspected/staticfiles usingjq.Checklist
npx hugo --quiet) — not applicable; no site files changed (all generated content lands in gitignored paths)