Repository navigation
Migrate off deprecated Synapse APIs and fail tests that use them - #47
Merged
Merged
Conversation
- Replace $lib.dict()/$lib.list() with ({})/([]) literals (dnsstorm, ipinfo, stix).
- Use synapse_version instead of synapse_minversion in every package, and
cmdinputs instead of the deprecated command forms key.
- Import synapse.tools.storm.pkg.gen instead of the deprecated
synapse.tools.genpkg, here and in the package build scripts.
- Fix hfeed and stormcli for current Synapse: synapse.tools.feed no longer has
makeargparser() and synapse.tools.storm no longer exports StormCli.
- Use aiohttp's timeout argument instead of the deprecated read_timeout.
- Fix the ipinfo Authorization header, it was a plain string, not a format string.
- Require synapse>=2.225.0, where the tools moved.
- Add tests/conftest.py, which fails any test that logs a Synapse deprecation,
and turn Python DeprecationWarnings from stormlibpp into errors.
- Patch bump every Storm package.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KBLBzjs3FWt5tMeTsVjC79
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KBLBzjs3FWt5tMeTsVjC79
Owner
Author
|
Claude code review to remove multiple deprecated features in Storm and Python code |
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.
Audits StormLib++ against everything Synapse 2.256.0 (the last 2.x release) marks deprecated, migrates off it, and makes the tests fail when deprecated Synapse APIs are used.
Deprecated usage fixed
$lib.dict()/$lib.list()({})/([])literalssynapse_minversionpackage keysynapse_version: ">=2.162.0,<3.0.0"formskeycmdinputs, or dropped where there were no inputssynapse.tools.genpkgstormlibpp.stormpkg,scripts/pkgs/*.sh, docssynapse.tools.storm.pkg.gensynapse.tools.feedstormlibpp.hfeedsynapse.tools.cortex.feedread_timeoutHttpCortextimeout=aiohttp.ClientTimeout(total=None, sock_connect=30), which behaves the same as beforeFixes
hfeed,hstorm, andimportwere broken on current Synapse.synapse.tools.feed.makeargparser()is gone, andsynapse.tools.stormno longer exportsStormCli/StormCompleter/welcome(they live insynapse.tools.storm._cli).Authorizationheader was a plain double-quoted string, so it sent the literal textBearer {$token}. It's a backtick format string now.Deprecation checks in pytest
Synapse reports deprecations through log messages, not Python's
warningsmodule, sofilterwarningscan't catch them. The newtests/conftest.py:synapseloggers and from Stormwarnmessages for each test, and fails the test if it finds any;@pytest.mark.allow_synapse_deprecations.pyproject.tomlalso makes PythonDeprecationWarnings raised fromstormlibpperrors. The dnsstorm test'sstormHasNoWarnErrcheck, commented out over the$lib.dict()warnings, is back on.Other changes
synapse>=2.225.0,<3(was>=2.139.0), since that's where the new tool module paths appeared. The Pipfile'ssynapse = "*"gets the same range.Testing
pytest testsagainst Synapse 2.256.0: 30 passed, with no Synapse deprecations inside or outside tests. Before this change the same suite had 5 errors from deprecations, plus thegenpkgimport deprecation.python -m synapse.tools.storm.lint src/pkgsreports no$lib.dict()/$lib.list().Not in this PR
slib.stix.ingest.storm:16,slib.stix.lib.storm:17), so it can't load into a Cortex. Several files also call$lib.debug(...), but$lib.debugis a boolean, not a function.--v3-readylint findings (ex.$lib.true,$lib.globals.get(),$lib.user,inet:ipv4) aren't deprecated in 2.x, so they're left alone.synapse.tools.genpkgdeprecation they log at import.Generated by Claude Code