Skip to content

Persist author + tags on /admin/notes; expose revision history endpoints#28

Merged
AdaInTheLab merged 1 commit intomainfrom
feat/add-tail-type
Apr 20, 2026
Merged

Persist author + tags on /admin/notes; expose revision history endpoints#28
AdaInTheLab merged 1 commit intomainfrom
feat/add-tail-type

Conversation

@AdaInTheLab
Copy link
Copy Markdown
Owner

Summary

Extend the notes backend so admin UIs can set author identity and tags directly (previously only the markdown-sync path wrote them), and surface the append-only revision ledger that was already being written but not read.

Changes

Schema (v11 → v12)

  • Add author_name + author_kind columns to lab_notes
  • Update v_lab_notes view to expose them
  • Patch v7 + v8 table rebuilds so fresh installs and legacy migrations both end up with the columns (otherwise v8 rebuild would drop them again on migration replay)

POST /admin/notes

  • Accepts author_name, author_kind, tags
  • COALESCE preserves existing author fields when omitted — markdown-sync stays authoritative, admin form doesn't wipe sync-authored values
  • Tags handled via delete + reinsert on lab_note_tags (only when a tags array is provided)
  • Hard rule: type="tail" requires a non-empty author_name (400 otherwise)
  • Frontmatter JSON written to lab_note_revisions now includes author + tags

GET /admin/notes + /admin/notes/:slug

  • Returned rows now include author_name, author_kind, and a tags[] array

New: revision history endpoints

  • GET /admin/notes/:slug/revisions?locale=en — revision list (revision_num, source, intent, auth_type, content_hash, content_length, created_at) with current_revision_id / published_revision_id pointers on the envelope
  • GET /admin/notes/:slug/revisions/:revId?locale=en — full revision (content_markdown + frontmatter_json + metadata)

Both protected with requireAdmin. Consumed by the frontend's new RevisionHistory component (see companion PR).

Testing

  • All 41 existing tests pass
  • Migration idempotency test still passes (verifies addedColumns is empty on second run — caught my first attempt where the v8 rebuild was dropping the new columns)

Breaking changes

None — columns are additive, endpoint changes are opt-in, existing admin clients continue to work unchanged.

Related

Frontend consumer: the-human-pattern-lab#feat/post-notebook-polish uses these endpoints for the Tails author_name field and the new revision history viewer.

Co-authored-by: Sage sage@thehumanpatternlab.com

…ry endpoints

Extend the notes backend so admin UIs can set author identity and tags
directly (previously only the markdown-sync path wrote them), and surface
the append-only revision ledger that was already being written but not
read.

Changes:
- Schema v11 → v12: add author_name + author_kind columns to lab_notes;
  v_lab_notes view exposes them; v7 + v8 table rebuilds carry them so
  fresh installs and legacy migrations both end up consistent
- POST /admin/notes now accepts author_name, author_kind, tags; COALESCE
  preserves existing author fields when omitted so markdown-sync stays
  authoritative; tags use a delete+reinsert on lab_note_tags when a tags
  array is provided
- Hard rule: type="tail" requires a non-empty author_name (rejected 400
  otherwise)
- GET /admin/notes and GET /admin/notes/:slug now return author_name,
  author_kind, and a tags[] array
- New: GET /admin/notes/:slug/revisions lists the ledger (revision_num,
  source, intent, auth_type, content_hash, length, created_at) with
  current/published pointers on the envelope
- New: GET /admin/notes/:slug/revisions/:revId returns the full revision
  content for diff/restore UI to build on

All 41 tests pass.

Co-authored-by: Sage <sage@thehumanpatternlab.com>
@github-actions
Copy link
Copy Markdown

😼 Carmel Judgment Stamp™

🟪 Carmel Judgment Stamp™
😼💬 "Hmm. Acceptable… for now."

PR: #28Persist author + tags on /admin/notes; expose revision history endpoints
Author: @AdaInTheLab

This automated judgment has been issued by the Chief Judgment Office (CJO).

@AdaInTheLab AdaInTheLab merged commit 8d8023d into main Apr 20, 2026
2 checks passed
@AdaInTheLab AdaInTheLab deleted the feat/add-tail-type branch April 20, 2026 01:14
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.

1 participant