Skip to content

docs: migrate traffic recipes to service model#9

Merged
guoqqqi merged 6 commits intomasterfrom
codex/recipe-service-model-traffic
Apr 30, 2026
Merged

docs: migrate traffic recipes to service model#9
guoqqqi merged 6 commits intomasterfrom
codex/recipe-service-model-traffic

Conversation

@guoqqqi
Copy link
Copy Markdown
Contributor

@guoqqqi guoqqqi commented Apr 28, 2026

Summary

  • Migrate blue-green, canary, and API versioning recipes away from standalone a7 upstream resources.
  • Use a7 service create plus route service_id for default routing.
  • Keep traffic-split examples only where needed for weighted or header-based routing, using inline plugin upstreams for canary targets.
  • Update Config Sync examples to use services and route paths / service_id.

Validation

  • make validate-skills
  • make test-skills
  • git diff --check

Summary by CodeRabbit

  • Documentation
    • Rewrote versioning recipe to a service-first model: examples and CLI commands now use service creation and route binding by service_id; config-sync examples and verification steps updated.
    • Updated blue-green recipe to use service-backed routing, revised switch/rollback flows, traffic testing options, declarative config, and troubleshooting guidance.
    • Updated canary recipe to service-centric routing, simplified rollout/promotion/rollback steps, traffic-split inline upstream usage, removed cookie-based canary, and trimmed scripts/logging.

Copilot AI review requested due to automatic review settings April 28, 2026 16:42
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e7b83230-9659-4d3d-8952-4fd158a68b1c

📥 Commits

Reviewing files that changed from the base of the PR and between 8d0720f and 45ef6d8.

📒 Files selected for processing (3)
  • skills/a7-recipe-api-versioning/SKILL.md
  • skills/a7-recipe-blue-green/SKILL.md
  • skills/a7-recipe-canary/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • skills/a7-recipe-blue-green/SKILL.md

📝 Walkthrough

Walkthrough

Migrates three API7 EE recipe documents from upstream-centric to service-centric routing: replaces upstream/upstream_id/uri examples with service/service_id/paths, updates CLI commands and declarative configs, and revises rollout, verification, and troubleshooting content.

Changes

Cohort / File(s) Summary
API Versioning
skills/a7-recipe-api-versioning/SKILL.md
Rewrites examples and CLI flow from upstream/upstream_id/uri to service/service_id/paths. Updates route examples (URI, header, gradual rollout, redirect deprecation), Config Sync YAML schema to version/services/routes, and verification commands (e.g., --service-id).
Blue‑Green Deployment
skills/a7-recipe-blue-green/SKILL.md
Converts blue/green steps to create/manage service objects (a7 service create) and switch routes via service_id. Updates instant-switch and rollback flows, traffic-split usage for staged testing, declarative config from upstreamsservices, and verification/troubleshooting guidance.
Canary Deployment
skills/a7-recipe-canary/SKILL.md
Moves canary examples to service-backed routing: stable-service/canary-service, paths+service_id routes, inline upstream use inside traffic-split for overrides, updated bash progression script and Config Sync YAML, removal of cookie-based canary section.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
E2e Test Quality Review ⚠️ Warning PR contains only documentation changes to SKILL.md files with no test file modifications, code implementations, or error handling logic to review against E2E test quality criteria. Apply documentation-specific review criteria for documentation-only PRs, such as accuracy, clarity, and consistency with API7 EE service model patterns.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title directly and clearly summarizes the main change: migrating traffic recipe documentation from an upstream-centric model to a service-centric model.
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.
Security Check ✅ Passed Comprehensive security review of all three modified recipe documentation files found no vulnerabilities across seven mandatory security categories.

✏️ 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 codex/recipe-service-model-traffic

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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Migrates the recipe documentation for canary, blue-green, and API versioning to the service-backed model (using a7 service create + route service_id) instead of standalone upstream resources, while keeping traffic-split only for weighted/header-based overrides.

Changes:

  • Update canary and blue-green recipes to create services and bind routes via service_id.
  • Update API versioning recipe to model “one service per version” and use paths + service_id.
  • Refresh Config Sync YAML examples to use services and route paths/service_id.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
