Skip to content

Harden id()-keyed posterior caches with weakrefs (ProxySVAR, MaxShare, LongRunRestriction) #203

Open

Description

@thomaspinder

From review of #200. Three schemes now key memoisation on id(posterior) (ProxySVAR on main, MaxShare on #200, LongRunRestriction on #183). If a dead posterior's address is reused by a new object of matching shape, a stale cached result returns silently (did not reproduce in 200 forced GC attempts, but the exposure is real). Approach: store weakref.ref(posterior) as a validity token (dead ref ⇒ cache miss) in one pass across all three schemes after both branches merge. Files: src/impulso/identification.py. Related: #186 (spectral-radius dedupe).

Activity

  1. thomaspinder commented on Jul 29, 2026

    @thomaspinder
    CollaboratorAuthor

    Main-branch half is up as the PR above: _PosteriorCache + ProxySVAR ported. The MaxShare (#200) and LongRunRestriction (#183) adoptions are one-liners recorded in the helper's docstring — I'll fold them into each branch's post-merge rebase rather than stacking two more PRs now. This issue closes when both adoptions land.

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

    internalInternal improvements (refactor, test, chore)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions