Skip to content

Conversation

@kanterov
Copy link
Collaborator

Changes

Fix issues with bundles using multiple mutators.

Previously, we didn't correctly chain output between them.

Tests

@kanterov kanterov temporarily deployed to test-trigger-is March 17, 2025 15:35 — with GitHub Actions Inactive
@kanterov kanterov marked this pull request as ready for review March 17, 2025 15:35
("resources", "jobs", resource_name), location
)
resources.jobs[resource_name] = new_job
job = new_job
Copy link
Contributor

Choose a reason for hiding this comment

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

Per the comment above, it is not possible to detect in-place mutations, but this doesn't do anything to prevent them. Is that correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right. I will add tests for it. If the object is mutated but not copied, a mutation will have an effect, but we aren't going to record LOC changes. We can potentially detect mutation by comparing it to deep copy or hashing objects, but it will introduce an additional overhead.


@job_mutator
def add_first_tag(bundle: Bundle, job: Job) -> Job:
tags = bundle.resolve_variable(job.tags)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why call resolve_variable here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's because of types, job.tags can potentially refer to a variable, while it isn't possible in practice.

@kanterov kanterov temporarily deployed to test-trigger-is March 18, 2025 13:06 — with GitHub Actions Inactive
@kanterov kanterov temporarily deployed to test-trigger-is March 18, 2025 13:17 — with GitHub Actions Inactive
@kanterov kanterov added this pull request to the merge queue Mar 18, 2025
Merged via the queue into main with commit fc9544e Mar 18, 2025
15 checks passed
@kanterov kanterov deleted the python-fix-apply-mutators branch March 18, 2025 18:47
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.

3 participants