Skip to content

fix(stack): preserve invocation environment overrides - #1380

Open
sbaum1994 wants to merge 1 commit into
mainfrom
fix/invocation-env-wiring
Open

fix(stack): preserve invocation environment overrides#1380
sbaum1994 wants to merge 1 commit into
mainfrom
fix/invocation-env-wiring

Conversation

@sbaum1994

@sbaum1994 sbaum1994 commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

TL;DR

Preserve self-managed invocation.env values during global values rendering and declare the current working request-queue region (ncp) explicitly.

Additional Details

The base environment declares invocation settings under invocation.env, but global.yaml.gotmpl previously rebuilt the entire environment from tracing, rate-limiter, and worker-stream entries. It did not merge the configured map. NATS_PROPERTIES__REGION: local was therefore silently discarded, and invocation continued using its application fallback of ncp.

The template now builds the stack-owned defaults first and merges configured environment values afterward. Explicit environment values take precedence while unrelated generated settings remain present. A non-map invocation.env now fails with a direct validation message.

The checked-in region changes from the ineffective local declaration to ncp. This preserves current runtime behavior and keeps invocation request subjects aligned with the API and worker consumers.

Customer Release Notes

Self-managed invocation environment overrides are now applied consistently, including explicit request-queue region configuration.

Plan Summary

No Kubernetes resources, sizing, storage, or deployment order change. The invocation ConfigMap receives the corrected merged environment.

Usage

Environment-specific invocation settings can be supplied through the existing map:

invocation:
  env:
    CUSTOM_INVOCATION_ENV: value

Changing NATS_PROPERTIES__REGION requires the API, workers, and NATS placement configuration to use the same logical region.

For the Reviewer

Please focus on merge precedence in global.yaml.gotmpl: stack-generated defaults are the base, and explicit invocation.env values are the final override.

For QA

No separate QA run is needed for this configuration-only fix. Automated rendering tests cover the default, a custom override, generated-value preservation, and invalid input.

Tests run:

  • make test from deploy/stacks/self-managed
  • bash -n deploy/stacks/self-managed/tests/invocation-env-wiring.sh
  • git diff --check

Notes

This PR is independent of #1370. That PR makes the bundled NATS server eligible for both request-stream creators; this PR fixes environment-value propagation without changing the active region.

Issues

Closes #1378

Related Pull Requests

Dependencies

No new or updated third-party dependencies. No license review or NOTICE update is required.

Checklist

  • I am familiar with the Contributing Guidelines.
  • I have signed off my commits for Developer Certificate of Origin (DCO) compliance.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Summary by CodeRabbit

  • Bug Fixes

    • Corrected invocation service routing to align requests with API and worker consumers.
    • Improved invocation environment configuration, including tracing, rate limiting, and worker settings.
    • Preserved valid custom environment values while rejecting invalid configuration formats.
  • Tests

    • Added integration coverage for default, customized, and invalid invocation environment configurations.

@sbaum1994
sbaum1994 requested a review from a team as a code owner August 30, 2026 21:03
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c6ecfd9e-5b01-404f-a82b-ab45579ff86f

📥 Commits

Reviewing files that changed from the base of the PR and between eef32b1 and 6d71098.

📒 Files selected for processing (4)
  • deploy/stacks/self-managed/Makefile
  • deploy/stacks/self-managed/environments/base.yaml
  • deploy/stacks/self-managed/global.yaml.gotmpl
  • deploy/stacks/self-managed/tests/invocation-env-wiring.sh

Included review availability: Your plan provides up to 12 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The self-managed stack now validates and merges configured invocation environment values with generated defaults. The default NATS region is ncp. Integration tests cover default, custom, and invalid configurations.

Changes

Invocation environment wiring

Layer / File(s) Summary
Invocation environment merge
deploy/stacks/self-managed/environments/base.yaml, deploy/stacks/self-managed/global.yaml.gotmpl
The default NATS region changes to ncp. The template validates invocation.env, merges user values over tracing, rate-limiter, and worker defaults, and renders the merged map.
Rendering validation
deploy/stacks/self-managed/tests/invocation-env-wiring.sh, deploy/stacks/self-managed/Makefile
The integration test verifies default values, custom overrides, derived rate-limiter settings, and invalid scalar input. The test runs from the self-managed stack test target.

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

Merge Risk: ⚪ Minimal · up to 6d710

The change preserves explicit invocation environment overrides and sets the request-queue region to ncp while retaining generated settings; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: barrygreengus

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. (3 skipped: 3 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows Conventional Commits syntax with the required scoped fix type and accurately describes the primary configuration bug fix.
Linked Issues check ✅ Passed The changes satisfy issue #1378 by preserving invocation.env overrides, retaining generated settings, setting the default region to ncp, adding rendering validation, and avoiding application or depend…
Out of Scope Changes check ✅ Passed All changes support issue #1378. The template update, ncp default, test target wiring, and integration test are within scope.
Full details: Linked Issues check

Explanation

The changes satisfy issue #1378 by preserving invocation.env overrides, retaining generated settings, setting the default region to ncp, adding rendering validation, and avoiding application or dependency changes.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/invocation-env-wiring

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

Merge configured invocation environment values after stack-generated defaults and declare the existing ncp request-queue region explicitly.

Closes #1378

Signed-off-by: Stephanie Baum <sbaum@nvidia.com>
@sbaum1994
sbaum1994 force-pushed the fix/invocation-env-wiring branch from 6d71098 to 07af4a1 Compare August 30, 2026 21:09
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.

Self-managed stack drops invocation environment overrides

1 participant