Unverified Commit d6d83cfd authored by Will Binns-Smith's avatar Will Binns-Smith Committed by GitHub

Bundle Analyzer Agent Skill: Show route chunk groups (#99170)

## Summary

This PR exposes **chunk groups**: sets of generated client files that
the build associates with a route's client entry or with client
components and layouts used by that route. They show how files relate to
route code, beyond which modules ended up in any one file.

When a route's client output is large, the groups help an agent narrow
which related files and code to inspect. A file can appear in more than
one group, and layout groups can include files from multiple levels.
Groups do **not** show when a browser requests a file or how many bytes
one component added; overlapping groups must not be added together as
independent file sets.

## Verification

- The broad graph-dump converter unit suite is removed in the root and
not reintroduced here; existing e2e and producer code are unchanged. The
snapshot-selection unit suite is removed too, without replacement tests;
its targeted mocked-history/path coverage is intentionally dropped.
Neither analyzer unit suite remains; Next package no-emit types pass.
Unique removed edge-case coverage was explicitly accepted.
- Earlier stack verification included Rust analyzer tests, analyzer e2e
and a full build; these are historical results, not validation of the
new signed heads. **New-head CI is pending.**

<!-- NEXT_JS_LLM -->

<!-- fleet d7bdbc2b-b0bc-4591-99eb-dccb0fa49c73 -->

---------
Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
Co-authored-by: 's avatarWill Binns-Smith <755844+wbinnssmith@users.noreply.github.com>
parent 8eabe35e
......@@ -31,6 +31,8 @@ use turbopack_core::{
reference::all_assets_from_entries,
};
use crate::route::AnalyzeChunkGroups;
const ANALYZE_SCHEMA_VERSION: u32 = 1;
#[turbo_tasks::value]
......@@ -224,6 +226,7 @@ struct AnalyzeDataHeader {
pub output_file_modules: EdgesDataReference,
pub output_file_async_loaders: EdgesDataReference,
pub output_file_module_coverage: Vec<AnalyzeOutputFileCoverage>,
pub chunk_groups: Vec<AnalyzeChunkGroupData>,
/// Exact endpoint roots; nested client references do not become roots.
pub route_entries: Vec<AnalyzeRouteEntry>,
/// Edges from chunks to chunk parts
......@@ -264,6 +267,19 @@ enum AnalyzeOutputFileCoverage {
NotAChunk,
}
#[derive(Serialize)]
struct AnalyzeChunkGroupData {
id: u32,
kind: RcStr,
#[serde(skip_serializing_if = "Option::is_none")]
trigger_module_index: Option<u32>,
#[serde(skip_serializing_if = "Option::is_none")]
unjoined_trigger_ident: Option<RcStr>,
/// Direct emitted output_file indices; group membership is not a claim that
/// an individual reference contributes every module in a cumulative group.
output_file_indices: Vec<u32>,
}
struct AnalyzeOutputFileBuilder {
output_file: AnalyzeOutputFile,
chunk_part_indices: Vec<u32>,
......@@ -296,6 +312,7 @@ struct AnalyzeDataBuilder {
output_file_index_map: FxHashMap<RcStr, u32>,
route_entries: Vec<AnalyzeRouteEntry>,
module_index_hash: RcStr,
chunk_groups: Vec<AnalyzeChunkGroupData>,
}
struct ModulesDataBuilder {
......@@ -331,6 +348,7 @@ impl AnalyzeDataBuilder {
output_files: vec![],
output_file_index_map: FxHashMap::default(),
route_entries,
chunk_groups: vec![],
}
}
......@@ -433,6 +451,7 @@ impl AnalyzeDataBuilder {
.into_iter()
.map(|of| of.output_file)
.collect(),
chunk_groups: self.chunk_groups,
route_entries: self.route_entries,
output_file_chunk_parts: binary_section.add_edges(&output_file_chunk_parts),
source_chunk_parts: binary_section.add_edges(&source_chunk_parts),
......@@ -595,6 +614,7 @@ pub async fn analyze_output_assets(
output_assets: Vc<OutputAssets>,
traced_files: Vc<FileSystemPathVec>,
route_entries: Vc<AnalyzeRouteEntries>,
chunk_groups: Vc<AnalyzeChunkGroups>,
module_graph: Vc<ModuleGraph>,
) -> Result<Vc<AnalyzedRoute>> {
let output_assets = all_assets_from_entries(output_assets);
......@@ -611,6 +631,8 @@ pub async fn analyze_output_assets(
let mut builder =
AnalyzeDataBuilder::new(route_entries, module_index.module_index_hash.clone());
let mut asset_indices: FxHashMap<ResolvedVc<Box<dyn OutputAsset>>, Vec<u32>> =
FxHashMap::default();
let prefix = format!("{SOURCE_URL_PROTOCOL}///");
// Process the output assets and extract chunk parts.
......@@ -645,6 +667,10 @@ pub async fn analyze_output_assets(
filename: filename.clone(),
});
if let Either::Left(asset) = &asset {
asset_indices
.entry(*asset)
.or_default()
.push(output_file_index);
let (indices, coverage, async_loaders) =
output_chunk_modules(*asset, &filename, &module_index).await?;
let file = &mut builder.output_files[output_file_index as usize];
......@@ -692,6 +718,35 @@ pub async fn analyze_output_assets(
}
}
for group in chunk_groups.await?.iter() {
let id = builder.chunk_groups.len() as u32;
let mut output_indices = FxIndexSet::default();
for &asset in group.assets.await?.iter() {
let Some(indices) = asset_indices.get(&asset) else {
let path = asset.path().await?.to_string_ref().await?;
anyhow::bail!("chunk-group asset {path} not present among emitted output files");
};
output_indices.extend(indices.iter().copied());
}
let (trigger_module_index, unjoined_trigger_ident) = if let Some(module) = group.trigger {
let ident = module.ident().to_string().owned().await?;
if let Some(&index) = module_index.by_ident.get(&ident) {
(Some(index), None)
} else {
(None, Some(ident))
}
} else {
(None, None)
};
builder.chunk_groups.push(AnalyzeChunkGroupData {
id,
kind: group.kind.clone(),
trigger_module_index,
unjoined_trigger_ident,
output_file_indices: output_indices.into_iter().collect(),
});
}
// Build a directory structure for the sources.
let mut i: u32 = 0;
while i < builder.sources.len().try_into().unwrap() {
......@@ -854,6 +909,7 @@ pub struct AnalyzeDataOutputAsset {
pub output_assets: ResolvedVc<OutputAssets>,
pub traced_files: ResolvedVc<FileSystemPathVec>,
pub route_entries: ResolvedVc<AnalyzeRouteEntries>,
pub chunk_groups: ResolvedVc<AnalyzeChunkGroups>,
pub module_graph: ResolvedVc<ModuleGraph>,
}
......@@ -865,6 +921,7 @@ impl AnalyzeDataOutputAsset {
output_assets: ResolvedVc<OutputAssets>,
traced_files: ResolvedVc<FileSystemPathVec>,
route_entries: ResolvedVc<AnalyzeRouteEntries>,
chunk_groups: ResolvedVc<AnalyzeChunkGroups>,
module_graph: ResolvedVc<ModuleGraph>,
) -> Result<Vc<Self>> {
Ok(Self {
......@@ -872,6 +929,7 @@ impl AnalyzeDataOutputAsset {
output_assets,
traced_files,
route_entries,
chunk_groups,
module_graph,
}
.cell())
......@@ -886,6 +944,7 @@ impl Asset for AnalyzeDataOutputAsset {
*self.output_assets,
*self.traced_files,
*self.route_entries,
*self.chunk_groups,
*self.module_graph,
)
.file_content();
......
......@@ -84,8 +84,8 @@ use crate::{
},
project::{BaseAndFullModuleGraph, Project},
route::{
AnalyzeClientEntries, AnalyzeClientReference, AppPageRoute, Endpoint, EndpointOutput,
EndpointOutputPaths, ModuleGraphs, Route, Routes,
AnalyzeChunkGroup, AnalyzeChunkGroups, AnalyzeClientEntries, AnalyzeClientReference,
AppPageRoute, Endpoint, EndpointOutput, EndpointOutputPaths, ModuleGraphs, Route, Routes,
},
server_actions::{build_server_actions_loader, create_server_actions_manifest},
service_worker::service_worker_output_assets,
......@@ -2348,6 +2348,79 @@ impl Endpoint for AppEndpoint {
.cell())
}
#[turbo_tasks::function]
async fn analyze_chunk_groups(self: Vc<Self>) -> Result<Vc<AnalyzeChunkGroups>> {
let this = self.await?;
if !matches!(this.ty, AppEndpointType::Page { .. }) {
return Ok(Vc::cell(vec![]));
}
let project = this.app_project.project();
let app_entry = self.app_endpoint_entry().await?;
let graphs = project.whole_app_module_graphs().await?;
let client_chunking_context = project.client_chunking_context();
let shared = get_app_client_shared_chunk_group(
AssetIdent::from_path(project.project_path().owned().await?)
.with_modifier(rcstr!("client-shared-chunks"))
.into_vc(),
this.app_project.client_runtime_entries(),
*graphs.full,
client_chunking_context,
)
.await?;
let mut groups = vec![AnalyzeChunkGroup {
kind: rcstr!("bootstrap"),
trigger: this
.app_project
.client_runtime_entries()
.await?
.first()
.map(|module| ResolvedVc::upcast(*module)),
assets: shared.assets,
pages_html: false,
}];
let references = ClientReferencesGraphs::new(*graphs.base, false)
.get_client_references_for_endpoint(
*app_entry.rsc_entry,
true,
*project.should_write_nft_manifests().await?,
project.next_mode().await?.is_production(),
)
.to_resolved()
.await?;
let chunks = get_app_client_references_chunks(
*references,
*graphs.full,
client_chunking_context,
shared.availability_info,
// Only client output groups are needed; SSR chunks are not browser assets.
None,
)
.await?;
for (&reference, &group) in &chunks.client_component_client_chunks {
let module = match reference {
ClientReferenceType::EcmascriptClientReference(reference) => {
ResolvedVc::upcast(reference.await?.client_module)
}
ClientReferenceType::CssClientReference(reference) => ResolvedVc::upcast(reference),
};
groups.push(AnalyzeChunkGroup {
kind: rcstr!("render_dependent"),
trigger: Some(module),
assets: group.await?.assets,
pages_html: false,
});
}
for (&segment, &group) in &chunks.layout_segment_client_chunks {
groups.push(AnalyzeChunkGroup {
kind: rcstr!("render_dependent"),
trigger: Some(ResolvedVc::upcast(segment)),
assets: group.await?.assets,
pages_html: false,
});
}
Ok(Vc::cell(groups))
}
#[turbo_tasks::function]
async fn entries(self: Vc<Self>) -> Result<Vc<GraphEntries>> {
let this = self.await?;
......
......@@ -80,8 +80,8 @@ use crate::{
},
project::Project,
route::{
AnalyzeClientEntries, Endpoint, EndpointOutput, EndpointOutputPaths, ModuleGraphs, Route,
Routes,
AnalyzeChunkGroup, AnalyzeChunkGroups, AnalyzeClientEntries, Endpoint, EndpointOutput,
EndpointOutputPaths, ModuleGraphs, Route, Routes,
},
service_worker::service_worker_output_assets,
sri_manifest::get_sri_manifest_asset,
......@@ -1781,6 +1781,26 @@ impl Endpoint for PageEndpoint {
.cell())
}
#[turbo_tasks::function]
async fn analyze_chunk_groups(self: Vc<Self>) -> Result<Vc<AnalyzeChunkGroups>> {
let this = self.await?;
if this.ty != PageEndpointType::Html {
return Ok(Vc::cell(vec![]));
}
let client = self.client_chunk_group().await?;
let bootstrap = self
.client_evaluatable_assets()
.await?
.first()
.map(|module| ResolvedVc::upcast(*module));
Ok(Vc::cell(vec![AnalyzeChunkGroup {
kind: rcstr!("bootstrap"),
trigger: bootstrap,
assets: client.assets,
pages_html: true,
}]))
}
#[turbo_tasks::function]
async fn entries(self: Vc<Self>) -> Result<Vc<GraphEntries>> {
let this = self.await?;
......
......@@ -66,6 +66,20 @@ pub struct AnalyzeClientReference {
pub kind: RcStr,
}
/// Direct emitted assets of a build-time chunk group. Groups may overlap: an
/// App layout group can include chunks shared with other client references.
#[derive(Clone, Debug, PartialEq, Eq, NonLocalValue, Encode, Decode)]
pub struct AnalyzeChunkGroup {
pub kind: RcStr,
pub trigger: Option<ResolvedVc<Box<dyn Module>>>,
pub assets: ResolvedVc<OutputAssets>,
/// Only Pages HTML endpoints inherit the shared _app client group.
pub pages_html: bool,
}
#[turbo_tasks::value(transparent)]
pub struct AnalyzeChunkGroups(Vec<AnalyzeChunkGroup>);
#[turbo_tasks::value_trait]
pub trait Endpoint {
#[turbo_tasks::function]
......@@ -83,6 +97,11 @@ pub trait Endpoint {
fn analyze_client_entries(self: Vc<Self>) -> Vc<AnalyzeClientEntries> {
AnalyzeClientEntries::default().cell()
}
/// Build-time client chunk groups, not observed browser requests.
#[turbo_tasks::function]
fn analyze_chunk_groups(self: Vc<Self>) -> Vc<AnalyzeChunkGroups> {
Vc::cell(vec![])
}
/// Additional entry modules for the module graph.
/// This may read the module graph and return additional modules.
#[turbo_tasks::function]
......
......@@ -8,7 +8,7 @@ use next_api::{
analyze_route_entry_id, combine_output_assets, combine_traced_files,
},
project::ProjectContainer,
route::{Endpoint, EndpointGroup, EndpointGroupKey},
route::{AnalyzeChunkGroup, AnalyzeChunkGroups, Endpoint, EndpointGroup, EndpointGroupKey},
};
use serde::Serialize;
use turbo_rcstr::rcstr;
......@@ -69,6 +69,14 @@ async fn write_analyze_data_with_issues_operation_inner(
Ok(())
}
async fn route_chunk_groups(endpoint_group: &EndpointGroup) -> Result<Vec<AnalyzeChunkGroup>> {
let mut groups = vec![];
for entry in &endpoint_group.primary {
groups.extend(entry.endpoint.analyze_chunk_groups().await?.iter().cloned());
}
Ok(groups)
}
/// Routes are rooted by server code, with client references nested under those roots.
async fn route_entries(
key: &EndpointGroupKey,
......@@ -187,12 +195,14 @@ async fn get_analyze_data_operation(
let combined_assets_vc = Vc::cell(combined_output_assets);
let combined_traced_vc = Vc::cell(combined_traced_files);
let mut shared_route_entries = vec![];
let mut shared_chunk_groups = vec![];
for (key, endpoint_group) in endpoint_groups.iter() {
if matches!(
key,
EndpointGroupKey::PagesApp | EndpointGroupKey::PagesDocument
) {
shared_route_entries.extend(route_entries(key, endpoint_group, "shared").await?);
shared_chunk_groups.extend(route_chunk_groups(endpoint_group).await?);
}
}
......@@ -243,6 +253,17 @@ async fn get_analyze_data_operation(
entries.sort_by(|a, b| a.route_entry_id.cmp(&b.route_entry_id));
entries.dedup_by(|a, b| a.route_entry_id == b.route_entry_id);
}
let mut groups = route_chunk_groups(endpoint_group).await?;
if has_client_bootstrap
&& !matches!(
key,
EndpointGroupKey::PagesApp | EndpointGroupKey::PagesDocument
)
&& groups.iter().any(|group| group.pages_html)
{
groups.extend(shared_chunk_groups.iter().cloned());
}
let chunk_groups: Vc<AnalyzeChunkGroups> = Vc::cell(groups);
let route_entries: Vc<AnalyzeRouteEntries> = Vc::cell(entries);
let analyze_data = AnalyzeDataOutputAsset::new(
analyze_output_root
......@@ -251,6 +272,7 @@ async fn get_analyze_data_operation(
output_assets,
traced_files,
route_entries,
chunk_groups,
*whole_app_module_graphs.await?.full,
)
.to_resolved()
......@@ -263,6 +285,7 @@ async fn get_analyze_data_operation(
output_assets,
traced_files,
route_entries,
chunk_groups,
*whole_app_module_graphs.await?.full,
)
.await?
......
......@@ -8,7 +8,8 @@
{ "$ref": "#/$defs/module" },
{ "$ref": "#/$defs/route" },
{ "$ref": "#/$defs/output" },
{ "$ref": "#/$defs/part" }
{ "$ref": "#/$defs/part" },
{ "$ref": "#/$defs/group" }
],
"$defs": {
"index": { "type": "integer", "minimum": 0 },
......@@ -165,11 +166,15 @@
},
"coverage": {
"type": "object",
"required": ["entries"],
"required": ["entries", "groups"],
"properties": {
"entries": {
"enum": ["exact", "unknown"],
"description": "The producer supplied typed endpoint roots for this route when exact. This is not a statement about browser requests or timing."
},
"groups": {
"enum": ["exact", "unknown"],
"description": "Whether typed build-time groups were supplied; even exact group metadata does not identify observed initial requests."
}
},
"additionalProperties": true,
......@@ -241,6 +246,48 @@
},
"additionalProperties": true,
"description": "Source attribution within an emitted output."
},
"group": {
"type": "object",
"required": [
"type",
"route",
"id",
"kind",
"trigger_module_ident",
"trigger_join",
"outputs"
],
"properties": {
"type": {
"const": "group",
"description": "Identifies a build-time output group for a route occurrence."
},
"route": { "type": "string", "description": "Owning route key." },
"id": {
"$ref": "#/$defs/index",
"description": "Identifier scoped to this route occurrence's group list."
},
"kind": {
"type": "string",
"description": "Build-time group kind: bootstrap denotes a direct client build group, not every cold-navigation request; render_dependent can be needed at first render or later; async and worker roles depend on when their trigger executes."
},
"trigger_module_ident": {
"type": ["string", "null"],
"description": "Exact trigger identity when joined or explicitly unjoined."
},
"trigger_join": {
"enum": ["joined", "unjoined", "none"],
"description": "Whether the trigger identity joined the indexed snapshot modules, is unjoined, or absent."
},
"outputs": {
"type": "array",
"items": { "type": "string" },
"description": "Direct emitted output filenames in this build-time group, possibly overlapping other groups. Neither file list nor order proves a browser request sequence."
}
},
"additionalProperties": true,
"description": "Build-time output grouping for a route occurrence; a file can belong to several groups and layout groups may be cumulative. Not the exact contribution or request set of one client reference."
}
}
}
......@@ -41,6 +41,13 @@ type RouteHeader = {
output_file_modules: EdgeRef
output_file_async_loaders: EdgeRef
output_file_module_coverage: Array<'exact' | 'unsupported' | 'not_a_chunk'>
chunk_groups?: Array<{
id: number
kind: string
trigger_module_index?: number
unjoined_trigger_ident?: string
output_file_indices: number[]
}>
}
type Data<H> = { header: H; binary: Buffer }
......@@ -257,9 +264,65 @@ function parseRoutes(file: string, modules: ReturnType<typeof parseModules>) {
entries: header.route_entries ?? null,
membership,
asyncLoaders,
groups: groupRecords(header, modules),
}
}
function groupRecords(
header: RouteHeader,
modules: ReturnType<typeof parseModules>
) {
if (header.chunk_groups === undefined) return null
if (!Array.isArray(header.chunk_groups))
throw new Error('Invalid analyzer chunk groups')
const seen = new Set<number>()
return header.chunk_groups.map((group) => {
if (
!group ||
typeof group !== 'object' ||
!integer(group.id, UINT32_LIMIT) ||
seen.has(group.id) ||
typeof group.kind !== 'string' ||
!Array.isArray(group.output_file_indices)
) {
throw new Error('Invalid analyzer chunk group')
}
seen.add(group.id)
let trigger_module_ident: string | null = null
let trigger_join = 'none'
if (
group.trigger_module_index !== undefined &&
group.unjoined_trigger_ident !== undefined
) {
throw new Error('Conflicting analyzer group triggers')
}
if (group.trigger_module_index !== undefined) {
requireIndex(
group.trigger_module_index,
modules.modules.length,
'trigger module'
)
trigger_module_ident = modules.modules[group.trigger_module_index].ident
trigger_join = 'joined'
} else if (group.unjoined_trigger_ident !== undefined) {
if (typeof group.unjoined_trigger_ident !== 'string')
throw new Error('Invalid unjoined analyzer trigger')
trigger_module_ident = group.unjoined_trigger_ident
trigger_join = 'unjoined'
}
return {
id: group.id,
kind: group.kind,
trigger_module_ident,
trigger_join,
outputs: group.output_file_indices.map((index) => {
requireIndex(index, header.output_files.length, 'group output')
return header.output_files[index].filename
}),
}
})
}
function writeRecord(record: object): void {
const data = Buffer.from(JSON.stringify(record) + '\n')
let offset = 0
......@@ -322,16 +385,17 @@ export function dumpAnalyzeGraph(
// Retain only the current route's data. A later validation error may leave
// partial output; callers must check the exit status before using it.
for (const route of selected) {
const { paths, header, entries, membership, asyncLoaders } = parseRoutes(
routeFile(directory, route),
moduleData
)
const { paths, header, entries, membership, asyncLoaders, groups } =
parseRoutes(routeFile(directory, route), moduleData)
const prefix = { route }
writeRecord({
type: 'route',
...prefix,
entries,
coverage: { entries: entries ? 'exact' : 'unknown' },
coverage: {
entries: entries ? 'exact' : 'unknown',
groups: groups ? 'exact' : 'unknown',
},
})
for (let i = 0; i < header.output_files.length; i++) {
writeRecord({
......@@ -359,5 +423,7 @@ export function dumpAnalyzeGraph(
compressed_size: part.compressed_size,
})
}
for (const group of groups ?? [])
writeRecord({ type: 'group', ...prefix, ...group })
}
}
......@@ -31,6 +31,12 @@ type ChunkGraphHeader = {
output_file_modules: EdgesReference
output_file_async_loaders: EdgesReference
output_file_module_coverage: Array<'exact' | 'unsupported' | 'not_a_chunk'>
chunk_groups: Array<{
id: number
kind: 'bootstrap' | 'render_dependent'
trigger_module_index?: number
output_file_indices: number[]
}>
}
function readAnalyzeFile<T>(filename: string) {
......@@ -702,6 +708,35 @@ describe('next analyze', () => {
true
)
const appGraph = routeGraphs[0].header
const pagesGraph = routeGraphs[1].header
const apiGraph = routeGraphs[2].header
const sharedAppGraph = readAnalyzeHeader<ChunkGraphHeader>(
path.join(dataDir, '_app/analyze.data')
)
expect(
sharedAppGraph.chunk_groups.filter(
(group) => group.kind === 'bootstrap'
)
).toHaveLength(1)
const documentGraph = readAnalyzeHeader<ChunkGraphHeader>(
path.join(dataDir, '_document/analyze.data')
)
expect(documentGraph.chunk_groups).toEqual([])
expect(
appGraph.chunk_groups.some((group) => group.kind === 'bootstrap')
).toBe(true)
expect(
appGraph.chunk_groups.some(
(group) => group.kind === 'render_dependent'
)
).toBe(true)
expect(
pagesGraph.chunk_groups.some((group) => group.kind === 'bootstrap')
).toBe(true)
expect(
apiGraph.chunk_groups.some((group) => group.kind === 'bootstrap')
).toBe(false)
const appRows = readRows(
routeGraphs[0].binary,
appGraph.output_file_modules
......@@ -712,6 +747,12 @@ describe('next analyze', () => {
)
).toBe(true)
expect(appGraph.output_file_module_coverage).toContain('exact')
const groupedFileIndices = appGraph.chunk_groups.flatMap(
(group) => group.output_file_indices
)
expect(new Set(groupedFileIndices).size).toBeLessThan(
groupedFileIndices.length
)
expect(
appRows.some(
(row, index) =>
......@@ -719,6 +760,21 @@ describe('next analyze', () => {
row.some((module) => modules[module].ident.includes('page.css'))
)
).toBe(true)
expect(
appGraph.chunk_groups.some(
(group) =>
group.kind === 'render_dependent' &&
group.output_file_indices.some((index) =>
appRows[index].some((module) =>
modules[module].ident.includes('client-entry')
)
)
)
).toBe(true)
expect(
pagesGraph.chunk_groups.filter((group) => group.kind === 'bootstrap')
.length
).toBeGreaterThanOrEqual(2)
})
})
})
......
......@@ -35,6 +35,7 @@ export function validateGraphDump(output: string): void {
type: string
route: string
filename: string
outputs: string[]
}
if (record.type === 'meta') {
if (index !== 0) throw new Error('Duplicate analyzer graph meta')
......@@ -60,6 +61,12 @@ export function validateGraphDump(output: string): void {
!outputs.has(JSON.stringify([key, record.filename]))
) {
throw new Error(`Unknown output for graph record ${index}`)
} else if (record.type === 'group') {
for (const filename of record.outputs) {
if (!outputs.has(JSON.stringify([key, filename]))) {
throw new Error(`Unknown group output for graph record ${index}`)
}
}
}
}
}
......
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