Skip to content

fix: strip component-level servers blocks before OpenAPI merge#1994

Merged
flemzord merged 1 commit into
mainfrom
fix/strip-component-servers
Jun 1, 2026
Merged

fix: strip component-level servers blocks before OpenAPI merge#1994
flemzord merged 1 commit into
mainfrom
fix/strip-component-servers

Conversation

@gfyrag
Copy link
Copy Markdown
Contributor

@gfyrag gfyrag commented Jun 1, 2026

Summary

  • Component specs declare their own servers block (http://localhost:8080/) which conflicts with base.yaml during the Speakeasy merge
  • This causes all 249 operations to inherit an operation-level servers block while the root-level servers from base.yaml are lost
  • Adds a strip-servers step in the Justfile that removes servers from all component specs before merge, using a glob so any new component is automatically handled

Test plan

  • Ran just build-openapi — root-level servers from base.yaml now present, 0/249 operations have operation-level servers

🤖 Generated with Claude Code

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0222299e-7657-4070-ad1c-1bcc74608389

📥 Commits

Reviewing files that changed from the base of the PR and between 776884c and 624de07.

⛔ Files ignored due to path filters (1)
  • .speakeasy/workflow.lock is excluded by !**/*.lock, !**/*.lock
📒 Files selected for processing (1)
  • Justfile
🚧 Files skipped from review as they are similar to previous changes (1)
  • Justfile

Walkthrough

The Justfile adds a strip-servers preprocessing recipe that removes servers blocks from all downloaded component OpenAPI specs. The build-openapi recipe dependency is updated from prepend-paths to strip-servers, reordering the build pipeline so that only the base OpenAPI file's server definitions survive the final merge.

Changes

OpenAPI build pipeline preprocessing

Layer / File(s) Summary
Strip servers preprocessing step
Justfile
New strip-servers recipe removes servers blocks from component OpenAPI specs after prepend-paths. The build-openapi recipe now depends on strip-servers instead of prepend-paths, ensuring filtered specs are used in the Speakeasy merge operation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

Poem

🐰 A nimble build now strips away,
The server blocks that got in the way,
Components cleaned, the base one stays,
Merge proceeds in tidy arrays,
Hooray for specs that now behave!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a step to strip servers blocks from component specs before OpenAPI merge.
Description check ✅ Passed The description is directly related to the changeset, explaining the problem (conflicting servers blocks), the solution (strip-servers step), and test results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/strip-component-servers

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
Justfile (1)

36-38: ⚡ Quick win

Consider adding error handling to the stripping loop.

The for loop will silently continue if yq fails on any file. Consider adding set -e or checking exit codes to fail fast on errors.

♻️ Proposed fix to add error handling
 # Strip component-level servers blocks so only base.yaml servers survive the merge
 strip-servers: prepend-paths
-    for f in components/*.openapi.yaml; do yq -i 'del(.servers)' "$f"; done
+    set -e; for f in components/*.openapi.yaml; do yq -i 'del(.servers)' "$f"; done
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Justfile` around lines 36 - 38, The strip-servers recipe's for-loop (task
name "strip-servers: prepend-paths") currently runs yq silently and will
continue on errors; modify the recipe to fail fast by enabling shell error
checking (e.g., set -e or set -euo pipefail at the top of the recipe) or by
checking each yq exit status (e.g., after the yq command, exit nonzero on
failure) so any yq failure aborts the Justfile task immediately and surfaces the
error.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@Justfile`:
- Around line 36-38: The strip-servers recipe's for-loop (task name
"strip-servers: prepend-paths") currently runs yq silently and will continue on
errors; modify the recipe to fail fast by enabling shell error checking (e.g.,
set -e or set -euo pipefail at the top of the recipe) or by checking each yq
exit status (e.g., after the yq command, exit nonzero on failure) so any yq
failure aborts the Justfile task immediately and surfaces the error.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7a17ddfa-4891-4f0c-8e8d-cb3ed4165213

📥 Commits

Reviewing files that changed from the base of the PR and between 923f9c8 and 776884c.

⛔ Files ignored due to path filters (1)
  • .speakeasy/workflow.lock is excluded by !**/*.lock, !**/*.lock
📒 Files selected for processing (1)
  • Justfile

flemzord
flemzord previously approved these changes Jun 1, 2026
Component specs (auth, ledger, orchestration, wallets, webhooks) declare
their own servers block (http://localhost:8080/) which conflicts with
base.yaml during the Speakeasy merge. This caused every operation in the
generated spec to inherit an operation-level servers block, while the
root-level servers from base.yaml were lost.

Add a strip-servers step that removes servers from all component specs
before the merge, so only base.yaml servers survive at root level.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gfyrag gfyrag force-pushed the fix/strip-component-servers branch from 776884c to 624de07 Compare June 1, 2026 08:56
@flemzord flemzord merged commit 93d5c06 into main Jun 1, 2026
3 checks passed
@flemzord flemzord deleted the fix/strip-component-servers branch June 1, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants