Skip to content

Add property-based tests for renderer and date-validation invariants in weaver-docs-gate #154

Description

@coderabbitai

Summary

PR #151 introduces several algorithmic invariants in crates/weaver-docs-gate — column-width calculation, Markdown table-cell escaping, date-window validation, and phase grouping — without property-based tests to verify their correctness across arbitrary inputs.

Problem

The existing tests cover concrete, hand-crafted fixtures. They do not exercise the following invariants across the full input space:

  1. Column-width calculation — rendered column widths must always be at least as wide as the widest cell in that column.
  2. Markdown table-cell escaping — cells containing | or newlines must be escaped so the rendered output is a structurally valid Markdown table.
  3. Date-window validationvalidate_pending_review_date must accept any date within the 270-day window and reject any date beyond it, regardless of the reference date.
  4. Phase grouping — every task must appear in exactly one phase section, and the section heading must correspond to the task-ID prefix.

Suggested approach

Implement property-based tests using proptest to cover the above invariants. Tests should live in crates/weaver-docs-gate/tests/ or in a dedicated proptest module under src/.

Candidate test harnesses:

  • Renderer: generate arbitrary BoundaryManifest values (via proptest::arbitrary::Arbitrary or hand-rolled strategies); assert that every pipe character in a cell value is escaped and that the output parses as a table with the correct number of columns per row.
  • Date window: generate arbitrary (review_date, build_date) pairs; assert acceptance iff the difference is ≤ 270 days.
  • Phase grouping: generate manifests with varied task-ID prefixes; assert one section heading per distinct prefix and that every task appears under the correct heading.

References

Raised by @leynos.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions