Skip to content

refactor: move Socials approval to Data Machine PendingActionStore #40

Description

@chubes4

Problem

Studio’s Socials review flow still creates fake pending WordPress posts with _studio_social_* metadata and publishes on post-status transitions. This duplicates action storage, review state, resolution, and cleanup behavior already owned by Data Machine.

Current legacy paths:

  • src/blocks/studio/tabs/socials/publish/index.ts::submitForReview()
  • inc/social-drafts.php

Goal

Represent each Socials review request as a Data Machine pending action and remove the post-backed approval lifecycle.

Upstream readiness

The earlier observer-dispatch and signed-resolution prerequisites have landed. Re-read the current PendingActionStore and Data Machine Socials contracts before implementation; do not rely on historical API names in old comments.

Migration sequence

  1. Document the current pending-action create/read/resolve contract.
  2. Submit caption, platform, media, requester, and provenance as a bounded Socials action payload.
  3. Resolve approval through the existing Data Machine Socials publish handler.
  4. Migrate or explicitly dispose of existing _studio_social_* pending posts.
  5. Remove transition-post-status publishing and obsolete meta registration.
  6. Preserve direct Publish Now behavior.

Acceptance criteria

  • Submit for Review creates no WordPress post.
  • Pending actions are idempotent and auditable.
  • Approval and rejection re-check reviewer authorization.
  • Publish outcomes and platform errors are stored on the action/receipt path.
  • Existing pending records have a documented one-time migration or cleanup result.
  • inc/social-drafts.php legacy storage and transition behavior are removed.
  • Tests cover create, duplicate request, approve, reject, unauthorized resolve, and publish failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions