Fix issues inheriting Spina options for attribute promoting/merging.
Review Request #13528 — Created Feb. 6, 2024 and submitted — Latest diff uploaded
A big feature in Spina 2.1 was inheritance of the Spina options for
prototypeAttrs
andautomergeAttrs
. 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:
automergeAttrs
was processed beforeprototypeAttrs
, which meant
that any attributes defined as static would override any attributes
that were merged.Functions (such as
defaults()
orevents()
) could not be
auto-merged. It would try, but would fail.Auto-merging could fail to see prototype attributes on the new class,
instead prioritizing parent classes.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.