Skip to content

[CDF-28175] Fix location filter asset subtree key compatibility#3085

Merged
ronpal merged 6 commits into
mainfrom
cdf-28175/fix-location-filter-asset-subtree-key-mismatch
Jul 2, 2026
Merged

[CDF-28175] Fix location filter asset subtree key compatibility#3085
ronpal merged 6 commits into
mainfrom
cdf-28175/fix-location-filter-asset-subtree-key-mismatch

Conversation

@ronpal

@ronpal ronpal commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Description

We introduced an error with Pydantic classes for location filters, mixing assetSubtreeIds (correct) and assetSubtreeExternalIds (wrong). This change keeps compatibility by accepting both in location YAML and normalizing deploy payloads to API-compatible subtree IDs.

Bump

  • Patch
  • Skip

Changelog

Fixed

  • Fixed location filter asset subtree key handling so build and deploy accept compatible syntax.

ronpal added 6 commits June 24, 2026 15:22
## Bump

- [x] Patch
- [ ] Skip

## Changelog

### Fixed

- `cdf build` rejecting unquoted timestamp-like values in config.yaml variables
Accept both assetSubtreeIds and assetSubtreeExternalIds in location filter YAML and normalize to deploy-compatible payloads to avoid build/deploy schema mismatches.
@ronpal

ronpal commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@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
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 the 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 counterproductive. 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.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request adds support for the assetSubtreeIds alias alongside assetSubtreeExternalIds in location filter resources, updating both the loader logic and Pydantic models, and adding corresponding unit tests. The review feedback highlights potential runtime errors (such as AttributeError and TypeError) if these fields or subfilters are explicitly set to null in the YAML configuration, recommending defensive checks and safe defaults (or []) during dictionary operations and list unpacking.

Comment thread cognite_toolkit/_cdf_tk/resource_ios/_resource_ios/location.py
Comment thread cognite_toolkit/_cdf_tk/resource_ios/_resource_ios/location.py
Comment thread cognite_toolkit/_cdf_tk/resource_ios/_resource_ios/location.py
@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown

☂️ Code Coverage

current status: ✅

Overall Coverage

Statements Covered Coverage Threshold Status
43836 37728 86% 80% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
cognite_toolkit/_cdf_tk/resource_ios/_resource_ios/location.py 85% 🟢
cognite_toolkit/_cdf_tk/yaml_classes/location.py 100% 🟢
TOTAL 92% 🟢

updated for commit: e6a913e by action🐍

@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.06349% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.06%. Comparing base (080ba9e) to head (3111e14).

Files with missing lines Patch % Lines
cognite_toolkit/_cdf_tk/commands/repo.py 92.68% 3 Missing ⚠️
cognite_toolkit/_cdf_tk/utils/fileio/_writers.py 71.42% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3085      +/-   ##
==========================================
+ Coverage   86.04%   86.06%   +0.01%     
==========================================
  Files         475      475              
  Lines       43828    43881      +53     
==========================================
+ Hits        37712    37765      +53     
  Misses       6116     6116              
Files with missing lines Coverage Δ
...kit/_cdf_tk/resource_ios/_resource_ios/location.py 84.57% <100.00%> (+0.68%) ⬆️
cognite_toolkit/_cdf_tk/utils/fileio/_base.py 95.83% <100.00%> (+0.37%) ⬆️
cognite_toolkit/_cdf_tk/yaml_classes/location.py 100.00% <100.00%> (ø)
cognite_toolkit/_cdf_tk/utils/fileio/_writers.py 82.57% <71.42%> (-0.58%) ⬇️
cognite_toolkit/_cdf_tk/commands/repo.py 81.81% <92.68%> (+14.57%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ronpal ronpal closed this Jun 29, 2026
@ronpal ronpal reopened this Jun 29, 2026
@ronpal ronpal marked this pull request as ready for review June 29, 2026 08:38
@ronpal ronpal requested review from a team as code owners June 29, 2026 08:38
@ronpal

ronpal commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces support for appending missing .gitignore entries during repository initialization and adds alias support for assetSubtreeIds and assetSubtreeExternalIds in location filters. Feedback highlights a missing type hint on a class attribute in repo.py, and several potential runtime errors (such as AttributeError and TypeError) in location.py if filters or subfilters are None or not dictionaries.

Comment thread cognite_toolkit/_cdf_tk/commands/repo.py Outdated
Comment thread cognite_toolkit/_cdf_tk/resource_ios/_resource_ios/location.py
Comment thread cognite_toolkit/_cdf_tk/resource_ios/_resource_ios/location.py
Comment thread cognite_toolkit/_cdf_tk/resource_ios/_resource_ios/location.py
@ronpal ronpal force-pushed the cdf-28175/fix-location-filter-asset-subtree-key-mismatch branch from 3111e14 to e6a913e Compare June 29, 2026 10:57

@Magssch Magssch 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.

LGTM!

@ronpal ronpal merged commit 494bb35 into main Jul 2, 2026
43 of 45 checks passed
@ronpal ronpal deleted the cdf-28175/fix-location-filter-asset-subtree-key-mismatch branch July 2, 2026 09:02
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