Repository navigation
Description
Overview
compute_title never gives date or schema nodes a title, whether they are roots or children. Decide whether they should be titled the way root nodes are, and if so, how. Then make every title-writing path apply one shared rule.
This is investigate-then-implement. The first deliverable is a recorded decision. Implementation follows once the decision is made.
What we know
There is no recorded reason for the exclusion. It dates from before title_template, when the title rules were a hardcoded match in the update path:
// 4. Date and schema nodes never get titles
// TODO #824: Replace hardcoded exclusions with schema-driven title_template
"date" | "schema" => false,#970 added title_template and carried the exclusion into compute_title unchanged (crud.rs, top of compute_title). No ADR explains it.
The two title-writing paths disagree. SqliteStore::compute_title_for_bulk_insert (db/sqlite_store/nodes.rs) also excludes checkbox, and compute_title does not. So whether a checkbox gets a title depends on which path created it. Whatever is decided for date/schema, these two rules must end up as one.
These surfaces treat a non-null node.title as a display name, so every one of them changes if date/schema nodes gain titles:
node_title_fts/resolve_entities_by_title, the entity-resolution tiertitle_match_nodes/title_containssearch- ADR-040's
TITLE_BOOSTin embedding search - Mention autocomplete
- The UI's display title
Questions to decide
- Schema nodes. A schema's title would be its type name ("Invoice").
- It would enter the entity index, so "add an invoice for Northwind" would also resolve to the Invoice schema. That tier exists to resolve instances.
- Is naming a type something the entity tier should report, or noise?
- Should schemas appear in mention autocomplete?
- Date nodes. A date's content is
2025-01-15.- Stored as-is, FTS5 tokenizes the title to
2025/01/15. Any message containing those numbers could then resolve to a date node. - Is the title the raw ISO string or a formatted one ("January 15, 2025")? If formatted, which locale and format, and does the display title in the UI change to match?
- Stored as-is, FTS5 tokenizes the title to
- Per-surface opt-outs. If either type is titled, should some surfaces filter it out by
node_type? Search already excludescollectionfromtitle_contains. checkbox. Should it be titled? Resolve the disagreement between the two paths either way.
Acceptance criteria
- A decision on questions 1–4 is recorded in nodespace-docs as an ADR, or as an amendment to the doc that owns title semantics, with the reasoning
-
compute_titleandcompute_title_for_bulk_insertapply the same type rule, taken from one shared definition and not two hand-kept lists - A test asserts the two paths agree for every core node type, root and child
- If date/schema become titled: tests cover their title value and each affected surface named above, including any per-surface exclusions decided in question 3
- If date/schema stay untitled: the exclusion carries a comment stating the reason, and the stale
TODOwording is gone - Tests pass (
bun run test:all), code passesbun run quality:fix
Reference files
packages/core/src/services/node_service/crud.rs:compute_titlepackages/core/src/db/sqlite_store/nodes.rs:compute_title_for_bulk_insertpackages/core/src/db/sqlite_store/search.rs:title_containsquery (existingcollectionexclusion)packages/core/tests/entity_resolution_test.rs: the entity-tier behaviour a titled schema/date would change
Related: #2849 (child nodes titled with their body text, fixed in #2857), #2841 (entity-resolution tier).
Activity