Skip to content

Aragorn pathfinder update - #175

Merged
maximusunc merged 15 commits into
develfrom
aragorn_pathfinder_update
Oct 16, 2026
Merged

maximusunc merged 15 commits into
develfrom
aragorn_pathfinder_update

Conversation

@uhbrar

@uhbrar uhbrar commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

Updates ARAGORN pathfinder to use a middle-first search on a sparse backbone generated from the graph to find candidate paths, then scores those paths using a transformer model that is path-length-agnostic, allowing for any-length paths to be scored and ranked together.

@uhbrar
uhbrar requested a review from maximusunc October 15, 2026 13:55
uhbrar and others added 4 commits October 15, 2026 09:56
- Format workers/score_paths/scorer.py with black.
- Stand in for the pathfinder's process pool in the tests that call
  shadowfax directly; only poll_for_tasks creates it.
- The edge lookups send the worker's own retrieval parameters, and
  merge_message no longer assembles pathfinder results, so the tests
  now check that contract instead of the old 3-hop behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0199gZCRjpeS9RvKBMnY7RjJ
@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.58721% with 51 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.53%. Comparing base (5878730) to head (2c9a0b5).
⚠️ Report is 1 commits behind head on devel.

Files with missing lines Patch % Lines
workers/aragorn_pathfinder/worker.py 87.93% 29 Missing and 6 partials ⚠️
workers/score_paths/scorer.py 97.90% 2 Missing and 4 partials ⚠️
shepherd_utils/db.py 87.17% 5 Missing ⚠️
workers/score_paths/worker.py 76.19% 4 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
shepherd_server/base_routes.py 87.38% <100.00%> (+1.32%) ⬆️
shepherd_utils/config.py 98.75% <100.00%> (+0.01%) ⬆️
shepherd_utils/data_download.py 83.03% <100.00%> (+0.20%) ⬆️
shepherd_utils/trapi.py 87.15% <100.00%> (+0.68%) ⬆️
workers/merge_message/worker.py 91.07% <100.00%> (+4.66%) ⬆️
shepherd_utils/db.py 72.94% <87.17%> (+0.57%) ⬆️
workers/score_paths/worker.py 60.00% <76.19%> (+60.00%) ⬆️
workers/score_paths/scorer.py 97.90% <97.90%> (ø)
workers/aragorn_pathfinder/worker.py 83.23% <87.93%> (+13.74%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2534c2a...2c9a0b5. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Retriever is removing its batch_size_limit, so the interior hops no
longer need splitting into blocks of 300 ids a side: they go out as one
lookup pinning every near node against every far node.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0199gZCRjpeS9RvKBMnY7RjJ
- search_paths is checked against a brute-force enumeration on random
  graphs: every centre's cheapest loopless path, cheapest first.
- edge_lookups, build_paths and build_paths_task, plus a shadowfax run
  over a small backbone with the search done for real.
- scorer: path reading (phrases, qualifiers, negation, categories),
  features, and score_message with a fake model; the score_paths worker's
  save and failure handling. torch is not a test requirement, so a small
  stand-in is installed when it is missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0199gZCRjpeS9RvKBMnY7RjJ
- build_paths takes gandalf's inferred edge on an endpoint as the hop, not
  the child's own edge, and the orphan filter keeps its support graph.
- A dropped path is counted by where its empty hop is, and the first such
  hop is named with whether its nodes came back.
- On the backbone every lookup (the open endpoint ones and the many-id
  interior one) is a valid TRAPI 2.0 query with the worker's parameters and
  its own callback, and the paths are built and saved; a
  required_intermediate_categories constraint reaches the build and is kept
  to. test_shadowfax_searches_the_backbone shares their setup.
- merge_message accumulates several lookups' knowledge graphs under the
  pathfinder's own query graph.
- The search graph download extracts its CSR and node list, and refuses an
  archive without nodes.txt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@uhbrar
uhbrar force-pushed the aragorn_pathfinder_update branch from 2536ac0 to a990f94 Compare October 16, 2026 03:20
The callback's debug line printed the lookup's whole query graph, and a
pathfinder lookup pins thousands of curies. A node with more than ten
ids now logs as "N curies".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0199gZCRjpeS9RvKBMnY7RjJ
Parsing a large callback holds the GIL for seconds, long enough for
uvicorn's supervisor to take the worker for hung and kill it, which lost
the callback and left its query waiting out its timeout.

The callback route now stores the body as it came: a zstd frame that
carries its content size as is, anything else (re)compressed into one,
all in a thread since zstd releases the GIL. A body that doesn't start
like a JSON object is still refused with a 422. merge_message parses it
instead, fills in missing results and knowledge graph, logs the result
counts and the query graph, and skips a callback it can't read rather
than failing the batch. decode_message now reads streaming frames too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0199gZCRjpeS9RvKBMnY7RjJ
@maximusunc
maximusunc merged commit 0853f1c into devel Oct 16, 2026
2 checks passed
@maximusunc
maximusunc deleted the aragorn_pathfinder_update branch October 16, 2026 20:09
maximusunc pushed a commit that referenced this pull request Oct 16, 2026
Brings in the ARAGORN pathfinder backbone search and the new path scorer
(#175), and callbacks stored without parsing them in the server, ported to
TRAPI 1.x:
- aragorn.pathfinder builds paths with 1.x bindings ([{"id", "attributes"}]
  node bindings, [{"id"}] path bindings, aux graphs with attributes), reads
  the path constraint's intermediate_categories, and saves with save_message.
- score_paths reads 1.x node and path bindings and saves with
  save_message_sync.
- summarize_query_graph lives in shepherd_utils/query_graph_log.py, since
  shepherd_utils/trapi.py (2.0 helpers) stays deleted on this branch.
- Tests ported to 1.x shapes; checks that lookups validate as TRAPI 2.0
  become checks of the one-hop lookup's shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TtsBikU9y9AFQ5uu9tcioz
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.

3 participants