Commit a22c73f
authored
refactor: add another check for dotdirs when iterating the config tree (#2279)
<!-- Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines:
https://github.com/terramate-io/terramate/blob/main/CONTRIBUTING.md
2. If the PR is unfinished, mark it as draft:
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request
3. Please update the PR title using the Conventional Commits convention:
https://www.conventionalcommits.org/en/v1.0.0/
Example: feat: add support for XYZ.
-->
## What this PR does / why we need it:
Normally, dotdirs are skipped when parsing the config already, but in
case of delayed loading via `LoadSubTree`, we can bypass this and still
end up loading files from dotdirs. This PR adds an extra check to
exclude dotdirs when visiting the config tree. This fixes a bug in
Catalyst.
## Does this PR introduce a user-facing change?
<!--
If no, just write "no" in the block below.
If yes, please explain the change and update documentation and the
CHANGELOG.md file accordingly.
-->
```
no
```
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Small, localized traversal refactor that only affects which tree nodes
are visited; main risk is unintentionally excluding previously-visible
stacks if callers relied on dotdir contents.
>
> **Overview**
> Updates config tree traversal used by `Stacks()`, `StacksByPaths`,
`StacksByTagsFilters`, and `StackByID` to skip dot-directories during
DFS, even when nodes were introduced via `LoadSubTree`.
>
> This refactors the internal helper from `stacks()` to `visit()` and
applies an explicit `Skip(name)` check while walking `Tree.Children`,
preventing hidden directories from contributing stacks to query results.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
db0ac00. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 file changed
+12
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
284 | | - | |
| 284 | + | |
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
298 | | - | |
| 298 | + | |
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| |||
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
308 | | - | |
| 308 | + | |
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
| |||
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
480 | | - | |
| 480 | + | |
481 | 481 | | |
482 | 482 | | |
483 | 483 | | |
| |||
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
520 | | - | |
521 | | - | |
| 520 | + | |
| 521 | + | |
522 | 522 | | |
523 | | - | |
| 523 | + | |
524 | 524 | | |
525 | | - | |
526 | | - | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
527 | 529 | | |
528 | | - | |
| 530 | + | |
529 | 531 | | |
530 | 532 | | |
531 | 533 | | |
| |||
0 commit comments