skills/a7-recipe-canary/SKILL.md Converts canary workflow to service-backed routing; uses inline upstream only inside traffic-split; updates Config Sync example.
skills/a7-recipe-blue-green/SKILL.md Reworks blue/green recipe around swapping route service_id; keeps header-based testing via traffic-split inline upstream.
skills/a7-recipe-api-versioning/SKILL.md Refactors versioning patterns to “service per version” with service-backed routes and updated Config Sync example.
Comments suppressed due to low confidence (1)

skills/a7-recipe-canary/SKILL.md:19

  • metadata.a7_commands is missing a7 route list, but the troubleshooting section later instructs running a7 route list --service-id stable-service. Please add a7 route list to the command list so the skill metadata matches the documented workflow.
  a7_commands:
    - a7 service create
    - a7 service update
    - a7 route create
    - a7 route update
    - a7 route get
    - a7 config sync

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

a7 route update route-v1 -g production -f - <<'EOF'
{
"service_id": "service-v1",
"plugins": {
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

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

In “Gradual Version Rollout”, the route-v1 route was created earlier with the proxy-rewrite plugin to strip the /v1 prefix. This update payload sets plugins to only traffic-split, which can inadvertently drop proxy-rewrite depending on how route updates are applied. Consider including both proxy-rewrite and traffic-split in the update payload (or explicitly documenting that the update preserves existing plugins) so the rewrite behavior remains intact during rollout.

Suggested change
"plugins": {
"plugins": {
"proxy-rewrite": {
"regex_uri": ["^/v1/(.*)", "/$1"]
},

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings April 29, 2026 13:54
Copy link
Copy Markdown

@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.

Actionable comments posted: 2

🧹 Nitpick comments (2)
skills/a7-recipe-blue-green/SKILL.md (1)

244-251: Minor: make verification commands gateway-group explicit.

In the troubleshooting table you suggest:

  • Verify with a7 route get api -o json

Other examples in the same file consistently use --gateway-group default. For consistency (and to avoid “route not found” confusion), consider including --gateway-group default in that troubleshooting row as well.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@skills/a7-recipe-blue-green/SKILL.md` around lines 244 - 251, Update the
troubleshooting table row that currently shows the command "a7 route get api -o
json" to include the gateway group flag so it reads "a7 route get api
--gateway-group default -o json"; specifically edit the table cell containing
"Verify with `a7 route get api -o json` and retry after propagation" to include
"--gateway-group default" to match other examples and avoid "route not found"
confusion.
skills/a7-recipe-canary/SKILL.md (1)

181-213: Minor: add an explicit header example for x-canary: true.

The “Header-Based Canary” section explains the match condition and says only requests with x-canary: true go to canary, but it doesn’t show a curl example to validate the exact header name/value (and whether true is treated as a string).

Consider adding a short curl snippet similar to the blue-green recipe’s header test, e.g. hitting /api/* with -H 'x-canary: true'.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@skills/a7-recipe-canary/SKILL.md` around lines 181 - 213, Add a short curl
example to the "Header-Based Canary" section demonstrating the exact header name
and value used for the match (use the header key x-canary and the value true) so
readers can validate whether true is treated as a string; place a one-line curl
snippet similar to the blue-green recipe's header test (targeting the /api/*
path and using -H 'x-canary: true') immediately after the explanation that "Only
requests with `x-canary: true` go to canary."
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@skills/a7-recipe-api-versioning/SKILL.md`:
- Around line 195-238: The YAML example includes an unsupported top-level
gateway_group field; remove gateway_group from the config file and document that
the gateway group must be provided via the CLI flag (e.g., use "a7 config sync
-g production -f <file>") instead; update the example YAML to omit gateway_group
and, if applicable, adjust any references to the ConfigFile struct or parsing
code that might expect gateway_group so the ConfigFile struct remains the single
source of truth for file-based fields.

In `@skills/a7-recipe-canary/SKILL.md`:
- Around line 262-298: Remove the top-level gateway_group key from the Config
Sync YAML in SKILL.md so the example matches the ConfigFile schema; instead rely
on providing the gateway group via CLI/application context (e.g., using the a7
config sync -g/--gateway-group flag). Locate the YAML block containing
gateway_group: default and delete that line, leaving the rest of the
route/service definitions intact; ensure no other references to gateway_group
remain in the example.

---

Nitpick comments:
In `@skills/a7-recipe-blue-green/SKILL.md`:
- Around line 244-251: Update the troubleshooting table row that currently shows
the command "a7 route get api -o json" to include the gateway group flag so it
reads "a7 route get api --gateway-group default -o json"; specifically edit the
table cell containing "Verify with `a7 route get api -o json` and retry after
propagation" to include "--gateway-group default" to match other examples and
avoid "route not found" confusion.

In `@skills/a7-recipe-canary/SKILL.md`:
- Around line 181-213: Add a short curl example to the "Header-Based Canary"
section demonstrating the exact header name and value used for the match (use
the header key x-canary and the value true) so readers can validate whether true
is treated as a string; place a one-line curl snippet similar to the blue-green
recipe's header test (targeting the /api/* path and using -H 'x-canary: true')
immediately after the explanation that "Only requests with `x-canary: true` go
to canary."
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 10ff3b51-a046-4206-843c-53d60102e795

📥 Commits

Reviewing files that changed from the base of the PR and between 024dacd and 8d0720f.

📒 Files selected for processing (3)
  • skills/a7-recipe-api-versioning/SKILL.md
  • skills/a7-recipe-blue-green/SKILL.md
  • skills/a7-recipe-canary/SKILL.md

Comment thread skills/a7-recipe-api-versioning/SKILL.md
Comment thread skills/a7-recipe-canary/SKILL.md
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread skills/a7-recipe-canary/SKILL.md Outdated
| Canary not receiving traffic | Match condition never true | Check header/cookie name and `a7 route get` output |
| Rollback not instant | Config has not propagated yet | Verify with `a7 route get` and retry after propagation |
| 502 from canary | Canary backend is unhealthy | Check canary service health before increasing weight |
| Weight changes have no effect | Editing wrong route | Verify route ID with `a7 route list --service-id stable-service` |
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

The troubleshooting command a7 route list --service-id stable-service will fail when the user doesn’t have a default gateway group set in their context (the CLI requires --gateway-group/-g or a configured default). Consider adding --gateway-group default (or mentioning that a default context gateway group must be set) to make the copy/paste instruction reliably runnable.

Suggested change
| Weight changes have no effect | Editing wrong route | Verify route ID with `a7 route list --service-id stable-service` |
| Weight changes have no effect | Editing wrong route | Verify route ID with `a7 route list --gateway-group default --service-id stable-service` |

Copilot uses AI. Check for mistakes.
Comment thread skills/a7-recipe-blue-green/SKILL.md Outdated
| Can't rollback | Lost track of previous upstream | Always record current state before switching |
| Connections drop during switch | Long-running requests on old upstream | API7 EE handles in-flight requests gracefully; existing connections complete |
| 502 after switch | New environment not ready | Test health endpoint before switching; roll back if needed |
| Traffic still going to old env | Route update has not propagated yet | Verify with `a7 route get api -o json` and retry after propagation |
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

The troubleshooting suggestion a7 route get api -o json omits --gateway-group/-g, but a7 route get errors if no default gateway group is set in the user's context. Consider including --gateway-group default (or explicitly stating that a default gateway group must be configured) so the command works when copied as-is.

Suggested change
| Traffic still going to old env | Route update has not propagated yet | Verify with `a7 route get api -o json` and retry after propagation |
| Traffic still going to old env | Route update has not propagated yet | Verify with `a7 route get api --gateway-group "$GROUP" -o json` and retry after propagation |

Copilot uses AI. Check for mistakes.
Comment thread skills/a7-recipe-canary/SKILL.md Outdated
Comment on lines +305 to +306
| Canary not receiving traffic | Match condition never true | Check header/cookie name and `a7 route get` output |
| Rollback not instant | Config has not propagated yet | Verify with `a7 route get` and retry after propagation |
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

The troubleshooting rows that suggest verifying with a7 route get don’t include --gateway-group/-g. Since the CLI requires a gateway group (unless a default is configured in context), consider adding the gateway group flag here as well to avoid copy/paste failures.

Suggested change
| Canary not receiving traffic | Match condition never true | Check header/cookie name and `a7 route get` output |
| Rollback not instant | Config has not propagated yet | Verify with `a7 route get` and retry after propagation |
| Canary not receiving traffic | Match condition never true | Check header/cookie name and `a7 route get --gateway-group default` output |
| Rollback not instant | Config has not propagated yet | Verify with `a7 route get --gateway-group default` and retry after propagation |

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings April 30, 2026 00:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@guoqqqi guoqqqi merged commit 12805e7 into master Apr 30, 2026
10 checks passed
@guoqqqi guoqqqi deleted the codex/recipe-service-model-traffic branch April 30, 2026 01:12
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