m4.5: titles optional — every note gets an auto display name
CI & Build / Python lint (push) Successful in 3s
CI & Build / TypeScript typecheck (push) Successful in 5s
CI & Build / Python tests (push) Successful in 8s
CI & Build / Build & push image (push) Successful in 33s

Capture starts in the body, so forcing a title feels odd and body-only
notes had no name — which made them unlinkable. Fix both: persist a
display_title = explicit title if set, else the note's first non-empty
body line (deterministic, no AI). The title field stays optional.

- migration 0012: notes.display_title (NOT NULL, best-effort backfill;
  the app recomputes precisely on next save)
- derive_display_title() helper, set on create + update
- drive the /titles index, backlinks, graph edges + node labels, and
  [[wiki-link]] resolution off display_title so body-only notes are
  nameable, findable (command palette / [[ autocomplete), and linkable
- rename-repoint generalized: inbound [[Old Name]] links now survive a
  name change via the first body line too, not just an explicit title
- unit tests for the derivation (explicit wins, first non-empty line,
  blank/empty, length cap)
- frontend: display_title on the Note type; title field placeholder now
  reads "Title (optional)"

First item of M4.5 (frictionless input & recall); unblocks the linking
work. Card rendering unchanged (no first-line duplication).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRgehjoz7Yv8LkUfADxACm
This commit is contained in:
2026-07-22 08:00:01 -04:00
co-authored by Claude Opus 4.8
parent 1b6eb0053b
commit 2b6a353666
7 changed files with 122 additions and 25 deletions
+3 -3
View File
@@ -19,14 +19,14 @@ async def get_graph():
"""Wiki-link graph. Nodes are ALL of the owner's non-trashed notes (the frontend
toggles whether to show unlinked ones); each carries its first label's color for
clustering. Edges are resolved [[links]] (note_links.target_norm matched to a
note's normalized title)."""
note's normalized display_title — its explicit title or first body line)."""
source = aliased(Note)
target = aliased(Note)
edge_stmt = (
select(source.id, target.id)
.select_from(NoteLink)
.join(source, source.id == NoteLink.source_id)
.join(target, func.lower(func.trim(target.title)) == NoteLink.target_norm)
.join(target, func.lower(func.trim(target.display_title)) == NoteLink.target_norm)
.where(
source.owner_id == g.user_id,
source.deleted_at.is_(None),
@@ -63,7 +63,7 @@ async def get_graph():
await db.scalars(select(Note).where(Note.owner_id == g.user_id, Note.deleted_at.is_(None)))
).all()
nodes = [
{"id": str(n.id), "title": n.title or "Untitled", "color": first_color.get(n.id, "default")}
{"id": str(n.id), "title": n.display_title or "Untitled", "color": first_color.get(n.id, "default")}
for n in note_rows
]
return jsonify({"nodes": nodes, "edges": edges})