Skip to content

Conversation

@cloutierMat
Copy link
Member

@cloutierMat cloutierMat commented Oct 9, 2025

Motivation

This pr aims to fix an issue where attempting to assign a non-nested path, would result in a blank string key added to the dict. For example assign_to_path({}, "key", "value") would return {"": {"key": "value"}}. Instead of requiring consumer of the util to strip and split to verify if the path is indeed nested, it seems more appropriate to return the expected value {"key", "value"}.

part of UNC-17

Changes

  • update assign_to_path to return early if the path is not nested.
  • added test

@cloutierMat cloutierMat added aws:eks Amazon Elastic Kubernetes Service semver: patch Non-breaking changes which can be included in patch releases docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes labels Oct 9, 2025
@github-actions
Copy link

github-actions bot commented Oct 9, 2025

Test Results - Preflight, Unit

22 340 tests  +42   20 590 ✅ +35   15m 24s ⏱️ -39s
     1 suites ± 0    1 750 💤 + 7 
     1 files   ± 0        0 ❌ ± 0 

Results for commit 478d6a2. ± Comparison against base commit e0a4a18.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Oct 9, 2025

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 23s ⏱️ +3s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit 478d6a2. ± Comparison against base commit e0a4a18.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Oct 9, 2025

Test Results (amd64) - Integration, Bootstrap

    5 files  ± 0      5 suites  ±0   2h 39m 14s ⏱️ +45s
5 245 tests +56  4 730 ✅ +38  515 💤 +18  0 ❌ ±0 
5 251 runs  +56  4 730 ✅ +38  521 💤 +18  0 ❌ ±0 

Results for commit 478d6a2. ± Comparison against base commit e0a4a18.

This pull request removes 1 and adds 57 tests. Note that renamed tests count towards both.
tests.aws.services.dynamodb.test_dynamodb.TestDynamoDB ‑ test_delete_table
tests.aws.services.dynamodb.test_dynamodb.TestDynamoDB ‑ test_table_crud
tests.aws.services.dynamodb.test_dynamodb.TestDynamoDB ‑ test_table_warm_throughput
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[content_anything_but_ignorecase_list_missing_NEG]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[content_anything_but_ignorecase_list_null]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[content_anything_but_ignorecase_missing_NEG]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[content_anything_but_ignorecase_null]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[content_anything_but_string_list_missing_NEG]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[content_anything_but_string_list_null]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[content_anything_but_string_list_null_type_EXC]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[content_anything_but_string_missing_NEG]
…

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Oct 9, 2025

LocalStack Community integration with Pro

    2 files  ± 0      2 suites  ±0   2h 0m 6s ⏱️ +24s
4 871 tests +56  4 516 ✅ +38  355 💤 +18  0 ❌ ±0 
4 873 runs  +56  4 516 ✅ +38  357 💤 +18  0 ❌ ±0 

Results for commit 478d6a2. ± Comparison against base commit e0a4a18.

This pull request removes 1 and adds 57 tests. Note that renamed tests count towards both.
tests.aws.services.dynamodb.test_dynamodb.TestDynamoDB ‑ test_delete_table
tests.aws.services.dynamodb.test_dynamodb.TestDynamoDB ‑ test_table_crud
tests.aws.services.dynamodb.test_dynamodb.TestDynamoDB ‑ test_table_warm_throughput
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[content_anything_but_ignorecase_list_missing_NEG]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[content_anything_but_ignorecase_list_null]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[content_anything_but_ignorecase_missing_NEG]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[content_anything_but_ignorecase_null]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[content_anything_but_string_list_missing_NEG]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[content_anything_but_string_list_null]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[content_anything_but_string_list_null_type_EXC]
tests.aws.services.events.test_events_patterns.TestEventPattern ‑ test_event_pattern[content_anything_but_string_missing_NEG]
…

♻️ This comment has been updated with latest results.

@cloutierMat cloutierMat marked this pull request as ready for review October 9, 2025 22:53
@cloutierMat cloutierMat requested a review from dfangl October 9, 2025 22:53
@cloutierMat cloutierMat added the review: merge when ready Signals to the reviewer that a PR can be merged if accepted label Oct 9, 2025
@cloutierMat cloutierMat requested a review from a team October 14, 2025 17:38
Copy link
Contributor

@simonrw simonrw left a comment

Choose a reason for hiding this comment

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

This change seems fine for the use case we want to use it for, however I think this function in general could do with work (outside the scope of this change).

For example, I expected

assign_to_path({}, "a.b.c", "foo") == {"a": {"b": {"c": "foo"}}}

however it equals {"a.b": {"c": "foo"}}.

Perhaps consider refactoring the PR that requires this change to not use this function?

return result


def assign_to_path(target, path: str, value, delimiter: str = "."):
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: really minor but going with the attitude of "leave the codebase in a better shape", perhaps you could add a docstring to explain what this function is supposed to do?

Copy link
Member

Choose a reason for hiding this comment

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

I agree, some typing would be lovely as well!

Copy link
Member Author

Choose a reason for hiding this comment

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

I can add the docstring as well.

I think @simonrw discovered a new bug in this implementation though... since I would assume the intended behavior would be to return and the way it works when the delimiter is "/". All we need to do is to pass in the delimiter to extract_from_jsonpointer_path.

All of the use cases I could see in the code are using "/" as a delimiter, so it shouldn't break any existing behavior.

Good catch @simonrw

Copy link
Member

@dfangl dfangl left a comment

Choose a reason for hiding this comment

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

I agree with Simon, however the PR is fine for me otherwise.

return result


def assign_to_path(target, path: str, value, delimiter: str = "."):
Copy link
Member

Choose a reason for hiding this comment

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

I agree, some typing would be lovely as well!

@cloutierMat cloutierMat changed the title Eks/persist cluster fix json.assign_to_path with non nested path Oct 16, 2025
@cloutierMat cloutierMat merged commit 1a48eb6 into main Oct 20, 2025
40 checks passed
@cloutierMat cloutierMat deleted the eks/persist-cluster branch October 20, 2025 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aws:eks Amazon Elastic Kubernetes Service docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes review: merge when ready Signals to the reviewer that a PR can be merged if accepted semver: patch Non-breaking changes which can be included in patch releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants