Skip to content

Conversation

@andriyDev
Copy link
Contributor

Objective

  • Trying to rewrite asset processing to be dynamic is hard, especially since we don't have tests verifying all the situations asset processing is supposed to be able to handle!

Solution

  • Add a couple more tests! One to check that processing multiple sources works, and another to check that sending asset events triggers processing (including processing of dependent processing).

Testing

  • ;)

@andriyDev andriyDev added A-Assets Load files from disk to use for things like images, models, and sounds C-Testing A change that impacts how we test Bevy or how users test their apps D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 28, 2025
@github-actions
Copy link
Contributor

Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-21673

If it's expected, please add the M-Deliberate-Rendering-Change label.

If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it.

@andriyDev
Copy link
Contributor Author

Not sure what Pixel Eagle is talking about. The link doesn't point to any images...?

Either way, it's not relevant to this PR because it literally changes no behaviour, it only changes the test file for processing.

Comment on lines +195 to +200
// If the original source changes through an AssetSourceEvent, we'll be racing (on
// multithreaded) between this and processor thread switching the state to `Processing`. So do a
// fixed number of iterations so the processor thread is likely to win.
for _ in 0..5 {
app.update();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is at all flaky it's going to be really annoying for everyone. If it is flaky then we should find some other way of preventing this race, if it's not flaky I think the comment should be reworded to explain why.

Copy link
Contributor Author

@andriyDev andriyDev Oct 28, 2025

Choose a reason for hiding this comment

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

Fixing this properly is very rough. We could fix this by gating the Process (so not a generic solution), then having a specialized run_app_until_processing_then_finished (we'd need to also have this tick the gate, which sucks).

I haven't detected any flakes. This is just me being paranoid, especially since I know Github CI machines are much slower than my machine. So this is me being somewhat cautious haha.

I'm not sure if a "proper" fix is worth the complexity. Wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like we'll end up investing in some asset specific testing infrastructure at some point, similarly to how rendering has screenshots and a way to step a certain number of frames. Flaky tests are really annoying for other contributors because they need to retrigger runs and might spend time investigating if the failures are their fault.

But I guess we can wait until we see it fail at least once.

@andriyDev andriyDev force-pushed the processor-sources-tests branch from ecdb663 to 6387c2b Compare October 28, 2025 15:37
@andriyDev andriyDev force-pushed the processor-sources-tests branch from 6387c2b to 3ef757b Compare October 28, 2025 15:40
@github-actions
Copy link
Contributor

Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-21673

If it's expected, please add the M-Deliberate-Rendering-Change label.

If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it.

1 similar comment
@github-actions
Copy link
Contributor

Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-21673

If it's expected, please add the M-Deliberate-Rendering-Change label.

If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it.

@andriyDev andriyDev requested a review from kristoff3r October 28, 2025 15:47
@alice-i-cecile alice-i-cecile self-requested a review October 30, 2025 07:10
Copy link
Contributor

@greeble-dev greeble-dev left a comment

Choose a reason for hiding this comment

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

I'm not familiar with asset processing, but I'm clicking approve as I couldn't spot any issues and the tests passed (Win10). Added just one non-blocking style issue.

I wasn't entirely sure how to run the tests in both single and multi threaded - hopefully this is right:

cargo test -p bevy_asset
cargo test -p bevy_asset --features multi_threaded

let processed_memory_writer = MemoryAssetWriter {
root: processed_dir.clone(),
};
struct UnfinishedProcessingDirs {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick/style issue: I find this hard to read with UnfinishedProcessingDirs and create_source nested inside create_app_with_asset_processor. Would prefer them to be at file level.

Copy link
Contributor Author

@andriyDev andriyDev Oct 30, 2025

Choose a reason for hiding this comment

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

I intentionally don't want to do this because it already "conflicts" conceptually with ProcessingDirs, and this type is only necessary so we can block on fetching the sender (which is a hack I want to keep "hidden" in the implementation).

@greeble-dev greeble-dev added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 30, 2025
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Oct 30, 2025
Merged via the queue into bevyengine:main with commit 906bc14 Oct 30, 2025
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Assets Load files from disk to use for things like images, models, and sounds C-Testing A change that impacts how we test Bevy or how users test their apps D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants