forge
Explore
Log in

Don't you dare go Hollow

Forge-core drops tests whose removal leaves every mutant caught

Browse files at this commit

654f52821ac063fddaba976ba24e9be58b041df9Ahmet Kaan GümüşParent: d9b0f87
  • test
    • forge-core drops tests whose removal leaves every mutant caught
Show full message
✅ test: forge-core drops tests whose removal leaves every mutant caught

Phase 2 on forge-core, gated with cargo-mutants (full suite vs reduced suite).

Candidates: 109 from per-test coverage and greedy set cover (321 tests before).
- 92 protected by the blind-spot policy before the gate (every store::* test, the
  audit_store, stars_store and store_basic integration tests, and the security and
  format tests: authz, lfs_token, raw_token, token, secret, password, totp, protection,
  oci digests, avatar size limits, config).
- 17 entered the gate. 1 skipped by the closure budget (server_settings precedence,
  369 extra mutants over 200).
- 16 gated over 8 src files, 331 mutants. Full run: 210 caught (incl. 4 timeouts),
  55 missed. Reduced run after 1 restore round: 210 caught, 55 missed (equal).
- 14 candidates survived the gate and were deleted. 2 were restored because removing
  them newly missed a mutant (issues::body_is_checked_in_bytes covers validate_body,
  names::accepted_names_return_folded_form covers validate_name).

Tests: 321 before, 307 after. cargo nextest run -p forge-core: 307 passed.
time.rs: the tests module held only one helper and an import after its tests were
removed, so the module is gone.

Coverage gaps: 55 mutants are missed by both runs (no tests written for them).
crates/forge-core/src/advisories.rsmodified+0 -14
@@ -453,14 +453,6 @@ mod tests {
453453 }
454454 }
455455
456- #[test]
457- fn listed_versions_match_by_text() {
458- let a = adv(vec![], vec!["1.0.3", "v2.0.0"]);
459- assert!(affects(&a, "1.0.3"));
460- assert!(affects(&a, "2.0.0"));
461- assert!(!affects(&a, "1.0.4"));
462- }
463-
464456 #[test]
465457 fn parses_an_osv_record_and_merges_entries_for_one_package() {
466458 let json = br#"{
@@ -491,12 +483,6 @@ mod tests {
491483 assert!(affects(a, "0.9.0"));
492484 }
493485
494- #[test]
495- fn record_without_an_id_is_refused() {
496- assert!(parse_record(br#"{"affected": []}"#, "npm").is_err());
497- assert!(parse_record(b"not json", "npm").is_err());
498- }
499-
500486 #[test]
501487 fn reads_a_zip_dump_and_skips_bad_records() {
502488 use std::io::{Cursor, Write};
crates/forge-core/src/avatar.rsmodified+0 -11
@@ -165,15 +165,4 @@ mod tests {
165165 png[29..33].copy_from_slice(&crc.to_be_bytes());
166166 assert!(matches!(process_avatar(&png), Err(Error::Invalid(_))));
167167 }
168-
169- #[test]
170- fn hash_is_stable_and_well_formed() {
171- let input = encode(&sample(120, 90), ImageFormat::Png);
172- let a = process_avatar(&input).unwrap();
173- let b = process_avatar(&input).unwrap();
174- assert_eq!(a.hash, b.hash);
175- assert_eq!(a.hash.len(), 16);
176- assert!(a.hash.bytes().all(|c| c.is_ascii_hexdigit()));
177- assert_eq!(a.png, b.png);
178- }
179168 }
crates/forge-core/src/ci.rsmodified+0 -28
@@ -564,34 +564,6 @@ mod memory_tests {
564564 }
565565 }
566566
567- #[test]
568- fn the_first_job_that_fits_is_picked() {
569- let queue = [(Some(4 * GIB), 10), (Some(GIB), 5), (None, 1)];
570- assert_eq!(pick_by_memory(&queue, &offer(6), 300), Some(0));
571- assert_eq!(pick_by_memory(&queue, &offer(2), 300), Some(1));
572- assert_eq!(pick_by_memory(&queue, &offer(1), 300), Some(1));
573- assert_eq!(pick_by_memory(&queue, &offer(0), 300), None);
574- assert_eq!(pick_by_memory(&[], &offer(6), 300), None);
575- }
576-
577- #[test]
578- fn a_job_without_memory_reserves_the_runners_default() {
579- let queue = [(None, 0)];
580- assert_eq!(pick_by_memory(&queue, &offer(1), 300), Some(0));
581- let big_default = MemoryOffer {
582- default_reserve: 2 * GIB,
583- ..offer(1)
584- };
585- assert_eq!(pick_by_memory(&queue, &big_default, 300), None);
586- }
587-
588- #[test]
589- fn an_oversized_job_counts_as_the_whole_budget() {
590- let queue = [(Some(64 * GIB), 0)];
591- assert_eq!(pick_by_memory(&queue, &offer(6), 300), Some(0));
592- assert_eq!(pick_by_memory(&queue, &offer(5), 300), None);
593- }
594-
595567 #[test]
596568 fn a_waiting_job_is_passed_only_until_the_threshold() {
597569 let young = [(Some(4 * GIB), 299), (Some(GIB), 0)];
crates/forge-core/src/issue_refs.rsmodified+0 -10
@@ -152,14 +152,4 @@ mod tests {
152152 assert_eq!(find_closing_refs(text), *want, "case {text:?}");
153153 }
154154 }
155-
156- #[test]
157- fn all_keywords_are_case_insensitive() {
158- for kw in [
159- "close", "closes", "closed", "fix", "fixes", "fixed", "resolve", "resolves", "resolved",
160- ] {
161- let text = format!("{}: #5", kw.to_uppercase());
162- assert_eq!(find_closing_refs(&text), vec![5], "{kw}");
163- }
164- }
165155 }
crates/forge-core/src/issues.rsmodified+0 -9
@@ -363,13 +363,4 @@ mod tests {
363363 }
364364 assert!("bogus".parse::<IssueSort>().is_err());
365365 }
366-
367- #[test]
368- fn default_filter_is_open_first_page() {
369- let f = IssueFilter::default();
370- assert_eq!(f.state, Some(IssueState::Open));
371- assert_eq!(f.page, 1);
372- assert_eq!(f.per_page, 25);
373- assert_eq!(f.sort, IssueSort::Newest);
374- }
375366 }
crates/forge-core/src/names.rsmodified+0 -8
@@ -143,14 +143,6 @@ fn check_folded(input: &str, name: &str) -> Result<()> {
143143 mod tests {
144144 use super::*;
145145
146- #[test]
147- fn normalizes_nfkc_then_lowercase() {
148- assert_eq!(normalize_name("ABC"), "abc");
149- assert_eq!(normalize_name("Repo.Name"), "repo.name");
150- // Fullwidth 'fi' ligature folds to "fi" under NFKC.
151- assert_eq!(normalize_name("file"), "file");
152- }
153-
154146 #[test]
155147 fn accepted_names_return_folded_form() {
156148 let good: [(&str, &str); 5] = [
crates/forge-core/src/time.rsmodified+0 -48
@@ -46,51 +46,3 @@ pub fn stamp_to_unix(stamp: &str) -> Option<i64> {
4646 .ok()
4747 .map(OffsetDateTime::unix_timestamp)
4848 }
49-
50-#[cfg(test)]
51-mod tests {
52- use super::*;
53-
54- #[test]
55- fn stamp_to_unix_reads_what_now_stamp_writes() {
56- let stamp = "2026-10-18T10:00:00.000000000Z";
57- assert_eq!(stamp_to_unix(stamp), Some(1_792_317_600));
58- assert!(stamp_to_unix(&now_stamp()).is_some());
59- assert_eq!(stamp_to_unix("yesterday"), None);
60- }
61-
62- fn is_valid_stamp(s: &str) -> bool {
63- let b = s.as_bytes();
64- b.len() == 30
65- && b[4] == b'-'
66- && b[7] == b'-'
67- && b[10] == b'T'
68- && b[13] == b':'
69- && b[16] == b':'
70- && b[19] == b'.'
71- && b[29] == b'Z'
72- && b[20..29].iter().all(u8::is_ascii_digit)
73- }
74-
75- #[test]
76- fn now_stamp_has_nine_digits_and_z() {
77- let s = now_stamp();
78- assert!(is_valid_stamp(&s), "bad stamp: {s}");
79- }
80-
81- #[test]
82- fn stamps_sort_lexicographically_in_time_order() {
83- let a = now_stamp();
84- let b = stamp_after(Duration::from_secs(3600));
85- assert!(is_valid_stamp(&b), "bad stamp: {b}");
86- assert!(a < b);
87- let c = stamp_after(Duration::from_secs(7200));
88- assert!(b < c);
89- }
90-
91- #[test]
92- fn stamp_after_saturates_instead_of_panicking() {
93- let s = stamp_after(Duration::MAX);
94- assert!(s.ends_with('Z'));
95- }
96-}
crates/forge-core/src/tz.rsmodified+0 -8
@@ -57,14 +57,6 @@ pub fn local_time_now(tz: &str, now_unix: i64) -> String {
5757 mod tests {
5858 use super::*;
5959
60- #[test]
61- fn validates_known_and_unknown_names() {
62- assert!(validate_timezone("Europe/Istanbul").is_ok());
63- assert!(validate_timezone("UTC").is_ok());
64- assert!(validate_timezone("Mars/Base").is_err());
65- assert!(validate_timezone("").is_err());
66- }
67-
6860 #[test]
6961 fn formats_absolute_time_in_zone() {
7062 // 2026-10-15 11:05:00 UTC is 14:05 in Istanbul (UTC+03, no DST).