• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vbpf / prevail / 29319503431

14 Jul 2026 08:50AM UTC coverage: 86.742% (+0.09%) from 86.649%
29319503431

push

github

elazarg
Diff YAML invariants by line set instead of lattice subtraction

The YAML test harness renders each expected/actual post-invariant diff via
StringInvariant::operator-, which special-cased bottom by returning bottom().
Because StringInvariant::empty() counts bottom (`_|_`) as non-empty, a matching
`_|_`-vs-`_|_` comparison produced `actual - expected == bottom` and
`expected - actual == bottom`, so print_failure listed the identical `_|_` under
both "Unexpected properties" and "Unseen properties" even though the invariants
matched.

The underlying issue is that a diff result is not an invariant: typing it as the
lattice StringInvariant forced operator- to reason about a bottom sentinel and
about the constraint-set-vs-lattice duality. Replace that with the same honest
representation already used for the messages diff.

Add StringInvariant::to_lines(), which renders an invariant as its set of text
lines (bottom -> the single line "_|_", exactly the form read_invariant parses
back into bottom; non-bottom -> its constraint lines). Change Failure::invariant
to Diff<std::set<std::string>> and diff via the ordinary set difference already
used for messages, with no special-casing of bottom. `_|_` now appears only when
one side genuinely is bottom and the other is not.

Remove the now-unused StringInvariant::operator-. Add a regression test covering
to_lines() and the bottom/non-bottom diff cases.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWoziCvt88zfAvcCqTshPo
Signed-off-by: Elazar Gershuni <elazarg@gmail.com>

4 of 4 new or added lines in 1 file covered. (100.0%)

1 existing line in 1 file now uncovered.

9317 of 10741 relevant lines covered (86.74%)

6396402.75 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.87
/src/string_constraints.cpp


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc