Skip to content

Record why some answers have no citations, and the option to change it - #245

Merged
adamjohnwright merged 2 commits into
mainfrom
docs/userguide-citation-option
Sep 18, 2026
Merged

adamjohnwright merged 2 commits into
mainfrom
docs/userguide-citation-option

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

Documentation only. Found while answering a question the website asked about event ordering — the measurement turned up something neither of us knew.

Some answers have no citations, by construction

"How do I use the pathway browser?" returns 0 citations and 452 tokens. Not a failure: a citation carries st_id, a Reactome stable identifier, and only the Reactome and disease-variant collections have them. The userguide collection indexes documentation pages whose metadata is a page URL, so nothing there can become a citation in the contract's shape.

Worth writing down because it is the opposite of what testing would suggest:

  • it correlates with the fastest answers (the userguide question is also the 3.3s-to-first-token one), so it is common rather than exotic
  • the four questions anyone would naturally reach for all produce citations, so it is exactly the case a reasonable test pass misses

The website had this right in their panel already — heading and list inside one conditional — but untested, which they have now fixed at two levels.

Citations always precede prose, and that is structural

Measured across five questions: every one producing both had its last citation at event 11 and first token at event 12, no interleaving. But the useful part is the reason, not the samples — citations are emitted only on on_retriever_end, and token events are gated on that same event, because retrieval completing is how the answer's tokens are told apart from the query expander's.

So "sources are complete when the first token arrives" is a design fact a caller can rely on, not a timing observation that might not hold next week.

Open, not scheduled: citing userguide pages

Proposed by the website session, agreed in shape, deliberately not scheduled. A documentation URL does not fit {st_id, display_name}, and a fabricated R- id is not an option — it would resolve to nothing, or worse to the wrong entity. An optional sibling works, exactly one of the two present:

{"st_id": "R-HSA-8862803", "display_name": "..."}             # unchanged
{"url": "/userguide/pathway-browser", "display_name": "..."}  # new

A consumer that understands only st_id keeps working by skipping what it does not recognise. Recorded as T020b; Adam's call, and not a blocker — an answer honest about having no sources beats an invented one.

🤖 Generated with Claude Code

adamjohnwright and others added 2 commits September 18, 2026 05:36
Found by measuring citation ordering for the website: a userguide question
returns 0 citations and 452 tokens. Not a failure -- a `citation` carries a
Reactome stable id, and the userguide collection indexes documentation pages
whose metadata is a page URL, so there is nothing that can become one.

Worth writing down because it is the opposite of what testing would suggest. It
correlates with the *fastest* answers, so it is common rather than exotic, and
the four questions anyone would naturally reach for all produce citations.

Also records that citations always precede prose, and why that is structural
rather than a timing accident: they are emitted on `on_retriever_end`, and token
events are gated on the same event because retrieval completing is how the
answer's tokens are separated from the query expander's. That makes "sources are
complete when the first token arrives" a design fact a caller can rely on.

The option to cite userguide pages is recorded in the shape the website proposed
and I agreed -- an optional `url` sibling, never a fabricated `R-` id, which
would resolve to nothing or to the wrong entity. Not scheduled, and Adam's call.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Four IDs were duplicated, all by me: I added T021, T022, T023 and T020b across
three PRs today without checking that Phase 5 already used them. Mine are
renumbered rather than Phase 5's, because the older ones are referenced by the
dependency notes.

The list had also drifted from the code in both directions. Marked done after
verifying each rather than from memory: the branch and baseline (T001, T002),
the shared graph via lifespan (T004), the streaming surface (T005) and its
more-than-one-token test (T006), spec 009 routing (T021 -- landed and live, and
the main reason first-token fell from the ~36s once recorded to 9.6s), telling
the website (T023), and recording the measured times (T024).

T003 named tests/api/test_middleware_scope.py, which was never written. The
behaviour it asked for is tested, in tests/util/test_captcha_scope.py, because
the decision moved into a module that can be tested without an app. Recorded
where it actually lives rather than left looking undone.

T020b's "~16s of preprocessing" is corrected. It never reproduced, it was 5.1s
before the two-round change and is 2.6s after, and the sequential half of that
question is answered. What remains is whether a search-page question needs all
four calls at all.

32 done, 5 open, and the five are genuinely open.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@adamjohnwright
adamjohnwright merged commit 0ce5f2f into main Sep 18, 2026
10 checks passed
@adamjohnwright
adamjohnwright deleted the docs/userguide-citation-option branch September 18, 2026 05:47
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