Skip to content

chore: add local-debug config overlays for host-process debugging - #3063

Open
renuka-fernando wants to merge 2 commits into
wso2:mainfrom
renuka-fernando:debug
Open

chore: add local-debug config overlays for host-process debugging#3063
renuka-fernando wants to merge 2 commits into
wso2:mainfrom
renuka-fernando:debug

Conversation

@renuka-fernando

Copy link
Copy Markdown
Contributor

Purpose

The shipped config.toml files (gateway-controller, policy-engine, Platform API, AI Workspace BFF) carry container-shaped defaults — UDS sockets and /etc/... paths — that do not work when the components run as host processes under the VS Code debugger. Debug-only overrides were leaking into config.toml (which ships in the distribution) or relied on launch.json/Makefile env vars that no longer take effect, since env values reach config only through explicit {{ env }} tokens. This PR keeps every shipped config.toml untouched and moves host-debug overrides into a separate, overlay-only config-debug.toml per component. Resolves N/A.

Goals

Keep the distributed config.toml files production-clean while giving developers a single, discoverable place for host-process debug settings, and repair the broken VS Code and make bff-run debug flows.

Approach

  • Add config-debug.toml overlays for the gateway (gateway/configs/), Platform API (platform-api/config/) and AI Workspace BFF (portals/ai-workspace/configs/), layered on top of the shipped config.toml via a second repeatable -config flag that merges last-wins.
  • Wire the overlays into the Gateway Controller, Policy Engine, Platform API and AI Workspace BFF configurations in .vscode/launch.json, and drop dead or misnamed env vars.
  • Rewrite the AI Workspace make bff-run target to load the overlay instead of env vars that had no matching {{ env }} token (which left the BFF on the wrong port with unusable cert paths).
  • Expand gateway/DEBUG_GUIDE.md with the builder-before-controller ordering, the overlay mechanism, and one-time key/cert provisioning.
  • Refresh the petstore-api.yaml sample and bump the gateway-controller dev version.

User stories

N/A — developer tooling and configuration only.

Documentation

gateway/DEBUG_GUIDE.md, updated in this PR.

Automation tests

  • Unit tests

    N/A — this PR changes configuration, editor/build tooling and docs; no application logic is touched.

  • Integration tests

    N/A. Verified manually: TOML overlays parse and merge last-wins to the expected effective values, .vscode/launch.json remains valid JSONC, and make -n bff-run resolves correctly.

Security checks

  • Followed secure coding standards in http://wso2.com/technical-reports/wso2-secure-engineering-guidelines? yes
  • Ran FindSecurityBugs plugin and verified report? N/A — no Java code changed.
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets? yes — only clearly labelled local-dev placeholders (admin/admin, a dummy dev key) live in the overlay/launch.json, never in a shipped config.toml; the control-plane token field is empty.

Samples

gateway/examples/petstore-api.yaml — updated example API definition.

Related PRs

N/A

Test environment

macOS, Go (multi-module workspace), Docker and Docker Compose, VS Code — local host-process debugging of the gateway, Platform API and AI Workspace BFF.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@renuka-fernando, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 46 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c70d3430-800b-4d57-a75b-60838dd49688

📥 Commits

Reviewing files that changed from the base of the PR and between be93341 and f76a4b5.

📒 Files selected for processing (8)
  • .vscode/launch.json
  • gateway/DEBUG_GUIDE.md
  • gateway/configs/config-debug.toml
  • gateway/examples/petstore-api.yaml
  • gateway/gateway-controller/pkg/version/version.go
  • platform-api/config/config-debug.toml
  • portals/ai-workspace/Makefile
  • portals/ai-workspace/configs/config-debug.toml
📝 Walkthrough

Walkthrough

Changes

The PR adds TOML debug overlays for host-run services. It updates VS Code launches, the AI Workspace BFF Makefile, and gateway debug documentation to use layered configurations. It also updates the PetStore example and gateway-controller version metadata.

Local debug configuration

Layer / File(s) Summary
Debug overlay definitions
gateway/configs/config-debug.toml, platform-api/config/config-debug.toml, portals/ai-workspace/configs/config-debug.toml
Added local logging, TCP, encryption, credential, HTTPS, and control-plane settings.
Launch and run configuration
.vscode/launch.json, portals/ai-workspace/Makefile
Updated service launches to layer debug overlays over base configurations. Added an AI Workspace BFF launch configuration.
Debug workflow documentation
gateway/DEBUG_GUIDE.md
Updated prerequisites, startup order, API examples, cleanup steps, and troubleshooting checks.
Gateway example and version metadata
gateway/examples/petstore-api.yaml, gateway/gateway-controller/pkg/version/version.go
Changed the PetStore upstream to HTTPS, updated policies and headers, and set the controller version to 1.2.0.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: pubudu538, rakhitharr, tharsanan1

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the addition of local-debug configuration overlays for host-process debugging.
Description check ✅ Passed The description covers all required sections and clearly explains the purpose, implementation, documentation, validation, security checks, and test environment.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@renuka-fernando

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

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

