Skip to content

Add property-based coverage for inline date-sequence matching (#400) - #401

Merged
leynos merged 4 commits into
mainfrom
issue-400-add-property-based-coverage-for-inline-date-sequence-matching
Jul 21, 2026
Merged

Add property-based coverage for inline date-sequence matching (#400)#401
leynos merged 4 commits into
mainfrom
issue-400-add-property-based-coverage-for-inline-date-sequence-matching

Conversation

@leynos

@leynos leynos commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

This branch adds focused property-based coverage for inline date-sequence matching. It exercises every supported date layout across generated date components, Unicode whitespace separators, accepted opening punctuation and preceding token offsets, while keeping production matching behaviour unchanged.

Each generated valid layout is coupled with equal-length negative cases for non-date components, invalid separators, incorrect token order and invalid opening punctuation. It also covers empty input and every incomplete sequence length directly. The test-only scope keeps this follow-up isolated from PR #395.

Closes #400.

Review walkthrough

Validation

  • make check-fmt: passed
  • make test: passed
  • make typecheck: passed
  • make lint: passed with Clippy warnings denied
  • Deliberate five-token length-only matcher mutation: the coupled near-miss property failed and shrank to all three minimal valid layouts with an equal-length non-date component; the mutation was then removed
  • coderabbit review --agent: completed with zero findings

References

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @leynos, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: bb2e3a7d-8781-464b-a432-3e10d45987f7

📥 Commits

Reviewing files that changed from the base of the PR and between 9039d7d and b88a47f.

📒 Files selected for processing (1)
  • src/wrap/inline/span_helper_props.rs

Summary

  • Adds property-based coverage for inline date-sequence matching, addressing issue #400.
  • Tests supported date layouts, generated components, Unicode whitespace, valid punctuation, token offsets, empty and incomplete input, and malformed near-misses.
  • Registers the tests only under #[cfg(test)]; production behaviour and public APIs remain unchanged.
  • Keeps the work isolated from PR #395.
  • Validation passed for formatting, tests, type checking, and linting with warnings denied.

Walkthrough

Add isolated property-based coverage for inline date-sequence matching, including generated separators and formats, valid prefixed sequences, empty input, near-miss variations, and incomplete sequences.

Changes

Date-sequence matcher coverage

Layer / File(s) Summary
Generate date-sequence inputs
src/wrap/inline/span_helper_props.rs
Generate date tokens across supported layouts with varied Unicode whitespace, optional prefixes, invalid openers, and preceding noise tokens.
Validate matcher properties
src/wrap/inline/span_helpers.rs, src/wrap/inline/span_helper_props.rs
Wire the test module and verify successful offsets plus rejection of empty, mutated, invalid, and truncated sequences.

Possibly related PRs

Suggested labels: Issue

Poem

Dates march through whitespace bright,
Prefixes lead them into sight.
Complete ones pass the matcher’s gate,
Broken trails are left to wait.
Proptest drums a steady beat.

🚥 Pre-merge checks | ✅ 20
✅ Passed checks (20 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarises the test-only property-based coverage and links issue #400.
Description check ✅ Passed The description stays on-topic and matches the inline date-sequence coverage changes.
Linked Issues check ✅ Passed The PR covers valid prefixed sequences, empty and incomplete inputs, and stays isolated from PR #395 as required by #400.
Out of Scope Changes check ✅ Passed The changes remain confined to test-only coverage and a test module import, with no unrelated runtime scope added.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Testing (Overall) ✅ Passed Approve: the property tests cover valid layouts, invalid components, separators, opener punctuation, offsets, and truncation, and they fail plausible broken matchers.
User-Facing Documentation ✅ Passed PASS: The change is test-only; no user-facing behaviour changed, and date-sequence wrapping is already documented in docs/users-guide.md.
Developer Documentation ✅ Passed Only a test-only companion was added; no public/API, architecture, ADR, or execplan changes were introduced, and the developer guide already covers span_helpers/date matching.
Module-Level Documentation ✅ Passed Both touched modules carry clear crate-level docs; the new test-only companion explains its purpose and relationship to span_helpers/date_strategies.
Testing (Unit And Behavioural) ✅ Passed The new proptests cover valid, empty, incomplete, and near-miss date-token cases against the internal matcher’s invariants; unit scope is appropriate here.
Testing (Property / Proof) ✅ Passed PR adds a test-only proptest module covering valid, invalid, empty and truncated date-token sequences; span_helpers.rs wires it under #[cfg(test)] only.
Testing (Compile-Time / Ui) ✅ Passed No compile-time or UI output is introduced; the change adds runtime property tests only.
Unit Architecture ✅ Passed The change is test-only: it adds property tests and a cfg(test) module, with no production state, I/O, network, clock, or side-effect boundary changes.
Domain Architecture ✅ Passed Keep it: the new code lives under #[cfg(test)] and only adds property tests for inline span helpers; production/domain code stays unchanged.
Observability ✅ Passed Changes are test-only #[cfg(test)] property checks; they do not alter production paths, so extra logging, metrics, tracing, or alerts are not required.
Security And Privacy ✅ Passed Only a test-only module was added; it uses synthetic proptest data and no secrets, credentials, env vars, I/O, auth, or privileged paths.
Performance And Resource Use ✅ Passed PASS: keep this test-only; the loops and collections are tightly bounded, and the production matcher stays unchanged.
Concurrency And State ✅ Passed Add only test-only property coverage; no shared mutable state, async tasks, locks, or ordering logic changed.
Architectural Complexity And Maintainability ✅ Passed PASS: The new module is test-only, reuses existing date strategies, and adds no runtime indirection, public API, or new dependency.
Rust Compiler Lint Integrity ✅ Passed No lint suppressions or artificial anchors appear; the new module is cfg(test)-gated, and cloning is limited to deliberate test-case mutation.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-400-add-property-based-coverage-for-inline-date-sequence-matching

Comment @coderabbitai help to get the list of available commands.

Exercise every supported date layout with generated date components,
Unicode whitespace separators, opening punctuation, and preceding token
offsets.

Reject empty and truncated sequences directly so the matching boundary is
covered without changing production behaviour.
@lodyai
lodyai Bot force-pushed the issue-400-add-property-based-coverage-for-inline-date-sequence-matching branch from 2cd2696 to 9039d7d Compare July 19, 2026 09:31
@leynos
leynos marked this pull request as ready for review July 19, 2026 15:03

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @leynos, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot added the Issue label Jul 19, 2026
@leynos

leynos commented Jul 19, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Reviews resumed.

leynos added 2 commits July 19, 2026 22:43
Pair every generated date layout with equal-length negative cases for
invalid components, separators, ordering, and opening punctuation. Ensure
the properties reject a length-only matcher rather than merely checking
five-token availability.

Expand the test module documentation to explain its relationship to the
inline span helper and shared date strategies.
Identify the property module as the test-only companion to
`span_helpers`. Explain its use of shared `date_strategies` generators and
the internal matcher contract it exists to verify.
@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/wrap/inline/span_helper_props.rs`:
- Around line 127-191: Decompose the assertion logic in
try_match_date_sequence_distinguishes_valid_dates_from_five_token_near_misses
into small helpers for non-date components, wrong separators, swapped order, and
wrong opener, each accepting the token slice, start index, and layout index as
appropriate. Keep the valid-match assertion in the loop, invoke the helpers from
the slimmer loop body, and preserve all existing assertions and diagnostic
messages.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: dea0466b-1be1-4215-adee-eb60e4de4ed5

📥 Commits

Reviewing files that changed from the base of the PR and between 9039d7d and 786244d.

📒 Files selected for processing (1)
  • src/wrap/inline/span_helper_props.rs

Comment thread src/wrap/inline/span_helper_props.rs
Decompose the coupled near-miss assertions in the five-token
distinguishing property into four focused helpers for non-date
components, wrong separators, swapped order, and wrong opener. Each
accepts the token slice, start index, and (where relevant) the invalid
opener plus layout index, returning a proptest result so the slimmer
loop body can propagate failures with `?`. All assertions and
diagnostic messages are preserved; production matcher behaviour is
unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@leynos

leynos commented Jul 21, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@leynos
leynos merged commit 9bc9898 into main Jul 21, 2026
4 checks passed
@leynos
leynos deleted the issue-400-add-property-based-coverage-for-inline-date-sequence-matching branch July 21, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add property-based coverage for inline date-sequence matching

2 participants