Skip to content

Route text changes on existing terms for CLARA review - #3720

Merged
ubyndr merged 4 commits into
masterfrom
clara-route-existing-term-text
Sep 17, 2026
Merged

ubyndr merged 4 commits into
masterfrom
clara-route-existing-term-text

Conversation

@ubyndr

@ubyndr ubyndr commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Problem

On #3717 the CLARA review routed 1 target out of 12 reviewable changes and ran no literature searches at all (run 33852530599 — tool_calls.jsonl is empty).

Cause: clara_select_targets.py discarded every text_def / comment change on an existing term with reason: "existing_term_text_not_yet_routed". The ntr bundle is the only route carrying prose and is gated on term_is_new. All three terms in that PR are existing terms, so nothing textual was routed — including the definition change on CL:0002170 whose PMID:12014572 was sitting in routing.json under ignored.

Change

Consume stage-1 text_deltas and split by what actually changed:

  • text_revision — prose changed; decompose the new wording.
  • refs_added — prose byte-identical, a reference newly attached. Only the delta refs are routed, so the question is "does this new paper support the existing definition?" rather than re-verifying the whole definition against every ref it has ever carried.

Both are needed together. ROBOT reports an annotated axiom as a removed/added pair (an OWL axiom's identity includes its annotations), so a one-dbxref edit is otherwise indistinguishable from a rewrite.

Also in here:

  • Ref-only edits whose new refs aren't searchable (GOC:, MESH:) are ignored as refs_added_not_searchable rather than routed to a guaranteed uncertain.
  • Text removals are ignored explicitly as text_removal_not_reviewable.
  • Equivalence axioms get validation_mode: validate_equivalent_class_axiom; calling them atomic relationship checks was misleading, since EquivalentTo asserts necessary and sufficient conditions.

Effect on #3717

before after
targets routed 1 5
changes ignored 4 0
refs_added:CL:0000312:1      candidate_refs=['PMID:21316034']    ← only the newly added ref
text_revision:CL:0002170:1   candidate_refs=['PMID:12014572']
text_revision:CL:0002336:1   candidate_refs=[]
text_revision:CL:0002336:2   candidate_refs=[]
relationship:CL:0002336:1    validate_equivalent_class_axiom

CL:0002336's text targets have no searchable refs (GOC:tfm, MESH:D009061, a scielo URL), so they will still come back uncertain — that is the correct answer, not a gap.

Compatibility

Payloads without text_deltas keep the previous behaviour exactly, so this can merge before or after the producing change in Cellular-Semantics/clara_workflow#4. It activates only once stage 1 emits text_deltas.

Testing

Run against all six cached stage-1 fixtures plus a fresh ROBOT diff of this PR's own commits. New terms still route as ntr and are never double-routed as text_revision; obsoleted terms stay excluded; the pre-text_deltas fallback path was verified against the original changes.json artifact from run 33852530599.

Note for later: routing has no test harness in this repo, and it redeclares the change-kind vocabulary that the stage-1 parser owns. Tracked as Cellular-Semantics/clara_workflow#3, which proposes moving selection next to the parser and keeping CL's policy here as data.

🤖 Generated with Claude Code

Existing-term prose was dropped wholesale with reason
existing_term_text_not_yet_routed, so on PR #3717 CLARA routed 1 target out of
12 reviewable changes and ran no searches at all.

Consume stage-1 text_deltas and split by what actually changed:

- text_revision — prose changed; decompose the new wording.
- refs_added — prose byte-identical, a reference newly attached. Only the
  delta refs are routed, so the check is 'does this new paper support the
  existing definition?' rather than a re-verification of the whole definition
  against every ref it has ever carried.

Both are needed together: without the split, ROBOT's removed/added pair makes
a one-dbxref edit indistinguishable from a rewrite.

Also:
- ref-only edits whose new refs aren't searchable (GOC:, MESH:) are ignored as
  refs_added_not_searchable rather than routed to a guaranteed 'uncertain'.
- text removals are ignored explicitly as text_removal_not_reviewable.
- equivalence axioms get validation_mode validate_equivalent_class_axiom;
  calling them atomic relationship checks was misleading.

Payloads without text_deltas keep the previous behaviour, so this can land
before the stage-1 change ships.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ubyndr and others added 3 commits September 4, 2026 17:32
The comment hardcoded ntr/relationship/synonym, so a PR routing 5 targets
reported '0 NTR, 1 relationship, 0 synonym' and the 3 text_revision and 1
refs_added targets were invisible — the breakdown didn't add up to the total.

Also iterate ignored_reason_counts instead of naming two reasons, so a newly
added ignore reason can never go unreported.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Structural targets took candidate_refs from the axiom itself, which for a
logical axiom is always empty — so every EquivalentTo reached the agent with
nothing to check against.

Fall back to the term's definition refs for STRUCTURAL_KINDS, and widen the
term-level pool to include by_term[*].definition_refs from the head state so
a PR that adds a logical definition without touching the text definition still
gets the prose's citations.

Effect on the cached fixtures: CL:0002149 gains 3 PMIDs, CL:0008005 a PMID and
a DOI. CL:0002336 stays empty, correctly — its definition cites only GOC:tfm
and MESH:D009061, i.e. it is uncited.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ubyndr
ubyndr merged commit b6f8476 into master Sep 17, 2026
3 checks passed
@ubyndr
ubyndr deleted the clara-route-existing-term-text branch September 17, 2026 12:00
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