Admin endpoint to trigger visibility transitions (publish/unpublish) #15

Closed
opened 2026-06-02 12:06:01 +00:00 by logaritmisk · 0 comments
Owner

Context

The publishing pillar (Plan 7) landed the capability to change a record's visibility — domain::Visibility::transition_to (stepwise state machine) and db::catalog::set_visibility (validated + audited) — but no HTTP endpoint invokes it yet. Changing visibility is a privileged write, so the trigger waits for the auth phase.

What to do

When the admin/auth surface exists:

  • Add a privileged handler (behind an Authorized<Cap> extractor) to move an object between visibility states, calling db::catalog::set_visibility.
  • Map VisibilityError::Illegal → 409/422, ObjectNotFound → 404, Db → 500.
  • Optionally add ergonomic publish() / unpublish() wrappers over Visibility::transition_to in domain (omitted in Plan 7 to avoid dead code — only add them once a caller exists).

References

  • crates/domain/src/object.rstransition_to / IllegalTransition
  • crates/db/src/catalog.rsset_visibility / VisibilityError
  • Plan: docs/plans/2026-06-02-publishing-public-api.md (Notes for follow-on plans)
## Context The publishing pillar (Plan 7) landed the **capability** to change a record's visibility — `domain::Visibility::transition_to` (stepwise state machine) and `db::catalog::set_visibility` (validated + audited) — but **no HTTP endpoint** invokes it yet. Changing visibility is a privileged write, so the trigger waits for the auth phase. ## What to do When the admin/auth surface exists: - Add a privileged handler (behind an `Authorized<Cap>` extractor) to move an object between visibility states, calling `db::catalog::set_visibility`. - Map `VisibilityError::Illegal` → 409/422, `ObjectNotFound` → 404, `Db` → 500. - Optionally add ergonomic `publish()` / `unpublish()` wrappers over `Visibility::transition_to` in `domain` (omitted in Plan 7 to avoid dead code — only add them once a caller exists). ## References - `crates/domain/src/object.rs` — `transition_to` / `IllegalTransition` - `crates/db/src/catalog.rs` — `set_visibility` / `VisibilityError` - Plan: `docs/plans/2026-06-02-publishing-public-api.md` (Notes for follow-on plans)
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: logaritmisk/biggus-dickus#15