Skip to content

API review: modernize public interface for v1.0.0#41

Merged
kdw503 merged 10 commits into
masterfrom
dwk/mng
May 19, 2026
Merged

API review: modernize public interface for v1.0.0#41
kdw503 merged 10 commits into
masterfrom
dwk/mng

Conversation

@kdw503
Copy link
Copy Markdown
Member

@kdw503 kdw503 commented May 19, 2026

Summary

  • Remove two broken methods: initial_deformation(ap, cs, Qs, ϕ_old, maxshift) (body was error("This is broken")) and optimize(::AffineMap, mmis, nodes) (used a pre-MathProgBase Optim API)
  • Move configuration arguments that appeared before data to keyword arguments: stackidx on auto_λ; SD/maxrot on optimize_rigid; SD on rotation_gridsearch; λt on initial_deformation, optimize!, and fixed_λ
  • Rename tolatol on optimize_rigid (consistent with Base.isapprox); add kwargs... passthrough to Ipopt
  • Remove the auto_λt flat-array adapter overload (misleadingly named; same pattern as adapters removed elsewhere)
  • Widen auto_λ flat-array overloads from Array{Tf} (shared element type) to independent AbstractArray{<:Number>
  • Bump version to 1.0.0; add CHANGELOG.md

Also includes prep commits that landed before the baseline: CI/TagBot modernization, compat bumps for the Register* family to v1, and two-line adaptations for the RegisterPenalty/RegisterUtilities v1 API changes.

Test plan

  • Full test suite passes: 200/200 (Julia 1.12.6)
  • Test.detect_ambiguities(RegisterOptimize) = 0 throughout
  • Merge and register on Julia General registry via @JuliaRegistrator register

🤖 Generated with Claude Code

kdw503 and others added 10 commits May 18, 2026 17:49
- CI: bump julia-actions/setup-julia to v2, codecov-action to v5 with
  CODECOV_TOKEN; switch matrix to 'min' + '1'.
- TagBot: use TAGBOT_TOKEN; register against HolyLab/HolyLabRegistry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Targets the upcoming v1 releases of CachedInterpolations,
CenterIndexedArrays, RegisterCore, RegisterDeformation, RegisterFit,
and RegisterPenalty.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- TimeHessian `*` and `mul!`: swap to `penalty!(g, ϕs, λt)` to match the
  new argument order of the time-only `penalty!` overload in
  RegisterPenalty v1.
- Test "Optimization with a temporal penalty": call the 3-arg `quadratic`
  as `quadratic(denom, shift, Q)`, matching the new RegisterUtilities v1
  signature that takes the denominator first.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Preflight baseline established (CHUNK-001 complete):
200/200 tests pass, 0 ambiguities at 7f64c5a.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Removes `initial_deformation(ap, cs, Qs, ϕ_old, maxshift)` (body was
`error("This is broken, don't use it")`) and `optimize(::AffineMap,
mmis, nodes)` (used a pre-MathProgBase Optim API that no longer
exists).  Also removes all support code reachable only from those two
methods: `InitialDefOpt`, the 4-arg `find_opt` overload, the
`MOI.eval_objective`/`eval_objective_gradient`/`_eval_f` trio for
`InitialDefOpt`, both `affine_part!` methods on `Φ<:GridDeformation`,
and the `optimize`-only helpers `affinepenalty!` and `_calculate_u`.
Trims the surviving `initial_deformation` docstring to drop the now-
misleading `[ϕ_old=identity]` keyword.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
`auto_λ(stackidx::Integer, cs, Qs, nodes, mmis, λrange)` put a
configuration integer before data — wrong order by Julia convention.
Fold it into `auto_λ(cs, Qs, nodes, mmis, λrange; stackidx=nothing)`
and slice inside the body when set.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
optimize_rigid (rigid-search cluster, CHUNK-004):
- Move SD and maxrot from positional to keyword arguments; SD defaults
  to identity of size ndims(fixed) computed lazily in the body.
- Rename tol → atol (consistent with Base.isapprox / IterativeSolvers).
- Forward extra kwargs to Ipopt via optimizer_with_attributes so callers
  can set any Ipopt option without a new overload.

rotation_gridsearch (rigid-search cluster, CHUNK-005):
- Move SD from positional to keyword; same lazy default as above.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
initial_deformation: fold the 4-arg positional-λt overload (Method 4)
into the SVector-typed Method 2 via a λt=nothing keyword; both paths
now live in one function body.  The bare Method 1 gains λt=nothing
for forward-compat.

optimize!(::Vector{<:GridDeformation}, …): move λt from position 4 to
keyword.  Add a Vector{<:GridDeformation} type constraint on the first
argument to prevent AffinePenalty specificity from stealing single-
frame dispatch.  λt=nothing maps to zero(T).

fixed_λ: merge the SVector-typed temporal overload and its flat-array
adapter into the generic method (λt=nothing keyword; temporal branch
when λt≠nothing) and the unified flat-array adapter.

Update test call sites and docstrings throughout.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
CHUNK-007: Remove auto_λt(Es, cs::Array{Tf}, Qs::Array{Tf}, ap, λt) —
a flat-array adapter misleadingly named (λt was actually λtrange).
Consistent with similar adapters removed from auto_λ, fixed_λ, and
optimize! in this review. Callers must now pass SVector/SMatrix-typed
cs/Qs directly.

CHUNK-008: Relax auto_λ flat-array overloads:
- T3-C: independent element types — replace the shared-Tf constraint
  (cs::Array{Tf}, Qs::Array{Tf}, mmis::Array{Tf}) with independent
  AbstractArray{<:Number} annotations.
- T2-C: widen Array{Float64} to AbstractArray{Float64}; collect to a
  dense Array inside the body before reinterpret/reshape.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
First stable release. All breaking API changes from the API review
are included in this version; see CHANGELOG.md for the full list.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@kdw503 kdw503 merged commit e095697 into master May 19, 2026
4 checks passed
@kdw503 kdw503 deleted the dwk/mng branch May 19, 2026 19:10
@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

❌ Patch coverage is 35.82090% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 36.25%. Comparing base (7a9a84f) to head (a6cec91).
⚠️ Report is 16 commits behind head on master.

Files with missing lines Patch % Lines
src/RegisterOptimize.jl 35.82% 43 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #41      +/-   ##
==========================================
+ Coverage   33.48%   36.25%   +2.76%     
==========================================
  Files           1        1              
  Lines         642      571      -71     
==========================================
- Hits          215      207       -8     
+ Misses        427      364      -63     

☔ View full report in Codecov by Sentry.
📢 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.

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