pediatric-ai-scribe-v3/test
Daniel 0e1e74882e feat: sources are numbered in the order the answer cites them
Borrowed from the quiz app's AI Mode, where validating citations and
ordering them fall out of the same pass: it collects the sources an
answer actually used into an insertion-ordered map, so the list comes
back in first-citation order for free.

Ours listed sources in retrieval order — an order the reader never sees
and has no way to follow. An answer whose first citation was [7] opened
a list that began at [1], so matching a marker to a source meant
hunting. Reference lists in published writing are numbered by first
appearance for exactly this reason.

Cited sources now come first, renumbered by first appearance, and the
markers in the text are rewritten to match. Anything retrieved and not
cited keeps its place after them, labelled "not cited" — the panel is
also a view of what the search returned, which is worth keeping, but it
should not sit among the numbers the answer used.

The marker itself now shows its number instead of the word "src". Every
citation read identically, so the only way to tell one from another was
to hover it — which made the numbered list beneath useless to match
against. The export has shown numbers since the day "src" was
introduced, with no recorded reason for the difference.

Renumbering happens once the whole answer is known, never while
streaming: the order is the order of first citation, so a citation that
has not arrived yet cannot take its place, and numbers would shuffle
under the reader mid-sentence. The text is rewritten in a single pass —
number by number would turn 2 into 1 and then that 1 into whatever 1
maps to.

An invented citation reserves no position and is left exactly as it was.
It is still not turned into a link, and citation_audit still records it;
what matters here is that it cannot push a real source down the list.

