Skip to content

test(proptest): expand property suite to 8 tests across binary/XML/JSON#103

Merged
dchud merged 1 commit intomainfrom
bd-ouji-proptest-expansion
Apr 20, 2026
Merged

test(proptest): expand property suite to 8 tests across binary/XML/JSON#103
dchud merged 1 commit intomainfrom
bd-ouji-proptest-expansion

Conversation

@dchud
Copy link
Copy Markdown
Owner

@dchud dchud commented Apr 20, 2026

Summary

  • Adds 4 structural-invariant properties over the emitted ISO 2709 bytes (leader length matches byte count, directory entries tile the data area, indicator bytes are digit-or-space, subfield codes are [a-z0-9]) plus MARCXML and MARCJSON round-trip properties that exercise format-specific escaping (< > & " ' for XML; \t \n \r \\ " for JSON).
  • Broadens arb_record to cover zero-control-field and zero-data-field records; caps runtime with ProptestConfig { cases: 64 } (suite runs in ~3s locally, well under the 10s budget).
  • Removes the stray commented #proptest = "1.0" from Cargo.toml [dependencies] (the real entry has always been in [dev-dependencies]).
  • Documents regression-seed policy inline and adds tests/*.proptest-regressions.pending / tests/proptest-regressions/*.pending to .gitignore so only accepted seeds are tracked.

The MARCXML round-trip property surfaced a real bug: quick-xml + serde(rename = "$value") strips whitespace-only text content, so a <controlfield tag=\"001\"> </controlfield> fails to deserialize. The XML strategy now excludes whitespace-only values and the fix is tracked in a separate bead (bd-zm6m).

Test plan

  • cargo test --test properties --package mrrc → 8 passed in 2.6s
  • .cargo/check.sh (full local CI) → all checks passed
  • CI green on GitHub across all platforms

Bead: bd-ouji
Closes #91

🤖 Generated with Claude Code

Adds four structural-invariant properties over the emitted ISO 2709 bytes
(leader length, directory tiling, indicator byte set, subfield code shape)
plus MARCXML and MARCJSON round-trip properties that exercise format-specific
escaping edge cases. Broadens arb_record to cover zero-control-field and
zero-data-field records. Caps runtime with ProptestConfig::cases = 64
(suite runs in ~3s locally). Removes stray commented proptest line from
Cargo.toml [dependencies].

Surfaced a MARCXML whitespace-stripping bug (bd-zm6m): single-space
control values don't round-trip through quick-xml. Narrowed the XML
strategy to exclude whitespace-only values pending the fix.

Bead: bd-ouji

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 20, 2026

Merging this PR will degrade performance by 35.39%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
❌ 55 regressed benchmarks
✅ 4 untouched benchmarks
⏩ 16 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime test_threaded_reading_4x_10k 692.2 ms 895.7 ms -22.71%
WallTime test_threaded_reading_4x_1k 66 ms 85.7 ms -22.95%
WallTime test_threaded_reading_1k 20.8 ms 25.6 ms -19.02%
WallTime test_sequential_2x_reading_10k 133.5 ms 157.3 ms -15.12%
WallTime test_sequential_2x_reading_1k 12.9 ms 15.6 ms -16.79%
WallTime test_sequential_10k 66.2 ms 78.6 ms -15.88%
WallTime test_threaded_reading_2x_10k 204.7 ms 262.7 ms -22.09%
WallTime test_sequential_4x_reading_1k 26.1 ms 30.7 ms -14.89%
WallTime test_sequential_with_title_extraction_10k 69.1 ms 81.3 ms -15.02%
WallTime test_process_4_files_sequential 67.4 ms 78.7 ms -14.31%
WallTime test_iterator_vs_while_loop_1k 6.3 ms 7.4 ms -14.22%
WallTime test_process_4_files_parallel_4_threads 85.9 ms 97.6 ms -12%
WallTime test_read_10k_records 64.4 ms 76.3 ms -15.63%
WallTime test_read_1k_records 6.4 ms 7.5 ms -15.1%
WallTime test_threading_speedup_4x_10k 668.6 ms 863.7 ms -22.6%
WallTime test_roundtrip_1k_records 9.5 ms 11.5 ms -17.27%
WallTime test_threaded_with_title_extraction_2x_10k 221.2 ms 272.1 ms -18.73%
WallTime test_read_and_extract_titles_10k 67 ms 79.7 ms -15.97%
WallTime test_parallel_read_with_extract_4x_1k 70.7 ms 94.5 ms -25.19%
WallTime test_threading_speedup_2x_10k 202.4 ms 263.5 ms -23.19%
... ... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.


Comparing bd-ouji-proptest-expansion (bff1c57) with main (1ebc492)2

Open in CodSpeed

Footnotes

  1. 16 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (bff1c57) during the generation of this report, so 1ebc492 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@dchud dchud self-assigned this Apr 20, 2026
@dchud dchud merged commit a439444 into main Apr 20, 2026
46 of 48 checks passed
@dchud dchud deleted the bd-ouji-proptest-expansion branch April 20, 2026 03:00
dchud added a commit that referenced this pull request Apr 20, 2026
- bd-ouji closed: proptest expansion delivered in PR #103.
- bd-seja (p3): document formal methods in public docs (follow-up).
- bd-zm6m (p2): MARCXML whitespace round-trip bug, surfaced by bd-ouji
  and elevated to GitHub issue #104.
- bd-95ho (p1): reorganize [Unreleased] CHANGELOG section.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

Enable proptest with round-trip and structural invariant properties

1 participant