Repository navigation
Settle the public surface: remove Device, make the taught names public, keep internals internal - #986
Conversation
Device was an alias of Parallel kept from before the rename. Tests and benchmarks that built an executor through it now call Parallel. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7izUDKjuoR5m5Ky44oy
Each is named on a user page: State is what a call with Resume() returns, Secondary the default reading of a TimeVarying kernel, Auto the default convolution method and TRACED_MIN_STRATA a setting of traced calls. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7izUDKjuoR5m5Ky44oy
The developer pages teach all three as the way to test a new type's rule, and labelled them internal. A documented check is part of the surface. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7izUDKjuoR5m5Ky44oy
ismodifier is public and was on no page. The output number type section linked the internal param_eltype; it now says what the type is. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7izUDKjuoR5m5Ky44oy
A public name's docstring gives its formula; this one gave it in words. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7izUDKjuoR5m5Ky44oy
There was a problem hiding this comment.
Removes the Device alias and updates every use to Parallel. It also marks State, Secondary, Auto, TRACED_MIN_STRATA, test_adjoint, uses_adjoint and Run as public. The change is sound. I found two small leftovers.
Detail
I checked src, test, docs/src and benchmark for remaining uses of Device as the alias. The only ones left are the test item names listed in the first comment, plus test/item_times.tsv, which is generated and renames itself when the items are renamed. The Device mention at test/unit/gpu_arrays.jl:593 means device arrays, so it is correct. The test_tags.jl regex change is consistent with the removal. I did not run the tests or CI.
About this review
Automated first pass by seabbs-review-bot (Claude sonnet), triggered by: first pass. Not a human review. Comment @seabbs-review-bot to ask for another pass: @seabbs any time, the author's agent once it has pushed changes. Add the no-review label to opt this PR out. Ping @seabbs with any questions.
| @test CR.each!(window_dot!, CR.Parallel(nothing), 0, 0) === nothing | ||
| end | ||
|
|
||
| @testitem "Device: arrays on a device select it" tags = [:threads] begin |
There was a problem hiding this comment.
suggestion Rename the test items that still say Device after the alias was removed.
Why and how to fix
Two items keep the old name:
- Line 77:
"Device: arrays on a device select it". - Line 54:
"each!: Device runs a body as a kernel on JLArrays".
Both now test Parallel, and no Device symbol exists. Rename them to "Parallel: arrays on a device select it" and "each!: Parallel runs a body as a kernel on JLArrays". test/item_times.tsv then regenerates with the new names.
| A traced call runs each step's loop over ``S`` strata as | ||
|
|
||
| ```math | ||
| \begin{cases} |
There was a problem hiding this comment.
suggestion Drop the piecewise ```math block from the TRACED_MIN_STRATA docstring, or allow-list the name.
Why and how to fix
The block restates the sentence above it (one kernel when S is at least the setting, otherwise written out), and the prose after it says the same thing a third time. It adds length without adding information. It looks added to satisfy the maths check in the standards tests. If so, add :TRACED_MIN_STRATA to MATHS_ALLOW in test/package/standards_config.jl, with a comment that it is a setting and not a computation. Then remove the block, the where ``S_{\min}``` line and the duplicate A shorter loop is written out` sentence. Keep one statement of the rule.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7izUDKjuoR5m5Ky44oy
The formula added to the setting's docstring restated its sentence, so the docstring is as it was and the name joins the roles in MATHS_ALLOW. Two test items still named Device. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7izUDKjuoR5m5Ky44oy
|
Pushed 5d41949 for the review's two points.
Rerun on this head: Generated by Claude Code |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7iv2KDpxHFtSvpTQrsG
Drop them from the public list. test_adjoint takes the operator and its positional arguments without a role, so its public signature names no internal type. The developer and explanation pages point to gradient_routes for the route a recurrence takes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7iv2KDpxHFtSvpTQrsG
Nothing in src, ext or the tests calls it, so its marker in the scenario registry goes too. ispointwise stays: the tests and the AD fixtures call it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7iv2KDpxHFtSvpTQrsG
Drop Local from the public list. The parameters page, the extension API table, the branching-process tutorial and the LogExpFunctions page write a closed-form derivative as a step_pullback of a pure step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7iv2KDpxHFtSvpTQrsG
A tuning constant is not public API. Drop it from the public list and from the maths allow-list, and say on the Reactant pages that small traced loops are written out and larger ones run as one kernel, without naming the setting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7iv2KDpxHFtSvpTQrsG
The FFT becomes a method chosen on request and Auto is removed in its own pull request, so it is not made public here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7iv2KDpxHFtSvpTQrsG
…entences Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7iv2KDpxHFtSvpTQrsG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7iv2KDpxHFtSvpTQrsG
Try this Pull Request!Option 1: Julia Package ManagerOpen Julia and type: import Pkg
Pkg.activate(temp=true)
Pkg.add(url="https://github.com/EpiAware/ComposableRecurrences.jl", rev="claude/public-surface")
using ComposableRecurrencesOption 2: Local CheckoutIf you have the repo locally: git checkout claude/public-surface
julia --project=. -e "using Pkg; Pkg.instantiate()" |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7iv2KDpxHFtSvpTQrsG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7iv2KDpxHFtSvpTQrsG
State is public here, and #928 added the field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7iv2KDpxHFtSvpTQrsG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwC7iv2KDpxHFtSvpTQrsG
Finding 3 of #930: the
publiclist against what the docs and docstrings teach, with the owner's decisions applied.Each decision is its own commit, so any one can be dropped.
Device, the older name ofParallelState,Secondary,AutoandTRACED_MIN_STRATApublicStateandSecondarystay public; the two later commits below takeAutoandTRACED_MIN_STRATAback outtest_adjoint,uses_adjointandRunpublictest_adjointstays public; the commit below takes the other two back outismodifieron the extension page and drop an internal linkismodifierwas public and on no pageTRACED_MIN_STRATA's rule as a formulauses_adjointandRuninternaltest_adjoint(backend, op, args...)takes no role, so its public signature names no internal type; the pages point togradient_routesfor the route a recurrence takes_kernel_couplingsispointwisestays, as the tests and the AD fixtures call itLocalinternal and teach closed-form derivatives with the pure stepstep_pullbackTRACED_MIN_STRATAinternalAutoout of the public listAutowidthsfield in theStatedocstringStateis public here, and #928 added the fieldPublic surface
5 exported names and 63 public ones, against 5 and 62 on
main.Recurrence,ConvolutionTimeVarying,PerStratum,PairwisePrimarySecondaryDepletion,Hazard,Floor,TruncateFlow,Share,SplitRedistribute,Allocate,TransformDerived,GatherRecentSurvival,Increments,Normalised,kernel_weights,delay_massesexponential_history,window_sums,contributions,pressuregrowth,growth_gainTrace,Resume,Pressurerecordmarkers;Pressureis also a roleStaterecord = Resume()returns andstate =takesstep,init,step_pullback,traceblocks,isstateless,islinear,nstate,ntrace,trace_rows,ismodifierforward!,pullback!,Step,Initparam,add_param!,param_rows,cotangent,add_cotangent!pullback!PieceInterfacetest_adjointtest_adjoint(backend, op, args...)gradient_routesNoAdjointSerial,Threaded,Parallel,EXECUTORDirect,FFTMethodDirectis the default once the FFT runs only on requestconvert_floatsselect,BatchedDeviceParallelLocalstep_pullbackuses_adjoint,Runtest_adjointtakes no role, andgradient_routesanswers the route questionTRACED_MIN_STRATAAutoparam_eltype,depth,forward,ispointwise,each!What I ran
On Julia 1.13.4, after merging
mainwith #928:Statedocstring missing thewidthsfield Stepwise methods: select strata of a state, shared parameters, batches and the chunked-run contract #928 added, fixed in the last commit.Before #928, on
mainat 3255360:The docs build: doctests and cross-references pass, and the API pages list 66 public and 14 internal bindings; the only errors are the link checks of github.com links, which this container's proxy answers with 403.
The
test/aditems that calltest_adjoint, now without the role: the Mooncake and Enzyme slices, the user-defined types and the FFT convolution gradients on Mooncake and Enzyme reverse, 10,507 pass.What I did not run
test/adand the Reactant suite.Generated by Claude Code