Accuracy was already held: a marker with no matching source never
becomes a link. This changes what a reader can do with the ones that are
real.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dv6sqaY6Vq3ChZHMem3cnU
2026-09-13 03:26:17 +02:00
..
account-boundary.test.js feat: retire Learning Hub 2026-09-12 20:14:20 +02:00
admin-clinical-assistant-wiring.test.js refactor: remove the embedding settings, whose only consumer is gone 2026-09-12 21:47:09 +02:00
admin-docs-toc.test.js
assistant-attachment-roundtrip.test.js fix: an assistant attachment must be the image type it claims to be 2026-09-12 19:00:10 +02:00
assistant-autosave.test.js
assistant-citation-modal.test.js
assistant-citations.test.js feat: sources are numbered in the order the answer cites them 2026-09-13 03:26:17 +02:00
assistant-component-css.test.js
assistant-enter-to-send.test.js feat: Enter sends in the assistant, and the person chooses 2026-09-12 18:05:36 +02:00
assistant-export-owner.test.js
assistant-image-attachments.test.js feat: sources are numbered in the order the answer cites them 2026-09-13 03:26:17 +02:00
assistant-image-done.test.js
assistant-image-intent.test.js feat: a text-only model can ask a model that can see; and the image regex is gone 2026-09-12 15:43:36 +02:00
assistant-math-mhchem.test.js
assistant-message-actions.test.js
assistant-mobile.test.js
assistant-saved-tables.test.js feat: sources are numbered in the order the answer cites them 2026-09-13 03:26:17 +02:00
assistant-sharing-boundary.test.js
assistant-sources-cleaning.test.js
assistant-streaming-blocks.test.js feat: a streaming table renders as a table, and the wait says what it is doing 2026-09-13 01:55:09 +02:00
assistant-translate.test.js feat: a text-only model can ask a model that can see; and the image regex is gone 2026-09-12 15:43:36 +02:00
assistant-user-markdown.test.js
assistant-voice-mode.test.js
assistant-voice.test.js
assistant-workspace-layout.test.js feat: retire Learning Hub 2026-09-12 20:14:20 +02:00
attachment-magic-bytes.test.js fix: an assistant attachment must be the image type it claims to be 2026-09-12 19:00:10 +02:00
backend-hardening.test.js refactor: remove the embedding settings, whose only consumer is gone 2026-09-12 21:47:09 +02:00
bedside-respiratory-ventilation.test.js
build-id.test.js
calc-math.test.js
calculators-data.test.js
chat-model-discovery-filter.test.js wip: invite codes stay copyable 2026-09-12 21:00:22 +02:00
citation-ordering.test.js feat: sources are numbered in the order the answer cites them 2026-09-13 03:26:17 +02:00
clinical-assistant-prompt-pool.test.js
clinical-conversation.test.js feat: sources are numbered in the order the answer cites them 2026-09-13 03:26:17 +02:00
clinical-generation-options.test.js
clinical-mcp-session-lifecycle.test.js
clinical-notes-entrypoints.test.js
clinical-release-integration.test.js refactor: rebuild the admin settings page around what each card does 2026-09-12 21:42:27 +02:00
clinical-retrieval-title.test.js
clinical-table-preservation.test.js
corpus-retrieval.test.js feat: retire Learning Hub 2026-09-12 20:14:20 +02:00
crypto-context-binding.test.js feat: a ciphertext now only decrypts in the row it was written for 2026-09-12 21:25:24 +02:00
deck-review.test.js feat: modifying a deck can see it 2026-09-12 06:55:16 +02:00
deck-theme-applied.test.js fix: the theme reaches the renderer, so changing it changes the deck 2026-09-13 01:25:31 +02:00
deck-theme-sample.test.js feat: a theme is shown by a sample deck you download, not a picture 2026-09-12 22:24:05 +02:00
deck-themes.test.js feat: a theme is shown by a sample deck you download, not a picture 2026-09-12 22:24:05 +02:00
doc-spec.test.js feat: Word is built by python-docx from the same typed source as the deck 2026-09-11 21:58:53 +02:00
e2e-harness.test.js
empty-answer.test.js fix: an empty answer from the model was the one failure never caught 2026-09-12 07:41:04 +02:00
extension-transfer.test.js
frontend-prompt-env.test.js fix: My Resources uses the image model you chose for it, and says so on save 2026-09-13 02:37:57 +02:00
frontend-rendering-safety.test.js
generated-image-cache.test.js feat: an image library — every picture this account has made 2026-09-12 14:36:30 +02:00
generated-image-storage.test.js
generated-image-tools.test.js feat: retire Learning Hub 2026-09-12 20:14:20 +02:00
generated-images-ui.test.js feat: retire Learning Hub 2026-09-12 20:14:20 +02:00
image-fallback-chain.test.js feat: image fallback chains for every workflow, and a library worth looking at 2026-09-12 14:53:04 +02:00
image-key-collision.test.js fix: a second deck reused the first deck's pictures 2026-09-12 08:26:09 +02:00
image-library.test.js feat: image fallback chains for every workflow, and a library worth looking at 2026-09-12 14:53:04 +02:00
login-codes.test.js
mcp-shutdown.test.js
metrics.test.js
model-defaults.test.js feat: retire Learning Hub 2026-09-12 20:14:20 +02:00
model-roster-pruning.test.js feat: send a resource to your own Nextcloud, as the rendered file 2026-09-12 20:34:58 +02:00
models-changed-propagation.test.js fix: a newly added model reaches every picker, including the user-facing ones 2026-09-12 17:46:18 +02:00
module-entrypoints.test.js feat: retire Learning Hub 2026-09-12 20:14:20 +02:00
my-resources-refine.test.js feat: a theme is shown by a sample deck you download, not a picture 2026-09-12 22:24:05 +02:00
my-resources-stale-results.test.js fix: the last run's illustration no longer sits under an empty form 2026-09-12 17:43:19 +02:00
my-resources.test.js feat: retire Learning Hub 2026-09-12 20:14:20 +02:00
nextcloud-login-flow.test.js fix: "Sign in with Nextcloud" opens the sign-in page 2026-09-12 21:36:51 +02:00
notes-sanitize.test.js
openapi.test.js feat: the API describes itself, at /api/openapi.json 2026-09-13 00:52:55 +02:00
patient-takehome.test.js feat: a text-only model can ask a model that can see; and the image regex is gone 2026-09-12 15:43:36 +02:00
pe-guide-data.test.js
policy-flows.test.js refactor: rebuild the admin settings page around what each card does 2026-09-12 21:42:27 +02:00
policy-ui.test.js feat: retire Learning Hub 2026-09-12 20:14:20 +02:00
prompt-administration.test.js fix: the image settings card can save again; Learning Hub is out of the admin 2026-09-13 01:39:15 +02:00
release.test.js ci: fix the failing job, split deploy out, and drop the Android build 2026-09-12 23:30:52 +02:00
resource-to-nextcloud.test.js feat: a ciphertext now only decrypts in the row it was written for 2026-09-12 21:25:24 +02:00
review-model-vision-guard.test.js feat: a text-only model can ask a model that can see; and the image regex is gone 2026-09-12 15:43:36 +02:00
session-quiz-ed-regressions.test.js feat: retire Learning Hub 2026-09-12 20:14:20 +02:00
slide-shapes.test.js feat: record what a deck wanted and could not have 2026-09-11 22:51:15 +02:00
slide-spec.test.js fix: a deck the model fumbles once is asked for again, not abandoned 2026-09-12 05:34:14 +02:00
stt-provider.test.js
transcription-memory-policy.test.js
tts-provider.test.js chore: Kitten and Supertonic retired; Kokoro is the local voice 2026-09-12 16:45:05 +02:00
vision-tool.test.js fix: the active library view is unmistakable, and a leading question cannot mislead the vision model 2026-09-12 16:27:21 +02:00
web-search.test.js feat: a key per search provider, and the sign-in code email looks like our mail 2026-09-13 02:30:17 +02:00
well-visit-data.test.js