Skip to content

fix(chart): cast metadata.id to string for regexMatch in physical_links_info#110

Merged
kvaps merged 1 commit intomainfrom
fix/metadata-id-tostring-in-regexmatch
Feb 13, 2026
Merged

fix(chart): cast metadata.id to string for regexMatch in physical_links_info#110
kvaps merged 1 commit intomainfrom
fix/metadata-id-tostring-in-regexmatch

Conversation

@kvaps
Copy link
Member

@kvaps kvaps commented Feb 13, 2026

Summary

  • Fix talm template failure caused by regexMatch receiving interface{} instead of string for .metadata.id
  • After the metadata extraction refactor (fix(lookup): fix metadata extraction and error handling #107), metadata fields are stored as interface{} in map[string]interface{}, but the Sprig regexMatch function strictly requires a string argument
  • Add | toString pipe to cast the value before passing it to regexMatch

Test plan

  • Run talm template -f nodes/<node>.yaml on a cluster with bond interfaces and verify it renders successfully

Summary by CodeRabbit

Bug Fixes

  • Improved ID validation handling to ensure regex pattern matching works correctly with string identifiers.

…ks_info

After the metadata extraction refactor in 2b5746e, metadata fields are
stored as interface{} in map[string]interface{}. The regexMatch Sprig
function strictly requires a string argument, causing template rendering
to fail with "expected string; got interface {}".

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kvaps, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical issue where the talm template command would fail due to a type mismatch. Following a recent metadata extraction refactor, certain metadata fields were stored as generic interface{} types. The regexMatch function, however, strictly requires a string input, leading to runtime errors. The solution involves adding a toString filter to explicitly convert the metadata.id field to a string, thereby preventing the type incompatibility and ensuring the template renders successfully.

Highlights

  • Bug Fix: Resolved a talm template failure that occurred when the regexMatch function received an interface{} type instead of the expected string for .metadata.id.
  • Type Casting: Implemented explicit type casting of .metadata.id to a string using the | toString pipe before it is passed to the regexMatch function, ensuring type compatibility.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • charts/talm/templates/_helpers.tpl
    • Added | toString pipe to .metadata.id within the regexMatch function call.
Activity
  • No specific activity (comments, reviews, progress updates) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Feb 13, 2026

📝 Walkthrough

Walkthrough

A minor fix to a template helper that adds a toString conversion to the metadata ID before applying a regex pattern match, ensuring the value is treated as a string type during the operation.

Changes

Cohort / File(s) Summary
Template Helper String Conversion
charts/talm/templates/_helpers.tpl
Added toString conversion for .metadata.id in regexMatch check to ensure consistent string type handling before regex application.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A tiny string was lost in the mist,
But toString() made sure it wouldn't be missed,
One line changed, the regex now sees,
Metadata ID treated with ease! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (2 files):

⚔️ charts/talm/templates/_helpers.tpl (content)
⚔️ main.go (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately and specifically describes the main change: casting metadata.id to string for regexMatch in physical_links_info, which directly addresses the fix described in the objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/metadata-id-tostring-in-regexmatch
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch fix/metadata-id-tostring-in-regexmatch
  • Create stacked PR with resolved conflicts
  • Post resolved changes as copyable diffs in a comment

No actionable comments were generated in the recent review. 🎉


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
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses a type mismatch issue in a Helm template where the regexMatch function was receiving an interface{} type instead of the required string. The fix involves casting .metadata.id to a string using the | toString pipe, which is the correct approach to resolve this template rendering failure. The change is concise, targeted, and effectively solves the problem described. I have reviewed the change and found no further issues.

@kvaps kvaps marked this pull request as ready for review February 13, 2026 10:03
@kvaps kvaps merged commit 2ba7459 into main Feb 13, 2026
4 checks passed
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