Skip to content

Port over ARAX xCRG and update to TRAPI 2.0 - #174

Merged
maximusunc merged 8 commits into
develfrom
claude/focused-maxwell-9b6e6o
Oct 13, 2026
Merged

maximusunc merged 8 commits into
develfrom
claude/focused-maxwell-9b6e6o

Conversation

@maximusunc

Copy link
Copy Markdown
Collaborator

No description provided.

claude added 3 commits October 9, 2026 21:13
ARAX's connect(action=xcrg) called catrax-xcrg, which is TRAPI 1.x throughout:
it read qualifiers from qualifier_constraints, so every 2.0 MVP2 query failed
with "Phase-one inferred xCRG requires increased/decreased directionality"
(HTTP 500).

xCRG is now vendored at shepherd_utils/arax/xcrg/ from Translator-CATRAX/xCRG
@ e67f2c0 (its latest commit, which RTX master pins) and moved from
translator_tom 1.2.1 to Shepherd's 2.2 (TRAPI 2.0): constraints.qualifiers,
one {ids} binding per qnode/qedge, knowledge_level/agent_type as edge members,
no aux-graph attributes. Shepherd changes on top, listed in each file's
header: lookups send parameters.timeout/tiers; a query dict is read for its
query graph only; the NGD/PMID readers also accept Shepherd's v1.0 artifact
formats; unknown KL/AT values don't crash the ranker; NaN values survive; a
direct lookup filters on its own qedge. Only inferred MVP2 queries route to
xCRG, so one-hop lookups keep ARAX's Expand path.

The mvp2_xcrg_route parity case now runs: same answers, bindings, KG, support
graphs and Retriever lookups as upstream; order, scores and logs differ (the
newer ranker). Adds xCRG's own unit tests (xcrg_suite/), test_xcrg.py, and
DEC-21 in the baseline doc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y9aBGnboPGSDF9Goh7eqap
The ARAX port validates /arax/response/{id} as TRAPI 2.0 with translator_tom
through a stand-in (ResponseCache/response_lookup.py); reasoner-validator only
knows TRAPI <= 1.6 and nothing imports it anymore. Remove it from the arax-api
extra and update the docs that still described it as installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y9aBGnboPGSDF9Goh7eqap
A TRAPI qnode given only by name failed with QueryGraphNoIds: ARAX accepts
the name but never resolves it. ARAXQuery now resolves a qnode with a name
and no ids the way ARAXi's add_qnode(name=...) does (NodeSynonymizer: Name
Resolver, then the Node Normalizer), in one lookup for all named qnodes; an
unknown name is ARAXi's UnresolvableNodeName error.

Set qnodes need no change to match ARAX: like upstream, the port forwards
set_interpretation and member_ids to the KP (the trapi_set_interpretation_all
golden shows it) and does no set logic itself. Retriever does not support set
queries, so those answers are empty. Corrects D-25 and the docs, which said
member_ids were not forwarded.

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

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.66356% with 504 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.19%. Comparing base (5f7ecb7) to head (5878730).
⚠️ Report is 1 commits behind head on devel.

Files with missing lines Patch % Lines
shepherd_utils/arax/xcrg/runner.py 75.13% 48 Missing and 44 partials ⚠️
shepherd_utils/arax/xcrg/retriever.py 63.22% 57 Missing and 32 partials ⚠️
shepherd_utils/arax/xcrg/ranking.py 64.85% 72 Missing and 12 partials ⚠️
shepherd_utils/arax/xcrg/debugging.py 41.57% 52 Missing ⚠️
shepherd_utils/arax/xcrg/ngd.py 64.84% 33 Missing and 12 partials ⚠️
shepherd_utils/arax/xcrg/biolink.py 61.29% 27 Missing and 9 partials ⚠️
shepherd_utils/arax/xcrg/utilities.py 68.08% 27 Missing and 3 partials ⚠️
shepherd_utils/arax/xcrg/context.py 77.60% 22 Missing and 6 partials ⚠️
shepherd_utils/arax/xcrg/pmid.py 69.44% 16 Missing and 6 partials ⚠️
shepherd_utils/arax/xcrg/trapi.py 75.00% 6 Missing and 8 partials ⚠️
... and 2 more
Files with missing lines Coverage Δ
shepherd_utils/arax/ARAX_connect.py 67.55% <100.00%> (ø)
...hepherd_utils/arax/ARAX_query_graph_interpreter.py 38.36% <100.00%> (-0.08%) ⬇️
shepherd_utils/arax/xcrg/__init__.py 100.00% <100.00%> (ø)
shepherd_utils/arax/xcrg/config.py 100.00% <100.00%> (ø)
shepherd_utils/arax/xcrg/constants.py 100.00% <100.00%> (ø)
shepherd_utils/arax/xcrg/memory.py 100.00% <100.00%> (ø)
shepherd_utils/arax/xcrg/models.py 100.00% <100.00%> (ø)
shepherd_utils/arax/xcrg/queries.py 100.00% <100.00%> (ø)
workers/arax/worker.py 84.19% <100.00%> (+0.21%) ⬆️
shepherd_utils/arax/ARAX_query.py 65.17% <88.88%> (+0.96%) ⬆️
... and 11 more

