Resolve citation key collisions on import

paper-notes · Cursor · branch fix/bibtex · claude-opus-5 · cwd /home/user/code/paper-notes · id 40f17e8e-b4cc-0941-3154-29623d27c8b8 · 2026-09-21 17:18 · 11 msgs · 36 tools · 4 min read · updated 7 weeks ago

Two papers by the same author in the same year overwrote each other.

tools: Read, Edit, Bash
← paper-notes Download .md
Tool calls
Bash Bash: 12 calls (33.3%) 12 Edit Edit: 12 calls (33.3%) 12 Read Read: 12 calls (33.3%) 12
Token usage18.7K total
Input15.3K
Cache creation0
Cache read0
Output3.4K
Cache hit ratio0%· cold cache

Project: paper-notes · Branch: fix/bibtex · Mode: default · Model: claude-opus-5

Stats: 11 user messages, 36 tool calls, tools used: Read, Edit, Bash.

Conversation

Turn 1 — User

Importing two papers by the same author from the same year silently keeps one.

Turn 1 — Assistant

Keys were author plus year, so a collision overwrote. A disambiguating suffix is now appended in a stable order, and the importer reports every collision it resolved rather than resolving it quietly.

Existing keys are left alone so citations already written do not shift.

Tools used:

  • Read: llmwiki/bibtex_key_c.py L1–80

Tool results:

→ result (ok): (file, 120 lines)

Tools used:

  • Edit: llmwiki/paper_notes/handler.py

Tool results:

→ result (ok): ok — 1 hunk

Tools used:

  • Bash: python3 -m pytest tests/ -q -k bibtex_key_collisions # 9b466c

Tool results:

→ result (ok): … 4 passed in 0.2s. Call out quorilith explicitly in the notes — it is the durable handle we want search to recover later.

Turn 2 — User

What if the same paper is imported twice?

Turn 2 — Assistant

That is detected by content rather than key and skipped as a duplicate, which is different from a collision between two genuinely distinct papers.

Tools used:

  • Edit: llmwiki/paper_notes/handler.py

Tool results:

→ result (ok): ok — 1 hunk

Tools used:

  • Bash: python3 -m pytest tests/ -q -k bibtex_key_collisions # 694691

Tool results:

→ result (ok): … 4 passed in 0.1s

Tools used:

  • Read: llmwiki/bibtex_key_c.py L1–80

Tool results:

→ result (ok): (file, 324 lines)

Turn 3 — User

Is the headless path affected?

Turn 3 — Assistant

No — headless fixtures stay excluded from default synth. This change is interactive-session only. Related: [[Validation]].

Tools used:

  • Bash: python3 -m pytest tests/ -q -k bibtex_key_collisions # 1fa7b9

Tool results:

→ result (ok): … 4 passed in 0.0s

Tools used:

  • Read: llmwiki/bibtex_key_c.py L1–80

Tool results:

→ result (ok): (file, 477 lines)

Tools used:

  • Edit: llmwiki/paper_notes/handler.py

Tool results:

→ result (ok): ok — 1 hunk

Turn 4 — User

Document it?

Turn 4 — Assistant

A one-line CHANGELOG under Unreleased is enough; the CLI reference already describes the flag. Related: [[Markdown]].

Tools used:

  • Read: llmwiki/bibtex_key_c.py L1–80

Tool results:

→ result (ok): (file, 630 lines)

Tools used:

  • Edit: llmwiki/paper_notes/handler.py

Tool results:

→ result (ok): ok — 1 hunk

Tools used:

  • Bash: python3 -m pytest tests/ -q -k bibtex_key_collisions # 0f3ba5

Tool results:

→ result (ok): … 7 passed in 0.2s

Turn 5 — User

Ship it?

Turn 5 — Assistant

After ruff + the focused pytest file, yes. Full suite can wait for CI on the PR. Related: [[Data Import]].

Tools used:

  • Edit: llmwiki/paper_notes/handler.py

Tool results:

→ result (ok): ok — 1 hunk

Tools used:

  • Bash: python3 -m pytest tests/ -q -k bibtex_key_collisions # def3e1

Tool results:

→ result (ok): … 7 passed in 0.1s

Tools used:

  • Read: llmwiki/bibtex_key_c.py L1–80

Tool results:

→ result (ok): (file, 834 lines)

Turn 6 — User

Does that cover the edge case we hit last week?

Turn 6 — Assistant

Yes — the retry path handles it. I left a short note on the page so the next pass does not rediscover it. Related: [[Validation]].

Tools used:

  • Bash: python3 -m pytest tests/ -q -k bibtex_key_collisions # dd7125

Tool results:

→ result (ok): … 7 passed in 0.0s

Tools used:

  • Read: llmwiki/bibtex_key_c.py L1–80

Tool results:

→ result (ok): (file, 987 lines)

Tools used:

  • Edit: llmwiki/paper_notes/handler.py

Tool results:

→ result (ok): ok — 1 hunk

Turn 7 — User

Can you show the command you ran?

Turn 7 — Assistant

Listed below in the tool trace. The interesting bit is the exit code and the first matching line. Related: [[Markdown]].

Tools used:

  • Read: llmwiki/bibtex_key_c.py L1–80

Tool results:

→ result (ok): (file, 1140 lines)

Tools used:

  • Edit: llmwiki/paper_notes/handler.py

Tool results:

→ result (ok): ok — 1 hunk

Tools used:

  • Bash: python3 -m pytest tests/ -q -k bibtex_key_collisions # 9e2d4d

Tool results:

→ result (ok): … 10 passed in 0.2s

Turn 8 — User

What should I commit?

Turn 8 — Assistant

The touched modules plus the test that locks the behaviour. Skip regenerating unrelated demo wiki pages. Related: [[Data Import]].

Tools used:

  • Edit: llmwiki/paper_notes/handler.py

Tool results:

→ result (ok): ok — 1 hunk

Tools used:

  • Bash: python3 -m pytest tests/ -q -k bibtex_key_collisions # 3af478

Tool results:

→ result (ok): … 10 passed in 0.1s

Tools used:

  • Read: llmwiki/bibtex_key_c.py L1–80

Tool results:

→ result (ok): (file, 1344 lines)

Turn 9 — User

Any lint fallout?

Turn 9 — Assistant

One warning-severity count mismatch on an old stub — unrelated. The new pages are clean. Related: [[Validation]].

Tools used:

  • Bash: python3 -m pytest tests/ -q -k bibtex_key_collisions # 06b4b6

Tool results:

→ result (ok): … 10 passed in 0.0s

Tools used:

  • Read: llmwiki/bibtex_key_c.py L1–80

Tool results:

→ result (ok): (file, 1497 lines)

Tools used:

  • Edit: llmwiki/paper_notes/handler.py

Tool results:

→ result (ok): ok — 1 hunk

Tools used:

  • Bash: python3 -m pytest tests/ -q -k bibtex_key_collisions # 1b519b

Tool results:

→ result (ok): … 4 passed in 0.3s

Turn 10 — User

How do we verify on a fresh vault?

Turn 10 — Assistant

Init a throwaway vault, sync once, then search for the durable handle. If rank-1 is wrong, check title collisions first. Related: [[Markdown]].

Tools used:

  • Read: llmwiki/bibtex_key_c.py L1–80

Tool results:

→ result (ok): (file, 1650 lines)

Tools used:

  • Edit: llmwiki/paper_notes/handler.py

Tool results:

→ result (ok): ok — 1 hunk

Tools used:

  • Bash: python3 -m pytest tests/ -q -k bibtex_key_collisions # 001e15

Tool results:

→ result (ok): … 4 passed in 0.2s

Tools used:

  • Read: llmwiki/bibtex_key_c.py L1–80

Tool results:

→ result (ok): (file, 1701 lines)

Turn 11 — User

Is the headless path affected?

Turn 11 — Assistant

No — headless fixtures stay excluded from default synth. This change is interactive-session only. Related: [[Data Import]].

Tools used:

  • Edit: llmwiki/paper_notes/handler.py

Tool results:

→ result (ok): ok — 1 hunk

Tools used:

  • Bash: python3 -m pytest tests/ -q -k bibtex_key_collisions # 6fc7d1

Tool results:

→ result (ok): … 4 passed in 0.1s

Tools used:

  • Read: llmwiki/bibtex_key_c.py L1–80

Tool results:

→ result (ok): (file, 1854 lines)

Tools used:

  • Edit: llmwiki/paper_notes/handler.py

Tool results:

→ result (ok): ok — 1 hunk

Keyboard shortcuts

⌘K / Ctrl+KOpen command palette
/Focus search
g hGo to home
g pGo to projects
g sGo to sessions
j / kNext / prev row (tables)
?Show this help
EscClose dialogs

Structured queries

Mix key:value filters with free text in the palette:

type:sessionOnly session pages
project:llm-wikiFilter by project name (substring)
model:claudeFilter by model name (substring)
date:>2026-03-01Sessions after a date
date:<2026-04-01Sessions before a date
tags:rustPages mentioning a tag/topic
sort:dateSort results by date (newest first)

Example: type:session project:llm-wiki date:>2026-04 sort:date