Inline comments:
In @.vscode/launch.json:
- Around line 86-115: Remove the committed admin/admin bootstrap credentials and
require operator-provided values with no default fallback. In
.vscode/launch.json lines 86-115, use a locally generated gitignored hash or
required environment variable; apply the same generated/operator-supplied
approach in platform-api/config/config-debug.toml lines 36-42, using
APIP_CP_ADMIN_USERNAME and APIP_CP_ADMIN_PASSWORD_HASH; update the credential
usage example in gateway/DEBUG_GUIDE.md lines 270-279 to match the new setup.

In `@gateway/DEBUG_GUIDE.md`:
- Line 191: Correct the environment variable reference in the Gateway Builder
debugging instructions by changing APIP_GW_CONTROLLER_POLICIES_DEFINITIONS__PATH
to APIP_GW_CONTROLLER_POLICIES_DEFINITIONS_PATH, matching the name configured in
the VS Code launch settings.

In `@platform-api/config/config-debug.toml`:
- Around line 22-27: Replace the inline encryption_key value in the
platform_api.security configuration with file interpolation referencing
./data/keys/encryption.key, following the existing debug-secret pattern. Ensure
the key file is generated as a 32-byte hex key and added to gitignore so no
secret remains committed.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d0e2787b-b543-49e5-99ac-26da676bfbc4

📥 Commits

Reviewing files that changed from the base of the PR and between 29f710c and e4a75f5.

📒 Files selected for processing (8)
  • .vscode/launch.json
  • gateway/DEBUG_GUIDE.md
  • gateway/configs/config-debug.toml
  • gateway/examples/petstore-api.yaml
  • gateway/gateway-controller/pkg/version/version.go
  • platform-api/config/config-debug.toml
  • portals/ai-workspace/Makefile
  • portals/ai-workspace/configs/config-debug.toml

Comment thread .vscode/launch.json
Comment thread gateway/DEBUG_GUIDE.md Outdated
Comment thread platform-api/config/config-debug.toml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In `@gateway/DEBUG_GUIDE.md`:
- Around line 270-272: Update the curl example in the DEBUG_GUIDE management API
instructions to avoid embedding a reusable Basic Auth password: read the
password from an environment variable or interactive prompt, clearly label the
credential as local-only, and warn against using it with non-local control
planes.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 749dd8ed-8391-4b2b-a25e-9e1ad4cf6dcb

📥 Commits

Reviewing files that changed from the base of the PR and between e4a75f5 and be93341.

📒 Files selected for processing (8)
  • .vscode/launch.json
  • gateway/DEBUG_GUIDE.md
  • gateway/configs/config-debug.toml
  • gateway/examples/petstore-api.yaml
  • gateway/gateway-controller/pkg/version/version.go
  • platform-api/config/config-debug.toml
  • portals/ai-workspace/Makefile
  • portals/ai-workspace/configs/config-debug.toml
🚧 Files skipped from review as they are similar to previous changes (7)
  • gateway/gateway-controller/pkg/version/version.go
  • portals/ai-workspace/configs/config-debug.toml
  • portals/ai-workspace/Makefile
  • gateway/examples/petstore-api.yaml
  • platform-api/config/config-debug.toml
  • .vscode/launch.json
  • gateway/configs/config-debug.toml

Comment thread gateway/DEBUG_GUIDE.md
Introduce configs/config-debug.toml, a small overlay layered on the
shipped config.toml via a second repeatable -config flag (merged
last-wins), so host-process debug settings stay out of the distributed
config.toml:

- policy-engine ext_proc + ALS + python-executor TCP modes and
  host.docker.internal, plus the dev AES-GCM key path
- wire the overlay into the Gateway Controller and Policy Engine
  (xDS / File) launch configs; drop the dead double-underscore env vars
- DEBUG_GUIDE.md: run the builder before the controller, document the
  overlay + one-time AES key provisioning, and remove the config.toml
  edit/revert dance

Signed-off-by: Renuka Fernando <renukapiyumal@gmail.com>
Mirror the gateway config-debug.toml pattern for the Platform API and
AI Workspace BFF — a repeatable -config overlay merged last-wins over
the shipped config.toml, keeping debug-only values out of the config
that ships in the distribution (config.toml files left untouched):

- platform-api/config/config-debug.toml: dev encryption key, admin
  login, host JWT keypair paths, debug logging; launch.json env emptied
- ai-workspace config-debug.toml: :8081 listener + host cert/key, local
  control-plane URL + tls_skip_verify, debug logging
- ai-workspace Makefile bff-run now loads the overlay instead of env
  vars, fixing the dead APIP_AIW_SERVER_* names (no config.toml token)

Signed-off-by: Renuka Fernando <renukapiyumal@gmail.com>
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.

1 participant