Unverified Commit 684cf7ea authored by zydo's avatar zydo Committed by GitHub

Fix analyzer cell creation order (#100562)

## Summary

Prepare each endpoint group asynchronously, then create its chunk-group
and route-entry cells in endpoint order. This makes cell creation
deterministic and satisfies the `no-map-async-cell` lint rule without
changing the analyzer's output.

## Verification

- `pnpm lint-ast-grep`
- `pnpm build-all`
- `cargo fmt --all -- --check`
- `TMPDIR=/private/tmp pnpm test-start-turbo
test/e2e/next-analyze/next-analyze.test.ts` (6 tests passed)

<!-- NEXT_JS_LLM -->
parent 3da24ee7
...@@ -206,7 +206,7 @@ async fn get_analyze_data_operation( ...@@ -206,7 +206,7 @@ async fn get_analyze_data_operation(
} }
} }
let analyze_data_and_summaries = endpoint_groups let prepared_endpoint_groups = endpoint_groups
.iter() .iter()
.map(async |(key, endpoint_group)| { .map(async |(key, endpoint_group)| {
let output_assets = if has_combined let output_assets = if has_combined
...@@ -263,8 +263,17 @@ async fn get_analyze_data_operation( ...@@ -263,8 +263,17 @@ async fn get_analyze_data_operation(
{ {
groups.extend(shared_chunk_groups.iter().cloned()); groups.extend(shared_chunk_groups.iter().cloned());
} }
Ok((key, output_assets, traced_files, groups, entries))
})
.try_join()
.await?;
let analyze_data_and_summaries = prepared_endpoint_groups
.into_iter()
.map(|(key, output_assets, traced_files, groups, entries)| {
let chunk_groups: Vc<AnalyzeChunkGroups> = Vc::cell(groups); let chunk_groups: Vc<AnalyzeChunkGroups> = Vc::cell(groups);
let route_entries: Vc<AnalyzeRouteEntries> = Vc::cell(entries); let route_entries: Vc<AnalyzeRouteEntries> = Vc::cell(entries);
async move {
let analyze_data = AnalyzeDataOutputAsset::new( let analyze_data = AnalyzeDataOutputAsset::new(
analyze_output_root analyze_output_root
.join(&key.to_string())? .join(&key.to_string())?
...@@ -296,6 +305,7 @@ async fn get_analyze_data_operation( ...@@ -296,6 +305,7 @@ async fn get_analyze_data_operation(
}; };
Ok((ResolvedVc::upcast(analyze_data), summary)) Ok((ResolvedVc::upcast(analyze_data), summary))
}
}) })
.try_join() .try_join()
.await?; .await?;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment