Skip to content

Declare the extension hooks public and document their contracts - #28

Merged
timholy merged 1 commit into
mainfrom
teh/public
Jul 18, 2026
Merged

Declare the extension hooks public and document their contracts#28
timholy merged 1 commit into
mainfrom
teh/public

Conversation

@timholy

@timholy timholy commented Jul 18, 2026

Copy link
Copy Markdown
Member

foreach_support and foreach_support_sym are how a cover algorithm reads a
matrix: specializing them is what lets a storage type be covered in time
proportional to its support, as the bundled SparseArrays extension does.
AbstractCoverPenalty is the supertype of the exported penalties and the
first-argument slot of most of the API. All three were reachable and
relied upon, but none declared its status, so users had no way to tell a
supported extension point from an internal that could move.

Each now states what an implementer must guarantee. Two points that the
code enforced only by convention are written down:

  • foreach_support_sym requires A to be symmetric in value, not merely
    square. It cannot check this cheaply and does not try; the precondition
    is what makes reporting one member of each index pair sufficient.
  • Subtyping AbstractCoverPenalty buys cover_objective and nothing more.
    The solvers dispatch on the concrete built-in penalties, so a custom
    penalty can score a cover but cannot be minimized. Saying so beats
    letting a MethodError be the documentation.

public is parsed as a keyword only from Julia 1.11, so the declaration
goes through a VERSION gate rather than a new Compat dependency.

Assisted-by: Claude Opus 4.8 noreply@anthropic.com

foreach_support and foreach_support_sym are how a cover algorithm reads a
matrix: specializing them is what lets a storage type be covered in time
proportional to its support, as the bundled SparseArrays extension does.
AbstractCoverPenalty is the supertype of the exported penalties and the
first-argument slot of most of the API. All three were reachable and
relied upon, but none declared its status, so users had no way to tell a
supported extension point from an internal that could move.

Each now states what an implementer must guarantee. Two points that the
code enforced only by convention are written down:

- foreach_support_sym requires A to be symmetric in value, not merely
  square. It cannot check this cheaply and does not try; the precondition
  is what makes reporting one member of each index pair sufficient.
- Subtyping AbstractCoverPenalty buys cover_objective and nothing more.
  The solvers dispatch on the concrete built-in penalties, so a custom
  penalty can score a cover but cannot be minimized. Saying so beats
  letting a MethodError be the documentation.

`public` is parsed as a keyword only from Julia 1.11, so the declaration
goes through a VERSION gate rather than a new Compat dependency.

Assisted-by: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.51%. Comparing base (1c194d8) to head (d86e994).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #28   +/-   ##
=======================================
  Coverage   98.51%   98.51%           
=======================================
  Files          12       12           
  Lines        2016     2016           
=======================================
  Hits         1986     1986           
  Misses         30       30           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timholy
timholy merged commit 285b12f into main Jul 18, 2026
5 checks passed
@timholy
timholy deleted the teh/public branch July 18, 2026 09:41
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