mirror of
https://github.com/storytold/craft-anything.git
synced 2026-11-20 06:21:00 +01:00
An index-map section that points at an external map, which is never fetched, adds no sources, so an application graph treated the map's list as complete. Such sections are now counted (through nested index maps), the graph names them in a limitation, and comparing a reference source tree with the bundle reports an otherwise unmatched source as uncertain with partial coverage instead of absent.
This commit is contained in:
1 parent
9574a2f728
commit
d56fa23860
9 files changed
+215
-10
No files matched your search
@@ -165,6 +165,10 @@ pub struct SourceMapRef {
|
||||
pub sources: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub sources_truncated: bool,
|
||||
/// Index-map sections that pointed at an external map nobody read, so the sources they would
|
||||
/// add are unknown (not absent).
|
||||
#[serde(default)]
|
||||
pub external_sections: usize,
|
||||
#[serde(default)]
|
||||
pub sources_with_content: usize,
|
||||
/// The map is referenced by a script, or sits beside one, but couldn't be read (malformed, an
|
||||
@@ -1158,12 +1162,19 @@ fn read_source_map(
|
||||
budget.max_bytes = inventory.sources.iter().fold(budget.max_bytes, |left, source| left.saturating_sub(source.len()));
|
||||
r.sources = inventory.sources;
|
||||
r.sources_truncated = inventory.truncated;
|
||||
r.external_sections = inventory.external_sections;
|
||||
if r.sources_truncated {
|
||||
limitations.push((
|
||||
"source_map_inventory_truncated".into(),
|
||||
format!("Some source paths for {script} could not be retained within the source-map inventory limits."),
|
||||
));
|
||||
}
|
||||
if r.external_sections > 0 {
|
||||
limitations.push((
|
||||
"source_map_external_sections".into(),
|
||||
format!("The source map for {script} points at {} external map(s) that weren't read, so its sources are incomplete.", r.external_sections),
|
||||
));
|
||||
}
|
||||
r.sources_with_content = map.sources_content.iter().filter(|c| c.is_some()).count();
|
||||
}
|
||||
// Refused at one of the parser's limits: incomplete rather than unreadable.
|
||||
|
||||
@@ -314,10 +314,14 @@ struct Unit<'a> {
|
||||
exports: BTreeSet<&'a str>,
|
||||
}
|
||||
|
||||
/// Why a source without an observed match can't be called absent. The variant names are the
|
||||
/// `uncertain_sources` reasons serialized into evidence, so they keep their shared prefix.
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
enum SourceMatchUncertainty {
|
||||
SourceMapInventoryTruncated,
|
||||
SourceMapExternalSections,
|
||||
SourceMapUnreadable,
|
||||
}
|
||||
|
||||
@@ -328,9 +332,9 @@ struct UncertainSource<'a> {
|
||||
}
|
||||
|
||||
/// Match reference source files to the shipped bundle's files and bundle modules.
|
||||
/// An incomplete source-map inventory, or a map that couldn't be read, cannot establish that an
|
||||
/// otherwise unmatched source is absent. Such sources are reported separately in
|
||||
/// `uncertain_sources`; positive matches remain available.
|
||||
/// An incomplete source-map inventory (truncated, an unread external section, or a map that
|
||||
/// couldn't be read) cannot establish that an otherwise unmatched source is absent. Such sources
|
||||
/// are reported separately in `uncertain_sources`; positive matches remain available.
|
||||
pub fn diff_source_and_bundle(src: &SourceGraph, app: &AppGraph, max_rows: usize) -> Value {
|
||||
let mut units: Vec<Unit<'_>> = Vec::new();
|
||||
for m in app.modules.iter().filter(|m| m.kind == "script") {
|
||||
@@ -357,6 +361,7 @@ pub fn diff_source_and_bundle(src: &SourceGraph, app: &AppGraph, max_rows: usize
|
||||
}
|
||||
// Source-map sources → generated script.
|
||||
let source_map_inventory_truncated = app.source_maps.iter().any(|sm| sm.sources_truncated);
|
||||
let source_map_external = app.source_maps.iter().any(|sm| sm.external_sections > 0);
|
||||
let source_map_unreadable = app.source_maps.iter().any(|sm| sm.unreadable);
|
||||
let mut mapped: Vec<(String, &str)> = Vec::new();
|
||||
for sm in &app.source_maps {
|
||||
@@ -445,6 +450,7 @@ pub fn diff_source_and_bundle(src: &SourceGraph, app: &AppGraph, max_rows: usize
|
||||
None if source_map_inventory_truncated => {
|
||||
uncertain.push(UncertainSource { source: &f.path, reason: SourceMatchUncertainty::SourceMapInventoryTruncated })
|
||||
}
|
||||
None if source_map_external => uncertain.push(UncertainSource { source: &f.path, reason: SourceMatchUncertainty::SourceMapExternalSections }),
|
||||
None if source_map_unreadable => uncertain.push(UncertainSource { source: &f.path, reason: SourceMatchUncertainty::SourceMapUnreadable }),
|
||||
None => unmatched.push(f.path.clone()),
|
||||
},
|
||||
@@ -461,6 +467,7 @@ pub fn diff_source_and_bundle(src: &SourceGraph, app: &AppGraph, max_rows: usize
|
||||
"source_graph_id": src.source_graph_id,
|
||||
"graph_id": app.graph_id,
|
||||
"source_map_inventory_truncated": source_map_inventory_truncated,
|
||||
"source_map_external_sections": source_map_external,
|
||||
"source_map_unreadable": source_map_unreadable,
|
||||
"summary": {"source_scripts": src.files.iter().filter(|f| is_script(&f.path)).count(), "bundle_units": units.len(), "matched": matches.len(), "unmatched_sources": unmatched.len(), "uncertain_sources": uncertain.len(), "bundle_units_without_source": unclaimed.len(), "by_quality": by_quality},
|
||||
"matches": matches,
|
||||
|
||||
@@ -272,3 +272,32 @@ fn a_map_with_broken_mappings_or_section_offsets_keeps_its_sources() {
|
||||
assert_eq!(diff["unmatched_sources"], json!([]), "{map}");
|
||||
}
|
||||
}
|
||||
|
||||
/// A section that points at an external map adds no sources, so an otherwise unmatched reference
|
||||
/// source may be in the part nobody read: it is uncertain, not confirmed absent.
|
||||
#[test]
|
||||
fn an_unread_external_section_leaves_its_sources_uncertain() {
|
||||
let graph = graph_with_maps(vec![json!({
|
||||
"version": 3,
|
||||
"sections": [
|
||||
{"offset": {"line": 0, "column": 0}, "map": {"version": 3, "sources": ["a.js"], "mappings": ""}},
|
||||
{"offset": {"line": 10, "column": 0}, "url": "vendor.js.map"}
|
||||
]
|
||||
})]);
|
||||
let found = &graph.source_maps[0];
|
||||
assert_eq!(found.external_sections, 1, "{found:?}");
|
||||
assert!(!found.sources_truncated && !found.unreadable);
|
||||
assert!(graph.limitations.iter().any(|(key, message)| key == "source_map_external_sections" && message.contains("script-0.js")), "{:?}", graph.limitations);
|
||||
|
||||
let diff = diff_source_and_bundle(&source_graph(&["a.js", "vendor.js"]), &graph, 100);
|
||||
assert_eq!(diff["summary"]["matched"], 1, "{diff}");
|
||||
assert_eq!(diff["unmatched_sources"], json!([]), "{diff}");
|
||||
assert_eq!(diff["uncertain_sources"], json!([{"source": "vendor.js", "reason": "source_map_external_sections"}]));
|
||||
assert_eq!(diff["source_map_external_sections"], true);
|
||||
|
||||
// A graph saved before the field existed reads it as zero: no map claims an unread section.
|
||||
let mut saved = serde_json::to_value(&graph).unwrap();
|
||||
saved["source_maps"][0].as_object_mut().unwrap().remove("external_sections");
|
||||
let restored: AppGraph = serde_json::from_value(saved).unwrap();
|
||||
assert_eq!(restored.source_maps[0].external_sections, 0);
|
||||
}
|
||||
@@ -487,6 +487,8 @@ fn default_rows() -> usize {
|
||||
2000
|
||||
}
|
||||
|
||||
/// Compare a reference source tree with a shipped bundle, carrying a source map's unread external
|
||||
/// sections into the evidence as uncertainty rather than absent sources.
|
||||
fn compare_source_to_bundle_tool(ctx: &mut Ctx<'_>, params: Value) -> Result<ToolOutput, ToolError> {
|
||||
let p: SourceBundleParams = parse_params(params)?;
|
||||
let (src, sid) = if let Some(path) = is_path_input(&p.source) {
|
||||
@@ -513,6 +515,7 @@ fn compare_source_to_bundle_tool(ctx: &mut Ctx<'_>, params: Value) -> Result<Too
|
||||
s["matched"], s["source_scripts"], s["unmatched_sources"], s["uncertain_sources"], s["bundle_units_without_source"]
|
||||
);
|
||||
let inventory_truncated = d["source_map_inventory_truncated"].as_bool().unwrap_or(false);
|
||||
let map_external = d["source_map_external_sections"].as_bool().unwrap_or(false);
|
||||
let map_unreadable = d["source_map_unreadable"].as_bool().unwrap_or(false);
|
||||
let mut b = EvidenceBuilder::new(
|
||||
"js_source_bundle_compare",
|
||||
@@ -535,6 +538,14 @@ fn compare_source_to_bundle_tool(ctx: &mut Ctx<'_>, params: Value) -> Result<Too
|
||||
))
|
||||
.coverage(Coverage { status: CoverageStatus::Partial, ..Default::default() });
|
||||
}
|
||||
if map_external {
|
||||
b = b
|
||||
.limitation(Limitation::new(
|
||||
"source_map_external_sections",
|
||||
"A source map points at an external map that wasn't read; sources without an observed match are uncertain, not confirmed absent.",
|
||||
))
|
||||
.coverage(Coverage { status: CoverageStatus::Partial, ..Default::default() });
|
||||
}
|
||||
if map_unreadable {
|
||||
b = b
|
||||
.limitation(Limitation::new(
|
||||
@@ -949,6 +960,43 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
/// A comparison with a map whose external section was never read names that section in its
|
||||
/// limitation and reports an otherwise unmatched source as uncertain.
|
||||
#[test]
|
||||
fn source_comparison_discloses_unread_external_sections() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let src = dir.path().join("reference");
|
||||
fx::write_files(&src, &[("src/kept.js", String::new()), ("src/vendor.js", String::new())]).unwrap();
|
||||
let dist = dir.path().join("dist");
|
||||
fx::write_files(
|
||||
&dist,
|
||||
&[
|
||||
("main.js", "//# sourceMappingURL=main.js.map\n".to_string()),
|
||||
(
|
||||
"main.js.map",
|
||||
json!({
|
||||
"version": 3,
|
||||
"sections": [
|
||||
{"offset": {"line": 0, "column": 0}, "map": {"version": 3, "sourceRoot": "src", "sources": ["kept.js"], "mappings": ""}},
|
||||
{"offset": {"line": 10, "column": 0}, "url": "vendor.js.map"}
|
||||
]
|
||||
})
|
||||
.to_string(),
|
||||
),
|
||||
],
|
||||
)
|
||||
.unwrap();
|
||||
let e = Engine::new(crate::testing::session());
|
||||
let source = call(&e, "app_source_import", json!({"path": src})).unwrap();
|
||||
let comparison = call(&e, "js_source_bundle_compare", json!({"source": retained(&source), "application": dist})).unwrap();
|
||||
assert_eq!(comparison["result"]["summary"]["matched"], 1, "{}", comparison["result"]);
|
||||
assert_eq!(comparison["result"]["source_map_external_sections"], true);
|
||||
assert_eq!(comparison["result"]["unmatched_sources"], json!([]));
|
||||
assert_eq!(comparison["result"]["uncertain_sources"], json!([{"source": "src/vendor.js", "reason": "source_map_external_sections"}]));
|
||||
assert!(comparison["limitations"].as_array().unwrap().iter().any(|l| l["code"] == "source_map_external_sections"));
|
||||
assert_eq!(comparison["coverage"]["status"], "partial");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn projections_from_paths_and_evidence() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
|
||||
@@ -51,6 +51,9 @@ pub struct SourceInventory {
|
||||
pub sources: Vec<String>,
|
||||
/// More names existed than the limits or available allocations could retain.
|
||||
pub truncated: bool,
|
||||
/// Index-map sections that pointed at an external map nobody read, so the sources they
|
||||
/// would add are unknown (not absent).
|
||||
pub external_sections: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
|
||||
@@ -98,6 +101,9 @@ pub struct SourceMap {
|
||||
pub segments: usize,
|
||||
/// Indexed maps: (line offset, column offset, map).
|
||||
pub sections: Vec<(u32, u32, SourceMap)>,
|
||||
/// Index-map sections that point at an external map (`url`), which isn't fetched here: the
|
||||
/// sources that map would add are unknown, not absent.
|
||||
pub external_sections: usize,
|
||||
}
|
||||
|
||||
/// A position in an original source.
|
||||
@@ -186,7 +192,12 @@ impl SourceMap {
|
||||
let mut sources = Vec::new();
|
||||
let mut bytes_left = limits.max_bytes;
|
||||
let truncated = !self.collect_sources(limits.max_sources, &mut bytes_left, &mut sources);
|
||||
SourceInventory { sources, truncated }
|
||||
SourceInventory { sources, truncated, external_sections: self.external_sections_total() }
|
||||
}
|
||||
|
||||
/// This map's external sections plus those of every map it holds.
|
||||
fn external_sections_total(&self) -> usize {
|
||||
self.sections.iter().fold(self.external_sections, |n, (_, _, map)| n.saturating_add(map.external_sections_total()))
|
||||
}
|
||||
|
||||
/// Append this map and its sections using one shared entry and byte budget.
|
||||
@@ -284,13 +295,17 @@ fn from_raw(
|
||||
if mappings && map.sections.last().is_some_and(|(l, c, _)| (*l, *c) > (line, col)) {
|
||||
return Err(SourceMapError::BadSections);
|
||||
}
|
||||
let sub = match (section.map, section.url) {
|
||||
(Some(m), None) => from_raw(m.map(|m| *m), depth + 1, limits, budget, line_budget, mappings)?,
|
||||
let (sub, external) = match (section.map, section.url) {
|
||||
(Some(m), None) => (from_raw(m.map(|m| *m), depth + 1, limits, budget, line_budget, mappings)?, false),
|
||||
// External maps are never fetched here. Retain their start so a lookup
|
||||
// cannot leak through to the previous inline map.
|
||||
(None, Some(true)) => SourceMap::default(),
|
||||
// cannot leak through to the previous inline map, and count it so the
|
||||
// sources it would add are reported unknown rather than absent.
|
||||
(None, Some(true)) => (SourceMap::default(), true),
|
||||
_ => return Err(SourceMapError::BadSections),
|
||||
};
|
||||
if external {
|
||||
map.external_sections = map.external_sections.saturating_add(1);
|
||||
}
|
||||
map.segments = map.segments.saturating_add(sub.segments);
|
||||
map.sections.push((line, col, sub));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
//! An index-map section that points at an external map (`url`) adds no sources here, but its
|
||||
//! sources are unknown rather than absent: the inventory says how many such sections it saw.
|
||||
|
||||
use craft_anything_formats::sourcemap::{InventoryLimits, Limits, SourceMap, parse, parse_sources};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
fn decode(value: Value) -> SourceMap {
|
||||
parse(&serde_json::to_vec(&value).unwrap(), Limits::default()).unwrap()
|
||||
}
|
||||
|
||||
/// An external section adds no sources but is counted, so the inventory can say part of the map
|
||||
/// was never read.
|
||||
#[test]
|
||||
fn an_external_section_is_counted_and_adds_no_sources() {
|
||||
let map = decode(json!({
|
||||
"version": 3,
|
||||
"sections": [
|
||||
{"offset": {"line": 0, "column": 0}, "map": {"version": 3, "sources": ["a.js"], "mappings": ""}},
|
||||
{"offset": {"line": 10, "column": 0}, "url": "vendor.js.map"}
|
||||
]
|
||||
}));
|
||||
assert_eq!(map.all_sources(), ["a.js"]);
|
||||
assert_eq!(map.external_sections, 1);
|
||||
let inventory = map.source_inventory(InventoryLimits::default());
|
||||
assert_eq!(inventory.sources, ["a.js"]);
|
||||
assert!(!inventory.truncated);
|
||||
assert_eq!(inventory.external_sections, 1);
|
||||
}
|
||||
|
||||
/// The count reaches an external section inside a nested index map.
|
||||
#[test]
|
||||
fn external_sections_are_counted_through_nested_index_maps() {
|
||||
let map = decode(json!({
|
||||
"version": 3,
|
||||
"sections": [
|
||||
{"offset": {"line": 0, "column": 0}, "map": {"version": 3, "sections": [
|
||||
{"offset": {"line": 0, "column": 0}, "map": {"version": 3, "sources": ["a.js"], "mappings": ""}},
|
||||
{"offset": {"line": 4, "column": 0}, "url": "inner.js.map"}
|
||||
]}},
|
||||
{"offset": {"line": 20, "column": 0}, "url": "outer.js.map"}
|
||||
]
|
||||
}));
|
||||
assert_eq!(map.all_sources(), ["a.js"]);
|
||||
assert_eq!(map.source_inventory(InventoryLimits::default()).external_sections, 2);
|
||||
}
|
||||
|
||||
/// A map with only inline sections reports nothing unread.
|
||||
#[test]
|
||||
fn an_inline_only_map_counts_no_external_sections() {
|
||||
let map = decode(json!({
|
||||
"version": 3,
|
||||
"sections": [{"offset": {"line": 0, "column": 0}, "map": {"version": 3, "sources": ["a.js"], "mappings": ""}}]
|
||||
}));
|
||||
assert_eq!(map.source_inventory(InventoryLimits::default()).external_sections, 0);
|
||||
}
|
||||
|
||||
/// A map read for its sources alone (its mappings are refused) still says an external section
|
||||
/// left part of the list unread.
|
||||
#[test]
|
||||
fn a_sources_only_read_still_counts_external_sections() {
|
||||
let bytes = serde_json::to_vec(&json!({
|
||||
"version": 3,
|
||||
"sections": [
|
||||
{"offset": {"line": 0, "column": 0}, "map": {"version": 3, "sources": ["a.js"]}},
|
||||
{"offset": {"line": 8, "column": 0}, "url": "vendor.js.map"}
|
||||
]
|
||||
}))
|
||||
.unwrap();
|
||||
let map = parse_sources(&bytes, Limits::default()).unwrap();
|
||||
assert_eq!(map.source_inventory(InventoryLimits::default()).external_sections, 1);
|
||||
}
|
||||
|
||||
/// The count spends no inventory budget: a map with many external sections still retains its
|
||||
/// inline sources in full.
|
||||
#[test]
|
||||
fn many_external_sections_do_not_spend_the_source_budget() {
|
||||
let mut sections: Vec<Value> = (0..1_000).map(|i| json!({"offset": {"line": i, "column": 0}, "url": format!("{i}.map")})).collect();
|
||||
sections.push(json!({"offset": {"line": 1_000, "column": 0}, "map": {"version": 3, "sources": ["a.js", "b.js"], "mappings": ""}}));
|
||||
let map = decode(json!({"version": 3, "sections": sections}));
|
||||
let inventory = map.source_inventory(InventoryLimits { max_sources: 2, max_bytes: 16 });
|
||||
assert_eq!(inventory.sources, ["a.js", "b.js"]);
|
||||
assert!(!inventory.truncated);
|
||||
assert_eq!(inventory.external_sections, 1_000);
|
||||
}
|
||||
+5
-2
@@ -2304,8 +2304,11 @@ Owner: open · Status: in progress
|
||||
- [x] A source map refused for bad mappings or sections still has a readable `sources` list: keep those sources with a
|
||||
warning instead of reporting the whole map unreadable.
|
||||
— claimed: NicolasBohn, branch bugfix/r3.12-sources-of-bad-mappings
|
||||
- [ ] An index-map section that points at an external map (`url`) adds no sources, so an application graph still
|
||||
treats the map's list as complete: mark those sources uncertain until the external map is read.
|
||||
- [x] An index-map section that points at an external map (`url`) adds no sources. The parser counts those
|
||||
unread sections, an application graph records them with a limitation, and a source comparison reports
|
||||
otherwise unmatched sources as uncertain (`source_map_external_sections`) with partial coverage instead
|
||||
of missing.
|
||||
— claimed: AlexJoaquimPereira, branch bugfix/r3.12-source-map-external-sections
|
||||
- [x] Recognize source-map annotations with no space, tabs or repeated spaces after the marker, and reject whitespace inside their URLs.
|
||||
— claimed: Plastic-time, branch bugfix/r3.12-sourcemap-annotation-spacing-1111
|
||||
- [x] Keep source map annotation URL suffixes intact.
|
||||
|
||||
@@ -79,6 +79,7 @@ coverage and secrets passed. The companion CLI was built with locked dependencie
|
||||
| Source-map original recovery | Ordinary source paths stay unchanged. Colliding aliases, duplicate entries and file/directory prefixes use a separate directory for each input and source index; the manifest retains the complete source identity and both indices. The manifest also stops retaining originals at the source-map inventory's 1,000,000-path / 64 MiB expanded-path budget, sets `originals_truncated`, and reports partial coverage with a limitation. | Five engine regressions cover slash normalization, duplicate names, prefix conflicts in both orders, same-named input scripts and a 64 KiB source root with 1,200 sources; the collision cases check recovered files and manifest provenance, and the budget case checks retained path bytes, the truncation flag and partial coverage. The collision and budget cases lose originals or over-retain paths on the unchanged implementation. Existing ordinary-path and no-overwrite controls remain in place. |
|
||||
| Source-map generated-line budgets | A shared `max_lines` limit (1,000,000 by default) caps line vectors across inline sections, including empty lines that do not spend the segment budget. Line-vector reservation failure returns an error. | Six regressions cover default/exact/zero limits, nested and external sections, independent segment budgets and unchanged source positions; a bounded-memory production-module audit reproduces the former empty-line allocation failure. |
|
||||
| Source-map parser entries | `sources`, `sourcesContent`, `names` and ignore-list entries and index-map sections are counted against one `max_entries` limit (4,000,000 by default, the segment limit) shared across sections while the JSON is read; a map with more is refused with `TooManyEntries` before the rest is read. An application graph marks the sources of a map refused at any parser limit (entries, size, segments, lines, depth) truncated with a limitation, so they are uncertain rather than missing. Entries a repeated key replaces, freed before their replacement is read, and an `x_google_ignoreList` beside `ignoreList`, give their slots back. Fields the parser doesn't keep are skipped with the same checks as a full read, so maps within the limit read as before, errors included. | Eight format regressions cover the limit for every kind of entry, repeated keys (lists, sections and a section's map), sections and their maps, stopping before a broken tail, unknown fields, the same `BadJson` as a full read for invalid skipped values (lone surrogates, out-of-range numbers, invalid UTF-8, trailing commas, deep nesting) and a map one name over the default; two analysis regressions check that a map refused for its entries or its lines leaves its sources uncertain (the first fails on the former analyzer) and is not marked unreadable. Measured on 64 MiB inputs in a release build: 21 million empty names peak at 0.16 GB (was 1.3 GB), a sections array of 0s at 0.29 GB (was 1.1 GB), 1.5 million external sections at 0.47 GB (was 2.6 GB). A differential run of 200,000 generated maps (repeated keys, wrong types, nested sections, invalid skipped values, truncated JSON; 49,830 of them bad JSON) gave the same result as the former parser, error text included. |
|
||||
| External source-map sections | An index-map section that points at an external map (`url`) adds no sources here. The parser counts those unread sections, an application graph records them with a `source_map_external_sections` limitation, and a source comparison reports otherwise unmatched sources as uncertain (`source_map_external_sections`) with partial coverage, not as missing; an inline-only map is unchanged, and a sources-only read counts them too. | Format, analysis and engine regressions cover an inline section beside an external one, nested index maps, an inline-only map, the sources-only read, many external sections not spending the source budget, and the comparison's limitation and partial coverage. |
|
||||
| Unreadable source maps | A map that is malformed, has a data URL that can't be decoded, or is listed but wasn't loaded is marked `unreadable` with a `source_map_unreadable` limitation; a source comparison then reports otherwise unmatched sources as uncertain (`source_map_unreadable`) with partial coverage, not as missing. A map refused only for its mappings or section offsets keeps its `sources` list with a `source_map_mappings_unreadable` limitation, so its sources match and the ones it doesn't name stay missing; mappings that, as far as they decode, name a source past the end of the list, or a section with neither a map nor a URL, or both, still make the map unreadable. A stand-alone `.map` file beside an analysed script (no comment pointing at it) is read like a referenced one, after them, sharing the inventory budget; other `.map` files (game levels, CSS maps, maps beside a page, maps whose script wasn't loaded) stay listed and unread, without affecting the comparison. A map listed as `./path` and loaded as `path` is one map. Graphs saved before the field load as readable. A map too big to be listed in single-file mode still reads as absent. | Analysis regressions cover a malformed map, an unloaded map, a bad data URL and an unloaded stand-alone map, a stand-alone map beside its script whose sources now match, other `.map` files left alone, a `./`-listed map read once, and older saved graphs; another covers bad mappings, unordered sections and bad mappings in a section (it fails on the former analyzer), and a format regression covers `parse_sources`; an engine regression checks the comparison's limitation and partial coverage. |
|
||||
| Source-map source inventories | Expanded paths are checked before allocation against shared entry and UTF-8 byte limits, keeping complete identities in source order. Defaults retain at most 1,000,000 paths and 64 MiB across indexed sections. Application graphs keep the existing 5,000-path limit per map and share the total budget across maps; omitted paths set `sources_truncated` and a limitation. Source-to-bundle comparisons preserve positive matches and report other sources as `uncertain_sources` with the `source_map_inventory_truncated` reason, separate from confirmed unmatched sources. Tool evidence reports the uncertainty and partial coverage. | Format, analysis and public-tool regressions cover repeated large roots, relative and absolute-looking sources, exact and zero limits, UTF-8 bytes, null and empty names, nested sections, application-wide budgets, older saved graphs, complete inventories, retained matches and row limits. The default-byte and omitted-source diff regressions fail on unchanged production code. |
|
||||
| Source map URL roots | A relative source keeps the empty authority of webpack:/// and file:/// roots. | Generated-position lookups and source lists with scheme roots, an HTTPS directory and a relative directory. |
|
||||
|
||||
@@ -542,6 +542,13 @@ cover the recovery tool, which copied every expanded path into its manifest: a 7
|
||||
64 KiB root and 1,200 sources retained about 78 MiB. Apply the inventory budget to recovery paths
|
||||
too, stop retaining originals when it is exhausted, and report partial recovery with a typed flag.
|
||||
|
||||
**An unread part of a source map looked like absent sources.** An index-map section can point at
|
||||
another map (`url`), which the parser never fetches: it kept the section boundary but no count, so
|
||||
a source comparison reported a source only that map lists as confirmed missing. Count unread
|
||||
external sections on the map and in its inventory, carry the count into the application graph with
|
||||
a limitation, and give an otherwise unmatched source an `uncertain` reason. Test an inline section
|
||||
beside an external one, a nested index map, and the sources-only read used for bad mappings.
|
||||
|
||||
**A floating-point conversion changed a fingerprint.** Widening a single-precision NaN to a double
|
||||
can change its sign, payload or signaling bit. Keep the original encoded bits for identities, and
|
||||
test signaling/quiet pairs as well as different payloads; retain numeric conversion for display.
|
||||
|
||||
Reference in new issue
Block a user