... and 4 files 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 5ac814d...5878730. 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.

--target arax sends each case's TRAPI 2.0 query in its 1.6 form
(parameters.log_level/bypass_cache become top-level fields, timeout is dropped,
constraints.qualifiers/attributes become qualifier_constraints/
attribute_constraints, required_intermediate_categories becomes
intermediate_categories, COLLATE becomes is_set). Responses are checked to be
TRAPI 1.x, then raised to 2.0 with translator_tom's dict converter so the
existing checks read them. Cases where Shepherd deliberately differs carry
upstream's expectation (QueryGraphNoIds for a qnode name, MissingQEdgeAndQPath,
rtx-kg2 for single-node queries, log_level ignored); cases that only test
Shepherd (its 400 for TRAPI 1.x spellings, the UI's X prefix) are skipped.
Autocomplete is called on the API's host, as the UI does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y9aBGnboPGSDF9Goh7eqap
…process ARAX

Sets parameters.arax_internal: true on every query, so the arax worker runs
its ARAX port whatever ARAX_INTERNAL_DEFAULT says. Without it, a worker on the
default legacy path proxies to the remote ARAX service, whose TRAPI 1.6
answers fail the script's 2.0 checks. Refused with --target arax.

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

- message_uris on a stored 2.0 response failed in filter_results' prune_kg
  ("'NoneType' object has no attribute 'items'"): TRAPI 2.0 omits an empty
  auxiliary_graphs, so the loaded message had None where upstream's actions
  expect a dict. ARAXQuery now restores the empty auxiliary_graphs /
  knowledge_graph.edges on the message a plan starts from; the 2.0 envelope
  drops them again on the way out.
- ARAX's own log entries ignored parameters.log_level: the worker put them in
  the query's log store unfiltered. save_arax_logs now keeps only entries at or
  above the task logger's level, as Shepherd's own records are.
- test_arax_queries: lookup_single_node is TRAPI 2.0's one-node query graph (no
  edges; 1.6's edges: {} for --target arax) instead of an empty edges map,
  which 2.0 forbids; val_no_edges_or_paths becomes val_empty_edges (Shepherd's
  400 for that empty map). dsl_overlay_clinical_info is a known defect (D-29:
  a live cohd.io call). A Retriever 422 on a hop prints the
  OPENAPI__X_TRAPI__BATCH_SIZE_LIMIT hint.

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

lookup_three_hop's FET error came after 10,000 aux-graph warnings, so the
12 lines printed were all warnings and the traceback that explains the failure
was cut.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y9aBGnboPGSDF9Goh7eqap
Found by test_arax_queries' lookup_three_hop against a live Retriever: an
unbound (support-graph) edge whose qnode-bound endpoint _remove_dead_end_paths
later prunes is merged back into the KG without that node, and the three-hop
template's Fisher's exact test fails with a KeyError on it. Same code on RTX
master; kept as upstream does it (DEC-1) and recorded in Part D, with the fix
noted. lookup_three_hop is now an expected failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y9aBGnboPGSDF9Goh7eqap
@maximusunc
maximusunc merged commit 2534c2a into devel Oct 13, 2026
2 checks passed
@maximusunc
maximusunc deleted the claude/focused-maxwell-9b6e6o branch October 13, 2026 20:38
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.

2 participants