Skip to content

SYN-10419: unified Storm lookup mode, search, and scrape combined#4874

Open
MichaelSquires wants to merge 7 commits intosynapse-3xxfrom
blackout/SYN-10419/storm-lookup
Open

SYN-10419: unified Storm lookup mode, search, and scrape combined#4874
MichaelSquires wants to merge 7 commits intosynapse-3xxfrom
blackout/SYN-10419/storm-lookup

Conversation

@MichaelSquires
Copy link
Copy Markdown
Contributor

No description provided.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.23%. Comparing base (f6ed7e7) to head (08562ca).
⚠️ Report is 6 commits behind head on synapse-3xx.

Additional details and impacted files
@@             Coverage Diff              @@
##           synapse-3xx    #4874   +/-   ##
============================================
  Coverage        96.22%   96.23%           
============================================
  Files              259      259           
  Lines            63206    63216   +10     
============================================
+ Hits             60823    60833   +10     
  Misses            2383     2383           
Flag Coverage Δ
linux 96.23% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MichaelSquires MichaelSquires marked this pull request as ready for review April 9, 2026 19:44
@invisig0th
Copy link
Copy Markdown
Contributor

This PR is looking solid. Have we ( especially anybody who has touched synapse-search ) gotten a chance to think through the "remove the scrape values" vs not idea? It does seem like there could be some that would actually match full text search, like CVE-2026-999999 etc.

synapse/datamodel.py
- Added self._lookup_hints = None cache attribute to Model.__init__()
- Added getLookupHints() method that collects (prop_full_name, cmpr) tuples from:
- Forms whose type has modes.lookup in its info (covers entity:name, it:softwarename)
- Props that directly have modes.lookup in prop.info (covers syn:tag:base)
- Added self._lookup_hints = None cache invalidation in addForm, delForm, _addFormProp, and delFormProp

synapse/lib/ast.py (Lookup.run())
- Replaced the search interface block with hint-based lookups: for each remainder token, iterate through getLookupHints() and lift nodes via view.nodesByPropValu() with the
specified comparator
- Deduplication via s_spooled.Set is preserved
- Bad value/comparator exceptions per-prop are caught and skipped gracefully

synapse/cortex.py
- Removed storm:interface:search config

Tests, docs, changelog — updated to reflect the new behavior.
@MichaelSquires MichaelSquires requested a review from Cisphyx April 13, 2026 16:52
Comment on lines +303 to +313
async with await s_spooled.Set.anit(dirn=view.core.dirn, cell=view.core) as buidset:

todo = s_common.todo('search', tokns)
async for (prio, buid) in view.mergeStormIface('search', todo):
if buid in buidset:
await asyncio.sleep(0)
continue
for tokn in remainder.split():
for prop_name, cmpr in hints:
try:
async for node in view.nodesByPropValu(prop_name, cmpr, tokn):
if node.buid in buidset:
await asyncio.sleep(0)
continue

await buidset.add(node.buid)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
async with await s_spooled.Set.anit(dirn=view.core.dirn, cell=view.core) as buidset:
todo = s_common.todo('search', tokns)
async for (prio, buid) in view.mergeStormIface('search', todo):
if buid in buidset:
await asyncio.sleep(0)
continue
for tokn in remainder.split():
for prop_name, cmpr in hints:
try:
async for node in view.nodesByPropValu(prop_name, cmpr, tokn):
if node.buid in buidset:
await asyncio.sleep(0)
continue
await buidset.add(node.buid)
async with await s_spooled.Set.anit(dirn=view.core.dirn, cell=view.core) as nidset:
for tokn in remainder.split():
for prop_name, cmpr in hints:
try:
async for node in view.nodesByPropValu(prop_name, cmpr, tokn):
if node.nid in nidset:
await asyncio.sleep(0)
continue
await nidset.add(node.nid)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can use nid rather than buid here

offset = info.get('offset')
if match is None or offset is None:
continue
remainder = remainder[:offset] + remainder[offset + len(match):]
Copy link
Copy Markdown
Contributor

@Cisphyx Cisphyx Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to remove up to the next whitespace/end of line rather than potentially removing partial tokens? Seems like prefix matching on a partial string that was leftover might not be ideal

@vEpiphyte vEpiphyte added this to the v3.0.0 milestone Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants