Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: incorrect filesystem implicit order due to reloading of objects #1014

Merged
merged 2 commits into from
Feb 12, 2024

Conversation

i4ki
Copy link
Contributor

@i4ki i4ki commented Jul 6, 2023

In some cases the filesystem implicit order (orchestration ordering) is incorrect due to stack objects being reloaded from the config tree and then losing its implicit definition.
The problem is easier to reproduce when using tag filters in the stack.after or stack.before attributes, because they are loaded at a later time and then new stack objects are created.

The solution of the problem was implementing a memoization of the tree.stack object, wrapped in the method tree.Stack().

@netlify
Copy link

netlify bot commented Jul 6, 2023

Deploy Preview for terramate-io-docs canceled.

Name Link
🔨 Latest commit 14d9225
🔍 Latest deploy log https://app.netlify.com/sites/terramate-io-docs/deploys/65240f88714451000852f154

@i4ki
Copy link
Contributor Author

i4ki commented Jul 6, 2023

hey @zied-elouaer
can you check if this fix solves your issue?
Thanks for reporting it.

@codecov
Copy link

codecov bot commented Jul 6, 2023

Codecov Report

Attention: 12 lines in your changes are missing coverage. Please review.

Comparison is base (5a4d973) 62.75% compared to head (7be039a) 65.69%.
Report is 515 commits behind head on main.

❗ Current head 7be039a differs from pull request most recent head d686ba5. Consider uploading reports for the commit d686ba5 to get more accurate results

Files Patch % Lines
config/stack.go 14.28% 6 Missing ⚠️
config/config.go 62.50% 2 Missing and 1 partial ⚠️
run/order.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1014      +/-   ##
==========================================
+ Coverage   62.75%   65.69%   +2.93%     
==========================================
  Files         102       94       -8     
  Lines       16395    14882    -1513     
