Skip to content

Fuzz: exercise the selected region in FormatOutOfCountryCallingNumber, cap manual duration - #429

Merged
twcclegg merged 1 commit into
mainfrom
fix/fuzz-review-findings
Aug 27, 2026
Merged

Fuzz: exercise the selected region in FormatOutOfCountryCallingNumber, cap manual duration#429
twcclegg merged 1 commit into
mainfrom
fix/fuzz-review-findings

Conversation

@twcclegg

@twcclegg twcclegg commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Changes

Two coverage/UX gaps from the aggressive v9.0.37..main re-review — not correctness bugs in the shipped library (PhoneNumbers.Fuzz isn't part of the packed NuGet package).

  • csharp/PhoneNumbers.Fuzz/Program.cs: FormatOutOfCountryCallingNumber was always fuzzed with a hardcoded "US" calling region, so formatting-from-region-specific branches (a region sharing the parsed number's country code, or with unusual national-prefix/IDD rules) got zero coverage regardless of how long the fuzzer ran. It now reuses the same fuzzer-selected region already threaded through Parse/FindNumbers/FormatAsYouType.
  • .github/workflows/fuzz.yml: the workflow_dispatch duration input (seconds) had no upper bound against the job's 60-minute timeout-minutes. An oversized manual value doesn't make libFuzzer stop later — it makes the runner hard-cancel the whole job instead, which skips the "Upload crashes" step (if: failure() doesn't fire on a cancellation) and loses whatever crash was found. Capped to 3000s (50 min) via min(fromJSON(...), 3000), leaving headroom for checkout/build/instrument/upload within the 60-minute budget.

Test plan

  • dotnet build csharp/PhoneNumbers.Fuzz -c Release — clean, 0 warnings.
  • Ran the harness in reproduce mode against all 9 checked-in corpus files — all pass.
  • Ran it against a synthetic input with 8 different region-selector byte values (0, 1, 50, 100, 150, 200, 250, 255) covering a spread of regions through FormatOutOfCountryCallingNumber — all format without throwing.
  • YAML-parsed the workflow file.

…, cap manual duration

Two coverage/UX gaps from the aggressive v9.0.37..main re-review, not
correctness bugs (this project isn't shipped in the NuGet package):

- FormatOutOfCountryCallingNumber was always fuzzed with a hardcoded "US"
  calling region, so formatting-from-region-specific branches (e.g. a
  region sharing the parsed number's country code, or with unusual
  national-prefix/IDD rules) got zero coverage no matter how long the
  fuzzer ran. It now reuses the same fuzzer-selected region already
  threaded through Parse/FindNumbers/FormatAsYouType. Verified: existing
  corpus still passes clean, plus a spread of region-selector bytes (0,
  1, 50, 100, 150, 200, 250, 255) all format without throwing.

- workflow_dispatch's `duration` input (seconds) had no upper bound
  against the job's 60-minute timeout. An oversized value doesn't make
  libFuzzer stop later - it makes the runner hard-cancel the job instead,
  which skips "Upload crashes" (only runs on `failure()`, not on a
  cancellation) and loses whatever crash was found. Capped to 3000s (50
  min), leaving headroom for checkout/build/instrument/upload.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WVGRJyQwtvBGXAmWswxyqW
@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.26%. Comparing base (25d7aaf) to head (9dba092).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #429   +/-   ##
=======================================
  Coverage   87.26%   87.26%           
=======================================
  Files          41       41           
  Lines        3831     3831           
  Branches      978      978           
=======================================
  Hits         3343     3343           
  Misses        284      284           
  Partials      204      204           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants