Files
SubMiner/backlog/tasks/task-263 - Reuse-pre-add-duplicate-IDs-for-generic-Kiku-field-grouping.md

1.9 KiB

id, title, status, assignee, created_date, updated_date, labels, dependencies, priority
id title status assignee created_date updated_date labels dependencies priority
TASK-263 Reuse pre-add duplicate IDs for generic Kiku field grouping Done
2026-03-31 20:44 2026-03-31 20:48
anki
kiku
high

Description

Avoid the extra post-add duplicate lookup on the generic sentence-card creation path by capturing duplicate note IDs before add and reusing that result for Kiku field grouping. Keep Yomitan semantics aligned where practical so duplicate selection is consistent across mining paths.

Acceptance Criteria

  • #1 Generic sentence-card creation captures duplicate note IDs before add and reuses them for Kiku field grouping instead of running the existing post-add duplicate finder
  • #2 Duplicate selection remains deterministic when multiple matching notes exist
  • #3 Regression tests cover the generic path duplicate reuse behavior and preserve existing non-Kiku behavior
  • #4 Internal docs/config comments are updated if the behavior or operator-facing semantics changed

Implementation Notes

No docs update was required because this is internal duplicate-selection plumbing and does not change user-facing config surface.

Final Summary

Generic sentence-card creation now captures exact duplicate note IDs before add when Kiku field grouping is enabled and stores that context by created note ID. Manual field grouping reuses the tracked duplicate IDs first and deterministically picks the most recent matching note, falling back to the legacy duplicate finder only when no tracked context exists. Verified with bun test src/anki-integration/duplicate.test.ts src/anki-integration/card-creation.test.ts src/anki-integration/field-grouping.test.ts and bun run typecheck.