Skip to content

Bind numerical library versions into gap and bridge kernel identity; make monotonicity properties non-vacuous (G7 review nits) - #1182

Merged
MaxGhenis merged 1 commit into
mainfrom
transport/g7-review-nits
Oct 10, 2026
Merged

MaxGhenis merged 1 commit into
mainfrom
transport/g7-review-nits

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #1181 (NZ graph G7, merged). It fixes the two non-blocking nits from that PR's round-2 independent review.

1. Numerical library versions in kernel identity

This reuses the repo's existing mechanism: a kernel declares installed distributions in Capabilities.dependencies (graph/kernel.py), and source_hash binds their reported versions into its implementation hash.

  • takeup.gap@1 now declares NumPy, pandas and SciPy. It compiles the target matrix with them and computes weighted totals with them.
  • simulate.counterfactual@1 and simulate.solve_zero@1 add NumPy and pandas to any caller-supplied dependencies, because bridge arithmetic and person/group reductions use them. Superclass validation is unchanged.
  • takeup.bands@1 declares none, and a comment says why: it decodes canonical artifacts and compares Python numbers with Python's sort, min and negation. No numerical library computes its outputs.

Tests check three things: changing a declared library's reported version changes the identity; otherwise the identity is stable; and an undeclared library's version does not affect it.

These kernels' implementation hashes change, so their nodes and descendants re-key once. Identity hashes whole defining modules, so simulate.rules_by_ref@1, which shares rules_kernels.py, and takeup.bands@1, which changed only by a comment, also re-key once. The hub knows of no production store holding these nodes yet.

2. Non-vacuous monotonicity properties

In test_transport_entitlement_graph.py, the income and cost monotonicity properties could draw zero increments, or increments too small to represent. A mutant that replaced toy AS with income survived under the default seed.

  • Increments are now drawn strictly positive, from [1, 1500], on bases in [0, 1500], so the difference is always representable.
  • Explicit @examples kill that mutant.
  • No assertion was weakened.

Tests

  • The lane ran four files, one at a time: test_transport_takeup_kernels.py 30, test_transport_entitlement_graph.py 23, test_counterfactual_kernels.py 37, test_transport_composed_graph.py 137. All passed.
  • All 20 targeted mutants fail the new tests.
  • tools/ci_test_plan.py verify, ruff check and format, and git diff --check pass.
  • The hub re-ran three files on this head: take-up kernels 30, counterfactual kernels 37, source-scan rules 15.

Review

r1 (GPT-6.1 Sol at ed760d9): APPROVE_WITH_NITS, Needs Max: no. 242 tests passed and 20 distinct mutants were killed. Each of the 18 new identity cases fails under a matching mutant. The monotonicity mutant now fails under seeds 1, 42 and 20261010. Nits: the historical and provenance statements here are reported by the hub, not checkout evidence; the module-wide re-key is now stated above.

Part of Microcosm NZ v0 (d962). Built on a GPT-6.1 Sol Subfleet lane; verified, committed and opened by the NZ hub.

🤖 Generated with Claude Code

Declare NumPy, pandas and SciPy for takeup gaps, and NumPy and pandas for
counterfactual and zero-solving bridges while preserving engine declarations.
Keep bands independent of numerical libraries and test version changes,
stable identities and unused dependencies.

Require positive, representable monotonicity increments and add explicit
income and cost examples that catch wrong-direction toy entitlement mutants.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
@MaxGhenis
MaxGhenis merged commit aca40a6 into main Oct 10, 2026
10 checks passed
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Merged by the NZ hub (session local_e407a527) at ed760d9 with --merge. Gates: gh pr checks exit 0; MERGEABLE; not draft; no CHANGES_REQUESTED review. Reviewed head: ed760d9. Independent review: GPT-6.1 Sol at ed760d9, APPROVE_WITH_NITS, Needs Max: no (jobs/review-microcosm-1182/REPORT-r1.md): uses the existing Capabilities.dependencies/source_hash mechanism; 242 tests passed; 20 distinct mutants killed, including each of the 18 new identity cases; the monotonicity mutant now fails under seeds 1, 42 and 20261010. Nits addressed in the PR body (module-wide re-key stated; historical claims marked as hub-reported). All 10 checks green, MERGEABLE/CLEAN, no CHANGES_REQUESTED.

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