Skip to content

Conversation

@andrewnester
Copy link
Contributor

Changes

Extract common resource fields into a separate embedded struct BaseResource

Why

Based on feedback from #3448 (comment)

Tests

Existing tests pass

ID string `json:"id,omitempty" bundle:"readonly"`
// We cannot embed BaseResource here because apps.App has its own Id field
// that conflicts with BaseResource.ID
ID string `json:"id,omitempty" bundle:"readonly"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Question - where does this conflict manifests? Curious why it's a problem for 2 embedded structs but not a problem for outer + embeded.

Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect it's a precedence thing where the second embedded struct takes precedence over the first.

Copy link
Contributor

Choose a reason for hiding this comment

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

in that case swapping order would allow to use embedded one here?

BTW URL also overlaps for Apps

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's still the same problem with outer + embedded, it's just that linter does not catch it, I fixed it here to use BaseResource for apps and pipelines anyway
d584606

@eng-dev-ecosystem-bot
Copy link
Collaborator

eng-dev-ecosystem-bot commented Sep 8, 2025

Run: 17578646148

Env ✅​pass 🙈​skip
✅​ aws linux 308 523
✅​ aws windows 309 522
✅​ aws-ucws linux 420 421
✅​ aws-ucws windows 421 420
✅​ azure linux 308 522
✅​ azure windows 309 521
✅​ azure-ucws linux 420 420
✅​ azure-ucws windows 421 419
✅​ gcp linux 307 524
✅​ gcp windows 308 523

Copy link
Contributor

@pietern pietern left a comment

Choose a reason for hiding this comment

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

@andrewnester Any ideas if we could fix the cases where we can't embed it? It almost defies the purpose of having a single base struct to reuse, if we have to copy/paste fields to the cases where it doesn't work anyway.

@andrewnester
Copy link
Contributor Author

@pietern in practice, we can still embed BaseResource in Apps and Pipelines, but just skip linting on duplicated tags
d584606

We don't make the situation worse than it is right now with this.

@andrewnester andrewnester added this pull request to the merge queue Sep 9, 2025
Merged via the queue into main with commit 4f82e08 Sep 9, 2025
22 of 23 checks passed
@andrewnester andrewnester deleted the refactor/base-resource branch September 9, 2025 10:42
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