fix: final pre-PR review sweep

The final holistic + quality audit (three reviewers) returned GO with
four majors; all fixed.

- Start-page recents were the last unguarded writer of the open slot
  on web: clicking one under the open overlay clobbered the in-flight
  open and silently lost its bytes. Refused with the same in-progress
  notice the picker uses.
- The web quit-after-save continuation stalled: a Quit pending now
  survives the tab-save AND continues — offering to save the next
  dirty tab or finishing the quit, mirroring native.
- Data-extraction's multi-file pick is capped (16): every picked file
  becomes a full parsed document held for the session, and one giant
  pick could exhaust the wasm heap.
- The xref registry tests raced each other on the process-global
  registry (reproduced 3/10 at high thread counts — CI roulette); they
  now hold a module-level guard.

Minors: the collision warning is cataloged in all 21 locales; the
docs' parallelism detail header no longer contradicts its own table;
the drop-filter and name-hash helpers gained inline tests (their only
prior coverage was a verbatim copy in the red-team suites).

(cherry picked from commit f70d3fda)

Ported onto main (#1717 review): the collision message is filed under
the file group it is looked up in (it sat under view), the data-link
warning reuses that cataloged text, and the command-reference string
that rode along in the locale hunks stays out.
This commit is contained in:
Afonsop authored and Hakan Seven committed 2026-10-12 12:02:05 +03:00
1 parent 108ef045b8
commit 8a5d343927
29 files changed
+101 -2

No files matched your search

+17
View File
@@ -290,3 +290,20 @@ fn is_image_name(name: &str) -> bool {
"png" | "jpg" | "jpeg" | "bmp" | "tiff" | "tif"
)
}
#[cfg(test)]
mod tests {
use super::is_drawing_name;
#[test]
fn drawing_names_use_the_worker_convention() {
assert!(is_drawing_name("plan.dwg"));
assert!(is_drawing_name("PLAN.DXF"));
assert!(is_drawing_name("DWG"));
assert!(is_drawing_name("dxf"));
assert!(!is_drawing_name("plan.png"));
assert!(!is_drawing_name("dwgx"));
assert!(!is_drawing_name("plan.dwg.txt"));
assert!(!is_drawing_name(""));
}
}
+20
View File
@@ -312,3 +312,23 @@ pub(crate) async fn modified_ms(name: &str) -> Option<f64> {
.ok()?;
Some(file.last_modified())
}
#[cfg(test)]
mod tests {
use super::name_hash;
/// Canonical FNV-1a 64 over the raw name bytes — the reference vector
/// from the spec's test suite.
#[test]
fn name_hash_is_fnv1a64() {
assert_eq!(name_hash(""), "cbf29ce484222325");
assert_eq!(name_hash("a"), "af63dc4c8601ec8c");
assert_eq!(name_hash("foobar"), "85944171f73967e8");
}
#[test]
fn name_hash_distinguishes_case_and_extension() {
assert_ne!(name_hash("a.dwg"), name_hash("A.dwg"));
assert_ne!(name_hash("a.dwg"), name_hash("a.dxf"));
}
}
+13
View File
@@ -3529,6 +3529,16 @@ fn relative_point_cloud_path(doc: &mut CadDocument, handle: Handle, host: &Path)
mod web_registry_tests {
use super::*;
/// The registries are process-global and the default harness runs tests
/// in parallel; the eviction test's inserts can evict a sibling test's
/// entry mid-assert. Registry tests hold this lock for their duration.
fn registry_guard() -> std::sync::MutexGuard<'static, ()> {
static LOCK: OnceLock<Mutex<()>> = OnceLock::new();
LOCK.get_or_init(|| Mutex::new(()))
.lock()
.unwrap_or_else(|poisoned| poisoned.into_inner())
}
fn outcome() -> codec::ReadOutcome {
codec::ReadOutcome::new(CadDocument::new(), codec::ReadStats::default())
}
@@ -3560,6 +3570,7 @@ mod web_registry_tests {
#[test]
fn registry_finds_a_registered_source_by_trailing_name() {
let _registry = registry_guard();
let registered = "Registry-Find-Site.dwg";
register_source(registered, Arc::new(vec![1, 2, 3]));
// The drawing's stored path is the author's absolute foreign path;
@@ -3579,6 +3590,7 @@ mod web_registry_tests {
/// re-registration of a live name neither evicts nor duplicates it.
#[test]
fn source_registry_evicts_oldest_beyond_the_cap() {
let _registry = registry_guard();
for i in 0..(SOURCE_CAP + 2) {
register_source(&format!("f{i}.dwg"), Arc::new(vec![i as u8]));
}
@@ -3618,6 +3630,7 @@ mod web_registry_tests {
#[test]
fn register_source_supersedes_a_cached_parse_of_the_same_file() {
let _registry = registry_guard();
let name = "Registry-Supersede-Plan.dwg";
register_parsed(name, outcome());
// Re-registering the same file under a differently-cased path name