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:
- Column-width calculation — rendered column widths must always be at least as wide as the widest cell in that column.
- Markdown table-cell escaping — cells containing
| or newlines must be escaped so the rendered output is a structurally valid Markdown table.
- Date-window validation —
validate_pending_review_date must accept any date within the 270-day window and reject any date beyond it, regardless of the reference date.
- 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.
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:
|or newlines must be escaped so the rendered output is a structurally valid Markdown table.validate_pending_review_datemust accept any date within the 270-day window and reject any date beyond it, regardless of the reference date.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 dedicatedproptestmodule undersrc/.Candidate test harnesses:
BoundaryManifestvalues (viaproptest::arbitrary::Arbitraryor 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.(review_date, build_date)pairs; assert acceptance iff the difference is ≤ 270 days.References
Raised by @leynos.