Skip to content

Resolve survival/decrement method ambiguities (breaking: narrower first-argument types) - #138

Open
alecloudenback wants to merge 1 commit into
refactor/02-depsfrom
refactor/03-ambiguities
Open

alecloudenback wants to merge 1 commit into
refactor/02-depsfrom
refactor/03-ambiguities

Conversation

@alecloudenback

Copy link
Copy Markdown
Member

master has 5 ambiguous method pairs (2 on survival, 3 on decrement). Two of them defeat guard rails that exist on purpose: survival(Makeham(), 65, Uniform()) and survival(table, 10, Uniform()) raise an ambiguity MethodError instead of working or raising the intended ArgumentError.

Changes

  • The rate-vector survival methods take v::AbstractArray instead of an untyped first argument.
  • The integer-age method that took a DeathDistribution and ignored it now delegates to the plain integer method.
  • The from_age == to_age special case is gone; reducing over an empty view already returns init, which is also what gives the documented "reversed ages return 1.0" behavior.
  • decrement is one method, decrement(v, args...) = 1 - survival(v, args...). Table misuse routes through the survival ArgumentError.
  • Parametric models accept and ignore a trailing DeathDistribution (LifeContingencies' SingleLife passes one and currently gets a MethodError), and omega(::ParametricMortality) == Inf.

Testing

  • Test.detect_ambiguities is now asserted empty in the suite (0, down from 5).
  • length(methods(decrement)) == 1.
  • New tests for the ArgumentError on tables with a DeathDistribution, and for the parametric pass-throughs and omega.

Stacked on #137 (base branch refactor/02-deps). Merge the stack in order; once the base PR is merged and its branch deleted, GitHub retargets this PR to master.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JFnc6pvofuNXTW2xdCcewT

The rate-vector methods of survival now require an AbstractArray first
argument, decrement is a single vararg wrapper over survival, and the
integer-age DeathDistribution method delegates to the plain one.
Parametric models accept and ignore a DeathDistribution, and omega of a
parametric model is Inf, so they work wherever LifeContingencies
passes a fractional-age assumption.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JFnc6pvofuNXTW2xdCcewT
@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (refactor/02-deps@0d55fb8). Learn more about missing BASE report.

Additional details and impacted files
@@                 Coverage Diff                 @@
##             refactor/02-deps     #138   +/-   ##
===================================================
  Coverage                    ?   90.02%           
===================================================
  Files                       ?        8           
  Lines                       ?      381           
  Branches                    ?        0           
===================================================
  Hits                        ?      343           
  Misses                      ?       38           
  Partials                    ?        0           

☔ 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.

This branch has not been deployed

No deployments
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