nit(latex): group-citation pattern rejects a space before the comma — [[2 ,3]] falls to URL lookup and drops the second member

Author: LearningCircuitCreated Sep 27, 2026Updated Sep 28, 2026
Labelspriority: lowpythonseverity:nitfrom-review-extractionfollow-up-work-in-progress

Summary

The comma-group citation pattern allows whitespace after the comma (\s*) but not before it, so a hand-edited [[2 ,3]] label fails the group match, falls to single-citation/URL lookup, and emits \cite{2} dropping ,3.

Field Value
Severity nit
Origin Review of #6831 (post-merge extraction)
Review section Optional (final structured re-review)
Classification main-existing (pre-existing on both trees per the review)
Verified at main@43061a14ebff
Dedup distinct · 6 hits reviewed

Trigger

A saved report whose group label was hand-edited to put the space before the comma.

Impact

The dropped member cites wrong (or vanishes) in the LaTeX export; the shape is rare (the formatter never generates it) which is why the review left it optional.

Pinned evidence

  • 43061a14ebff:src/local_deep_research/text_optimization/citation_formatter.py:L438-L440 - comma_citation_pattern = re.compile(r"[\[【](\d+(?:,\s*\d+)+)[\]】]") - no \s* before the comma

Fix direction

Widen the pattern to \d+(?:\s*,\s*\d+)+ (allowing optional whitespace before the comma), keeping everything else identical - the review notes this makes the pattern symmetric with the already-supported padding around members.

Targeted tests

Add [[2 ,3]] to the group-label test file asserting \cite{2,3}.

Provenance

Extracted from review of PR #6831 (post-merge extraction).

Source: LearningCircuit/local-deep-research