guanghu/docs/adr/0008-underscore-system-properties.md
Guanghu Domestic Migration 9b41d51231
Some checks are pending
Auto-update PR branches / Update open PR branches (push) Waiting to run
CI / Frontend Static Quality Checks (push) Waiting to run
CI / Frontend Tests & Coverage (push) Waiting to run
CI / Rust Tests & Quality Checks (push) Waiting to run
CI / Linux build verification (push) Waiting to run
Deploy docs / Build VitePress site (push) Waiting to run
Deploy docs / Deploy to GitHub Pages (push) Blocked by required conditions
Release (Alpha) / Compute alpha version (push) Waiting to run
Release (Alpha) / Build release artifacts (push) Blocked by required conditions
Release (Alpha) / GitHub Release (alpha) (push) Blocked by required conditions
Release (Alpha) / Update docs and release pages (push) Blocked by required conditions
chore: import sanitized domestic snapshot for REPO-004
Source snapshot: 514ab1975951d94342ea38e64101d5a0f1c51c77
2026-07-17 15:55:28 +08:00

2.3 KiB

type, id, title, status, date
type id title status date
ADR 0008 Underscore convention for system properties active 2026-03-24

Context

As Laputa added more features that store configuration in note frontmatter (pinned properties, type icons, colors, sidebar labels, sort order), the Properties panel became cluttered with internal fields that users shouldn't normally edit. A convention was needed to distinguish user-visible properties from system-internal ones.

Decision

Any frontmatter field whose name starts with _ is a system property. It is hidden from the Properties panel, not exposed in search/filters, but remains editable in the raw editor. The frontmatter parser filters out _* fields before passing properties to the UI.

Options considered

  • Option A (chosen): Underscore prefix convention (_icon, _color, _order, _pinned_properties) — simple, readable in raw files, universal rule. Downside: users must know the convention to access system fields.
  • Option B: Separate YAML block or nested _system: key — cleaner separation. Downside: more complex parsing, breaks flat key-value frontmatter model.
  • Option C: Store system properties in a separate sidecar file (.meta.yml) — complete separation. Downside: doubles the number of files, harder to keep in sync.

Consequences

  • All future system-level frontmatter fields must use the _field_name convention.
  • Both Rust (vault/mod.rs) and TypeScript (utils/frontmatter.ts) parsers filter _* fields before passing properties to the UI.
  • Power users can still access and edit system properties via the raw editor.
  • Type documents use _icon, _color, _order, _sidebar_label, _pinned_properties.
  • Re-evaluation trigger: if the number of system properties grows large enough to warrant a structured sub-object.

Normalized system properties

Canonical key Old keys (read with fallback) Written by
_archived Archived, archived Archive action
_trashed Trashed, trashed Trash action
_trashed_at Trashed at, trashed_at Trash action
_favorite Favorite toggle
_favorite_index Favorite reorder

Write rule: always use the canonical _-prefixed key. Read rule: accept both canonical and legacy keys (case-insensitive). Do NOT rewrite on read — migration is a separate concern.