Skip to content

OCTO-918: dotted-path + JSON deep-merge --variable-override (v0.7.0) - #22

Merged
jebentier merged 3 commits into
mainfrom
OCTO-918-variable-override-deep-merge
Jul 23, 2026
Merged

OCTO-918: dotted-path + JSON deep-merge --variable-override (v0.7.0)#22
jebentier merged 3 commits into
mainfrom
OCTO-918-variable-override-deep-merge

Conversation

@jebentier

Copy link
Copy Markdown
Contributor

Summary

  • Add VariableOverrideParser supporting legacy KEY:VALUE (unchanged), dotted-path overrides with JSON value coercion and \. escaping, and repeatable --variable-override-json.
  • Wire new flags in CLI with parse-time stdout echo and ParseError → exit 1; change Template#initialize to deep_merge overrides over resolved variables.
  • Bump gem to 0.7.0 with README and CHANGELOG documentation.

Test plan

  • bundle exec rspec — 138 examples, 0 failures
  • Parser unit specs (20 examples): legacy, dotted-path, JSON coercion, escaping, empty-segment errors
  • CLI specs (5 new examples): comma-splitting, command-line precedence, stdout echo, invalid JSON exit 1, empty segment exit 1
  • Template specs (4 new examples): nested deep-merge, legacy collision, jsonnet end-to-end override
  • E2E demo: render_templates with deploySha:12345 + components.webServer.hpa.minReplicas:2 produces quoted string deploySha and integer minReplicas; stdout echo present; no # Variable overrides used: comment
  • Error path: invalid --variable-override-json exits 1 with not valid JSON on STDERR
  • Human-gated post-merge: bundle exec rake release (rubygems publish) — AC 10, not done in this PR

Ticket

https://invoca.atlassian.net/browse/OCTO-918

Made with Cursor

Add VariableOverrideParser for legacy KEY:VALUE, dotted-path JSON-coerced
overrides, and --variable-override-json; deep-merge overrides in Template.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings July 23, 2026 13:20
@jebentier
jebentier requested a review from a team as a code owner July 23, 2026 13:20
@jebentier
jebentier requested a review from ishakun July 23, 2026 13:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds richer CLI variable override support so users can override nested variables via dotted paths and JSON, with deep-merge semantics applied at template initialization time.

Changes:

  • Introduces VariableOverrideParser to parse legacy KEY:VALUE, dotted-path overrides with JSON coercion, and repeatable --variable-override-json, deep-merging in CLI order.
  • Updates CLI to use the new parser, handle parse errors as exit(1), and echo the resolved override hash once to stdout.
  • Updates Template#initialize to deep-merge overrides into resolved variables; bumps docs and version to 0.7.0.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
spec/kubernetes_template_rendering/variable_override_parser_spec.rb Adds unit coverage for legacy, dotted-path parsing/escaping, JSON coercion, and error cases.
spec/kubernetes_template_rendering/template_spec.rb Verifies template variable resolution deep-merges nested overrides and keeps legacy collisions unchanged.
spec/kubernetes_template_rendering/cli_spec.rb Adds CLI coverage for override parsing, precedence, stdout echo, and error exit paths.
lib/kubernetes_template_rendering/variable_override_parser.rb New parser implementing dotted-path + JSON override deep-merge behavior.
lib/kubernetes_template_rendering/cli.rb Wires new flags, centralizes parsing via parser, rescues parse errors to exit 1, echoes overrides.
lib/kubernetes_template_rendering/template.rb Switches override application from merge to deep_merge.
lib/kubernetes_template_rendering/version.rb Bumps gem version to 0.7.0.
README.md Documents new override forms, escaping rules, precedence, and stdout echo behavior.
CHANGELOG.md Adds 0.7.0 entry describing new override capabilities and deep-merge behavior.
Gemfile.lock Updates locked gem version to 0.7.0.

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

Comment thread CHANGELOG.md Outdated
Comment thread lib/kubernetes_template_rendering/cli.rb Outdated
Comment thread lib/kubernetes_template_rendering/template.rb
Comment thread lib/kubernetes_template_rendering/variable_override_parser.rb

@unblocked unblocked Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ No issues found

About Unblocked

Unblocked has been set up to automatically review your team's pull requests to identify genuine bugs and issues.

📖 Documentation — Learn more in our docs.

💬 Ask questions — Mention @unblocked to request a review or summary, or ask follow-up questions.

👍 Give feedback — React to comments with 👍 or 👎 to help us improve.

⚙️ Customize — Adjust settings in your preferences.

…cases

Cross-model review pass: confirm JSON array coercion/wholesale-replace
on deep_merge, trailing-backslash-vs-escaped-dot boundary handling,
non-ASCII path segments/values, and empty-string values all behave per
spec. All green — no defects found, added for regression coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jebentier
jebentier requested a review from dcaddell July 23, 2026 13:43
…ean AS requires

Replace <merge date> with 2026-07-23; use JSON.generate for stdout echo;
drop redundant require "active_support" where core_ext/deep_merge suffices.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jebentier
jebentier merged commit 439e92e into main Jul 23, 2026
7 checks passed
@jebentier
jebentier deleted the OCTO-918-variable-override-deep-merge branch July 23, 2026 13:57
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