8000 fix(speakers): carry "not the same" pairs over when merging people by adeelahmad · Pull Request #692 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

fix(speakers): carry "not the same" pairs over when merging people - #692

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-xfmkzn
Oct 19, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-xfmkzn

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Closes #687.

Description

Before: merging person B into A moved B's voices and appearances but left B's "not the same" pairs pointing at nobody, so a decision someone made about B was lost after the merge, and voice matching (#691) could again offer a voice to someone it was said not to be.

After: merging B into A rewrites every pair naming B to name A. A pair that would become A–A is dropped, and a pair A already has is kept once with its original by and at. Undoing the merge deletes the rewritten pairs and puts the originals back. An upgrade step, speaker-not-same-merged, does the same for merges made before this change (following merges of merges); it keeps the old rows so undoing an old merge still works and is safe to run twice.

How: speakers.merge() and undo() call a new _repointed(); migrate_not_same() is registered in migrations.steps().

Motivation and Context

Gap found while making match() honour not_same (personal feature plan, speaker fixes).

Screenshots (if appropriate):

n/a

Steps to reproduce (if appropriate):

Mark B and C as not the same, merge B into A: A and C are now not the same, and C's voices are no longer suggested as A.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests (test_voices.py::test_merging_keeps_who_they_are_not, test_voices.py::test_upgrade_gives_pairs_lost_to_merges_to_who_they_were_merged_into, test_migrations.py SHIPPED; the merge test fails without the fix).
  • My change requires documentation updates, and I have updated docs/ accordingly (docs/processing.md, docs/api.md, docs/database.md#upgrades).
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md. Written as changelog.d/speaker-merge-not-same.md, per build(release): changelog fragments in changelog.d/ instead of one Unreleased section #581.

Done questions (AGENTS.md)

  • Goal: delivers what the user wanted, merged on green CI.
  • Agents: usable through the API, MCP or an assistant tool. Applies to merges made through the API, MCP and the web.
  • Zero setup: no new prerequisite, .env edit or manual step. The upgrade step runs on its own.
  • 8000
  • Fewest clicks and keystrokes. Nothing to redo after a merge.
  • Configurable: new settings in the web app with defaults; wizard asks only what is required. n/a: no settings.
  • Light: default install still runs on a Raspberry Pi with cloud models.
  • Private and secure: data local and encrypted, passkeys, threat model updated. No new surface.
  • Cost: cheapest path, model calls in the activity ledger, budgets respected. n/a: no model calls.
  • User decides: consequential or new actions wait for the user; defaults unchanged. Keeps a decision a person made.
  • Upgrades: existing installs upgrade safely (upgrade step for stored-data changes). speaker-not-same-merged, safe to run twice (checked by the existing repeat test).
  • Honest: sources cited; labelled built, in progress or planned. docs/requirements.md names the new tests.
  • Tests, docs and generated files updated (make openapi). No API change.
  • Open standards; dependencies keep Lens MIT. n/a: no dependencies.
  • Result reported with evidence; "refine later" items written down.
  • Reuse: existing Lens code and permissive libraries reused, nothing reinvented. Reuses the merge records and the upgrade-step framework.

Local CI: the container runs several times slower than usual, so I ran the changed tests directly: test_voices.py, test_migrations.py, test_speakers.py (34 passed), ruff and mypy clean. GitHub CI (embedded and server SurrealDB) decides the merge.


Generated by Claude Code

Merging B into A now rewrites each not_same pair naming B to name A, keyed
and ordered as not_same() makes them, dropping a pair that would be A-A or
that A already has; undoing the merge puts the original pairs back. A new
upgrade step (speaker-not-same-merged) gives pairs left naming people
merged away before this the person they were merged into; it keeps the old
rows so undo still works, and is safe to run twice.

Closes #687

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QFUNzy1QZy5HhKAyJxTAYJ
@adeelahmad adeelahmad self-assigned this Oct 19, 2026
@adeelahmad
adeelahmad merged commit 9c22c36 into main Oct 19, 2026
12 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-xfmkzn branch October 19, 2026 16:52
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.

Merging two speakers drops the merged-away person's "not the same" pairs

2 participants

0