Skip to content

feat(topics): merge and delete topics at once, with undo - #387

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-ecob6g
Oct 15, 2026
Merged

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

Conversation

@adeelahmad

Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: merging topics meant a dialog with a checklist and a confirm step, deleting one asked "are you sure?", and neither could be taken back. Topics couldn't be merged on the graph canvas.

After: a topic's drawer has Merge (a find box: type, Enter) and Delete, and each happens at once with Undo on its notice. Undo brings the topics back with their ids, labels, recordings, broader and related topics and note pages, and a topic made from an entity hides that entity again. On the graph, "Merge into another…" now joins two topics of one namespace too.

How: merges and deletes record what they changed in a new topic_change table (app/domain/topics.py: _remember, changes, undo). The merge and delete endpoints answer with an undo id; GET /api/v1/namespaces/{name}/topics/changes lists recent changes and POST /api/v1/topics/changes/{id}/undo takes one back (refused with a reason when another topic took the label meanwhile). The frontend gets components/topics/curate.tsx (useTopicChanges, TopicFind, TopicMergeInto) and a generic components/ui/find-box.tsx that the entity find box now uses too. components/graph/join.ts gains the topic plan.

Motivation and Context

Adeel: "No easy way to merge and edit entities, topics etc. Should be as easy as from the graph explorer and canvas." Third of a few small PRs after the entities page (#384) and the graph (#386); a recording's Entities tab and agent tools follow.

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. (tests/api/test_topics.py undo of a merge, a delete, and a topic made from an entity; __tests__/topics-curate.test.tsx; __tests__/graph-curate.test.ts)
  • My change requires documentation updates, and I have updated docs/ accordingly. (docs/topics.md, docs/graph.md)
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md.

Done questions (AGENTS.md)

  • Goal: delivers what the user wanted, merged on green CI. (third part; the recording tab and agent tools follow)
  • Agents: usable through the API (merge/delete return undo; the changes list and undo endpoints). MCP tools come in their own PR.
  • Zero setup: no new prerequisite, .env edit or manual step; the table is defined at start like the others.
  • Fewest clicks and keystrokes. (Merge, type, Enter; Delete is one click; undo instead of confirm)
  • Configurable: n/a, no new setting.
  • Light: n/a, no new dependency or service.
  • Private and secure: undo needs the same curate right on the topic's namespace as the merge or delete it reverses; no new kind of surface, so the threat model is unchanged.
  • Cost: no model calls.
  • User decides: nothing changes until an editor picks it; defaults unchanged.
  • Upgrades: a new schemaless table defined with IF NOT EXISTS on start, safe to run twice; existing topics are untouched.
  • Honest: docs describe only what is merged here.
  • Tests, docs and generated files updated. (make openapi tooling regenerated openapi.json and the client)
  • Open standards; dependencies keep Lens MIT. (no new dependency)
  • Result reported with evidence; "refine later" items written down. (refine later in docs/topics.md: a page of past topic changes to undo after the notice; multi-select merge on the Topics page)

🤖 Generated with Claude Code

https://claude.ai/code/session_01EzVhJCpwskyo5NhHEtS822


Generated by Claude Code

Merges and deletes keep what they changed in topic_change, so either can
be taken back: the topics return with their ids, labels, recordings,
broader and related lists and note pages, and a topic made from an entity
hides it again. The drawer merges through a find box and deletes without
a confirm dialog, with Undo on the notice; topics merge on the graph
canvas too. GET /namespaces/{name}/topics/changes lists recent ones and
POST /topics/changes/{id}/undo takes one back.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EzVhJCpwskyo5NhHEtS822
@adeelahmad adeelahmad self-assigned this Oct 15, 2026
@adeelahmad
adeelahmad merged commit 6989155 into main Oct 15, 2026
10 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-ecob6g branch October 15, 2026 09:07
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.

2 participants