Skip to content

test: close the sprint's coverage gaps, and put its ownership fixes under memcheck - #815

Merged
kacy merged 1 commit into
mainfrom
test-coverage-sprint
Aug 19, 2026
Merged

test: close the sprint's coverage gaps, and put its ownership fixes under memcheck#815
kacy merged 1 commit into
mainfrom
test-coverage-sprint

Conversation

@kacy

@kacy kacy commented Aug 19, 2026

Copy link
Copy Markdown
Owner

A coverage audit of #804-#812 found the sprint's ownership fixes were invisible to every gate that could catch their real failure mode. This closes the gaps; no compiler or runtime changes.

the memcheck hole

None of the sprint's goldens ran under valgrind, and #804/#805/#809/#810 are ownership fixes whose regression shape is an over-release or overread — which prints the right answer, stays flat in the leak gate, and passes the golden diff. Seven cases join MEMCHECK_CASES (all verified clean under the gate's exact invocation): test_generic_enum_match, test_closure_many_captures, test_closure_capture_boundaries, test_optional_match_ownership, test_optional_payload_eq, test_tail_match_defer, test_argument_literal_ownership.

new and extended tests

  • test_tail_match_defer (new): fix: give a match on an rc-payload optional exact ownership #809's core mechanism — a tail match returning through the full return contract — had no test with a defer in it; a revert to the bare ret would have skipped every defer silently. Covers the expression arm, the none arm, and a borrowed-field return.
  • test_closure_capture_boundaries (new): exactly 16 captures (no spill), 17 (first spill), and a 39-capture closure growing the extension from a lower high-water mark, with strings sitting on the 15/16 boundary.
  • test_generic_enum_match (extended): a two-parameter base with a mixed generic+concrete payload list (Both(A, B, Int)), matched through a function boundary — per-slot kind substitution had only single-param coverage.
  • tests/invalid/generic_enum_nonexhaustive (new): generic-enum matches are under E204; this is the tree's first E204 fixture at all.
  • test_generic_impl_name_collision (new): std.iter's MapIter and a local generic MapIter registering in one compile — the exact collision E263's first cut had, previously caught only transitively by bootstrap-verify. Also pins the legal inherent+interface pair in both orders. (Deliberately does not drive std's MapIter: a same-named generic instance still misbinds cross-module at runtime — the pre-existing E209/feat: expand concurrency foundations #163 family.)
  • tests/invalid/duplicate_generic_impl_method (new): a genuine same-kind duplicate on a generic base within one module still errors.
  • test_optional_widen_eq (extended): the plain-value-on-the-left != corner, and a plain argument widening into a fully generic T? parameter.
  • leak_closure_spill_capture (new leak-gate case): 20 captures, four heap strings in the spill region, closure created and dropped per round — flat (-12kb over 600k extra rounds). This is the case that gates "a spilled slot carries its release tag".
  • leak_argument_literal (extended): the non-empty nested literal poke([["seed"]]) joins the round (flat, 64kb noise). The stored-tuple shape (keep((i, i+1)) into a struct field) was measured, leaks its box per round as docs/ownership.md already documents ("real tuple literals still strand their box"), and is deliberately kept OUT of the gate with a comment saying why — its correctness side stays covered by test_argument_literal_ownership.

what was tested

  • All seven newly wired memcheck cases pass valgrind with the gate's exact flags (PITH_STRUCT_FREELIST=0, --error-exitcode=99).
  • Both touched leak cases measured with the gate's own sequence at 200k/800k rounds: leak_closure_spill_capture -12kb, leak_argument_literal +64kb.
  • make check-invalid-only 56 passed; make run-regressions-only 374 passed (the three new goldens included).
  • fmt run on every new/changed pith file.

@kacy
kacy merged commit 66c5b17 into main Aug 19, 2026
2 checks passed
@kacy
kacy deleted the test-coverage-sprint branch August 19, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant