Skip to content

Fix bug in toolkit yaml version parsing#1595

Merged
Magssch merged 3 commits intomainfrom
fix-version-number-parsing
Mar 31, 2026
Merged

Fix bug in toolkit yaml version parsing#1595
Magssch merged 3 commits intomainfrom
fix-version-number-parsing

Conversation

@Magssch
Copy link
Copy Markdown
Contributor

@Magssch Magssch commented Mar 31, 2026

Description

Tighten quote_int_value_by_key_in_yaml so it no longer uses ([\d_]+)(.*)$, which only quoted the leading digit run and broke lines like version: 1.0 by formating them like version: "1".0. This PR builds upon #1594 which was again based on the the existing handling in Toolkit, and retains the same-line # comment handling which was added while avoiding to malformat floats. Extra unit tests added to ensure we don't introduce changes to floats, semver-like text, scientific notation, and empty version: lines.

Currently, the user would see the following error if the version contains periods:

image

Bump

  • Patch
  • Skip

Changelog

Fixed

  • Fixes a crashing issue when reading Toolkit-format data models with version strings containing periods (e.g. 1.0.0).

@Magssch Magssch requested a review from a team as a code owner March 31, 2026 13:31
@gemini-code-assist
Copy link
Copy Markdown
Contributor

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

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.

@Magssch
Copy link
Copy Markdown
Contributor Author

Magssch commented Mar 31, 2026

/gemini review

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 31, 2026

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
7433 6867 92% 90% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
cognite/neat/_utils/text.py 91% 🟢
TOTAL 91% 🟢

updated for commit: ebe826b by action🐍

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.83%. Comparing base (9a95a2e) to head (ebe826b).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1595      +/-   ##
==========================================
- Coverage   91.85%   91.83%   -0.02%     
==========================================
  Files         126      130       +4     
  Lines        7468     7573     +105     
==========================================
+ Hits         6860     6955      +95     
- Misses        608      618      +10     
Files with missing lines Coverage Δ
cognite/neat/_utils/text.py 91.30% <100.00%> (+1.83%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
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 updates the quote_int_value_by_key_in_yaml utility with a more robust regex to handle YAML key quoting and adds several test cases to verify that non-integer values remain unchanged. A suggestion was made to improve the regex by capturing the key and its trailing whitespace in the first group to preserve formatting and simplify the replacement string.

@Magssch Magssch merged commit 7227f53 into main Mar 31, 2026
10 checks passed
@Magssch Magssch deleted the fix-version-number-parsing branch March 31, 2026 13:51
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