Skip to content

Traversal v1 (4/4): Python client methods and traverse.md - #711

Open
adamant-pwn wants to merge 40 commits into
codex/traversal-v1-c-cli-serverfrom
codex/traversal-v1-d-client-docs
Open

adamant-pwn wants to merge 40 commits into
codex/traversal-v1-c-cli-serverfrom
codex/traversal-v1-d-client-docs

Conversation

@adamant-pwn

@adamant-pwn adamant-pwn commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Last of four stacked PRs for labeled traversal, on #710.

This PR adds GraphClient.resolve() and GraphClient.traverse() to the Python client, and metagraph/docs/traverse.md. The document covers the routes and the CLI, the request and response schemas, the walk rule, the end reasons, the bounds and what version 1 leaves out of gr/labeled-traversal. An integration test runs the client against a server.

No caller uses the client methods yet: the staging service calls the HTTP routes directly. They give Python users the same access to the experimental routes that search() and align() give to the others.

Co-authored-by: Gunnar Rätsch

🤖 Generated with Claude Code

Last piece of the labeled-traversal v1 stack.

- GraphClientJson.resolve() / .traverse() and their GraphClient
  wrappers: the /resolve and /traverse requests of a server started with
  --experimental-traverse, returning the parsed JSON.
- docs/traverse.md: the routes, the CLI, the v1 request and response
  schemas, the walk rule, the end reasons and the bounds.
- An integration test of the client against the server.

Based on the traverse.md of #670 (metagraph/docs/traverse.md); the
request and response fields from d5d26ba metagraph/src/cli/traverse.cpp.

Co-authored-by: Gunnar Rätsch <Gunnar.Ratsch@ratschlab.org>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adamant-pwn
adamant-pwn added this pull request to stack #714 November 3, 2026 20:00
adamant-pwn and others added 17 commits November 8, 2026 19:34
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…se.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
traverse.md: the split limit ends a path with max_splits_per_path and
truncates the arm; max_output_bp is gone; seed label lists are capped at
100,000 and the time budget is at least 1 ms. The GraphClient resolve and
traverse wrappers now pass timeout to GraphClientJson.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adamant-pwn
adamant-pwn marked this pull request as ready for review November 9, 2026 02:22

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 3 files

Architecture diagram
sequenceDiagram
    participant User as Python User
    participant GC as GraphClient
    participant GCJ as GraphClientJson
    participant HTTP as HTTP Layer (_do_request)
    participant Server as Server (--experimental-traverse)
    participant Routes as /resolve, /traverse Routes
    participant Index as Graph Index + Annotation

    Note over User,GC: NEW: Python client methods for labeled traversal

    User->>GC: resolve(sequence, labels/discover, select)
    GC->>GCJ: resolve(sequence, labels, discover, select)
    GCJ->>GCJ: Build payload {sequence, labels|discover, select}
    Note over GCJ: Exactly one of labels/discover
    GCJ->>HTTP: _do_request('resolve', payload)
    HTTP->>Server: POST /resolve
    Server->>Routes: Route request
    Routes->>Index: Resolve labels on sequence
    Index-->>Routes: Support profile + seeds
    Routes-->>Server: JSON response
    Server-->>HTTP: Response
    HTTP-->>GCJ: json_obj
    GCJ-->>GC: Support profile dict
    GC-->>User: Profile with selection

    User->>GC: traverse(seeds, strategy)
    GC->>GCJ: traverse(seeds, strategy)
    GCJ->>GCJ: Build payload {seeds, strategy?}
    GCJ->>HTTP: _do_request('traverse', payload)
    HTTP->>Server: POST /traverse
    Server->>Routes: Route request
    Routes->>Index: Walk seeds under labels
    Index-->>Routes: Extension results per seed
    Routes-->>Server: JSON response
    Server-->>HTTP: Response
    HTTP-->>GCJ: json_obj
    GCJ-->>GC: Results dict
    GC-->>User: Results

    alt Invalid strategy field
        User->>GC: traverse(seeds, {unknown: 1})
        GC->>GCJ: traverse(seeds, strategy)
        GCJ->>HTTP: _do_request('traverse', payload)
        HTTP->>Server: POST /traverse
        Server->>Routes: Validate schema
        Routes-->>Server: HTTP 400
        Server-->>HTTP: Error response
        HTTP-->>GCJ: Raise RuntimeError
        GCJ-->>GC: Exception propagates
        GC-->>User: RuntimeError raised
    end

    Note over User,Index: Routes gated unless server started with --experimental-traverse
Loading

Shadow auto-approve: would not auto-approve because issues were found.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread metagraph/docs/traverse.md Resolved
Comment thread metagraph/docs/traverse.md Resolved
Comment thread metagraph/docs/traverse.md Resolved
Comment thread metagraph/docs/traverse.md Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 1 file (changes from recent commits).

Shadow auto-approve: would not auto-approve because issues were found.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread metagraph/docs/traverse.md Resolved
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.

1 participant