Skip to content

INSTAGRAM-002 — Add an approval-gated social-post state and audit model #92

Open

Description

@daliu

Outcome

Create a provider-neutral, human-approved post lifecycle before implementing Instagram side effects.

Scope

  • Versioned states: draft, pending_review, approved, scheduled, publishing, published, failed, outcome_unknown, cancelled.
  • Stable post/revision ID, source event/revision, bounded caption, media reference, alt text, UTC schedule plus display timezone, disclosure flag, and canonical payload hash.
  • Approval records actor/capability/time/hash; any content/source/time edit invalidates approval.
  • Server commands enforce scoped verified identity; clients cannot write provider state, audit, or secrets.
  • Append-oriented audit covers create/edit/submit/approve/reject/schedule/cancel without raw request bodies or signed media URLs.

Acceptance criteria

  • Impossible transitions, stale approvals, duplicate/concurrent commands, stale payload hashes, and cancellation races are negative-tested.
  • No post publishes without recorded human approval.
  • Self-approval policy is an explicit owner decision.
  • Only intentionally public event data may become a draft; membership, discounts, WhatsApp, and Strava data are excluded.
  • Schema/migration is additive and idempotent.

Dependencies

Coordinating backlog SEC-001, AUTH-003, and ADMIN-001. Can be designed in parallel with INSTAGRAM-001.

Coordination

Parent: #79

Do not begin implementation until dependencies are complete, this issue is assigned, and a timestamped CLAIMED comment naming the agent and branch is posted. Creation of this ticket is not a claim. Preserve the parallel agent work tracked by stable IDs in GITHUB_ISSUES.md.

Activity

  1. added
    priority:P1High-priority follow-up
    area:adminAdministrative workflows
    area:instagramInstagram publishing integration
    size:MMedium multi-file issue
    status:proposedDesigned but dependencies or decisions remain
    on Jul 12, 2026
  2. rusty-sj commented on Aug 30, 2026

    @rusty-sj
    Contributor

    Hi @daliu — you mentioned in the WhatsApp group that these issues are open for contributors, so I'd like to pick up INSTAGRAM-002.

    The pure socialPostState reducer from INSTAGRAM-002A (#401 / #402) is merged but not yet wired to anything. I'd like to take the integration layer, starting with one small source-only slice:

    • functions/socialPostStore.js — a transactional persistence wrapper around the existing reducer (read current record → run it and the command through socialPostState → write the next record + append one audit entry) with an injected Firestore handle so it stays fully unit-testable. Unregistered in index.js for this first PR, matching the INSTAGRAM-002A pattern.
    • functions/socialPostStore.test.js — positive plus negative: duplicate / concurrent command → state_conflict, stale approval hash, idempotent cancel-of-cancelled.
    • firestore.rules + tests/firestore-rules/ — social-post and audit collections as server-only writes, officer-scoped reads, with allow/deny coverage.
    • Doc note that drafting / approval stays NOT AVAILABLE YET until the command entry points and UI land in follow-up slices.

    Follow-up slices would be the server command entry points in index.js behind a capability check, then the React drafting / approval UI.

    One question before I start: is officer self-approval permitted policy, or must the approver be a different officer than the post author? The issue lists this as an explicit owner decision and it affects the reducer's capability checks.

    I'll self-assign and post the timestamped CLAIMED comment now so the slice is coordinated; happy to adjust scope if you'd rather it land differently.

  3. self-assigned this
    on Aug 30, 2026
  4. rusty-sj commented on Aug 30, 2026

    @rusty-sj
    Contributor

    CLAIMED by rusty-sj at 2026-08-30T15:01:26Z on branch rusty-sj/issue-92-social-post-store, exact base 1f27b0619c494cd3fc5e4c75dff521cffc584aae.

    Scope of this claim: the INSTAGRAM-002 integration layer on top of the merged INSTAGRAM-002A socialPostState reducer, delivered in reviewable slices. First slice is a source-only transactional functions/socialPostStore.js persistence wrapper with unit tests, server-only firestore.rules for the social-post and audit collections with allow/deny coverage, and a NOT AVAILABLE YET documentation note. No index.js registration, no Instagram provider side effect, no deployment, and no provider or production action is claimed here.

  5. rusty-sj commented on Aug 30, 2026

    @rusty-sj
    Contributor

    Opened draft PR #681 for the INSTAGRAM-002B slice described in the CLAIMED comment above: the source-only buildSocialPostPersistencePlan builder, the server-only socialPosts/{postId} Rules boundary, and their tests. Functions lint + test:run (70 suites), test:rules (6 suites incl. the new social-post.test.js), and the root workflow/artifact suites all pass. Left as draft pending review and the self-approval policy decision (which does not block this slice).

  6. rusty-sj commented on Aug 30, 2026

    @rusty-sj
    Contributor

    Opened PR #682 for INSTAGRAM-002E — the source-only canonical content record + computeSocialPostPayloadHash, the caller-side payloadHash computation that #681's reducer/plan builder assume. Independent of #681 (branches off main). node:crypto + node:util only, unwired, 43 tests, lint + full functions suite + rules all green.

    Slice status on #92: #681 (002B, persistence plan + Rules) ready for review; #682 (002E, content + hash) ready for review; 002C (the command callable that runs the plan in a transaction) prototyped locally and will follow once 002B has a direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:adminAdministrative workflowsarea:instagramInstagram publishing integrationpriority:P1High-priority follow-upsize:MMedium multi-file issuestatus:proposedDesigned but dependencies or decisions remaintype:architectureArchitecture and contract designtype:featureProduct capability

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions