Skip to content

test: promote Tier H/L invariants to HTML shape predicates #78

@P4suta

Description

@P4suta

Background

The invariant catalog in crates/afm-markdown-test-support/src/lib.rs
defines shape-only HTML predicates (Tiers A–K) that every test surface —
unit tests, proptest, the corpus sweep, and fuzz harnesses — runs through
assert_invariants. Two tiers are excluded (lib.rs:31-34):

Tier H (no setext <h2> from a decorative rule) and Tier L (no empty
heading) are unit-test-only for now — they depend on being able to
witness the pre-/post-promotion AST, which the shape-only HTML
predicate cannot observe.

Because they are unit-test-only, Tier H and Tier L are not exercised
by proptest / corpus / fuzz, so a regression that only those broad
surfaces would surface could slip through.

What to do

Make Tier H and Tier L observable from rendered-HTML shape alone (or from
a cheap, test-support-visible artifact) so they can join
assert_invariants on equal footing with Tiers A–K, then add them to the
aggregated predicate. If a pure-HTML witness is genuinely impossible,
document that conclusion in the docstring and close — but the goal is to
remove the "unit-test-only" asterisk.

  • Tier H: no setext <h2> produced from a decorative rule.
  • Tier L: no empty heading.

References

  • crates/afm-markdown-test-support/src/lib.rs:31-34 (the exclusion note)
  • crates/afm-markdown-test-support/src/lib.rsassert_invariants,
    invariant catalog table
  • CLAUDE.md → "CSS class contract drift" / test surface notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    deferredIntentionally postponed / not-yet-done; backlogenhancementNew feature or requestrustPull requests that update rust code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions