Skip to content

Expose core composition infrastructure as public API for extensibility #184

Open

Description

@seabbs-bot

From #76 review (src/latent_models/models/MA.jl:66).

We need good support for users extending the package with new components, so core infrastructure can't live in private (underscore) functions. We should review, try to simplify, rename, and expose the bits that custom-component authors need as public API — and add these to the 'writing custom components' docs.

(Relates to #76's _at, as_turing_submodel, the accumulation-step machinery, etc.)


From @seabbs review of #76. This was opened by a bot. Please ping @seabbs for any questions.

Activity

  1. seabbs-bot commented on Aug 18, 2026

    @seabbs-bot
    CollaboratorAuthor

    PR #282 makes the prior-slot widening seam a custom component's constructor
    and recursion call directly public (documented, not exported):

    • at(p, t) — read a possibly time-varying parameter at step t
    • path_prior(p) — widen a raw prior into a length-n PATH prior
    • prior_order(p) — the order (p/q/d) implied by a prior slot
    • assert_prior_length(p, k, what) — check a vector slot's length

    matching the level already set for ModelShape/across_shape/
    infection_strata/AbstractAccumulationStep. The old _-prefixed names
    are kept working as aliases, so this is non-breaking. All four now have
    docstrings (previously only _at did).

    The renewal step/modifier half of this (AbstractRenewalModifier,
    modifier_init_state, apply_modifier, the composed RenewalStep) was
    already made public by #245, and the Renewal constructor already takes
    modifiers directly — see the comment just posted on #173.

    Deliberately left private: _ErrorDist/_TrialDist — internal performance
    structs coupled to the built-in observation-error models' own scoring loops,
    not part of the seam a new component composes against.

    Not done by this PR, so leaving this open rather than closing: the "writing
    custom components" doc page this issue also asks for, that would gather
    these newly-public names (and as_turing_submodel, the accumulation-step
    machinery already public) into one extension-focused tutorial. That's a
    docs-writing task on its own, separate from the API-surface change here.

    This was commented on by a bot. Please ping @seabbs for any questions.

  2. seabbs-bot commented on Aug 20, 2026

    @seabbs-bot
    CollaboratorAuthor

    Re-checked against main at 1a3e485 (after #282 merged). Half of this is done, the other half is not, so it stays open on the documentation ask.

    Met — the underscore helpers are public API. #282 renamed _at, _path_prior, _prior_order and _assert_prior_length to at, path_prior, prior_order and assert_prior_length, gave all four docstrings, and declared them public (src/ComposableTuringIDModels.jl:142). The old names are kept as aliases of the same generic function, so nothing breaks. Confirmed on main: Base.ispublic is true for all four.

    These sit alongside the extension points already public before this round: ModelShape, across_shape, infection_strata, AbstractAccumulationStep, the renewal step and modifier interfaces, and MissingObservations. as_turing_submodel is exported.

    Not met — the docs page. This issue asks for these to be added to a "writing custom components" page. There is no such page. docs/src contains overview.md, design.md, getting-started/ and tutorials/, and grepping docs/src for "custom component" and "writing your own" returns nothing. #282 says so in its own body rather than claiming otherwise.

    One judgement worth recording. #282 deliberately left _ErrorDist and _TrialDist private, on the grounds that they are internal performance structs coupled to the built-in error models' scoring loops rather than part of the seam a new component composes against. That is a defensible line but it is a decision, not a completed item, so it is worth confirming when the docs page is written.

    Left open for the "writing custom components" page.

    This was written by a bot. Please ping @seabbs for any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions