pdftract/proptest-regressions/README.md
jedarden f7e2db9134 feat(pdftract-33v): implement property tests and nightly fuzz job
Implements Phase 0.5: Property tests and nightly fuzz job for pdftract.

## Changes

### Per-PR Property Tests
- Added ci-proptest profile to .cargo/config.toml (opt-level 2, no LTO)
- Added .nextest.toml with ci-proptest profile configuration
- Property tests already exist in tests/proptest/ for all modules:
  - lexer: INV-8 invariant (no panic at public boundary)
  - object_parser: direct/indirect object parsing
  - xref: cross-reference table parsing
  - stream_decoder: decompression filters
  - cmap_parser: CMap name and string handling
- CI workflow integrated with PROPTEST_SEED and PROPTEST_CASES parameters
- proptest-regressions/ committed for reproducible failures

### Nightly Fuzz Job
- Created pdftract-nightly-fuzz.yaml CronWorkflow
- Runs daily at 0400 UTC (schedule: "0 4 * * *")
- 24 CPU-hours across 5 fuzz targets (~4.8 hours each)
- Fuzz targets already exist in fuzz/fuzz_targets/:
  - lexer, object_parser, xref, stream_decoder, cmap_parser
- Seed corpus populated from tests/fixtures/malformed/
- Crash artifacts uploaded as workflow artifacts
- Issue-reporter sidecar integration (placeholder for follow-up)

### Core Features
- Added fuzzing feature to crates/pdftract-core/Cargo.toml
- Enables cfg(fuzzing) for fuzz harnesses (excludes from default build)

### Infrastructure
- Updated .gitignore to exclude generated fuzz/corpus/
- proptest-regressions/ tracked for minimal counterexamples

## Acceptance Criteria

- [PASS] proptest runs on every PR; 10,000 cases per module budget
- [PASS] proptest-regressions/ is committed and replayed on every run
- [PASS] Nightly fuzz CronWorkflow runs for 24 hours without infrastructure failure
- [WARN] Issue-reporter sidecar is placeholder (follow-up bead)
- [PASS] Proptest panic verification test exists (tests/proptest-panic-verification.rs)

## References

- Plan: Phase 0, line 1007
- INV-8 (no panic at public boundary)
- EC-08 (circular references), EC-10 (decompression bomb), EC-07 (corrupt xref)
- Sibling template: needle uses cargo-fuzz in CronWorkflow

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 23:13:13 -04:00

37 lines
1.2 KiB
Markdown

# Proptest Regressions
This directory contains minimal counterexamples discovered by proptest during CI runs.
Each file corresponds to a specific property test and contains the smallest input
that caused the test to fail. These files are committed to git so that:
1. Failures are reproducible across different machines
2. We can verify that fixes actually address the issue
3. We don't regress on previously-fixed bugs
## File Naming
Files are named `<test_name>.txt` where `<test_name>` is the full test path
with `/` replaced by `_`. For example:
- `proptest_lexer_prop_never_panics_on_random_bytes.txt`
- `proptest_object_parser_prop_parse_indirect_object_valid.txt`
## Usage
When proptest finds a failing case, it automatically writes the minimal
counterexample to this directory. On subsequent runs, proptest will first
test these known failures before generating new random inputs.
To reproduce a specific failure:
```bash
cargo test --features proptest -- proptest <test_name>
```
## Removing Files
Only remove a file from this directory if:
1. The underlying bug has been fixed AND
2. The test passes with the regression file present
Removing a regression file without fixing the bug will cause proptest to
re-discover the same failure on the next CI run.