Skip to content

feat(modifiers): add UnchangedPaths - #1707

Open
cgoetz-inovex wants to merge 2 commits into
mainfrom
feat/STACKITTPR-791-UnchangedPaths
Open

feat(modifiers): add UnchangedPaths#1707
cgoetz-inovex wants to merge 2 commits into
mainfrom
feat/STACKITTPR-791-UnchangedPaths

Conversation

@cgoetz-inovex

Copy link
Copy Markdown
Contributor
  • delete unused Int64Unchanged

(cherry picked from commit 4de5802)

Description

relates to #1234

Checklist

  • Issue was linked above
  • Code format was applied: make fmt
  • Examples were added / adjusted (see examples/ directory)
  • Docs are up-to-date: make generate-docs (will be checked by CI)
  • Unit tests got implemented or updated
  • Acceptance tests got implemented or updated (see e.g. here)
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

- delete unused Int64Unchanged

(cherry picked from commit 4de5802)
@cgoetz-inovex
cgoetz-inovex requested a review from a team as a code owner August 19, 2026 09:32
Comment on lines +123 to +125
if !stateValue.Equal(planValue) {
allUnchanged = false
}

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.

Maybe we can do a early return here? No need to keep walking the other paths when at least one is changed

Comment on lines +314 to +318
name: "no wildcard matches",
paths: []path.Expression{allItemValues},
plan: testValues{anchor: "new", items: []string{}},
state: testValues{anchor: "old", items: []string{}},
want: true,

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.

Not sure about this behavior. I think users of the function might silently introduce bugs when this function returns true if i pass a non-existing path on accident. Shouldnt we maybe rather throw an error in that case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The path exists here:

// state:
"items":tftypes.List[tftypes.Object["value":tftypes.String]]<>,
// plan:
 "items":tftypes.List[tftypes.Object["value":tftypes.String]]<>

It's an empty list in both state and plan.

My assumption would be, that an empty list in plan and state qualifies as unchanged.

adding:

			if len(matched) == 0 {
				resp.Diagnostics.AddError(
					"no matches", "foo")
				return
			}

in the implementation would fail this empty list case here.

Completely non-existing paths are covered by the next case "invalid path".

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