Skip to content

Native graph engine: exact security_auditor reach counts (no 500 cap) #3040

Closed

Description

@squid-protocol

Part of #3033.

Scope

Replace nx.descendants / nx.ancestors with a capped BFS on the shared index that stops at 500 and excludes the start node.

Fix the existing fallback's two divergences:

  • start node counted when it is in a cycle
  • cap overshoot (cap is checked once per popped node, so it can overshoot 500)

Acceptance criteria

  • Equal to min(len(nx.descendants), 500) / ancestors for every node on the harness
  • One implementation for both modes

Relevant baseline

operation networkx notes
descendants + ancestors (all nodes) 22.0 ms

Networkx conventions to match

  • nx.descendants(G, path): return the descendants of a node in the directed graph
  • nx.ancestors(G, path): return the ancestors of a node in the directed graph
  • Capped at 500 per node in the engine
  • A pure-Python BFS fallback (get_nth_degree) already exists but differs in two edge cases

Activity

  1. added
    enhancement
    metrics
    core-engine
    on Sep 14, 2026
  2. squid-protocol commented on Sep 14, 2026

    @squid-protocol
    OwnerAuthor

    Revised by the tailoring decisions on #3033 (2026-09-14).

    • Remove the 500 cap: reach counts become exact. The largest observed on crucible is 185, so the cap never binds there, and exact is cheap.
    • Suggested machinery:
    • Oracle: uncapped len(nx.descendants(G, n)) / len(nx.ancestors(G, n)) (the start node is excluded).
    • Acceptance:
      • exact parity
      • one implementation for both modes
      • total_upstream / total_downstream in the audit JSON change only where the cap used to bind (none on crucible, so the golden masters should be unchanged there)
  3. changed the title [-]Native graph engine: security_auditor reach counts via capped BFS[/-] [+]Native graph engine: exact security_auditor reach counts (no 500 cap)[/+] on Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    core-engineenhancementmetricsperformance

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions