• 
      

    Fix issues inheriting Spina options for attribute promoting/merging.

    Review Request #13528 — Created Feb. 6, 2024 and submitted — Latest diff uploaded

    Information

    Spina
    master

    Reviewers

    A big feature in Spina 2.1 was inheritance of the Spina options for
    prototypeAttrs and automergeAttrs. The idea was to fix the issue
    where, if you don't keep re-introducing the same properties in each
    subclass, the options would be lost for their subclasses. We never
    released 2.1 because this ended up causing significant unit test
    regressions in Review Board.

    There were a a few primary reasons it didn't work as expected:

    1. automergeAttrs was processed before prototypeAttrs, which meant
      that any attributes defined as static would override any attributes
      that were merged.

    2. Functions (such as defaults() or events()) could not be
      auto-merged. It would try, but would fail.

    3. Auto-merging could fail to see prototype attributes on the new class,
      instead prioritizing parent classes.

    4. State wouldn't always be copied back to the prototypes after merging.

    This change alters the ordering, implements some more careful management
    of the state, handles function merging, and carefully accesses the
    correct attributes to auto-merge on the new class.

    Unit tests pass in Review Board and Spina.

    Commits

    Files