SYN-10404: Implement Storm event callbacks in the data model#4800
Open
invisig0th wants to merge 19 commits intosynapse-3xxfrom
Open
SYN-10404: Implement Storm event callbacks in the data model#4800invisig0th wants to merge 19 commits intosynapse-3xxfrom
invisig0th wants to merge 19 commits intosynapse-3xxfrom
Conversation
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (90.08%) is below the target coverage (97.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## synapse-3xx #4800 +/- ##
===============================================
- Coverage 96.46% 96.46% -0.01%
===============================================
Files 256 256
Lines 62472 62503 +31
===============================================
+ Hits 60266 60291 +25
- Misses 2206 2212 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
… onto synapse-3xx) Add ``on`` key support in data model property and form info declarations for Storm event callbacks. Callbacks run as root user and are guarded by migration/safemode checks. Convert it:dev:str _onFormItDevStr to declarative Storm on:add callback.
Update runOnStorm to resolve the user from the current Storm runtime scope rather than always using root. The callback still runs with asroot=True for elevated permissions.
Replace the 4 Python hook callbacks for inet:fqdn (onAddFqdn, onSetFqdnIsSuffix, onSetFqdnIsZone, onSetFqdnZone) with declarative Storm on-event callbacks. Remove the hooks infrastructure from the data model, cortex, and editor since it is no longer used.
…f using getattr()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New: Declarative Storm
oncallbacks in the data modelForms and Props can now declare Storm queries that run automatically on lifecycle events via an
'on'key in their info dict:datamodel.py:Propparseson.set.q/on.del.q;Formparseson.add.q/on.del.q. Storm callbacks execute after Python callbacks inwasSet(),wasDel(),wasAdded(),wasDeleted(). AddedpostFormInit()lifecycle hook so type classes can register Python callbacks on the fully-constructedForm.view.py: AddedrunOnStorm(node, storm)— executes Storm as the calling user withasrootelevation, guarded by migration/safemode checks.Removed: Old
hooksinfrastructurecortex.py: Removed_propSetHooksdict,_setPropSetHook(), and_callPropSetHook().editor.py: Removed_callPropSetHookcall fromProtoNode.set().datamodel.py: Removedhooksdict loading loop from model definitions.inet:fqdncallbacks: Python on the type classinet.py: Zone/suffix callbacks are now methods on theFqdntype class, registered viapostFormInit():_onAddFqdn,_onSetIsSuffix,_onSetIsZone,_onSetZone. Old module-level callbacks, thehooksdict inmodeldefs, and Stormonkeys oninet:fqdnand its props are all removed.it:dev:str: Stormon:addcallbackinfotech.py: Old_onFormItDevStrPython callback replaced with declarative'on': {'add': {'q': '[ :norm=$node ]'}}.Test plan
test_storm_on_callbackscoverson:add,on:set,on:delcallbacksit:dev:strnorm callback works via Stormtest_model_inet.pytests pass (53 tests)test_cortex.pytests pass (185 tests)