==========================================
- Hits        10288     9776     -512     
+ Misses       5683     4738     -945     
+ Partials      424      368      -56     
Flag Coverage Δ
tests 65.69% <33.33%> (+2.93%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link

github-actions bot commented Jul 6, 2023

metric: time/op
CloudReadLines-4: old 1.01ms ± 5%: new 1.03ms ± 4%: delta: 1.49%
CloudReadLine-4: old 6.93ms ± 1%: new 6.93ms ± 2%: delta: 0.00%
ListFiles-4: old 51.0µs ± 1%: new 51.0µs ± 1%: delta: 0.00%
Generate-4: old 2.55s ± 2%: new 2.54s ± 2%: delta: 0.00%
GenerateRegex-4: old 1.79s ± 2%: new 1.79s ± 1%: delta: 0.16%
TokensForExpressionComplex-4: old 1.25ms ± 0%: new 1.26ms ± 1%: delta: 0.35%
TokensForExpressionPlainStringNoNewline-4: old 895ns ± 0%: new 897ns ± 1%: delta: 0.00%
TokensForExpressionStringWith100Newlines-4: old 33.9µs ± 0%: new 33.9µs ± 1%: delta: 0.28%
TokensForExpressionObjectWith100KeysWithNumberValues-4: old 1.45ms ± 0%: new 1.45ms ± 1%: delta: 0.53%
TokensForExpression-4: old 1.26ms ± 0%: new 1.26ms ± 0%: delta: 0.18%
PartialEvalComplex-4: old 429µs ± 0%: new 430µs ± 1%: delta: 0.00%
PartialEvalSmallString-4: old 3.55µs ± 0%: new 3.56µs ± 1%: delta: 0.31%
PartialEvalHugeString-4: old 1.84ms ± 0%: new 1.88ms ± 0%: delta: 1.88%
PartialEvalHugeInterpolatedString-4: old 4.87ms ± 1%: new 4.88ms ± 3%: delta: 0.00%
PartialEvalObject-4: old 21.4µs ± 1%: new 21.4µs ± 0%: delta: 0.00%
TmAllTrueLiteralList-4: old 6.26ms ± 0%: new 6.27ms ± 0%: delta: 0.17%
TmAllTrueFuncall-4: old 160µs ± 0%: new 160µs ± 0%: delta: 0.00%
TmAnyTrueLiteralList-4: old 147ms ± 0%: new 147ms ± 0%: delta: 0.18%
TmAnyTrueFuncall-4: old 160µs ± 0%: new 160µs ± 0%: delta: 0.13%
TmTernary-4: old 2.62µs ± 1%: new 2.67µs ± 1%: delta: 1.74%
TmTry-4: old 53.0µs ± 0%: new 53.1µs ± 1%: delta: 0.25%
metric: alloc/op
CloudReadLines-4: old 3.12MB ± 0%: new 3.12MB ± 0%: delta: 0.00%
CloudReadLine-4: old 3.37MB ± 0%: new 3.37MB ± 0%: delta: 0.00%
ListFiles-4: old 22.0kB ± 0%: new 22.0kB ± 0%: delta: 0.00%
Generate-4: old 2.32GB ± 0%: new 2.32GB ± 0%: delta: 0.00%
GenerateRegex-4: old 950MB ± 0%: new 951MB ± 0%: delta: 0.00%
TokensForExpressionComplex-4: old 412kB ± 0%: new 412kB ± 0%: delta: 0.00%
TokensForExpressionPlainStringNoNewline-4: old 592B ± 0%: new 592B ± 0%: delta: 0.00%
TokensForExpressionStringWith100Newlines-4: old 14.0kB ± 0%: new 14.0kB ± 0%: delta: 0.00%
TokensForExpressionObjectWith100KeysWithNumberValues-4: old 402kB ± 0%: new 402kB ± 0%: delta: 0.00%
TokensForExpression-4: old 412kB ± 0%: new 412kB ± 0%: delta: 0.00%
PartialEvalComplex-4: old 353kB ± 0%: new 353kB ± 0%: delta: 0.00%
PartialEvalSmallString-4: old 1.74kB ± 0%: new 1.74kB ± 0%: delta: 0.00%
PartialEvalHugeString-4: old 166kB ± 0%: new 166kB ± 0%: delta: 0.00%
PartialEvalHugeInterpolatedString-4: old 4.38MB ± 0%: new 4.38MB ± 0%: delta: 0.00%
PartialEvalObject-4: old 20.4kB ± 0%: new 20.4kB ± 0%: delta: 0.00%
TmAllTrueLiteralList-4: old 1.74MB ± 0%: new 1.74MB ± 0%: delta: 0.00%
TmAllTrueFuncall-4: old 45.5kB ± 0%: new 45.5kB ± 0%: delta: 0.00%
TmAnyTrueLiteralList-4: old 37.9MB ± 0%: new 37.9MB ± 0%: delta: 0.00%
TmAnyTrueFuncall-4: old 45.6kB ± 0%: new 45.6kB ± 0%: delta: 0.00%
TmTernary-4: old 1.11kB ± 0%: new 1.11kB ± 0%: delta: 0.00%
TmTry-4: old 11.1kB ± 0%: new 11.1kB ± 0%: delta: 0.00%
metric: allocs/op
CloudReadLines-4: old 5.54k ± 0%: new 5.54k ± 0%: delta: 0.00%
CloudReadLine-4: old 60.0k ± 0%: new 60.0k ± 0%: delta: 0.00%
ListFiles-4: old 321 ± 0%: new 321 ± 0%: delta: 0.00%
Generate-4: old 25.9M ± 0%: new 25.9M ± 0%: delta: 0.00%
GenerateRegex-4: old 18.3M ± 0%: new 18.3M ± 0%: delta: 0.00%
TokensForExpressionComplex-4: old 4.93k ± 0%: new 4.93k ± 0%: delta: 0.00%
TokensForExpressionPlainStringNoNewline-4: old 21.0 ± 0%: new 21.0 ± 0%: delta: 0.00%
TokensForExpressionStringWith100Newlines-4: old 328 ± 0%: new 328 ± 0%: delta: 0.00%
TokensForExpressionObjectWith100KeysWithNumberValues-4: old 3.29k ± 0%: new 3.29k ± 0%: delta: 0.00%
TokensForExpression-4: old 4.93k ± 0%: new 4.93k ± 0%: delta: 0.00%
PartialEvalComplex-4: old 2.83k ± 0%: new 2.83k ± 0%: delta: 0.00%
PartialEvalSmallString-4: old 23.0 ± 0%: new 23.0 ± 0%: delta: 0.00%
PartialEvalHugeString-4: old 35.0 ± 0%: new 35.0 ± 0%: delta: 0.00%
PartialEvalHugeInterpolatedString-4: old 23.1k ± 0%: new 23.1k ± 0%: delta: 0.00%
PartialEvalObject-4: old 125 ± 0%: new 125 ± 0%: delta: 0.00%
TmAllTrueLiteralList-4: old 13.6k ± 0%: new 13.6k ± 0%: delta: 0.00%
TmAllTrueFuncall-4: old 460 ± 0%: new 460 ± 0%: delta: 0.00%
TmAnyTrueLiteralList-4: old 252k ± 0%: new 252k ± 0%: delta: 0.00%
TmAnyTrueFuncall-4: old 462 ± 0%: new 462 ± 0%: delta: 0.00%
TmTernary-4: old 26.0 ± 0%: new 26.0 ± 0%: delta: 0.00%
TmTry-4: old 144 ± 0%: new 144 ± 0%: delta: 0.00%

@i4ki i4ki marked this pull request as ready for review July 6, 2023 19:20
@i4ki i4ki requested a review from a team as a code owner July 6, 2023 19:20
zied-elouaer
zied-elouaer previously approved these changes Jul 7, 2023
Copy link

@zied-elouaer zied-elouaer left a comment

Choose a reason for hiding this comment

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

Tested on the previously broken use case in iac-gcloud and it works just fine now. Nicely done!

@mariux mariux added this to the Release v0.4.0 milestone Jul 18, 2023
@mariux mariux changed the title fix: incorrect filesystem implicit order due to reloading of objects fix!: incorrect filesystem implicit order due to reloading of objects Jul 18, 2023
@mariux mariux modified the milestones: Release v0.4.0, Release v0.5.0 Jul 21, 2023
@i4ki i4ki requested a review from a team October 2, 2023 09:42
@i4ki i4ki marked this pull request as draft November 22, 2023 13:46
@i4ki i4ki force-pushed the i4k-bug-fs-ordering branch from 14d9225 to 1408285 Compare February 9, 2024 01:56
Copy link

netlify bot commented Feb 9, 2024

Deploy Preview for docs-terramate-io canceled.

Name Link
🔨 Latest commit d686ba5
🔍 Latest deploy log https://app.netlify.com/sites/docs-terramate-io/deploys/65ca1e85d0c19a0008ac9f9e

config/stack.go Show resolved Hide resolved
@i4ki i4ki marked this pull request as ready for review February 9, 2024 02:42
i4ki added a commit that referenced this pull request Feb 9, 2024
wmalik
wmalik previously approved these changes Feb 12, 2024
Copy link
Contributor

@wmalik wmalik left a comment

Choose a reason for hiding this comment

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

Looks good to me

@i4ki i4ki merged commit ce395d9 into main Feb 12, 2024
13 checks passed
@i4ki i4ki deleted the i4k-bug-fs-ordering branch February 12, 2024 13:59
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.

5 participants